Skip to content

Commit 72ad365

Browse files
zickgrafmohamed-barakat
authored andcommitted
Distinguish between small and big integers
1 parent f4f8829 commit 72ad365

File tree

7 files changed

+29
-10
lines changed

7 files changed

+29
-10
lines changed

AdditiveClosuresForCAP/gap/AdditiveClosure.gi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_ADDITIVE_CLOSURE,
926926
function( cat, diagram, test_object, morphisms, direct_sum )
927927
local listlist;
928928

929-
listlist := UnionOfColumnsListList( Length( ObjectList( test_object ) ), List( morphisms, tau -> MorphismMatrix( tau ) ) );
929+
listlist := UnionOfColumnsListList( BigInt( Length( ObjectList( test_object ) ) ), List( morphisms, tau -> MorphismMatrix( tau ) ) );
930930

931931
return AdditiveClosureMorphism( cat, test_object,
932932
listlist,
@@ -939,7 +939,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_ADDITIVE_CLOSURE,
939939
function( cat, diagram, test_object, morphisms, direct_sum )
940940
local listlist;
941941

942-
listlist := UnionOfRowsListList( Length( ObjectList( test_object ) ), List( morphisms, tau -> MorphismMatrix( tau ) ) );
942+
listlist := UnionOfRowsListList( BigInt( Length( ObjectList( test_object ) ) ), List( morphisms, tau -> MorphismMatrix( tau ) ) );
943943

944944
return AdditiveClosureMorphism( cat, direct_sum,
945945
listlist,

AdditiveClosuresForCAP/gap/CategoryOfRows.gi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_ROWS,
393393
AddAdditiveGenerators( category,
394394
function( cat )
395395

396-
return [ CategoryOfRowsObject( cat, 1 ) ];
396+
return [ CategoryOfRowsObject( cat, BigInt( 1 ) ) ];
397397

398398
end );
399399

@@ -1002,7 +1002,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_CATEGORY_OF_ROWS,
10021002
AddTensorUnit( category,
10031003
function( cat )
10041004

1005-
return CategoryOfRowsObject( cat, 1 );
1005+
return CategoryOfRowsObject( cat, BigInt( 1 ) );
10061006

10071007
end );
10081008

@@ -1340,7 +1340,7 @@ AddFinalDerivationBundle( "Using BasisOfExternalHom and CoefficientsOfMorphism t
13401340
[ ],
13411341
function ( cat )
13421342

1343-
return CategoryOfRowsObject( RangeCategoryOfHomomorphismStructure( cat ), 1 );
1343+
return CategoryOfRowsObject( RangeCategoryOfHomomorphismStructure( cat ), BigInt( 1 ) );
13441344

13451345
end
13461346
],

AdditiveClosuresForCAP/gap/CategoryOfRows_as_AdditiveClosure_RingAsCategory.gi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ InstallMethod( CategoryOfRows_as_AdditiveClosure_RingAsCategory,
9999

100100
modeling_tower_object_datum := function ( cat, object )
101101

102-
return Length( ObjectList( object ) );
102+
return BigInt( Length( ObjectList( object ) ) );
103103

104104
end;
105105

CAP/gap/InstallAdds.gi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ InstallGlobalFunction( CAP_INTERNAL_INSTALL_ADDS_FROM_RECORD,
372372

373373
fi;
374374

375-
InstallMethod( CAP_operation, replaced_filter_list{[ 2 .. Length( replaced_filter_list ) ]}, get_convenience_function( CAP_operation ) );
375+
InstallOtherMethod( CAP_operation, replaced_filter_list{[ 2 .. Length( replaced_filter_list ) ]}, get_convenience_function( CAP_operation ) );
376376

377377
fi;
378378

CAP/gap/ToolsForCategories.gi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ InstallGlobalFunction( "CAP_INTERNAL_GET_DATA_TYPE_FROM_STRING", function ( stri
106106

107107
elif string = "integer" then
108108

109-
return rec( filter := IsInt );
109+
return rec( filter := IsSmallIntRep );
110110

111111
elif string = "nonneg_integer_or_infinity" then
112112

CompilerForCAP/gap/CompilerForCAP.gi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ InstallGlobalFunction( CAP_JIT_INTERNAL_COMPILED_ENHANCED_SYNTAX_TREE, function
279279

280280
# resolving phase
281281
resolving_phase_functions := [
282+
CapJitInferredDataTypes,
282283
CapJitResolvedOperations,
283284
CapJitInlinedArguments,
284285
CapJitDroppedUnusedBindings,
@@ -399,6 +400,8 @@ InstallGlobalFunction( CAP_JIT_INTERNAL_COMPILED_ENHANCED_SYNTAX_TREE, function
399400

400401
fi;
401402

403+
#Display(ENHANCED_SYNTAX_TREE_CODE( tree ) );
404+
402405
tree := f( tree );
403406

404407
if CAP_JIT_INTERNAL_DEBUG_LEVEL >= 2 then

CompilerForCAP/gap/InferDataTypes.gi

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ InstallGlobalFunction( "CAP_JIT_INTERNAL_GET_OUTPUT_TYPE_OF_GLOBAL_FUNCTION_BY_I
152152

153153
if Length( type_signatures ) = 0 then
154154

155-
DisplayWithCurrentlyCompiledFunctionLocation( Concatenation( "WARNING: Could not find matching declaration of ", gvar, " for input ", String( input_filters ) ) );
155+
ErrorWithCurrentlyCompiledFunctionLocation( Concatenation( "WARNING: Could not find matching declaration of ", gvar, " for input ", String( input_filters ) ) );
156156
return fail;
157157

158158
elif Length( type_signatures ) > 1 then
@@ -428,7 +428,7 @@ InstallGlobalFunction( CAP_JIT_INTERNAL_INFERRED_DATA_TYPES, function ( tree, in
428428

429429
if tree.type = "EXPR_INT" then
430430

431-
data_type := rec( filter := IsInt );
431+
data_type := rec( filter := IsSmallIntRep );
432432

433433
elif tree.type = "EXPR_STRING" then
434434

@@ -519,6 +519,7 @@ InstallGlobalFunction( CAP_JIT_INTERNAL_INFERRED_DATA_TYPES, function ( tree, in
519519

520520
elif tree.type = "EXPR_RANGE" then
521521

522+
# TODO
522523
data_type := CapJitDataTypeOfListOf( IsInt );
523524

524525
elif tree.type = "EXPR_LIST" then
@@ -888,9 +889,17 @@ CapJitAddTypeSignature( "RETURN_TRUE", [ IsObject, IsObject ], IsBool );
888889
CapJitAddTypeSignature( "Length", [ IsList ], IsInt );
889890
CapJitAddTypeSignature( "IsEmpty", [ IsList ], IsBool );
890891
CapJitAddTypeSignature( "+", [ IsInt, IsInt ], IsInt );
892+
CapJitAddTypeSignature( "+", [ IsInt, IsSmallIntRep ], IsInt );
893+
CapJitAddTypeSignature( "+", [ IsSmallIntRep, IsSmallIntRep ], IsSmallIntRep );
894+
CapJitAddTypeSignature( "+", [ IsSmallIntRep, IsInt ], IsInt );
891895
CapJitAddTypeSignature( "AdditiveInverseSameMutability", [ IsInt ], IsInt );
892896
CapJitAddTypeSignature( "-", [ IsInt, IsInt ], IsInt );
897+
CapJitAddTypeSignature( "-", [ IsInt, IsSmallIntRep ], IsInt );
898+
CapJitAddTypeSignature( "-", [ IsSmallIntRep, IsSmallIntRep ], IsSmallIntRep );
893899
CapJitAddTypeSignature( "*", [ IsInt, IsInt ], IsInt );
900+
CapJitAddTypeSignature( "*", [ IsInt, IsSmallIntRep ], IsInt );
901+
CapJitAddTypeSignature( "*", [ IsSmallIntRep, IsInt ], IsInt );
902+
CapJitAddTypeSignature( "*", [ IsSmallIntRep, IsSmallIntRep ], IsInt );
894903
CapJitAddTypeSignature( "^", [ IsInt, IsInt ], IsInt );
895904
CapJitAddTypeSignature( "REM_INT", [ IsInt, IsInt ], IsInt );
896905
CapJitAddTypeSignature( "QUO_INT", [ IsInt, IsInt ], IsInt );
@@ -900,6 +909,7 @@ CapJitAddTypeSignature( "^", [ IsPerm, IsInt ], IsPerm );
900909
CapJitAddTypeSignature( "PermList", [ IsList ], IsPerm );
901910
CapJitAddTypeSignature( "PermutationMat", [ IsPerm, IsInt ], CapJitDataTypeOfListOf( CapJitDataTypeOfListOf( IsInt ) ) );
902911
CapJitAddTypeSignature( "BigInt", [ IsInt ], IsBigInt );
912+
CapJitAddTypeSignature( "BigInt", [ IsSmallIntRep ], IsInt );
903913

904914
CapJitAddTypeSignature( "IS_IDENTICAL_OBJ", [ IsObject, IsObject ], function ( input_types )
905915

@@ -1027,6 +1037,12 @@ CapJitAddTypeSignature( "[]", [ IsList, IsInt ], function ( input_types )
10271037

10281038
end );
10291039

1040+
CapJitAddTypeSignature( "[]", [ IsList, IsSmallIntRep ], function ( input_types )
1041+
1042+
return input_types[1].element_type;
1043+
1044+
end );
1045+
10301046
CapJitAddTypeSignature( "{}", [ IsList, IsList ], function ( input_types )
10311047

10321048
return input_types[1];

0 commit comments

Comments
 (0)