Skip to content

CapJitAddTypeSignature( "LazyArray", [ IsInt, IsFunction ], ... ) #1023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CompilerForCAP/gap/HoistExpressions.gi
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ InstallGlobalFunction( CapJitExtractedExpensiveOperationsFromLoops, function ( t

fi;

elif ForAny( tree.args, a -> a.type = "EXPR_DECLARATIVE_FUNC" ) and not tree.funcref.gvar in [ "ListN", "Iterated", "CapFixpoint", "LazyHList" ] then
elif ForAny( tree.args, a -> a.type = "EXPR_DECLARATIVE_FUNC" ) and not tree.funcref.gvar in [ "ListN", "Iterated", "CapFixpoint", "LazyHList", "LazyArray" ] then

# COVERAGE_IGNORE_NEXT_LINE
Print( "WARNING: Could not detect domain of function in call of ", tree.funcref.gvar, ". Please write a bug report including this message.\n" );
Expand Down
58 changes: 56 additions & 2 deletions CompilerForCAP/gap/InferDataTypes.gi
Original file line number Diff line number Diff line change
Expand Up @@ -965,10 +965,17 @@ CapJitAddTypeSignature( "ListWithIdenticalEntries", [ IsInt, IsObject ], functio
end );

CapJitAddTypeSignature( "Concatenation", [ IsList ], function ( input_types )
local filter;

Assert( 0, input_types[1].element_type.filter = IsList );
if input_types[1].element_type.filter = IsList then
filter := IsList;
elif input_types[1].element_type.filter = IsLazyArray then
filter := IsLazyArray;
else
Error( input_types[1].element_type.filter, " is not in [ IsList, IsLazyArray ]\n" );
fi;

return rec( filter := IsList, element_type := input_types[1].element_type.element_type );
return rec( filter := filter, element_type := input_types[1].element_type.element_type );

end );

Expand Down Expand Up @@ -1176,6 +1183,53 @@ CapJitAddTypeSignature( "[,]", [ IsList, IsInt, IsInt ], function ( input_types

end );

CapJitAddTypeSignature( "LazyArray", [ IsInt, IsFunction ], function ( args, func_stack )

args := ShallowCopy( args );

args.2 := CAP_JIT_INTERNAL_INFERRED_DATA_TYPES_OF_FUNCTION_BY_ARGUMENTS_TYPES( args.2, [ args.1.data_type ], func_stack );

if args.2 = fail then

#Error( "could not determine output type" );
return fail;

fi;

return rec( args := args, output_type := rec( filter := IsLazyArray, element_type := args.2.data_type.signature[2] ) );

end );

CapJitAddTypeSignature( "LazyStandardInterval", [ IsInt ], function ( input_types )

return rec( filter := IsLazyArray, element_type := rec( filter := IsInt ) );

end );

CapJitAddTypeSignature( "LazyInterval", [ IsInt, IsInt ], function ( input_types )

return rec( filter := IsLazyInterval, element_type := rec( filter := IsInt ) );

end );

CapJitAddTypeSignature( "LazyConstantArray", [ IsInt, IsInt ], function ( input_types )

return rec( filter := IsLazyConstantArray, element_type := rec( filter := IsInt ) );

end );

CapJitAddTypeSignature( "LazyArrayFromList", [ IsList ], function ( input_types )

return rec( filter := IsLazyArrayFromList, element_type := rec( filter := IsInt ) );

end );

CapJitAddTypeSignature( "ListOfValues", [ IsLazyArray ], function ( input_types )

return rec( filter := IsList, element_type := rec( filter := IsInt ) );

end );

CapJitAddTypeSignature( "LazyHList", [ IsList, IsFunction ], function ( args, func_stack )

args := ShallowCopy( args );
Expand Down