aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authormd52011-02-20 00:18:27 +0200
committermd52011-02-20 00:18:27 +0200
commitef38e4f57f32f495b7f1d8289306e6d829394aeb (patch)
tree13a2cfab700e92e1ac27b990cd2c77dbec5a2a46 /engines
parent92fac11c5feb21e16d8a7b895cc14ec4f3173d46 (diff)
downloadscummvm-rg350-ef38e4f57f32f495b7f1d8289306e6d829394aeb.tar.gz
scummvm-rg350-ef38e4f57f32f495b7f1d8289306e6d829394aeb.tar.bz2
scummvm-rg350-ef38e4f57f32f495b7f1d8289306e6d829394aeb.zip
SCI: Moved the gcCountdown() code inside the op_callk case, since that's the only place where it's used
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/vm.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 4f5a263331..a6677ee633 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -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)
@@ -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);