summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2015-04-03 17:03:02 -0400
committerAdrian Thurston <thurston@complang.org>2015-04-03 17:03:02 -0400
commit55f268c6e8f2c6f6821e56625efa999829d40281 (patch)
tree2c7a19f5968db180b76afc5657413ff860671aec
parent3173d2e67c276514be2c9ee61e508a36f7570545 (diff)
downloadcolm-55f268c6e8f2c6f6821e56625efa999829d40281.tar.gz
some fixes for contiguous stack
-rw-r--r--src/bytecode.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index 60f9666e..a143e54e 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -389,9 +389,9 @@ void colm_execute( Program *prg, Execution *exec, Code *code )
memset( vm_ptop(), 0, sizeof(Word) * fi->frameSize );
/* Execution loop. */
- colm_execute_code( prg, exec, sp, code );
+ sp = colm_execute_code( prg, exec, sp, code );
- downref_local_trees( prg, sp, exec, fi->locals, fi->localsLen );
+ downref_locals( prg, &sp, exec, fi->locals, fi->localsLen );
vm_popn( fi->frameSize );
vm_pop_ignore();
@@ -3374,11 +3374,12 @@ again:
debug( prg, REALM_BYTECODE, "IN_UITER_CREATE_WV\n" );
FunctionInfo *fi = prg->rtd->functionInfo + funcId;
+
+ vm_contiguous( (sizeof(UserIter) / sizeof(Word)) + FR_AA + fi->frameSize );
+
UserIter *uiter = uiterCreate( prg, &sp, fi, searchId );
vm_set_local(exec, field, (SW) uiter);
- vm_contiguous( FR_AA + fi->frameSize );
-
/* This is a setup similar to as a call, only the frame structure
* is slightly different for user iterators. We aren't going to do
* the call. We don't need to set up the return ip because the
@@ -3408,11 +3409,12 @@ again:
debug( prg, REALM_BYTECODE, "IN_UITER_CREATE_WC\n" );
FunctionInfo *fi = prg->rtd->functionInfo + funcId;
+
+ vm_contiguous( (sizeof(UserIter) / sizeof(Word)) + FR_AA + fi->frameSize );
+
UserIter *uiter = uiterCreate( prg, &sp, fi, searchId );
vm_set_local(exec, field, (SW) uiter);
- vm_contiguous( FR_AA + fi->frameSize );
-
/* This is a setup similar to as a call, only the frame structure
* is slightly different for user iterators. We aren't going to do
* the call. We don't need to set up the return ip because the
@@ -4126,11 +4128,11 @@ again:
break;
FrameInfo *fi = &prg->rtd->frameInfo[exec->frameId];
- downref_locals( prg, &sp, exec, fi->locals, fi->localsLen );
debug( prg, REALM_BYTECODE, " exit popping %s argSize %d\n",
( fi->name != 0 ? fi->name : "<no-name>" ), fi->argSize );
+ downref_locals( prg, &sp, exec, fi->locals, fi->localsLen );
vm_popn( fi->frameSize );
/* Call layout. */