Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ActivateProfileColour (it was rarely used or even known, and blocked work on the profiling engine) #5301

Merged
merged 2 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion doc/ref/debug.xml
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,6 @@ Profiles are transformed into a human-readable form with
<#Include Label="CoverageLineByLine">
<#Include Label="UnprofileLineByLine">
<#Include Label="UncoverageLineByLine">
<#Include Label="ActivateProfileColour">
<#Include Label="IsLineByLineProfileActive">


Expand Down
22 changes: 0 additions & 22 deletions lib/newprofile.g
Original file line number Diff line number Diff line change
Expand Up @@ -153,25 +153,3 @@ end);
BIND_GLOBAL("UncoverageLineByLine", function()
return DEACTIVATE_PROFILING();
end);


#############################################################################
##
##
## <#GAPDoc Label="ActivateProfileColour">
## <ManSection>
## <Func Name="ActivateProfileColour" Arg=""/>
##
## <Description>
## Called with argument <K>true</K>,
## <Ref Func="ActivateProfileColour"/>
## makes GAP colour functions when printing them to show which lines
## have been executed while profiling was active via
## <Ref Func="ProfileLineByLine" /> at any time during this GAP session.
## Passing <K>false</K> disables this behaviour.
## </Description>
## </ManSection>
## <#/GAPDoc>
BIND_GLOBAL("ActivateProfileColour",function(b)
return ACTIVATE_COLOR_PROFILING(b);
end);
34 changes: 22 additions & 12 deletions src/exprs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1194,29 +1194,39 @@ static void RecExpr2(Obj rec, Expr expr)

/****************************************************************************
**
*F PrintExpr(<expr>) . . . . . . . . . . . . . . . . . . print an expression
*V PrintExprFuncs[<type>] . . printing function for objects of type <type>
**
** 'PrintExpr' prints the expression <expr>.
** 'PrintExprFuncs' is the dispatching table that contains for every type of
** expressions a pointer to the printer for expressions of this type, i.e.,
** the function that should be called to print expressions of this type.
*/
static PrintExprFunc PrintExprFuncs[256];


/****************************************************************************
**
** 'PrintExpr' simply dispatches through the table 'PrintExprFuncs' to the
** appropriate printer.
*F InstallPrintExprFunc(<pos>,<f>)
*/
void PrintExpr (
Expr expr )
void InstallPrintExprFunc(unsigned int pos, PrintExprFunc f)
{
(*PrintExprFuncs[ TNUM_EXPR(expr) ])( expr );
GAP_ASSERT(pos < ARRAY_SIZE(PrintExprFuncs));
PrintExprFuncs[pos] = f;
}


/****************************************************************************
**
*V PrintExprFuncs[<type>] . . printing function for objects of type <type>
*F PrintExpr(<expr>) . . . . . . . . . . . . . . . . . . print an expression
**
** 'PrintExprFuncs' is the dispatching table that contains for every type of
** expressions a pointer to the printer for expressions of this type, i.e.,
** the function that should be called to print expressions of this type.
** 'PrintExpr' prints the expression <expr>.
**
** 'PrintExpr' simply dispatches through the table 'PrintExprFuncs' to the
** appropriate printer.
*/
PrintExprFunc PrintExprFuncs[256];
void PrintExpr(Expr expr)
{
(*PrintExprFuncs[TNUM_EXPR(expr)])(expr);
}


/****************************************************************************
Expand Down
10 changes: 1 addition & 9 deletions src/exprs.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,7 @@ void PrintExpr(Expr expr);
void PrintRecExpr1(Expr expr); /* needed for printing
function calls with options */

/****************************************************************************
**
*V PrintExprFuncs[<type>] . . printing function for objects of type <type>
**
** 'PrintExprFuncs' is the dispatching table that contains for every type of
** expressions a pointer to the printer for expressions of this type, i.e.,
** the function that should be called to print expressions of this type.
*/
extern PrintExprFunc PrintExprFuncs[256];
void InstallPrintExprFunc(unsigned int pos, PrintExprFunc f);


