Fix start-context-and-delete sub-primitive (reported by Sascha Matzke)
parent
39bcf7af6a
commit
451237a028
|
@ -335,7 +335,18 @@ IN: bootstrap.x86
|
||||||
jit-set-context
|
jit-set-context
|
||||||
] \ (set-context-and-delete) define-sub-primitive
|
] \ (set-context-and-delete) define-sub-primitive
|
||||||
|
|
||||||
|
: jit-start-context-and-delete ( -- )
|
||||||
|
jit-load-vm
|
||||||
|
jit-load-context
|
||||||
|
ESP [] vm-reg MOV
|
||||||
|
ESP 4 [+] ctx-reg MOV
|
||||||
|
"reset_context" jit-call
|
||||||
|
|
||||||
|
jit-pop-quot-and-param
|
||||||
|
ctx-reg jit-switch-context
|
||||||
|
jit-push-param
|
||||||
|
jit-jump-quot ;
|
||||||
|
|
||||||
[
|
[
|
||||||
jit-delete-current-context
|
jit-start-context-and-delete
|
||||||
jit-start-context
|
|
||||||
] \ (start-context-and-delete) define-sub-primitive
|
] \ (start-context-and-delete) define-sub-primitive
|
||||||
|
|
|
@ -230,9 +230,6 @@ IN: bootstrap.x86
|
||||||
: jit-switch-context ( reg -- )
|
: jit-switch-context ( reg -- )
|
||||||
-8 jit-scrub-return
|
-8 jit-scrub-return
|
||||||
|
|
||||||
! Save ds, rs registers
|
|
||||||
jit-save-context
|
|
||||||
|
|
||||||
! Make the new context the current one
|
! Make the new context the current one
|
||||||
ctx-reg swap MOV
|
ctx-reg swap MOV
|
||||||
vm-reg vm-context-offset [+] ctx-reg MOV
|
vm-reg vm-context-offset [+] ctx-reg MOV
|
||||||
|
@ -257,6 +254,7 @@ IN: bootstrap.x86
|
||||||
|
|
||||||
: jit-set-context ( -- )
|
: jit-set-context ( -- )
|
||||||
jit-pop-context-and-param
|
jit-pop-context-and-param
|
||||||
|
jit-save-context
|
||||||
arg1 jit-switch-context
|
arg1 jit-switch-context
|
||||||
RSP 8 ADD
|
RSP 8 ADD
|
||||||
jit-push-param ;
|
jit-push-param ;
|
||||||
|
@ -269,17 +267,17 @@ IN: bootstrap.x86
|
||||||
ds-reg 16 SUB ;
|
ds-reg 16 SUB ;
|
||||||
|
|
||||||
: jit-start-context ( -- )
|
: jit-start-context ( -- )
|
||||||
! Create the new context in return-reg
|
! Create the new context in return-reg. Have to save context
|
||||||
|
! twice, first before calling new_context() which may GC,
|
||||||
|
! and again after popping the two parameters from the stack.
|
||||||
jit-save-context
|
jit-save-context
|
||||||
arg1 vm-reg MOV
|
arg1 vm-reg MOV
|
||||||
"new_context" jit-call
|
"new_context" jit-call
|
||||||
|
|
||||||
jit-pop-quot-and-param
|
jit-pop-quot-and-param
|
||||||
|
jit-save-context
|
||||||
return-reg jit-switch-context
|
return-reg jit-switch-context
|
||||||
|
|
||||||
jit-push-param
|
jit-push-param
|
||||||
|
|
||||||
jit-jump-quot ;
|
jit-jump-quot ;
|
||||||
|
|
||||||
[ jit-start-context ] \ (start-context) define-sub-primitive
|
[ jit-start-context ] \ (start-context) define-sub-primitive
|
||||||
|
@ -295,7 +293,17 @@ IN: bootstrap.x86
|
||||||
jit-set-context
|
jit-set-context
|
||||||
] \ (set-context-and-delete) define-sub-primitive
|
] \ (set-context-and-delete) define-sub-primitive
|
||||||
|
|
||||||
|
: jit-start-context-and-delete ( -- )
|
||||||
|
jit-load-context
|
||||||
|
arg1 vm-reg MOV
|
||||||
|
arg2 ctx-reg MOV
|
||||||
|
"reset_context" jit-call
|
||||||
|
|
||||||
|
jit-pop-quot-and-param
|
||||||
|
ctx-reg jit-switch-context
|
||||||
|
jit-push-param
|
||||||
|
jit-jump-quot ;
|
||||||
|
|
||||||
[
|
[
|
||||||
jit-delete-current-context
|
jit-start-context-and-delete
|
||||||
jit-start-context
|
|
||||||
] \ (start-context-and-delete) define-sub-primitive
|
] \ (start-context-and-delete) define-sub-primitive
|
||||||
|
|
|
@ -166,6 +166,12 @@ VM_C_API void delete_context(factor_vm *parent, context *old_context)
|
||||||
parent->delete_context(old_context);
|
parent->delete_context(old_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VM_C_API void reset_context(factor_vm *parent, context *ctx)
|
||||||
|
{
|
||||||
|
ctx->reset();
|
||||||
|
parent->init_context(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
cell factor_vm::begin_callback(cell quot_)
|
cell factor_vm::begin_callback(cell quot_)
|
||||||
{
|
{
|
||||||
data_root<object> quot(quot_,this);
|
data_root<object> quot(quot_,this);
|
||||||
|
|
|
@ -73,6 +73,7 @@ struct context {
|
||||||
|
|
||||||
VM_C_API context *new_context(factor_vm *parent);
|
VM_C_API context *new_context(factor_vm *parent);
|
||||||
VM_C_API void delete_context(factor_vm *parent, context *old_context);
|
VM_C_API void delete_context(factor_vm *parent, context *old_context);
|
||||||
|
VM_C_API void reset_context(factor_vm *parent, context *ctx);
|
||||||
VM_C_API cell begin_callback(factor_vm *parent, cell quot);
|
VM_C_API cell begin_callback(factor_vm *parent, cell quot);
|
||||||
VM_C_API void end_callback(factor_vm *parent);
|
VM_C_API void end_callback(factor_vm *parent);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue