Skip to content

Commit

Permalink
Merge pull request #1046 from zickgraf/master
Browse files Browse the repository at this point in the history
Miscellaneous changes
  • Loading branch information
zickgraf authored Sep 19, 2022
2 parents 71351a8 + 6a2896a commit 75f0b17
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CompilerForCAP/PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SetPackageInfo( rec(

PackageName := "CompilerForCAP",
Subtitle := "Speed up computations in CAP categories",
Version := "2022.09-06",
Version := "2022.09-07",
Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ),
License := "GPL-2.0-or-later",

Expand Down
6 changes: 6 additions & 0 deletions CompilerForCAP/gap/InferDataTypes.gi
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,12 @@ CapJitAddTypeSignature( "CreateCapCategoryObjectWithAttributes", [ IsCapCategory

end );

CapJitAddTypeSignature( "CreateCapCategoryObjectWithAttributes", [ IsCapCategory, IsFunction, IsObject, IsFunction, IsObject, IsFunction, IsObject ], function ( input_types )

return CapJitDataTypeOfObjectOfCategory( input_types[1].category );

end );

CapJitAddTypeSignature( "CreateCapCategoryMorphismWithAttributes", [ IsCapCategory, IsCapCategoryObject, IsCapCategoryObject ], function ( input_types )

return CapJitDataTypeOfMorphismOfCategory( input_types[1].category );
Expand Down
9 changes: 7 additions & 2 deletions CompilerForCAP/gap/Tools.gd
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,17 @@ DeclareOperation( "ForAllOp", [ IsRecord, IsFunction ] );
DeclareOperation( "ForAnyOp", [ IsRecord, IsFunction ] );
DeclareOperation( "Iterator", [ IsRecord ] );

#! @Description
#! Prints <A>args...</A> followed by the location of the currently compiled function.
#! @Arguments args...
DeclareGlobalFunction( "PrintWithCurrentlyCompiledFunctionLocation" );

#! @Description
#! Displays <A>obj</A> followed by the location of the currently compiled function.
#! @Arguments obj
DeclareGlobalFunction( "DisplayWithCurrentlyCompiledFunctionLocation" );

#! @Description
#! Prints <A>obj</A> as an error followed by the location of the currently compiled function.
#! @Arguments obj
#! Prints <A>args...</A> as an error followed by the location of the currently compiled function.
#! @Arguments args...
DeclareGlobalFunction( "ErrorWithCurrentlyCompiledFunctionLocation" );
23 changes: 20 additions & 3 deletions CompilerForCAP/gap/Tools.gi
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,23 @@ InstallMethod( Iterator,

end );

InstallGlobalFunction( PrintWithCurrentlyCompiledFunctionLocation, function ( args... )
local func;

# COVERAGE_IGNORE_BLOCK_START
if IsEmpty( CAP_JIT_INTERNAL_COMPILED_FUNCTIONS_STACK ) then

CallFuncList( Print, Concatenation( args, [ "\nwhile not compiling a function. This should never happen.\n" ] ) );

fi;

func := Last( CAP_JIT_INTERNAL_COMPILED_FUNCTIONS_STACK );

CallFuncList( Print, Concatenation( args, [ "\nwhile compiling function with name \"", NameFunction( func ), "\"\nlocated at ", FilenameFunc( func ), ":", StartlineFunc( func ), "\n\n" ] ) );
# COVERAGE_IGNORE_BLOCK_END

end );

InstallGlobalFunction( DisplayWithCurrentlyCompiledFunctionLocation, function ( obj )
local func;

Expand All @@ -839,19 +856,19 @@ InstallGlobalFunction( DisplayWithCurrentlyCompiledFunctionLocation, function (

end );

InstallGlobalFunction( ErrorWithCurrentlyCompiledFunctionLocation, function ( obj )
InstallGlobalFunction( ErrorWithCurrentlyCompiledFunctionLocation, function ( args... )
local func;

# COVERAGE_IGNORE_BLOCK_START
if IsEmpty( CAP_JIT_INTERNAL_COMPILED_FUNCTIONS_STACK ) then

Error( obj, "\nwhile not compiling a function. This should never happen.\n" );
CallFuncList( Error, Concatenation( args, [ "\nwhile not compiling a function. This should never happen.\n" ] ) );

fi;

func := Last( CAP_JIT_INTERNAL_COMPILED_FUNCTIONS_STACK );

Error( obj, "\nwhile compiling function with name \"", NameFunction( func ), "\"\nlocated at ", FilenameFunc( func ), ":", StartlineFunc( func ), "\n" );
CallFuncList( Error, Concatenation( args, [ "\nwhile compiling function with name \"", NameFunction( func ), "\"\nlocated at ", FilenameFunc( func ), ":", StartlineFunc( func ), "\n" ] ) );
# COVERAGE_IGNORE_BLOCK_END

end );

0 comments on commit 75f0b17

Please sign in to comment.