diff --git a/doc/ref/methsel.xml b/doc/ref/methsel.xml
index 17543a9549..de75cfd1ac 100644
--- a/doc/ref/methsel.xml
+++ b/doc/ref/methsel.xml
@@ -252,6 +252,7 @@ one can install also immediate methods.
Logical Implications
<#Include Label="InstallTrueMethod">
+<#Include Label="MethodReordering">
diff --git a/lib/error.g b/lib/error.g
index 74bc769450..ff636977d1 100644
--- a/lib/error.g
+++ b/lib/error.g
@@ -32,6 +32,9 @@ BIND_GLOBAL( "OnQuit", # care to ensure it always has a definition. - GG
until IsEmpty(OptionsStack);
Info(InfoWarning,1,"Options stack has been reset");
fi;
+ if IsBound(ResetMethodReordering) and IsFunction(ResetMethodReordering) then
+ ResetMethodReordering();
+ fi;
end);
diff --git a/lib/filter.g b/lib/filter.g
index a3afa1ea0e..f80c2b74a6 100644
--- a/lib/filter.g
+++ b/lib/filter.g
@@ -171,6 +171,62 @@ BIND_GLOBAL( "InstallTrueMethodNewFilter", function ( tofilt, from )
end );
+#############################################################################
+##
+#F SuspendMethodReordering( )
+#F ResumeMethodReordering( )
+#F ResetMethodReordering( )
+##
+## <#GAPDoc Label="MethodReordering">
+##
+##
+##
+##
+##
+##
+## These functions control whether the method reordering process
+## described in is invoked or not. Since this
+## process can be comparatively time-consuming, it is usually suspended when
+## a lot of implications are due to be installed, for instance when loading
+## the library, or a package. This is done by calling SuspendMethodReordering()
+## once the installations are done, ResumeMethodReordering() should be called.
+## These pairs of calls can be nested. When the outermost pair is complete, method
+## reordering takes place and is enabled in InstallTrueMethod thereafter.
+##
+## ResetMethodReordering() effectively exits all nested suspensions, resuming
+## reordering immediately. This function is mainly provided for error recovery and
+## similar purposes and is called on quitting from a break loop.
+##
+##
+## <#/GAPDoc>
+
+#
+# This function will be defined in oper.g
+#
+RECALCULATE_ALL_METHOD_RANKS := fail;
+
+REORDER_METHODS_SUSPENSION_LEVEL := 1;
+
+BIND_GLOBAL( "SuspendMethodReordering", function()
+ REORDER_METHODS_SUSPENSION_LEVEL := REORDER_METHODS_SUSPENSION_LEVEL + 1;
+end);
+
+
+BIND_GLOBAL( "ResumeMethodReordering", function()
+ if REORDER_METHODS_SUSPENSION_LEVEL > 0 then
+ REORDER_METHODS_SUSPENSION_LEVEL := REORDER_METHODS_SUSPENSION_LEVEL - 1;
+ fi;
+ if REORDER_METHODS_SUSPENSION_LEVEL <= 0 then
+ RECALCULATE_ALL_METHOD_RANKS();
+ fi;
+end);
+
+BIND_GLOBAL( "ResetMethodReordering", function()
+ REORDER_METHODS_SUSPENSION_LEVEL := 0;
+ RECALCULATE_ALL_METHOD_RANKS();
+end);
+
+
#############################################################################
##
#F InstallTrueMethod( , )
@@ -209,18 +265,33 @@ end );
## This means that after the above implication has been installed,
## one can rely on the fact that every object in the filter
## IsGroup and IsCyclic will also be in the filter
-## .
+## .
+##
+## Adding logical implications can change the rank of filters
+## (see ) and consequently the rank, and so choice of
+## methods for operations (see ).
+## By default InstallTrueMethod adjusts the method selection data structures
+## to take care of this, but this process can be time-consuming, so functions
+## and
+## are provided to allow control of this process.
##
##
## <#/GAPDoc>
##
+
BIND_GLOBAL( "InstallTrueMethod", function ( tofilt, from )
InstallTrueMethodNewFilter( tofilt, from );
-
+
# clear the caches because we do not know if filter is new
CLEAR_HIDDEN_IMP_CACHE( from );
CLEAR_IMP_CACHE();
+
+ # maybe rerank methods to take account of new implication
+ if REORDER_METHODS_SUSPENSION_LEVEL = 0 then
+ RECALCULATE_ALL_METHOD_RANKS();
+ fi;
+
end );
@@ -424,11 +495,7 @@ BIND_GLOBAL( "RankFilter", function( filter )
all := WITH_IMPS_FLAGS(flags);
fi;
for i in TRUES_FLAGS(all) do
- if IsBound(RANK_FILTERS[i]) then
rank := rank + RANK_FILTERS[i];
- else
- rank := rank + 1;
- fi;
od;
return rank;
end );
diff --git a/lib/init.g b/lib/init.g
index bb5f570b20..573482e47f 100644
--- a/lib/init.g
+++ b/lib/init.g
@@ -1018,6 +1018,9 @@ fi;
##
## Read init files, run a shell, and do exit-time processing.
##
+
+ResumeMethodReordering();
+
InstallAndCallPostRestore( function()
local i, status;
for i in [1..Length(GAPInfo.InitFiles)] do
@@ -1037,6 +1040,8 @@ InstallAndCallPostRestore( function()
od;
end );
+
+
if IsLIBGAP then
# GAP is used as a library, do not start an interactive session
elif IsHPCGAP and THREAD_UI() then
diff --git a/lib/oper.g b/lib/oper.g
index b642d809ce..da59588d02 100644
--- a/lib/oper.g
+++ b/lib/oper.g
@@ -1096,6 +1096,7 @@ BIND_GLOBAL( "DeclareAttributeKernel", function ( name, filter, getter )
FILTERS[ FLAG2_FILTER( tester ) ] := tester;
IMM_FLAGS:= AND_FLAGS( IMM_FLAGS, FLAGS_FILTER( tester ) );
INFO_FILTERS[ FLAG2_FILTER( tester ) ] := 5;
+ RANK_FILTERS[ FLAG2_FILTER( tester ) ] := 1;
od;
# clear the cache because is something old
@@ -1107,10 +1108,6 @@ BIND_GLOBAL( "DeclareAttributeKernel", function ( name, filter, getter )
# run the attribute functions
RUN_ATTR_FUNCS( filter, getter, setter, tester, false );
- # store the ranks
- atomic FILTER_REGION do
- RANK_FILTERS[ FLAG2_FILTER( tester ) ] := 1;
- od;
# and make the remaining assignments
nname:= "Set"; APPEND_LIST_INTR( nname, name );
@@ -1198,6 +1195,8 @@ BIND_GLOBAL( "OPER_SetupAttribute", function(getter, flags, mutflag, filter, ran
# install the default functions
FILTERS[ FLAG2_FILTER( tester ) ] := tester;
IMM_FLAGS:= AND_FLAGS( IMM_FLAGS, FLAGS_FILTER( tester ) );
+ # store the rank
+ RANK_FILTERS[ FLAG2_FILTER( tester ) ] := rank;
# the is newly made, therefore the cache cannot contain a flag
# list involving
@@ -1209,8 +1208,6 @@ BIND_GLOBAL( "OPER_SetupAttribute", function(getter, flags, mutflag, filter, ran
# run the attribute functions
RUN_ATTR_FUNCS( filter, getter, setter, tester, mutflag );
- # store the rank
- RANK_FILTERS[ FLAG2_FILTER( tester ) ] := rank;
return;
@@ -1439,6 +1436,10 @@ BIND_GLOBAL( "DeclarePropertyKernel", function ( name, filter, getter )
INFO_FILTERS[ FLAG1_FILTER( getter ) ]:= 7;
INFO_FILTERS[ FLAG2_FILTER( getter ) ]:= 8;
+ # store the ranks
+ RANK_FILTERS[ FLAG1_FILTER( getter ) ] := 1;
+ RANK_FILTERS[ FLAG2_FILTER( getter ) ] := 1;
+
# clear the cache because is something old
if not GAPInfo.CommandLineOptions.N then
InstallHiddenTrueMethod( tester, getter );
@@ -1450,9 +1451,6 @@ BIND_GLOBAL( "DeclarePropertyKernel", function ( name, filter, getter )
# run the attribute functions
RUN_ATTR_FUNCS( filter, getter, setter, tester, false );
- # store the ranks
- RANK_FILTERS[ FLAG1_FILTER( getter ) ] := 1;
- RANK_FILTERS[ FLAG2_FILTER( getter ) ] := 1;
# and make the remaining assignments
nname:= "Set"; APPEND_LIST_INTR( nname, name );
@@ -1513,8 +1511,14 @@ BIND_GLOBAL( "NewProperty", function ( arg )
FILTERS[ FLAG2_FILTER( getter ) ] := tester;
INFO_FILTERS[ FLAG1_FILTER( getter ) ] := 9;
INFO_FILTERS[ FLAG2_FILTER( getter ) ] := 10;
+ if LEN_LIST( arg ) = 3 and IS_INT( arg[3] ) then
+ RANK_FILTERS[ FLAG1_FILTER( getter ) ]:= arg[3];
+ else
+ RANK_FILTERS[ FLAG1_FILTER( getter ) ]:= 1;
+ fi;
+ RANK_FILTERS[ FLAG2_FILTER( tester ) ]:= 1;
od;
-
+
# the and are newly made, therefore the cache cannot
# contain a flag list involving or
if not GAPInfo.CommandLineOptions.N then
@@ -1526,15 +1530,6 @@ BIND_GLOBAL( "NewProperty", function ( arg )
# run the attribute functions
RUN_ATTR_FUNCS( filter, getter, setter, tester, false );
- # store the rank
- atomic FILTER_REGION do
- if LEN_LIST( arg ) = 3 and IS_INT( arg[3] ) then
- RANK_FILTERS[ FLAG1_FILTER( getter ) ]:= arg[3];
- else
- RANK_FILTERS[ FLAG1_FILTER( getter ) ]:= 1;
- fi;
- RANK_FILTERS[ FLAG2_FILTER( tester ) ]:= 1;
- od;
# and return the getter
return getter;
@@ -1931,7 +1926,8 @@ end);
fi;
-if BASE_SIZE_METHODS_OPER_ENTRY <> 5 then
+
+if BASE_SIZE_METHODS_OPER_ENTRY <> 6 then
Error("MethodsOperation must be updated for new BASE_SIZE_METHODS_OPER_ENTRY");
fi;
@@ -1952,6 +1948,7 @@ BIND_GLOBAL("MethodsOperation", function(oper, nargs)
func := meths[i + nargs + 2],
rank := meths[i + nargs + 3],
info := meths[i + nargs + 4],
+ rankbase := meths[i + nargs + 6],
);
ADD_LIST(result, m);
if IsBound(meths[i + nargs + 5]) then
@@ -1961,6 +1958,139 @@ BIND_GLOBAL("MethodsOperation", function(oper, nargs)
return result;
end );
+#############################################################################
+##
+#F RECALCULATE_ALL_METHOD_RANKS() . . reorder methods after new implications
+##
+## Installing new implications (including hidden implications) can change the
+## rank of existing filters, and so of existing methods for operations.
+##
+## This function recalculates all such ranks and adjusts the method ordering
+## where needed. If the ordering changes, the relevant caches are flushed.
+##
+## If PRINT_REORDERED_METHODS is true, it prints some diagnostics (this is a
+## bit too low-level for Info).
+##
+##
+
+
+#
+# We had to install a placeholder for this in filter.g
+#
+Unbind(RECALCULATE_ALL_METHOD_RANKS);
+
+PRINT_REORDERED_METHODS := false;
+
+BIND_GLOBAL( "RECALCULATE_ALL_METHOD_RANKS", function()
+ local oper, n, changed, meths, nmethods, i, base, rank, j, req,
+ req2, k, l;
+
+ for oper in OPERATIONS do
+ for n in [0..6] do
+ changed := false;
+ meths := METHODS_OPERATION(oper, n);
+ nmethods := LENGTH(meths)/(BASE_SIZE_METHODS_OPER_ENTRY+n);
+ if IS_CONSTRUCTOR(oper) and n > 0 then
+ for i in [nmethods,nmethods-1..1] do
+ base := (i-1)*(BASE_SIZE_METHODS_OPER_ENTRY+n);
+ # data for this method is meths{[base+1..base+BASE_SIZE_METHODS_OPER_ENTRY + n]}
+ rank := meths[base+6+n];
+ if IS_FUNCTION(rank) then
+ rank := rank();
+ fi;
+ rank := rank - RankFilter(WITH_IMPS_FLAGS(meths[base+2]));
+ if rank <> meths[base+n+3] then
+ if IsHPCGAP and not changed then
+ meths := SHALLOW_COPY_OBJ(meths);
+ fi;
+ changed := true;
+ meths[base+n+3] := rank;
+ fi;
+ # compare to rank of succeding method
+ if i = nmethods or rank >= meths[base+BASE_SIZE_METHODS_OPER_ENTRY + 2*n + 3] then
+ continue;
+ fi;
+ k := i+2;
+ while k <= nmethods and meths[(k-1)*(BASE_SIZE_METHODS_OPER_ENTRY+n) + n + 3] < rank do
+ k := k+1;
+ od;
+ k := k-1;
+ if PRINT_REORDERED_METHODS then
+ Print("Constructor ",NAME_FUNC(oper), " ", n," args. Moving method ",i," (",
+ meths[base+n+4]," from ",meths[base+n+5][1],":", meths[base+n+5][2],
+ ") to position ",k,"\n");
+ fi;
+ l := meths{[base+1..base+n+BASE_SIZE_METHODS_OPER_ENTRY]};
+ COPY_LIST_ENTRIES(meths, 1 + i*(n+BASE_SIZE_METHODS_OPER_ENTRY), 1,
+ meths, 1 +(i-1)*(n+BASE_SIZE_METHODS_OPER_ENTRY), 1,
+ (k-i)*(n+BASE_SIZE_METHODS_OPER_ENTRY));
+ meths{[1 + (k-1)*(n+BASE_SIZE_METHODS_OPER_ENTRY)..
+ k*(n+BASE_SIZE_METHODS_OPER_ENTRY)]} := l;
+ od;
+ else
+ for i in [1 ..nmethods] do
+ base := (i-1)*(BASE_SIZE_METHODS_OPER_ENTRY+n);
+ # data for this method is meths{[base+1..base+BASE_SIZE_METHODS_OPER_ENTRY + n]}
+ rank := meths[base+6+n];
+ if IS_FUNCTION(rank) then
+ rank := rank();
+ fi;
+
+
+ for j in [1..n] do
+ req := meths[base+1+j];
+ rank := rank+RankFilter(WITH_IMPS_FLAGS(req));
+ od;
+
+ if rank <> meths[base+n+3] then
+ if IsHPCGAP and not changed then
+ meths := SHALLOW_COPY_OBJ(meths);
+ fi;
+ changed := true;
+ meths[base+n+3] := rank;
+ fi;
+
+ # compare to rank of preceding method
+ if i = 1 or rank <= meths[base-BASE_SIZE_METHODS_OPER_ENTRY+3] then
+ continue;
+ fi;
+
+ k := i-2;
+ while k > 1 and meths[(k-1)*(BASE_SIZE_METHODS_OPER_ENTRY+n) + n + 3] < rank do
+ k := k-1;
+ od;
+ k := k+1;
+ if PRINT_REORDERED_METHODS then
+ Print(NAME_FUNC(oper), " ", n," args. Moving method ",i," (",
+ meths[base+n+4]," from ",meths[base+n+5][1],":", meths[base+n+5][2],
+ ") to position ",k,"\n");
+ fi;
+ l := meths{[base+1..base+n+BASE_SIZE_METHODS_OPER_ENTRY]};
+ COPY_LIST_ENTRIES(meths, 1 + (k-1)*(n+BASE_SIZE_METHODS_OPER_ENTRY), 1,
+ meths, 1 + k*(n+BASE_SIZE_METHODS_OPER_ENTRY), 1,
+ (i-k)*(n+BASE_SIZE_METHODS_OPER_ENTRY));
+ meths{[1 + (k-1)*(n+BASE_SIZE_METHODS_OPER_ENTRY)..
+ k*(n+BASE_SIZE_METHODS_OPER_ENTRY)]} := l;
+ od;
+ fi;
+ if changed then
+ if IsHPCGAP then
+ SET_METHODS_OPERATION(oper,n,MakeReadOnlySingleObj(meths));
+ else
+ CHANGED_METHODS_OPERATION(oper,n);
+ fi;
+ fi;
+ od;
+ od;
+end );
+
+
+
+
+
+
+
+
#############################################################################
##
#E
diff --git a/lib/oper1.g b/lib/oper1.g
index 5ae4ecd52f..b36d6f8875 100644
--- a/lib/oper1.g
+++ b/lib/oper1.g
@@ -69,21 +69,21 @@ BIND_GLOBAL( "RunImmediateMethods", function ( obj, flags )
# `RunImmediateMethods'.
if IsBound( IMMEDIATES[j] ) then
-#T the `if' statement can disappear when `IMM_FLAGS' is improved ...
+ #T the `if' statement can disappear when `IMM_FLAGS' is improved ...
imm := IMMEDIATES[j];
for i in [ 0, SIZE_IMMEDIATE_METHOD_ENTRY .. LEN_LIST(imm)-SIZE_IMMEDIATE_METHOD_ENTRY ] do
if IS_SUBSET_FLAGS( flags, imm[i+4] )
- and not IS_SUBSET_FLAGS( flags, imm[i+3] )
- and not imm[i+6] in tried
- then
+ and not IS_SUBSET_FLAGS( flags, imm[i+3] )
+ and not imm[i+6] in tried
+ then
# Call the method, and store that it was used.
meth := IMMEDIATE_METHODS[ imm[i+6] ];
res := meth( obj );
ADD_LIST( tried, imm[i+6] );
RUN_IMMEDIATE_METHODS_CHECKS :=
- RUN_IMMEDIATE_METHODS_CHECKS+1;
+ RUN_IMMEDIATE_METHODS_CHECKS+1;
if TRACE_IMMEDIATE_METHODS then
Print( "#I immediate: ", NAME_FUNC( imm[i+1] ));
if imm[i+7] <> false then
@@ -99,7 +99,7 @@ BIND_GLOBAL( "RunImmediateMethods", function ( obj, flags )
imm[i+2]( obj, res );
IGNORE_IMMEDIATE_METHODS := false;
RUN_IMMEDIATE_METHODS_HITS :=
- RUN_IMMEDIATE_METHODS_HITS+1;
+ RUN_IMMEDIATE_METHODS_HITS+1;
# If `obj' has noticed the new information,
# add the numbers of newly known filters to
@@ -107,14 +107,14 @@ BIND_GLOBAL( "RunImmediateMethods", function ( obj, flags )
# methods later.
if not IS_IDENTICAL_OBJ( TYPE_OBJ(obj), type ) then
- type := TYPE_OBJ(obj);
+ type := TYPE_OBJ(obj);
- newflags := SUB_FLAGS( type![2], IMM_FLAGS );
- newflags := SUB_FLAGS( newflags, flags );
- APPEND_LIST_INTR( flagspos,
- TRUES_FLAGS( newflags ) );
+ newflags := SUB_FLAGS( type![2], IMM_FLAGS );
+ newflags := SUB_FLAGS( newflags, flags );
+ APPEND_LIST_INTR( flagspos,
+ TRUES_FLAGS( newflags ) );
- flags := type![2];
+ flags := type![2];
fi;
fi;
@@ -143,8 +143,8 @@ fi;
#F INSTALL_METHOD_FLAGS( , , , , , ) .
##
BIND_GLOBAL( "INSTALL_METHOD_FLAGS",
- function( opr, info, rel, flags, rank, method )
- local methods, narg, i, k, tmp, replace, match, j, lk;
+ function( opr, info, rel, flags, baserank, method )
+ local methods, narg, i, k, tmp, replace, match, j, lk, rank;
if IsHPCGAP then
# TODO: once the GAP compiler supports 'atomic', use that
@@ -152,6 +152,11 @@ BIND_GLOBAL( "INSTALL_METHOD_FLAGS",
lk := WRITE_LOCK(METHODS_OPERATION_REGION);
fi;
# add the number of filters required for each argument
+ if IS_FUNCTION(baserank) then
+ rank := baserank();
+ else
+ rank := baserank;
+ fi;
if IS_CONSTRUCTOR(opr) then
if 0 < LEN_LIST(flags) then
rank := rank - RankFilter( flags[ 1 ] );
@@ -210,8 +215,8 @@ BIND_GLOBAL( "INSTALL_METHOD_FLAGS",
fi;
# push the other functions back
if not REREADING or not replace then
- methods{[narg+BASE_SIZE_METHODS_OPER_ENTRY+i+1..narg+BASE_SIZE_METHODS_OPER_ENTRY+LEN_LIST(methods)]}
- := methods{[i+1..LEN_LIST(methods)]};
+ COPY_LIST_ENTRIES(methods, i+1, 1, methods, narg+BASE_SIZE_METHODS_OPER_ENTRY+i+1,1,
+ LEN_LIST(methods)-i);
fi;
# install the new method
@@ -247,8 +252,8 @@ BIND_GLOBAL( "INSTALL_METHOD_FLAGS",
if CHECK_INSTALL_METHOD and not IS_OPERATION( method ) then
tmp := NARG_FUNC(method);
if tmp < AINV(narg)-1 or (tmp >= 0 and tmp <> narg) then
- Error(NAME_FUNC(opr),": must accept ",
- narg, " arguments");
+ Error(NAME_FUNC(opr),": must accept ",
+ narg, " arguments");
fi;
fi;
methods[i+(narg+2)] := method;
@@ -261,6 +266,9 @@ BIND_GLOBAL( "INSTALL_METHOD_FLAGS",
methods[i+(narg+4)] := IMMUTABLE_COPY_OBJ(info);
if BASE_SIZE_METHODS_OPER_ENTRY >= 5 then
methods[i+(narg+5)] := MakeImmutable([INPUT_FILENAME(), READEVALCOMMAND_LINENUMBER, INPUT_LINENUMBER()]);
+ if BASE_SIZE_METHODS_OPER_ENTRY >= 6 then
+ methods[i+(narg+6)] := baserank;
+ fi;
fi;
# flush the cache
@@ -289,9 +297,11 @@ end );
## if supplied info should be a short but informative string
## that describes for what situation the method is installed,
## famp should be a function to be applied to the families
-## of the arguments,
-## and val should be an integer that measures the priority
-## of the method.
+## of the arguments.
+## aval should be an integer that measures the priority
+## of the method, or a function of no arguments which should return such an
+## integer and will be called each time method order is being recalculated,
+## (see ).
##
## The default values for info, famp, and val are
## the empty string,
@@ -454,9 +464,11 @@ BIND_GLOBAL( "INSTALL_METHOD",
# Check the rank.
if not IsBound( arglist[ pos ] ) then
Error( "the method is missing in " );
- elif IS_INT( arglist[ pos ] ) then
- rank:= arglist[ pos ];
- pos:= pos + 1;
+ elif IS_INT( arglist[ pos ] ) or
+ (IS_FUNCTION( arglist[ pos ] ) and NARG_FUNC( arglist[ pos ] ) = 0
+ and pos < LEN_LIST(arglist)) then
+ rank := arglist[ pos ];
+ pos := pos+1;
else
rank:= 0;
fi;
diff --git a/lib/package.gi b/lib/package.gi
index bf78020f41..66e7de917f 100644
--- a/lib/package.gi
+++ b/lib/package.gi
@@ -1420,7 +1420,7 @@ InstallGlobalFunction( LoadPackage, function( arg )
local name, Name, version, banner, loadsuggested, msg, depinfo, path,
pair, i, order, paths, cycle, secondrun, pkgname, pos, info,
filename, read;
-
+
# Get the arguments.
if Length( arg ) = 0 then
name:= "";
@@ -1516,7 +1516,14 @@ InstallGlobalFunction( LoadPackage, function( arg )
GAPInfo.LoadPackageLevel:= GAPInfo.LoadPackageLevel - 1;
return path;
fi;
-
+
+ #
+ # Suspend reordering of methods following InstallTrueMethod
+ # because it would slow things down too much
+ #
+ SuspendMethodReordering();
+
+
# Compute the order in which the packages are loaded.
# For each set of packages with cyclic dependencies,
# we will first read all `init.g' files
@@ -1631,6 +1638,8 @@ InstallGlobalFunction( LoadPackage, function( arg )
LogPackageLoadingMessage( PACKAGE_DEBUG, "return from LoadPackage",
Name );
GAPInfo.LoadPackageLevel:= GAPInfo.LoadPackageLevel - 1;
+
+ ResumeMethodReordering();
return true;
end );
@@ -1640,11 +1649,13 @@ InstallGlobalFunction( LoadPackage, function( arg )
#F LoadAllPackages()
##
InstallGlobalFunction( LoadAllPackages, function()
+ SuspendMethodReordering();
if ValueOption( "reversed" ) = true then
- List( Reversed( RecNames( GAPInfo.PackagesInfo ) ), LoadPackage );
+ List( Reversed( RecNames( GAPInfo.PackagesInfo ) ), LoadPackage );
else
- List( RecNames( GAPInfo.PackagesInfo ), LoadPackage );
+ List( RecNames( GAPInfo.PackagesInfo ), LoadPackage );
fi;
+ ResumeMethodReordering();
end );
diff --git a/src/c_oper1.c b/src/c_oper1.c
index 35886bdeb8..bbe06074d9 100644
--- a/src/c_oper1.c
+++ b/src/c_oper1.c
@@ -1,7 +1,7 @@
#ifndef AVOID_PRECOMPILED
/* C file produced by GAC */
#include "compiled.h"
-#define FILE_CRC "93694864"
+#define FILE_CRC "-16477221"
/* global variables used in handlers */
static GVar G_REREADING;
@@ -82,6 +82,8 @@ static GVar G_LEN__LIST;
static Obj GF_LEN__LIST;
static GVar G_APPEND__LIST__INTR;
static Obj GF_APPEND__LIST__INTR;
+static GVar G_COPY__LIST__ENTRIES;
+static Obj GF_COPY__LIST__ENTRIES;
static GVar G_CONV__STRING;
static Obj GF_CONV__STRING;
static GVar G_Print;
@@ -601,7 +603,7 @@ static Obj HdlrFunc3 (
Obj a_info,
Obj a_rel,
Obj a_flags,
- Obj a_rank,
+ Obj a_baserank,
Obj a_method )
{
Obj l_methods = 0;
@@ -613,6 +615,7 @@ static Obj HdlrFunc3 (
Obj l_match = 0;
Obj l_j = 0;
Obj l_lk = 0;
+ Obj l_rank = 0;
Obj t_1 = 0;
Obj t_2 = 0;
Obj t_3 = 0;
@@ -630,6 +633,7 @@ static Obj HdlrFunc3 (
(void)l_match;
(void)l_j;
(void)l_lk;
+ (void)l_rank;
Bag oldFrame;
OLD_BRK_CURR_STAT
@@ -638,6 +642,31 @@ static Obj HdlrFunc3 (
REM_BRK_CURR_STAT();
SET_BRK_CURR_STAT(0);
+ /* if IS_FUNCTION( baserank ) then */
+ t_3 = GF_IS__FUNCTION;
+ t_2 = CALL_1ARGS( t_3, a_baserank );
+ CHECK_FUNC_RESULT( t_2 )
+ CHECK_BOOL( t_2 )
+ t_1 = (Obj)(UInt)(t_2 != False);
+ if ( t_1 ) {
+
+ /* rank := baserank( ); */
+ CHECK_FUNC( a_baserank )
+ t_1 = CALL_0ARGS( a_baserank );
+ CHECK_FUNC_RESULT( t_1 )
+ l_rank = t_1;
+
+ }
+
+ /* else */
+ else {
+
+ /* rank := baserank; */
+ l_rank = a_baserank;
+
+ }
+ /* fi */
+
/* if IS_CONSTRUCTOR( opr ) then */
t_3 = GF_IS__CONSTRUCTOR;
t_2 = CALL_1ARGS( t_3, a_opr );
@@ -658,8 +687,8 @@ static Obj HdlrFunc3 (
C_ELM_LIST_FPL( t_4, a_flags, INTOBJ_INT(1) )
t_2 = CALL_1ARGS( t_3, t_4 );
CHECK_FUNC_RESULT( t_2 )
- C_DIFF_FIA( t_1, a_rank, t_2 )
- a_rank = t_1;
+ C_DIFF_FIA( t_1, l_rank, t_2 )
+ l_rank = t_1;
}
/* fi */
@@ -696,8 +725,8 @@ static Obj HdlrFunc3 (
t_7 = GF_RankFilter;
t_6 = CALL_1ARGS( t_7, l_i );
CHECK_FUNC_RESULT( t_6 )
- C_SUM_FIA( t_5, a_rank, t_6 )
- a_rank = t_5;
+ C_SUM_FIA( t_5, l_rank, t_6 )
+ l_rank = t_5;
}
/* od */
@@ -776,13 +805,13 @@ static Obj HdlrFunc3 (
C_SUM_FIA( t_5, l_i, t_6 )
CHECK_INT_POS( t_5 )
C_ELM_LIST_FPL( t_4, l_methods, t_5 )
- t_3 = (Obj)(UInt)(LT( a_rank, t_4 ));
+ t_3 = (Obj)(UInt)(LT( l_rank, t_4 ));
t_1 = t_3;
}
if ( ! t_1 ) break;
- /* i := i + (narg + 5); */
- C_SUM_FIA( t_2, l_narg, INTOBJ_INT(5) )
+ /* i := i + (narg + 6); */
+ C_SUM_FIA( t_2, l_narg, INTOBJ_INT(6) )
C_SUM_FIA( t_1, l_i, t_2 )
l_i = t_1;
@@ -815,7 +844,7 @@ static Obj HdlrFunc3 (
C_SUM_FIA( t_5, t_6, INTOBJ_INT(3) )
CHECK_INT_POS( t_5 )
C_ELM_LIST_FPL( t_4, l_methods, t_5 )
- t_3 = (Obj)(UInt)(EQ( a_rank, t_4 ));
+ t_3 = (Obj)(UInt)(EQ( l_rank, t_4 ));
t_1 = t_3;
}
if ( ! t_1 ) break;
@@ -890,9 +919,9 @@ static Obj HdlrFunc3 (
}
/* fi */
- /* k := k + narg + 5; */
+ /* k := k + narg + 6; */
C_SUM_FIA( t_2, l_k, l_narg )
- C_SUM_FIA( t_1, t_2, INTOBJ_INT(5) )
+ C_SUM_FIA( t_1, t_2, INTOBJ_INT(6) )
l_k = t_1;
}
@@ -915,23 +944,31 @@ static Obj HdlrFunc3 (
}
if ( t_1 ) {
- /* methods{[ narg + 5 + i + 1 .. narg + 5 + LEN_LIST( methods ) ]} := methods{[ i + 1 .. LEN_LIST( methods ) ]}; */
- C_SUM_FIA( t_4, l_narg, INTOBJ_INT(5) )
- C_SUM_FIA( t_3, t_4, l_i )
- C_SUM_FIA( t_2, t_3, INTOBJ_INT(1) )
- C_SUM_FIA( t_4, l_narg, INTOBJ_INT(5) )
- t_6 = GF_LEN__LIST;
- t_5 = CALL_1ARGS( t_6, l_methods );
- CHECK_FUNC_RESULT( t_5 )
- C_SUM_FIA( t_3, t_4, t_5 )
- t_1 = Range2Check( t_2, t_3 );
- C_SUM_FIA( t_4, l_i, INTOBJ_INT(1) )
- t_6 = GF_LEN__LIST;
- t_5 = CALL_1ARGS( t_6, l_methods );
- CHECK_FUNC_RESULT( t_5 )
- t_3 = Range2Check( t_4, t_5 );
- t_2 = ElmsListCheck( l_methods, t_3 );
- AsssListCheck( l_methods, t_1, t_2 );
+ /* COPY_LIST_ENTRIES( methods, i + 1, 1, methods, narg + 6 + i + 1, 1, LEN_LIST( methods ) - i ); */
+ t_1 = GF_COPY__LIST__ENTRIES;
+ t_2 = NEW_PLIST( T_PLIST, 7 );
+ SET_LEN_PLIST( t_2, 7 );
+ SET_ELM_PLIST( t_2, 1, l_methods );
+ CHANGED_BAG( t_2 );
+ C_SUM_FIA( t_3, l_i, INTOBJ_INT(1) )
+ SET_ELM_PLIST( t_2, 2, t_3 );
+ CHANGED_BAG( t_2 );
+ SET_ELM_PLIST( t_2, 3, INTOBJ_INT(1) );
+ SET_ELM_PLIST( t_2, 4, l_methods );
+ CHANGED_BAG( t_2 );
+ C_SUM_FIA( t_5, l_narg, INTOBJ_INT(6) )
+ C_SUM_FIA( t_4, t_5, l_i )
+ C_SUM_FIA( t_3, t_4, INTOBJ_INT(1) )
+ SET_ELM_PLIST( t_2, 5, t_3 );
+ CHANGED_BAG( t_2 );
+ SET_ELM_PLIST( t_2, 6, INTOBJ_INT(1) );
+ t_5 = GF_LEN__LIST;
+ t_4 = CALL_1ARGS( t_5, l_methods );
+ CHECK_FUNC_RESULT( t_4 )
+ C_DIFF_FIA( t_3, t_4, l_i )
+ SET_ELM_PLIST( t_2, 7, t_3 );
+ CHANGED_BAG( t_2 );
+ CALL_XARGS( t_1, t_2 );
}
/* fi */
@@ -1185,7 +1222,7 @@ static Obj HdlrFunc3 (
C_SUM_INTOBJS( t_2, l_narg, INTOBJ_INT(3) )
C_SUM_FIA( t_1, l_i, t_2 )
CHECK_INT_POS( t_1 )
- C_ASS_LIST_FPL( l_methods, t_1, a_rank )
+ C_ASS_LIST_FPL( l_methods, t_1, l_rank )
/* methods[i + (narg + 4)] := IMMUTABLE_COPY_OBJ( info ); */
C_SUM_INTOBJS( t_2, l_narg, INTOBJ_INT(4) )
@@ -1196,8 +1233,8 @@ static Obj HdlrFunc3 (
CHECK_FUNC_RESULT( t_2 )
C_ASS_LIST_FPL( l_methods, t_1, t_2 )
- /* if 5 >= 5 then */
- t_1 = (Obj)(UInt)(((Int)INTOBJ_INT(5)) >= ((Int)INTOBJ_INT(5)));
+ /* if 6 >= 5 then */
+ t_1 = (Obj)(UInt)(((Int)INTOBJ_INT(6)) >= ((Int)INTOBJ_INT(5)));
if ( t_1 ) {
/* methods[i + (narg + 5)] := MakeImmutable( [ INPUT_FILENAME( ), READEVALCOMMAND_LINENUMBER, INPUT_LINENUMBER( ) ] ); */
@@ -1225,6 +1262,19 @@ static Obj HdlrFunc3 (
CHECK_FUNC_RESULT( t_2 )
C_ASS_LIST_FPL( l_methods, t_1, t_2 )
+ /* if 6 >= 6 then */
+ t_1 = (Obj)(UInt)(((Int)INTOBJ_INT(6)) >= ((Int)INTOBJ_INT(6)));
+ if ( t_1 ) {
+
+ /* methods[i + (narg + 6)] := baserank; */
+ C_SUM_INTOBJS( t_2, l_narg, INTOBJ_INT(6) )
+ C_SUM_FIA( t_1, l_i, t_2 )
+ CHECK_INT_POS( t_1 )
+ C_ASS_LIST_FPL( l_methods, t_1, a_baserank )
+
+ }
+ /* fi */
+
}
/* fi */
@@ -1717,14 +1767,41 @@ static Obj HdlrFunc6 (
}
- /* elif IS_INT( arglist[pos] ) then */
+ /* elif IS_INT( arglist[pos] ) or IS_FUNCTION( arglist[pos] ) and NARG_FUNC( arglist[pos] ) = 0 and pos < LEN_LIST( arglist ) then */
else {
- t_3 = GF_IS__INT;
- C_ELM_LIST_FPL( t_4, a_arglist, l_pos )
- t_2 = CALL_1ARGS( t_3, t_4 );
- CHECK_FUNC_RESULT( t_2 )
- CHECK_BOOL( t_2 )
- t_1 = (Obj)(UInt)(t_2 != False);
+ t_4 = GF_IS__INT;
+ C_ELM_LIST_FPL( t_5, a_arglist, l_pos )
+ t_3 = CALL_1ARGS( t_4, t_5 );
+ CHECK_FUNC_RESULT( t_3 )
+ CHECK_BOOL( t_3 )
+ t_2 = (Obj)(UInt)(t_3 != False);
+ t_1 = t_2;
+ if ( ! t_1 ) {
+ t_7 = GF_IS__FUNCTION;
+ C_ELM_LIST_FPL( t_8, a_arglist, l_pos )
+ t_6 = CALL_1ARGS( t_7, t_8 );
+ CHECK_FUNC_RESULT( t_6 )
+ CHECK_BOOL( t_6 )
+ t_5 = (Obj)(UInt)(t_6 != False);
+ t_4 = t_5;
+ if ( t_4 ) {
+ t_8 = GF_NARG__FUNC;
+ C_ELM_LIST_FPL( t_9, a_arglist, l_pos )
+ t_7 = CALL_1ARGS( t_8, t_9 );
+ CHECK_FUNC_RESULT( t_7 )
+ t_6 = (Obj)(UInt)(EQ( t_7, INTOBJ_INT(0) ));
+ t_4 = t_6;
+ }
+ t_3 = t_4;
+ if ( t_3 ) {
+ t_7 = GF_LEN__LIST;
+ t_6 = CALL_1ARGS( t_7, a_arglist );
+ CHECK_FUNC_RESULT( t_6 )
+ t_5 = (Obj)(UInt)(LT( l_pos, t_6 ));
+ t_3 = t_5;
+ }
+ t_1 = t_3;
+ }
if ( t_1 ) {
/* rank := arglist[pos]; */
@@ -2685,8 +2762,8 @@ static Obj HdlrFunc7 (
t_6 = NewFunction( NameFunc[8], 1, 0, HdlrFunc8 );
SET_ENVI_FUNC( t_6, STATE(CurrLVars) );
t_7 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_7, 651);
- SET_ENDLINE_BODY(t_7, 669);
+ SET_STARTLINE_BODY(t_7, 663);
+ SET_ENDLINE_BODY(t_7, 681);
SET_FILENAME_BODY(t_7, FileName);
SET_BODY_FUNC(t_6, t_7);
CHANGED_BAG( STATE(CurrLVars) );
@@ -3289,8 +3366,8 @@ static Obj HdlrFunc11 (
t_1 = NewFunction( NameFunc[12], 1, 0, HdlrFunc12 );
SET_ENVI_FUNC( t_1, STATE(CurrLVars) );
t_2 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_2, 848);
- SET_ENDLINE_BODY(t_2, 852);
+ SET_STARTLINE_BODY(t_2, 860);
+ SET_ENDLINE_BODY(t_2, 864);
SET_FILENAME_BODY(t_2, FileName);
SET_BODY_FUNC(t_1, t_2);
CHANGED_BAG( STATE(CurrLVars) );
@@ -3369,8 +3446,8 @@ static Obj HdlrFunc11 (
t_6 = NewFunction( NameFunc[13], 1, 0, HdlrFunc13 );
SET_ENVI_FUNC( t_6, STATE(CurrLVars) );
t_7 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_7, 869);
- SET_ENDLINE_BODY(t_7, 869);
+ SET_STARTLINE_BODY(t_7, 881);
+ SET_ENDLINE_BODY(t_7, 881);
SET_FILENAME_BODY(t_7, FileName);
SET_BODY_FUNC(t_6, t_7);
CHANGED_BAG( STATE(CurrLVars) );
@@ -3432,8 +3509,8 @@ static Obj HdlrFunc11 (
t_6 = NewFunction( NameFunc[14], 2, 0, HdlrFunc14 );
SET_ENVI_FUNC( t_6, STATE(CurrLVars) );
t_7 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_7, 891);
- SET_ENDLINE_BODY(t_7, 914);
+ SET_STARTLINE_BODY(t_7, 903);
+ SET_ENDLINE_BODY(t_7, 926);
SET_FILENAME_BODY(t_7, FileName);
SET_BODY_FUNC(t_6, t_7);
CHANGED_BAG( STATE(CurrLVars) );
@@ -3481,8 +3558,8 @@ static Obj HdlrFunc11 (
t_6 = NewFunction( NameFunc[15], 2, 0, HdlrFunc15 );
SET_ENVI_FUNC( t_6, STATE(CurrLVars) );
t_7 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_7, 924);
- SET_ENDLINE_BODY(t_7, 932);
+ SET_STARTLINE_BODY(t_7, 936);
+ SET_ENDLINE_BODY(t_7, 944);
SET_FILENAME_BODY(t_7, FileName);
SET_BODY_FUNC(t_6, t_7);
CHANGED_BAG( STATE(CurrLVars) );
@@ -3543,8 +3620,8 @@ static Obj HdlrFunc11 (
t_6 = NewFunction( NameFunc[16], 3, 0, HdlrFunc16 );
SET_ENVI_FUNC( t_6, STATE(CurrLVars) );
t_7 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_7, 941);
- SET_ENDLINE_BODY(t_7, 954);
+ SET_STARTLINE_BODY(t_7, 953);
+ SET_ENDLINE_BODY(t_7, 966);
SET_FILENAME_BODY(t_7, FileName);
SET_BODY_FUNC(t_6, t_7);
CHANGED_BAG( STATE(CurrLVars) );
@@ -3917,8 +3994,8 @@ static Obj HdlrFunc17 (
t_4 = NewFunction( NameFunc[18], -1, 0, HdlrFunc18 );
SET_ENVI_FUNC( t_4, STATE(CurrLVars) );
t_5 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_5, 1020);
- SET_ENDLINE_BODY(t_5, 1036);
+ SET_STARTLINE_BODY(t_5, 1032);
+ SET_ENDLINE_BODY(t_5, 1048);
SET_FILENAME_BODY(t_5, FileName);
SET_BODY_FUNC(t_4, t_5);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4026,9 +4103,14 @@ static Obj HdlrFunc1 (
CHANGED_BAG( STATE(CurrLVars) );
CALL_2ARGS( t_1, t_2, t_3 );
- /* BIND_GLOBAL( "INSTALL_METHOD_FLAGS", function ( opr, info, rel, flags, rank, method )
- local methods, narg, i, k, tmp, replace, match, j, lk;
+ /* BIND_GLOBAL( "INSTALL_METHOD_FLAGS", function ( opr, info, rel, flags, baserank, method )
+ local methods, narg, i, k, tmp, replace, match, j, lk, rank;
;
+ if IS_FUNCTION( baserank ) then
+ rank := baserank( );
+ else
+ rank := baserank;
+ fi;
if IS_CONSTRUCTOR( opr ) then
if 0 < LEN_LIST( flags ) then
rank := rank - RankFilter( flags[1] );
@@ -4052,7 +4134,7 @@ static Obj HdlrFunc1 (
fi;
i := 0;
while i < LEN_LIST( methods ) and rank < methods[i + (narg + 3)] do
- i := i + (narg + 5);
+ i := i + (narg + 6);
od;
replace := false;
if REREADING then
@@ -4069,11 +4151,11 @@ static Obj HdlrFunc1 (
break;
fi;
fi;
- k := k + narg + 5;
+ k := k + narg + 6;
od;
fi;
if not REREADING or not replace then
- methods{[ narg + 5 + i + 1 .. narg + 5 + LEN_LIST( methods ) ]} := methods{[ i + 1 .. LEN_LIST( methods ) ]};
+ COPY_LIST_ENTRIES( methods, i + 1, 1, methods, narg + 6 + i + 1, 1, LEN_LIST( methods ) - i );
fi;
if rel = true then
methods[i + 1] := RETURN_TRUE;
@@ -4110,8 +4192,11 @@ static Obj HdlrFunc1 (
fi;
methods[i + (narg + 3)] := rank;
methods[i + (narg + 4)] := IMMUTABLE_COPY_OBJ( info );
- if 5 >= 5 then
+ if 6 >= 5 then
methods[i + (narg + 5)] := MakeImmutable( [ INPUT_FILENAME( ), READEVALCOMMAND_LINENUMBER, INPUT_LINENUMBER( ) ] );
+ if 6 >= 6 then
+ methods[i + (narg + 6)] := baserank;
+ fi;
fi;
CHANGED_METHODS_OPERATION( opr, narg );
return;
@@ -4122,7 +4207,7 @@ static Obj HdlrFunc1 (
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 146);
- SET_ENDLINE_BODY(t_4, 273);
+ SET_ENDLINE_BODY(t_4, 281);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4137,8 +4222,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[4], -1, 0, HdlrFunc4 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_4, 320);
- SET_ENDLINE_BODY(t_4, 322);
+ SET_STARTLINE_BODY(t_4, 330);
+ SET_ENDLINE_BODY(t_4, 332);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4153,8 +4238,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[5], -1, 0, HdlrFunc5 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_4, 347);
- SET_ENDLINE_BODY(t_4, 349);
+ SET_STARTLINE_BODY(t_4, 357);
+ SET_ENDLINE_BODY(t_4, 359);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4228,7 +4313,7 @@ static Obj HdlrFunc1 (
od;
if not IsBound( arglist[pos] ) then
Error( "the method is missing in " );
- elif IS_INT( arglist[pos] ) then
+ elif IS_INT( arglist[pos] ) or IS_FUNCTION( arglist[pos] ) and NARG_FUNC( arglist[pos] ) = 0 and pos < LEN_LIST( arglist ) then
rank := arglist[pos];
pos := pos + 1;
else
@@ -4323,17 +4408,17 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[6], 2, 0, HdlrFunc6 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_4, 360);
- SET_ENDLINE_BODY(t_4, 590);
+ SET_STARTLINE_BODY(t_4, 370);
+ SET_ENDLINE_BODY(t_4, 602);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
CALL_2ARGS( t_1, t_2, t_3 );
- /* LENGTH_SETTER_METHODS_2 := LENGTH_SETTER_METHODS_2 + (5 + 2); */
+ /* LENGTH_SETTER_METHODS_2 := LENGTH_SETTER_METHODS_2 + (6 + 2); */
t_2 = GC_LENGTH__SETTER__METHODS__2;
CHECK_BOUND( t_2, "LENGTH_SETTER_METHODS_2" )
- C_SUM_INTOBJS( t_3, INTOBJ_INT(5), INTOBJ_INT(2) )
+ C_SUM_INTOBJS( t_3, INTOBJ_INT(6), INTOBJ_INT(2) )
C_SUM_FIA( t_1, t_2, t_3 )
AssGVar( G_LENGTH__SETTER__METHODS__2, t_1 );
@@ -4382,8 +4467,8 @@ static Obj HdlrFunc1 (
t_2 = NewFunction( NameFunc[7], 6, 0, HdlrFunc7 );
SET_ENVI_FUNC( t_2, STATE(CurrLVars) );
t_3 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_3, 609);
- SET_ENDLINE_BODY(t_3, 673);
+ SET_STARTLINE_BODY(t_3, 621);
+ SET_ENDLINE_BODY(t_3, 685);
SET_FILENAME_BODY(t_3, FileName);
SET_BODY_FUNC(t_2, t_3);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4397,8 +4482,8 @@ static Obj HdlrFunc1 (
t_2 = NewFunction( NameFunc[9], 6, 0, HdlrFunc9 );
SET_ENVI_FUNC( t_2, STATE(CurrLVars) );
t_3 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_3, 676);
- SET_ENDLINE_BODY(t_3, 682);
+ SET_STARTLINE_BODY(t_3, 688);
+ SET_ENDLINE_BODY(t_3, 694);
SET_FILENAME_BODY(t_3, FileName);
SET_BODY_FUNC(t_2, t_3);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4426,8 +4511,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[10], 2, 0, HdlrFunc10 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_4, 695);
- SET_ENDLINE_BODY(t_4, 719);
+ SET_STARTLINE_BODY(t_4, 707);
+ SET_ENDLINE_BODY(t_4, 731);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4511,8 +4596,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[11], 4, 0, HdlrFunc11 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_4, 844);
- SET_ENDLINE_BODY(t_4, 955);
+ SET_STARTLINE_BODY(t_4, 856);
+ SET_ENDLINE_BODY(t_4, 967);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4563,8 +4648,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, 990);
- SET_ENDLINE_BODY(t_4, 1037);
+ SET_STARTLINE_BODY(t_4, 1002);
+ SET_ENDLINE_BODY(t_4, 1049);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4641,6 +4726,7 @@ static Int PostRestore ( StructInitInfo * module )
G_RETURN__FALSE = GVarName( "RETURN_FALSE" );
G_LEN__LIST = GVarName( "LEN_LIST" );
G_APPEND__LIST__INTR = GVarName( "APPEND_LIST_INTR" );
+ G_COPY__LIST__ENTRIES = GVarName( "COPY_LIST_ENTRIES" );
G_CONV__STRING = GVarName( "CONV_STRING" );
G_Print = GVarName( "Print" );
G_ViewObj = GVarName( "ViewObj" );
@@ -4757,6 +4843,7 @@ static Int InitKernel ( StructInitInfo * module )
InitCopyGVar( "RETURN_FALSE", &GC_RETURN__FALSE );
InitFopyGVar( "LEN_LIST", &GF_LEN__LIST );
InitFopyGVar( "APPEND_LIST_INTR", &GF_APPEND__LIST__INTR );
+ InitFopyGVar( "COPY_LIST_ENTRIES", &GF_COPY__LIST__ENTRIES );
InitFopyGVar( "CONV_STRING", &GF_CONV__STRING );
InitFopyGVar( "Print", &GF_Print );
InitCopyGVar( "ViewObj", &GC_ViewObj );
@@ -4871,7 +4958,7 @@ static Int InitLibrary ( StructInitInfo * module )
static StructInitInfo module = {
.type = MODULE_STATIC,
.name = "GAPROOT/lib/oper1.g",
- .crc = 93694864,
+ .crc = -16477221,
.initKernel = InitKernel,
.initLibrary = InitLibrary,
.postRestore = PostRestore,
diff --git a/src/c_type1.c b/src/c_type1.c
index 79a54f9985..387f98010a 100644
--- a/src/c_type1.c
+++ b/src/c_type1.c
@@ -3320,10 +3320,10 @@ static Obj HdlrFunc1 (
CHANGED_BAG( STATE(CurrLVars) );
CALL_1ARGS( t_1, t_2 );
- /* LENGTH_SETTER_METHODS_2 := LENGTH_SETTER_METHODS_2 + (5 + 2); */
+ /* LENGTH_SETTER_METHODS_2 := LENGTH_SETTER_METHODS_2 + (6 + 2); */
t_2 = GC_LENGTH__SETTER__METHODS__2;
CHECK_BOUND( t_2, "LENGTH_SETTER_METHODS_2" )
- C_SUM_INTOBJS( t_3, INTOBJ_INT(5), INTOBJ_INT(2) )
+ C_SUM_INTOBJS( t_3, INTOBJ_INT(6), INTOBJ_INT(2) )
C_SUM_FIA( t_1, t_2, t_3 )
AssGVar( G_LENGTH__SETTER__METHODS__2, t_1 );
diff --git a/src/hpc/c_oper1.c b/src/hpc/c_oper1.c
index d9962694e9..964ed69e7b 100644
--- a/src/hpc/c_oper1.c
+++ b/src/hpc/c_oper1.c
@@ -1,7 +1,7 @@
#ifndef AVOID_PRECOMPILED
/* C file produced by GAC */
#include "compiled.h"
-#define FILE_CRC "93694864"
+#define FILE_CRC "-16477221"
/* global variables used in handlers */
static GVar G_REREADING;
@@ -82,6 +82,8 @@ static GVar G_LEN__LIST;
static Obj GF_LEN__LIST;
static GVar G_APPEND__LIST__INTR;
static Obj GF_APPEND__LIST__INTR;
+static GVar G_COPY__LIST__ENTRIES;
+static Obj GF_COPY__LIST__ENTRIES;
static GVar G_CONV__STRING;
static Obj GF_CONV__STRING;
static GVar G_Print;
@@ -617,7 +619,7 @@ static Obj HdlrFunc3 (
Obj a_info,
Obj a_rel,
Obj a_flags,
- Obj a_rank,
+ Obj a_baserank,
Obj a_method )
{
Obj l_methods = 0;
@@ -629,6 +631,7 @@ static Obj HdlrFunc3 (
Obj l_match = 0;
Obj l_j = 0;
Obj l_lk = 0;
+ Obj l_rank = 0;
Obj t_1 = 0;
Obj t_2 = 0;
Obj t_3 = 0;
@@ -646,6 +649,7 @@ static Obj HdlrFunc3 (
(void)l_match;
(void)l_j;
(void)l_lk;
+ (void)l_rank;
Bag oldFrame;
OLD_BRK_CURR_STAT
@@ -662,6 +666,31 @@ static Obj HdlrFunc3 (
CHECK_FUNC_RESULT( t_1 )
l_lk = t_1;
+ /* if IS_FUNCTION( baserank ) then */
+ t_3 = GF_IS__FUNCTION;
+ t_2 = CALL_1ARGS( t_3, a_baserank );
+ CHECK_FUNC_RESULT( t_2 )
+ CHECK_BOOL( t_2 )
+ t_1 = (Obj)(UInt)(t_2 != False);
+ if ( t_1 ) {
+
+ /* rank := baserank( ); */
+ CHECK_FUNC( a_baserank )
+ t_1 = CALL_0ARGS( a_baserank );
+ CHECK_FUNC_RESULT( t_1 )
+ l_rank = t_1;
+
+ }
+
+ /* else */
+ else {
+
+ /* rank := baserank; */
+ l_rank = a_baserank;
+
+ }
+ /* fi */
+
/* if IS_CONSTRUCTOR( opr ) then */
t_3 = GF_IS__CONSTRUCTOR;
t_2 = CALL_1ARGS( t_3, a_opr );
@@ -682,8 +711,8 @@ static Obj HdlrFunc3 (
C_ELM_LIST_FPL( t_4, a_flags, INTOBJ_INT(1) )
t_2 = CALL_1ARGS( t_3, t_4 );
CHECK_FUNC_RESULT( t_2 )
- C_DIFF_FIA( t_1, a_rank, t_2 )
- a_rank = t_1;
+ C_DIFF_FIA( t_1, l_rank, t_2 )
+ l_rank = t_1;
}
/* fi */
@@ -720,8 +749,8 @@ static Obj HdlrFunc3 (
t_7 = GF_RankFilter;
t_6 = CALL_1ARGS( t_7, l_i );
CHECK_FUNC_RESULT( t_6 )
- C_SUM_FIA( t_5, a_rank, t_6 )
- a_rank = t_5;
+ C_SUM_FIA( t_5, l_rank, t_6 )
+ l_rank = t_5;
}
/* od */
@@ -808,13 +837,13 @@ static Obj HdlrFunc3 (
C_SUM_FIA( t_5, l_i, t_6 )
CHECK_INT_POS( t_5 )
C_ELM_LIST_FPL( t_4, l_methods, t_5 )
- t_3 = (Obj)(UInt)(LT( a_rank, t_4 ));
+ t_3 = (Obj)(UInt)(LT( l_rank, t_4 ));
t_1 = t_3;
}
if ( ! t_1 ) break;
- /* i := i + (narg + 5); */
- C_SUM_FIA( t_2, l_narg, INTOBJ_INT(5) )
+ /* i := i + (narg + 6); */
+ C_SUM_FIA( t_2, l_narg, INTOBJ_INT(6) )
C_SUM_FIA( t_1, l_i, t_2 )
l_i = t_1;
@@ -847,7 +876,7 @@ static Obj HdlrFunc3 (
C_SUM_FIA( t_5, t_6, INTOBJ_INT(3) )
CHECK_INT_POS( t_5 )
C_ELM_LIST_FPL( t_4, l_methods, t_5 )
- t_3 = (Obj)(UInt)(EQ( a_rank, t_4 ));
+ t_3 = (Obj)(UInt)(EQ( l_rank, t_4 ));
t_1 = t_3;
}
if ( ! t_1 ) break;
@@ -922,9 +951,9 @@ static Obj HdlrFunc3 (
}
/* fi */
- /* k := k + narg + 5; */
+ /* k := k + narg + 6; */
C_SUM_FIA( t_2, l_k, l_narg )
- C_SUM_FIA( t_1, t_2, INTOBJ_INT(5) )
+ C_SUM_FIA( t_1, t_2, INTOBJ_INT(6) )
l_k = t_1;
}
@@ -947,23 +976,31 @@ static Obj HdlrFunc3 (
}
if ( t_1 ) {
- /* methods{[ narg + 5 + i + 1 .. narg + 5 + LEN_LIST( methods ) ]} := methods{[ i + 1 .. LEN_LIST( methods ) ]}; */
- C_SUM_FIA( t_4, l_narg, INTOBJ_INT(5) )
- C_SUM_FIA( t_3, t_4, l_i )
- C_SUM_FIA( t_2, t_3, INTOBJ_INT(1) )
- C_SUM_FIA( t_4, l_narg, INTOBJ_INT(5) )
- t_6 = GF_LEN__LIST;
- t_5 = CALL_1ARGS( t_6, l_methods );
- CHECK_FUNC_RESULT( t_5 )
- C_SUM_FIA( t_3, t_4, t_5 )
- t_1 = Range2Check( t_2, t_3 );
- C_SUM_FIA( t_4, l_i, INTOBJ_INT(1) )
- t_6 = GF_LEN__LIST;
- t_5 = CALL_1ARGS( t_6, l_methods );
- CHECK_FUNC_RESULT( t_5 )
- t_3 = Range2Check( t_4, t_5 );
- t_2 = ElmsListCheck( l_methods, t_3 );
- AsssListCheck( l_methods, t_1, t_2 );
+ /* COPY_LIST_ENTRIES( methods, i + 1, 1, methods, narg + 6 + i + 1, 1, LEN_LIST( methods ) - i ); */
+ t_1 = GF_COPY__LIST__ENTRIES;
+ t_2 = NEW_PLIST( T_PLIST, 7 );
+ SET_LEN_PLIST( t_2, 7 );
+ SET_ELM_PLIST( t_2, 1, l_methods );
+ CHANGED_BAG( t_2 );
+ C_SUM_FIA( t_3, l_i, INTOBJ_INT(1) )
+ SET_ELM_PLIST( t_2, 2, t_3 );
+ CHANGED_BAG( t_2 );
+ SET_ELM_PLIST( t_2, 3, INTOBJ_INT(1) );
+ SET_ELM_PLIST( t_2, 4, l_methods );
+ CHANGED_BAG( t_2 );
+ C_SUM_FIA( t_5, l_narg, INTOBJ_INT(6) )
+ C_SUM_FIA( t_4, t_5, l_i )
+ C_SUM_FIA( t_3, t_4, INTOBJ_INT(1) )
+ SET_ELM_PLIST( t_2, 5, t_3 );
+ CHANGED_BAG( t_2 );
+ SET_ELM_PLIST( t_2, 6, INTOBJ_INT(1) );
+ t_5 = GF_LEN__LIST;
+ t_4 = CALL_1ARGS( t_5, l_methods );
+ CHECK_FUNC_RESULT( t_4 )
+ C_DIFF_FIA( t_3, t_4, l_i )
+ SET_ELM_PLIST( t_2, 7, t_3 );
+ CHANGED_BAG( t_2 );
+ CALL_XARGS( t_1, t_2 );
}
/* fi */
@@ -1217,7 +1254,7 @@ static Obj HdlrFunc3 (
C_SUM_INTOBJS( t_2, l_narg, INTOBJ_INT(3) )
C_SUM_FIA( t_1, l_i, t_2 )
CHECK_INT_POS( t_1 )
- C_ASS_LIST_FPL( l_methods, t_1, a_rank )
+ C_ASS_LIST_FPL( l_methods, t_1, l_rank )
/* methods[i + (narg + 4)] := IMMUTABLE_COPY_OBJ( info ); */
C_SUM_INTOBJS( t_2, l_narg, INTOBJ_INT(4) )
@@ -1228,8 +1265,8 @@ static Obj HdlrFunc3 (
CHECK_FUNC_RESULT( t_2 )
C_ASS_LIST_FPL( l_methods, t_1, t_2 )
- /* if 5 >= 5 then */
- t_1 = (Obj)(UInt)(((Int)INTOBJ_INT(5)) >= ((Int)INTOBJ_INT(5)));
+ /* if 6 >= 5 then */
+ t_1 = (Obj)(UInt)(((Int)INTOBJ_INT(6)) >= ((Int)INTOBJ_INT(5)));
if ( t_1 ) {
/* methods[i + (narg + 5)] := MakeImmutable( [ INPUT_FILENAME( ), READEVALCOMMAND_LINENUMBER, INPUT_LINENUMBER( ) ] ); */
@@ -1257,6 +1294,19 @@ static Obj HdlrFunc3 (
CHECK_FUNC_RESULT( t_2 )
C_ASS_LIST_FPL( l_methods, t_1, t_2 )
+ /* if 6 >= 6 then */
+ t_1 = (Obj)(UInt)(((Int)INTOBJ_INT(6)) >= ((Int)INTOBJ_INT(6)));
+ if ( t_1 ) {
+
+ /* methods[i + (narg + 6)] := baserank; */
+ C_SUM_INTOBJS( t_2, l_narg, INTOBJ_INT(6) )
+ C_SUM_FIA( t_1, l_i, t_2 )
+ CHECK_INT_POS( t_1 )
+ C_ASS_LIST_FPL( l_methods, t_1, a_baserank )
+
+ }
+ /* fi */
+
}
/* fi */
@@ -1764,14 +1814,41 @@ static Obj HdlrFunc6 (
}
- /* elif IS_INT( arglist[pos] ) then */
+ /* elif IS_INT( arglist[pos] ) or IS_FUNCTION( arglist[pos] ) and NARG_FUNC( arglist[pos] ) = 0 and pos < LEN_LIST( arglist ) then */
else {
- t_3 = GF_IS__INT;
- C_ELM_LIST_FPL( t_4, a_arglist, l_pos )
- t_2 = CALL_1ARGS( t_3, t_4 );
- CHECK_FUNC_RESULT( t_2 )
- CHECK_BOOL( t_2 )
- t_1 = (Obj)(UInt)(t_2 != False);
+ t_4 = GF_IS__INT;
+ C_ELM_LIST_FPL( t_5, a_arglist, l_pos )
+ t_3 = CALL_1ARGS( t_4, t_5 );
+ CHECK_FUNC_RESULT( t_3 )
+ CHECK_BOOL( t_3 )
+ t_2 = (Obj)(UInt)(t_3 != False);
+ t_1 = t_2;
+ if ( ! t_1 ) {
+ t_7 = GF_IS__FUNCTION;
+ C_ELM_LIST_FPL( t_8, a_arglist, l_pos )
+ t_6 = CALL_1ARGS( t_7, t_8 );
+ CHECK_FUNC_RESULT( t_6 )
+ CHECK_BOOL( t_6 )
+ t_5 = (Obj)(UInt)(t_6 != False);
+ t_4 = t_5;
+ if ( t_4 ) {
+ t_8 = GF_NARG__FUNC;
+ C_ELM_LIST_FPL( t_9, a_arglist, l_pos )
+ t_7 = CALL_1ARGS( t_8, t_9 );
+ CHECK_FUNC_RESULT( t_7 )
+ t_6 = (Obj)(UInt)(EQ( t_7, INTOBJ_INT(0) ));
+ t_4 = t_6;
+ }
+ t_3 = t_4;
+ if ( t_3 ) {
+ t_7 = GF_LEN__LIST;
+ t_6 = CALL_1ARGS( t_7, a_arglist );
+ CHECK_FUNC_RESULT( t_6 )
+ t_5 = (Obj)(UInt)(LT( l_pos, t_6 ));
+ t_3 = t_5;
+ }
+ t_1 = t_3;
+ }
if ( t_1 ) {
/* rank := arglist[pos]; */
@@ -2748,8 +2825,8 @@ static Obj HdlrFunc7 (
t_6 = NewFunction( NameFunc[8], 1, 0, HdlrFunc8 );
SET_ENVI_FUNC( t_6, STATE(CurrLVars) );
t_7 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_7, 651);
- SET_ENDLINE_BODY(t_7, 669);
+ SET_STARTLINE_BODY(t_7, 663);
+ SET_ENDLINE_BODY(t_7, 681);
SET_FILENAME_BODY(t_7, FileName);
SET_BODY_FUNC(t_6, t_7);
CHANGED_BAG( STATE(CurrLVars) );
@@ -3352,8 +3429,8 @@ static Obj HdlrFunc11 (
t_1 = NewFunction( NameFunc[12], 1, 0, HdlrFunc12 );
SET_ENVI_FUNC( t_1, STATE(CurrLVars) );
t_2 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_2, 848);
- SET_ENDLINE_BODY(t_2, 852);
+ SET_STARTLINE_BODY(t_2, 860);
+ SET_ENDLINE_BODY(t_2, 864);
SET_FILENAME_BODY(t_2, FileName);
SET_BODY_FUNC(t_1, t_2);
CHANGED_BAG( STATE(CurrLVars) );
@@ -3432,8 +3509,8 @@ static Obj HdlrFunc11 (
t_6 = NewFunction( NameFunc[13], 1, 0, HdlrFunc13 );
SET_ENVI_FUNC( t_6, STATE(CurrLVars) );
t_7 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_7, 869);
- SET_ENDLINE_BODY(t_7, 869);
+ SET_STARTLINE_BODY(t_7, 881);
+ SET_ENDLINE_BODY(t_7, 881);
SET_FILENAME_BODY(t_7, FileName);
SET_BODY_FUNC(t_6, t_7);
CHANGED_BAG( STATE(CurrLVars) );
@@ -3507,8 +3584,8 @@ static Obj HdlrFunc11 (
t_6 = NewFunction( NameFunc[14], 2, 0, HdlrFunc14 );
SET_ENVI_FUNC( t_6, STATE(CurrLVars) );
t_7 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_7, 891);
- SET_ENDLINE_BODY(t_7, 914);
+ SET_STARTLINE_BODY(t_7, 903);
+ SET_ENDLINE_BODY(t_7, 926);
SET_FILENAME_BODY(t_7, FileName);
SET_BODY_FUNC(t_6, t_7);
CHANGED_BAG( STATE(CurrLVars) );
@@ -3556,8 +3633,8 @@ static Obj HdlrFunc11 (
t_6 = NewFunction( NameFunc[15], 2, 0, HdlrFunc15 );
SET_ENVI_FUNC( t_6, STATE(CurrLVars) );
t_7 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_7, 924);
- SET_ENDLINE_BODY(t_7, 932);
+ SET_STARTLINE_BODY(t_7, 936);
+ SET_ENDLINE_BODY(t_7, 944);
SET_FILENAME_BODY(t_7, FileName);
SET_BODY_FUNC(t_6, t_7);
CHANGED_BAG( STATE(CurrLVars) );
@@ -3618,8 +3695,8 @@ static Obj HdlrFunc11 (
t_6 = NewFunction( NameFunc[16], 3, 0, HdlrFunc16 );
SET_ENVI_FUNC( t_6, STATE(CurrLVars) );
t_7 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_7, 941);
- SET_ENDLINE_BODY(t_7, 954);
+ SET_STARTLINE_BODY(t_7, 953);
+ SET_ENDLINE_BODY(t_7, 966);
SET_FILENAME_BODY(t_7, FileName);
SET_BODY_FUNC(t_6, t_7);
CHANGED_BAG( STATE(CurrLVars) );
@@ -3992,8 +4069,8 @@ static Obj HdlrFunc17 (
t_4 = NewFunction( NameFunc[18], -1, 0, HdlrFunc18 );
SET_ENVI_FUNC( t_4, STATE(CurrLVars) );
t_5 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_5, 1020);
- SET_ENDLINE_BODY(t_5, 1036);
+ SET_STARTLINE_BODY(t_5, 1032);
+ SET_ENDLINE_BODY(t_5, 1048);
SET_FILENAME_BODY(t_5, FileName);
SET_BODY_FUNC(t_4, t_5);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4110,9 +4187,14 @@ static Obj HdlrFunc1 (
CHECK_FUNC_RESULT( t_3 )
CALL_2ARGS( t_1, t_2, t_3 );
- /* BIND_GLOBAL( "INSTALL_METHOD_FLAGS", function ( opr, info, rel, flags, rank, method )
- local methods, narg, i, k, tmp, replace, match, j, lk;
+ /* BIND_GLOBAL( "INSTALL_METHOD_FLAGS", function ( opr, info, rel, flags, baserank, method )
+ local methods, narg, i, k, tmp, replace, match, j, lk, rank;
lk := WRITE_LOCK( METHODS_OPERATION_REGION );
+ if IS_FUNCTION( baserank ) then
+ rank := baserank( );
+ else
+ rank := baserank;
+ fi;
if IS_CONSTRUCTOR( opr ) then
if 0 < LEN_LIST( flags ) then
rank := rank - RankFilter( flags[1] );
@@ -4136,7 +4218,7 @@ static Obj HdlrFunc1 (
fi;
i := 0;
while i < LEN_LIST( methods ) and rank < methods[i + (narg + 3)] do
- i := i + (narg + 5);
+ i := i + (narg + 6);
od;
replace := false;
if REREADING then
@@ -4153,11 +4235,11 @@ static Obj HdlrFunc1 (
break;
fi;
fi;
- k := k + narg + 5;
+ k := k + narg + 6;
od;
fi;
if not REREADING or not replace then
- methods{[ narg + 5 + i + 1 .. narg + 5 + LEN_LIST( methods ) ]} := methods{[ i + 1 .. LEN_LIST( methods ) ]};
+ COPY_LIST_ENTRIES( methods, i + 1, 1, methods, narg + 6 + i + 1, 1, LEN_LIST( methods ) - i );
fi;
if rel = true then
methods[i + 1] := RETURN_TRUE;
@@ -4194,8 +4276,11 @@ static Obj HdlrFunc1 (
fi;
methods[i + (narg + 3)] := rank;
methods[i + (narg + 4)] := IMMUTABLE_COPY_OBJ( info );
- if 5 >= 5 then
+ if 6 >= 5 then
methods[i + (narg + 5)] := MakeImmutable( [ INPUT_FILENAME( ), READEVALCOMMAND_LINENUMBER, INPUT_LINENUMBER( ) ] );
+ if 6 >= 6 then
+ methods[i + (narg + 6)] := baserank;
+ fi;
fi;
SET_METHODS_OPERATION( opr, narg, MakeReadOnlySingleObj( methods ) );
UNLOCK( lk );
@@ -4207,7 +4292,7 @@ static Obj HdlrFunc1 (
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 146);
- SET_ENDLINE_BODY(t_4, 273);
+ SET_ENDLINE_BODY(t_4, 281);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4222,8 +4307,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[4], -1, 0, HdlrFunc4 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_4, 320);
- SET_ENDLINE_BODY(t_4, 322);
+ SET_STARTLINE_BODY(t_4, 330);
+ SET_ENDLINE_BODY(t_4, 332);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4238,8 +4323,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[5], -1, 0, HdlrFunc5 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_4, 347);
- SET_ENDLINE_BODY(t_4, 349);
+ SET_STARTLINE_BODY(t_4, 357);
+ SET_ENDLINE_BODY(t_4, 359);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4313,7 +4398,7 @@ static Obj HdlrFunc1 (
od;
if not IsBound( arglist[pos] ) then
Error( "the method is missing in " );
- elif IS_INT( arglist[pos] ) then
+ elif IS_INT( arglist[pos] ) or IS_FUNCTION( arglist[pos] ) and NARG_FUNC( arglist[pos] ) = 0 and pos < LEN_LIST( arglist ) then
rank := arglist[pos];
pos := pos + 1;
else
@@ -4408,17 +4493,17 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[6], 2, 0, HdlrFunc6 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_4, 360);
- SET_ENDLINE_BODY(t_4, 590);
+ SET_STARTLINE_BODY(t_4, 370);
+ SET_ENDLINE_BODY(t_4, 602);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
CALL_2ARGS( t_1, t_2, t_3 );
- /* LENGTH_SETTER_METHODS_2 := LENGTH_SETTER_METHODS_2 + (5 + 2); */
+ /* LENGTH_SETTER_METHODS_2 := LENGTH_SETTER_METHODS_2 + (6 + 2); */
t_2 = GC_LENGTH__SETTER__METHODS__2;
CHECK_BOUND( t_2, "LENGTH_SETTER_METHODS_2" )
- C_SUM_INTOBJS( t_3, INTOBJ_INT(5), INTOBJ_INT(2) )
+ C_SUM_INTOBJS( t_3, INTOBJ_INT(6), INTOBJ_INT(2) )
C_SUM_FIA( t_1, t_2, t_3 )
AssGVar( G_LENGTH__SETTER__METHODS__2, t_1 );
@@ -4467,8 +4552,8 @@ static Obj HdlrFunc1 (
t_2 = NewFunction( NameFunc[7], 6, 0, HdlrFunc7 );
SET_ENVI_FUNC( t_2, STATE(CurrLVars) );
t_3 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_3, 609);
- SET_ENDLINE_BODY(t_3, 673);
+ SET_STARTLINE_BODY(t_3, 621);
+ SET_ENDLINE_BODY(t_3, 685);
SET_FILENAME_BODY(t_3, FileName);
SET_BODY_FUNC(t_2, t_3);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4482,8 +4567,8 @@ static Obj HdlrFunc1 (
t_2 = NewFunction( NameFunc[9], 6, 0, HdlrFunc9 );
SET_ENVI_FUNC( t_2, STATE(CurrLVars) );
t_3 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_3, 676);
- SET_ENDLINE_BODY(t_3, 682);
+ SET_STARTLINE_BODY(t_3, 688);
+ SET_ENDLINE_BODY(t_3, 694);
SET_FILENAME_BODY(t_3, FileName);
SET_BODY_FUNC(t_2, t_3);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4511,8 +4596,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[10], 2, 0, HdlrFunc10 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_4, 695);
- SET_ENDLINE_BODY(t_4, 719);
+ SET_STARTLINE_BODY(t_4, 707);
+ SET_ENDLINE_BODY(t_4, 731);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4596,8 +4681,8 @@ static Obj HdlrFunc1 (
t_3 = NewFunction( NameFunc[11], 4, 0, HdlrFunc11 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
- SET_STARTLINE_BODY(t_4, 844);
- SET_ENDLINE_BODY(t_4, 955);
+ SET_STARTLINE_BODY(t_4, 856);
+ SET_ENDLINE_BODY(t_4, 967);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4648,8 +4733,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, 990);
- SET_ENDLINE_BODY(t_4, 1037);
+ SET_STARTLINE_BODY(t_4, 1002);
+ SET_ENDLINE_BODY(t_4, 1049);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
@@ -4726,6 +4811,7 @@ static Int PostRestore ( StructInitInfo * module )
G_RETURN__FALSE = GVarName( "RETURN_FALSE" );
G_LEN__LIST = GVarName( "LEN_LIST" );
G_APPEND__LIST__INTR = GVarName( "APPEND_LIST_INTR" );
+ G_COPY__LIST__ENTRIES = GVarName( "COPY_LIST_ENTRIES" );
G_CONV__STRING = GVarName( "CONV_STRING" );
G_Print = GVarName( "Print" );
G_ViewObj = GVarName( "ViewObj" );
@@ -4850,6 +4936,7 @@ static Int InitKernel ( StructInitInfo * module )
InitCopyGVar( "RETURN_FALSE", &GC_RETURN__FALSE );
InitFopyGVar( "LEN_LIST", &GF_LEN__LIST );
InitFopyGVar( "APPEND_LIST_INTR", &GF_APPEND__LIST__INTR );
+ InitFopyGVar( "COPY_LIST_ENTRIES", &GF_COPY__LIST__ENTRIES );
InitFopyGVar( "CONV_STRING", &GF_CONV__STRING );
InitFopyGVar( "Print", &GF_Print );
InitCopyGVar( "ViewObj", &GC_ViewObj );
@@ -4972,7 +5059,7 @@ static Int InitLibrary ( StructInitInfo * module )
static StructInitInfo module = {
.type = MODULE_STATIC,
.name = "GAPROOT/lib/oper1.g",
- .crc = 93694864,
+ .crc = -16477221,
.initKernel = InitKernel,
.initLibrary = InitLibrary,
.postRestore = PostRestore,
diff --git a/src/hpc/c_type1.c b/src/hpc/c_type1.c
index a8a53ea27f..d184cab36d 100644
--- a/src/hpc/c_type1.c
+++ b/src/hpc/c_type1.c
@@ -3550,10 +3550,10 @@ static Obj HdlrFunc1 (
CHANGED_BAG( STATE(CurrLVars) );
CALL_1ARGS( t_1, t_2 );
- /* LENGTH_SETTER_METHODS_2 := LENGTH_SETTER_METHODS_2 + (5 + 2); */
+ /* LENGTH_SETTER_METHODS_2 := LENGTH_SETTER_METHODS_2 + (6 + 2); */
t_2 = GC_LENGTH__SETTER__METHODS__2;
CHECK_BOUND( t_2, "LENGTH_SETTER_METHODS_2" )
- C_SUM_INTOBJS( t_3, INTOBJ_INT(5), INTOBJ_INT(2) )
+ C_SUM_INTOBJS( t_3, INTOBJ_INT(6), INTOBJ_INT(2) )
C_SUM_FIA( t_1, t_2, t_3 )
AssGVar( G_LENGTH__SETTER__METHODS__2, t_1 );
diff --git a/src/opers.c b/src/opers.c
index 2e42d27847..7a04f32e12 100644
--- a/src/opers.c
+++ b/src/opers.c
@@ -669,7 +669,7 @@ Obj FuncAND_FLAGS (
Obj HIDDEN_IMPS;
Obj WITH_HIDDEN_IMPS_FLAGS_CACHE;
-enum { HIDDEN_IMPS_CACHE_LENGTH = 2003 };
+enum { HIDDEN_IMPS_CACHE_LENGTH = 20003 };
/* Forward declaration of FuncFLAGS_FILTER */
Obj FuncFLAGS_FILTER(Obj self, Obj oper);
@@ -829,7 +829,7 @@ Obj FuncWITH_HIDDEN_IMPS_FLAGS(Obj self, Obj flags)
static Obj IMPLICATIONS_SIMPLE;
static Obj IMPLICATIONS_COMPOSED;
static Obj WITH_IMPS_FLAGS_CACHE;
-enum { IMPS_CACHE_LENGTH = 11001 };
+enum { IMPS_CACHE_LENGTH = 21001 };
/****************************************************************************
**
@@ -1909,7 +1909,7 @@ static Obj NEXT_VMETHOD_PRINT_INFO;
// Use of 'ALWAYS_INLINE' is critical for performance, see discussion
// earlier in this file.
enum {
- BASE_SIZE_METHODS_OPER_ENTRY = 5,
+ BASE_SIZE_METHODS_OPER_ENTRY = 6,
};
static ALWAYS_INLINE Obj GetMethodUncached(
UInt verbose, UInt constructor, UInt n, Obj methods, Int prec, Obj types[])
@@ -1928,6 +1928,9 @@ static ALWAYS_INLINE Obj GetMethodUncached(
// entry n+3 is the rank
// entry n+4 is the info text
// entry n+5 is, if set, the location where the method was installed
+ // entry n+6 is, if set, the relative rank that was supplied when
+ // the method was installed, either as a small integer
+ // or a function of no arguments
// check argument filters against the given types
Obj filter;
diff --git a/tst/testinstall/method-rankfns.tst b/tst/testinstall/method-rankfns.tst
new file mode 100644
index 0000000000..93fe2444f3
--- /dev/null
+++ b/tst/testinstall/method-rankfns.tst
@@ -0,0 +1,21 @@
+gap> START_TEST("method-rankfns.tst");
+gap> myOp := NewOperation("myOp",[IsObject]);;
+gap> myC := NewConstructor("myC",[IsObject]);;
+gap> xxx := 1;;
+gap> InstallMethod(myOp,"method1",[IsObject],x->1);
+gap> InstallMethod(myOp,"method2",[IsObject],{}->xxx,x->2);
+gap> InstallMethod(myC,"cons1",[IsObject],x->1);
+gap> InstallMethod(myC,"cons2",[IsObject],{}->xxx,x->2);
+gap> myOp(3);
+2
+gap> myC(IsObject);
+2
+gap> xxx := -1;;
+gap> RECALCULATE_ALL_METHOD_RANKS();
+gap> myOp(3);
+1
+gap> myC(IsObject);
+1
+gap> Unbind(myOp);
+gap> Unbind(myC);
+gap> STOP_TEST("method-rankfns.tst");
diff --git a/tst/testinstall/method-reordering.tst b/tst/testinstall/method-reordering.tst
new file mode 100644
index 0000000000..ff137098c5
--- /dev/null
+++ b/tst/testinstall/method-reordering.tst
@@ -0,0 +1,35 @@
+gap> START_TEST("method-reordering.tst");
+gap> CheckReorder := function(explicit)
+> local f1, f2, f3, myOp, fam, t, o, o2, myC;
+> f1 := NewFilter("filter1",100);
+> f2 := NewFilter("filter1",10);
+> f3 := NewFilter("filter1",1);
+> myOp := NewOperation("myOp", [IsObject]);
+> myC := NewConstructor("myC", [IsObject]);
+> InstallMethod(myOp, "meth1", [f2], x ->1);
+> InstallMethod(myOp, "meth2", [f3], x ->2);
+> fam := NewFamily("myFam");
+> t := NewType(fam, IsComponentObjectRep and f2 and f3);
+> o := Objectify(t, rec());
+> o2 := Objectify(t, rec());
+> InstallMethod(myC, "cons1", [f2], x ->o);
+> InstallMethod(myC, "cons2", [f3], x ->o2);
+> if myOp(o) <> 1 or not IsIdenticalObj(myC(IsObject),o2) then
+> Error("Initial method selection wrong");
+> fi;
+> InstallTrueMethod(f1,f3);
+> if explicit then
+> RECALCULATE_ALL_METHOD_RANKS();
+> fi;
+> return IsIdenticalObj(myC(IsObject),o) and myOp(o) = 2;
+> end;;
+gap> CheckReorder(false);
+true
+gap> SuspendMethodReordering();
+gap> CheckReorder(false);
+false
+gap> CheckReorder(true);
+true
+gap> ResumeMethodReordering();
+gap> Unbind(CheckReorder);
+gap> STOP_TEST("method-reordering.tst");
diff --git a/tst/testinstall/triviso.tst b/tst/testinstall/triviso.tst
index 5776ddfa3c..5b7bacb792 100644
--- a/tst/testinstall/triviso.tst
+++ b/tst/testinstall/triviso.tst
@@ -9,11 +9,11 @@ gap> START_TEST("triviso.tst");
gap> G := Group(());
Group(())
gap> phi := IsomorphismPermGroup(G);
-[ ] -> [ ]
+IdentityMapping( Group(()) )
gap> HasIsBijective(phi);
true
gap> inv := InverseGeneralMapping(phi);
-[ ] -> [ ]
+IdentityMapping( Group(()) )
gap> HasIsMapping(inv);
true
gap> STOP_TEST( "triviso.tst", 1);
diff --git a/tst/testinstall/varargs.tst b/tst/testinstall/varargs.tst
index 1038e5db22..9388937849 100644
--- a/tst/testinstall/varargs.tst
+++ b/tst/testinstall/varargs.tst
@@ -87,7 +87,7 @@ function ( <>, <>, <>, <>, <>, <> )
end
gap> Display(InstallMethod);
function ( <>... )
- <>
+ <>
end
gap> [1..2];
[ 1, 2 ]