mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 22:59:16 +02:00
SEXP_OP_CLOSURE_REF takes a non-sexp integer parameter, so we shouldn't adjust it when loading images
This commit is contained in:
parent
16f840ed20
commit
78c7eac033
2 changed files with 9 additions and 8 deletions
15
gc.c
15
gc.c
|
@ -523,15 +523,17 @@ void sexp_offset_heap_pointers (sexp_heap heap, sexp_heap from_heap, sexp* types
|
|||
sexp_stack_top(sexp_context_stack(p)) = 0;
|
||||
sexp_context_saves(p) = NULL;
|
||||
sexp_context_heap(p) = heap;
|
||||
} else if (sexp_bytecodep(p)) {
|
||||
} else if (sexp_bytecodep(p) && off != 0) {
|
||||
for (i=0; i<sexp_bytecode_length(p); ) {
|
||||
switch (sexp_bytecode_data(p)[i++]) {
|
||||
case SEXP_OP_CLOSURE_REF: case SEXP_OP_PUSH:
|
||||
case SEXP_OP_FCALL0: case SEXP_OP_FCALL1:
|
||||
case SEXP_OP_FCALL2: case SEXP_OP_FCALL3:
|
||||
case SEXP_OP_FCALL4: case SEXP_OP_CALL:
|
||||
case SEXP_OP_TAIL_CALL: case SEXP_OP_PARAMETER_REF:
|
||||
case SEXP_OP_TAIL_CALL: case SEXP_OP_PUSH:
|
||||
case SEXP_OP_GLOBAL_REF: case SEXP_OP_GLOBAL_KNOWN_REF:
|
||||
#if SEXP_USE_GREEN_THREADS
|
||||
case SEXP_OP_PARAMETER_REF:
|
||||
#endif
|
||||
#if SEXP_USE_EXTENDED_FCALL
|
||||
case SEXP_OP_FCALLN:
|
||||
#endif
|
||||
|
@ -539,8 +541,9 @@ void sexp_offset_heap_pointers (sexp_heap heap, sexp_heap from_heap, sexp* types
|
|||
if (v[0] && sexp_pointerp(v[0])) v[0] = (sexp) (((char*)v[0]) + off);
|
||||
/* ... FALLTHROUGH ... */
|
||||
case SEXP_OP_JUMP: case SEXP_OP_JUMP_UNLESS:
|
||||
case SEXP_OP_STACK_REF: case SEXP_OP_LOCAL_REF:
|
||||
case SEXP_OP_LOCAL_SET: case SEXP_OP_TYPEP:
|
||||
case SEXP_OP_STACK_REF: case SEXP_OP_CLOSURE_REF:
|
||||
case SEXP_OP_LOCAL_REF: case SEXP_OP_LOCAL_SET:
|
||||
case SEXP_OP_TYPEP:
|
||||
#if SEXP_USE_RESERVE_OPCODE
|
||||
case SEXP_OP_RESERVE:
|
||||
#endif
|
||||
|
@ -549,8 +552,6 @@ void sexp_offset_heap_pointers (sexp_heap heap, sexp_heap from_heap, sexp* types
|
|||
i += 2*sizeof(sexp); break;
|
||||
case SEXP_OP_MAKE_PROCEDURE:
|
||||
v = (sexp*)(&(sexp_bytecode_data(p)[i]));
|
||||
if (v[0] && sexp_pointerp(v[0])) v[0] = (sexp) (((char*)v[0]) + off);
|
||||
if (v[1] && sexp_pointerp(v[1])) v[1] = (sexp) (((char*)v[1]) + off);
|
||||
if (v[2] && sexp_pointerp(v[2])) v[2] = (sexp) (((char*)v[2]) + off);
|
||||
i += 3*sizeof(sexp); break;
|
||||
}
|
||||
|
|
2
vm.c
2
vm.c
|
@ -1135,7 +1135,7 @@ sexp sexp_apply (sexp ctx, sexp proc, sexp args) {
|
|||
break;
|
||||
case SEXP_OP_CLOSURE_REF:
|
||||
_ALIGN_IP();
|
||||
_PUSH(sexp_vector_ref(cp, sexp_make_fixnum(_WORD0)));
|
||||
_PUSH(sexp_vector_ref(cp, sexp_make_fixnum(_SWORD0)));
|
||||
ip += sizeof(sexp);
|
||||
break;
|
||||
case SEXP_OP_CLOSURE_VARS:
|
||||
|
|
Loading…
Add table
Reference in a new issue