in src/debugger/RDebugger.cpp [584:614]
void RDebugger::setBytecodeEnabled(bool enabled) {
if (enabled == bytecodeEnabled) return;
static PrSEXP prevJIT;
if (enabled) {
for (auto const& p : allBytecode) {
SEXP bytecode = p.first;
INTEGER(BCODE_CODE(bytecode))[0] = p.second;
}
RI->compilerEnableJIT(prevJIT);
prevJIT = R_NilValue;
} else {
prevJIT = RI->compilerEnableJIT(0);
static bool firstTime = true;
if (firstTime) {
firstTime = false;
ShieldSEXP myBytecode = Rf_cons(Rf_ScalarInteger(INT_MAX), R_NilValue);
SET_TYPEOF(myBytecode, BCODESXP);
WithOption with("warn", -1);
Rf_eval(myBytecode, R_GlobalEnv);
walkObjects([] (SEXP x) {
if (TYPEOF(x) == BCODESXP) registerBytecode(x);
}, Rf_list2(R_GlobalEnv, R_NamespaceRegistry));
}
for (auto &p : allBytecode) {
SEXP code = BCODE_CODE(p.first);
p.second = INTEGER(code)[0];
INTEGER(code)[0] = INT_MAX;
}
}
bytecodeEnabled = enabled;
}