Skip to content

Commit

Permalink
Make types returned by NEW_TYPE immutable
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Apr 26, 2018
1 parent cad8530 commit 9770b0b
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 86 deletions.
91 changes: 48 additions & 43 deletions hpcgap/src/c_type1.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef AVOID_PRECOMPILED
/* C file produced by GAC */
#include <src/compiled.h>
#define FILE_CRC "132228056"
#define FILE_CRC "47959145"

/* global variables used in handlers */
static GVar G_NAME__FUNC;
Expand Down Expand Up @@ -1610,6 +1610,10 @@ static Obj HdlrFunc11 (
t_1 = GF_UNLOCK;
CALL_1ARGS( t_1, l_lock );

/* MakeImmutable( type ); */
t_1 = GF_MakeImmutable;
CALL_1ARGS( t_1, l_type );

/* return type; */
RES_BRK_CURR_STAT();
SWITCH_TO_OLD_FRAME(oldFrame);
Expand Down Expand Up @@ -3782,6 +3786,7 @@ static Obj HdlrFunc1 (
family!.nTYPES := family!.nTYPES + 1;
MakeReadOnlySingleObj( type );
UNLOCK( lock );
MakeImmutable( type );
return type;
end ); */
t_1 = GF_BIND__GLOBAL;
Expand All @@ -3790,7 +3795,7 @@ static Obj HdlrFunc1 (
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 229);
SET_ENDLINE_BODY(t_4, 353);
SET_ENDLINE_BODY(t_4, 354);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand All @@ -3804,8 +3809,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[12], 3, 0, HdlrFunc12 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 357);
SET_ENDLINE_BODY(t_4, 364);
SET_STARTLINE_BODY(t_4, 358);
SET_ENDLINE_BODY(t_4, 365);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand All @@ -3819,8 +3824,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[13], 4, 0, HdlrFunc13 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 367);
SET_ENDLINE_BODY(t_4, 374);
SET_STARTLINE_BODY(t_4, 368);
SET_ENDLINE_BODY(t_4, 375);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand All @@ -3845,8 +3850,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[14], -1, 0, HdlrFunc14 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 377);
SET_ENDLINE_BODY(t_4, 401);
SET_STARTLINE_BODY(t_4, 378);
SET_ENDLINE_BODY(t_4, 402);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand All @@ -3860,8 +3865,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[15], 2, 0, HdlrFunc15 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 414);
SET_ENDLINE_BODY(t_4, 421);
SET_STARTLINE_BODY(t_4, 415);
SET_ENDLINE_BODY(t_4, 422);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand All @@ -3875,8 +3880,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[16], 3, 0, HdlrFunc16 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 424);
SET_ENDLINE_BODY(t_4, 431);
SET_STARTLINE_BODY(t_4, 425);
SET_ENDLINE_BODY(t_4, 432);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand Down Expand Up @@ -3904,8 +3909,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[17], -1, 0, HdlrFunc17 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 435);
SET_ENDLINE_BODY(t_4, 457);
SET_STARTLINE_BODY(t_4, 436);
SET_ENDLINE_BODY(t_4, 458);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand All @@ -3919,8 +3924,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[18], 2, 0, HdlrFunc18 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 471);
SET_ENDLINE_BODY(t_4, 478);
SET_STARTLINE_BODY(t_4, 472);
SET_ENDLINE_BODY(t_4, 479);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand All @@ -3934,8 +3939,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[19], 3, 0, HdlrFunc19 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 481);
SET_ENDLINE_BODY(t_4, 488);
SET_STARTLINE_BODY(t_4, 482);
SET_ENDLINE_BODY(t_4, 489);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand All @@ -3957,8 +3962,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[20], -1, 0, HdlrFunc20 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 491);
SET_ENDLINE_BODY(t_4, 505);
SET_STARTLINE_BODY(t_4, 492);
SET_ENDLINE_BODY(t_4, 506);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand All @@ -3972,8 +3977,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[21], 1, 0, HdlrFunc21 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 519);
SET_ENDLINE_BODY(t_4, 519);
SET_STARTLINE_BODY(t_4, 520);
SET_ENDLINE_BODY(t_4, 520);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand All @@ -3987,8 +3992,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[22], 1, 0, HdlrFunc22 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 533);
SET_ENDLINE_BODY(t_4, 533);
SET_STARTLINE_BODY(t_4, 534);
SET_ENDLINE_BODY(t_4, 534);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand All @@ -4002,8 +4007,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[23], 1, 0, HdlrFunc23 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 549);
SET_ENDLINE_BODY(t_4, 549);
SET_STARTLINE_BODY(t_4, 550);
SET_ENDLINE_BODY(t_4, 550);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand All @@ -4018,8 +4023,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[24], 2, 0, HdlrFunc24 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 551);
SET_ENDLINE_BODY(t_4, 557);
SET_STARTLINE_BODY(t_4, 552);
SET_ENDLINE_BODY(t_4, 558);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand Down Expand Up @@ -4047,8 +4052,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[25], 1, 0, HdlrFunc25 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 656);
SET_ENDLINE_BODY(t_4, 656);
SET_STARTLINE_BODY(t_4, 657);
SET_ENDLINE_BODY(t_4, 657);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand All @@ -4062,8 +4067,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[26], 1, 0, HdlrFunc26 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 670);
SET_ENDLINE_BODY(t_4, 670);
SET_STARTLINE_BODY(t_4, 671);
SET_ENDLINE_BODY(t_4, 671);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand Down Expand Up @@ -4136,8 +4141,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[27], 2, 0, HdlrFunc27 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 691);
SET_ENDLINE_BODY(t_4, 726);
SET_STARTLINE_BODY(t_4, 692);
SET_ENDLINE_BODY(t_4, 727);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand Down Expand Up @@ -4187,8 +4192,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[28], 2, 0, HdlrFunc28 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 748);
SET_ENDLINE_BODY(t_4, 786);
SET_STARTLINE_BODY(t_4, 749);
SET_ENDLINE_BODY(t_4, 787);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand Down Expand Up @@ -4229,8 +4234,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[29], 2, 0, HdlrFunc29 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 808);
SET_ENDLINE_BODY(t_4, 830);
SET_STARTLINE_BODY(t_4, 809);
SET_ENDLINE_BODY(t_4, 831);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand All @@ -4256,8 +4261,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[30], 3, 0, HdlrFunc30 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 846);
SET_ENDLINE_BODY(t_4, 852);
SET_STARTLINE_BODY(t_4, 847);
SET_ENDLINE_BODY(t_4, 853);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand Down Expand Up @@ -4335,8 +4340,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[31], -1, 0, HdlrFunc31 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 900);
SET_ENDLINE_BODY(t_4, 966);
SET_STARTLINE_BODY(t_4, 901);
SET_ENDLINE_BODY(t_4, 967);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand Down Expand Up @@ -4724,7 +4729,7 @@ static Int InitLibrary ( StructInitInfo * module )
static StructInitInfo module = {
.type = MODULE_STATIC,
.name = "GAPROOT/lib/type1.g",
.crc = 132228056,
.crc = 47959145,
.initKernel = InitKernel,
.initLibrary = InitLibrary,
.postRestore = PostRestore,
Expand Down
1 change: 1 addition & 0 deletions lib/type1.g
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ BIND_GLOBAL( "NEW_TYPE", function ( typeOfTypes, family, flags, data, parent )
MakeReadOnlySingleObj(type);
UNLOCK(lock);
fi;
MakeImmutable(type);

# return the type
return type;
Expand Down
Loading

0 comments on commit 9770b0b

Please sign in to comment.