/****************************************************************************
Expand Down
54 changes: 0 additions & 54 deletions src/hookintrprtr.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ struct InterpreterHooks * activeHooks[HookCount];
// Number of active hooks
static Int HookActiveCount;

// If a print hook is current active
static Int PrintHookActive;

/****************************************************************************
**
** Store the true values of each function we wrap for hooking. These always
Expand All @@ -44,9 +41,6 @@ ExecStatFunc OriginalExecStatFuncsForHook[256];
EvalExprFunc OriginalEvalExprFuncsForHook[256];
EvalBoolFunc OriginalEvalBoolFuncsForHook[256];

PrintStatFunc OriginalPrintStatFuncsForHook[256];
PrintExprFunc OriginalPrintExprFuncsForHook[256];

/****************************************************************************
**
** These functions install implementations of eval/expr functions,
Expand Down Expand Up @@ -83,26 +77,6 @@ void InstallExecStatFunc(Int pos, ExecStatFunc f)
HashUnlock(&activeHooks);
}

void InstallPrintStatFunc(Int pos, PrintStatFunc f)
{
OriginalPrintStatFuncsForHook[pos] = f;
HashLock(&activeHooks);
if(!PrintHookActive) {
PrintStatFuncs[pos] = f;
}
HashUnlock(&activeHooks);
}

void InstallPrintExprFunc(Int pos, PrintExprFunc f)
{
OriginalPrintExprFuncsForHook[pos] = f;
HashLock(&activeHooks);
if(!PrintHookActive) {
PrintExprFuncs[pos] = f;
}
HashUnlock(&activeHooks);
}

static ExecStatus ProfileExecStatPassthrough(Stat stat)
{
GAP_HOOK_LOOP(visitStat, stat);
Expand Down Expand Up @@ -191,34 +165,6 @@ Int DeactivateHooks(struct InterpreterHooks * hook)
return 1;
}

void ActivatePrintHooks(struct PrintHooks * hook)
{
Int i;

if (PrintHookActive) {
return;
}
PrintHookActive = 1;
for (i = 0; i < ARRAY_SIZE(ExecStatFuncs); i++) {
if (hook->printStatPassthrough) {
PrintStatFuncs[i] = hook->printStatPassthrough;
}
if (hook->printExprPassthrough) {
PrintExprFuncs[i] = hook->printExprPassthrough;
}
}
}

void DeactivatePrintHooks(struct PrintHooks * hook)
{
if (!PrintHookActive) {
return;
}
PrintHookActive = 0;
memcpy(PrintStatFuncs, OriginalPrintStatFuncsForHook, sizeof(PrintStatFuncs));
memcpy(PrintExprFuncs, OriginalPrintExprFuncsForHook, sizeof(PrintExprFuncs));
}

/****************************************************************************
**
*F * * * * * * * * * * * * * initialize module * * * * * * * * * * * * * * *
Expand Down
24 changes: 0 additions & 24 deletions src/hookintrprtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
void InstallEvalBoolFunc(Int, EvalBoolFunc);
void InstallEvalExprFunc(Int, EvalExprFunc);
void InstallExecStatFunc(Int, ExecStatFunc);
void InstallPrintStatFunc(Int, PrintStatFunc);
void InstallPrintExprFunc(Int, PrintExprFunc);


/****************************************************************************
Expand All @@ -36,9 +34,6 @@ extern ExecStatFunc OriginalExecStatFuncsForHook[256];
extern EvalExprFunc OriginalEvalExprFuncsForHook[256];
extern EvalBoolFunc OriginalEvalBoolFuncsForHook[256];

extern PrintStatFunc OriginalPrintStatFuncsForHook[256];
extern PrintExprFunc OriginalPrintExprFuncsForHook[256];


/****************************************************************************
**
Expand Down Expand Up @@ -91,25 +86,6 @@ extern struct InterpreterHooks * activeHooks[HookCount];
Int ActivateHooks(struct InterpreterHooks * hook);
Int DeactivateHooks(struct InterpreterHooks * hook);

/****************************************************************************
**
** A struct to represent the hooks allowed into printing functions
**
**
** This struct represents a list of functions which will be called whenever
** a statement or expression is printed. They can be used to provide
** simple customisation of printing. At the moment they are used by
** profiling.c, to mark statements which have been executed.
** Look at that code to get an idea how to use them.
*/
struct PrintHooks {
void (*printStatPassthrough)(Stat stat);
void (*printExprPassthrough)(Expr stat);
};

void ActivatePrintHooks(struct PrintHooks * hook);
void DeactivatePrintHooks(struct PrintHooks * hook);

/****************************************************************************
**
** We need the functions in the next three functions to be in the header,
Expand Down
Loading