Skip to content

Commit

Permalink
SCI: Moved the gcCountdown() code inside the op_callk case, since tha…
Browse files Browse the repository at this point in the history
…t's the only place where it's used
  • Loading branch information
bluegr committed Feb 19, 2011
1 parent 92fac11 commit ef38e4f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions engines/sci/engine/vm.cpp
Expand Up @@ -759,13 +759,6 @@ static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) {
s->_executionStack.pop_back();
}

static void gcCountDown(EngineState *s) {
if (s->gcCountDown-- <= 0) {
s->gcCountDown = s->scriptGCInterval;
run_gc(s);
}
}

int readPMachineInstruction(const byte *src, byte &extOpcode, int16 opparams[4]) {
uint offset = 0;
extOpcode = src[offset++]; // Get "extended" opcode (lower bit has special meaning)
Expand Down Expand Up @@ -1150,9 +1143,13 @@ void run_vm(EngineState *s) {
}

case op_callk: { // 0x21 (33)
// Call kernel function
gcCountDown(s);
// Run the garbage collector, if needed
if (s->gcCountDown-- <= 0) {
s->gcCountDown = s->scriptGCInterval;
run_gc(s);
}

// Call kernel function
s->xs->sp -= (opparams[1] >> 1) + 1;

bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY);
Expand Down

0 comments on commit ef38e4f

Please sign in to comment.