Skip to content

Commit

Permalink
Give useful names to installed methods
Browse files Browse the repository at this point in the history
This makes these methods easier to understand when profiling.
We add a name both to the installed method, and the function
which calculates their rank, where present.
  • Loading branch information
ChrisJefferson committed May 7, 2019
1 parent 4a3108e commit 6685949
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/oper1.g
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ BIND_GLOBAL( "INSTALL_METHOD",
rank,
method,
oreqs,
req, reqs, match, j, k, imp, notmatch, lk;
req, reqs, match, j, k, imp, notmatch, lk, funcname;

if IsHPCGAP then
# TODO: once the GAP compiler supports 'atomic', use that
Expand Down Expand Up @@ -601,6 +601,27 @@ BIND_GLOBAL( "INSTALL_METHOD",
fi;
fi;

if IS_FUNCTION(method) and not HasNameFunction(method) then
funcname := SHALLOW_COPY_OBJ(NameFunction(opr));
APPEND_LIST_INTR(funcname, " ");
if info <> false then
APPEND_LIST_INTR(funcname, info);
else
APPEND_LIST_INTR(funcname, "method");
fi;
SET_NAME_FUNC(method, funcname);
fi;

if IS_FUNCTION(rank) and not HasNameFunction(rank) then
funcname := "Priority calculation for ";
APPEND_LIST_INTR(funcname, NameFunction(opr));
if info <> false then
APPEND_LIST_INTR(funcname, " ");
APPEND_LIST_INTR(funcname, info);
fi;
SET_NAME_FUNC(rank, funcname);
fi;

# Install the method in the operation.
INSTALL_METHOD_FLAGS( opr, info, rel, flags, rank, method );

Expand Down

0 comments on commit 6685949

Please sign in to comment.