fix interaction of box chaperones and JIT

This commit is contained in:
Matthew Flatt 2010-08-18 17:11:00 -06:00
parent e99c53eee8
commit da173fed65
2 changed files with 9 additions and 4 deletions

View File

@ -4182,7 +4182,7 @@ Scheme_Object *scheme_apply_chaperone(Scheme_Object *o, int argc, Scheme_Object
if ((c == argc) || (c == (argc + 1))) { if ((c == argc) || (c == (argc + 1))) {
if (c > argc) { if (c > argc) {
post = argv2[0]; post = argv2[0];
memmove(argv2, argv2 + 1, sizeof(Scheme_Object*)*c); memmove(argv2, argv2 + 1, sizeof(Scheme_Object*)*argc);
} else } else
post = NULL; post = NULL;
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
@ -4229,10 +4229,10 @@ Scheme_Object *scheme_apply_chaperone(Scheme_Object *o, int argc, Scheme_Object
return scheme_tail_apply(px->prev, c, argv2); return scheme_tail_apply(px->prev, c, argv2);
} }
} else { } else {
/* Last element is a filter for the result(s) */ /* First element is a filter for the result(s) */
if (!SCHEME_PROCP(post)) if (!SCHEME_PROCP(post))
scheme_raise_exn(MZEXN_FAIL_CONTRACT, scheme_raise_exn(MZEXN_FAIL_CONTRACT,
"procedure chaperone: %V: expected <procedure> as last result, produced: %V", "procedure chaperone: %V: expected <procedure> as first result, produced: %V",
px->redirects, px->redirects,
post); post);
if (auto_val) { if (auto_val) {

View File

@ -6767,7 +6767,7 @@ static int generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in
mz_runstack_unskipped(jitter, 1); mz_runstack_unskipped(jitter, 1);
mz_rs_sync_fail_branch(); mz_rs_sync();
__START_TINY_JUMPS__(1); __START_TINY_JUMPS__(1);
ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1); ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1);
@ -6815,6 +6815,8 @@ static int generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in
mz_runstack_unskipped(jitter, 1); mz_runstack_unskipped(jitter, 1);
mz_rs_sync();
/* check for chaperone: */ /* check for chaperone: */
__START_TINY_JUMPS__(1); __START_TINY_JUMPS__(1);
jit_ldxi_s(JIT_R1, JIT_R0, &((Scheme_Object *)0x0)->type); jit_ldxi_s(JIT_R1, JIT_R0, &((Scheme_Object *)0x0)->type);
@ -8027,6 +8029,7 @@ static int generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i
generate_two_args(app->rand1, app->rand2, jitter, 1, 2); generate_two_args(app->rand1, app->rand2, jitter, 1, 2);
CHECK_LIMIT(); CHECK_LIMIT();
mz_rs_sync();
__START_TINY_JUMPS__(1); __START_TINY_JUMPS__(1);
if (!unsafe) if (!unsafe)
ref3 = jit_bmsi_ul(jit_forward(), JIT_R0, 0x1); ref3 = jit_bmsi_ul(jit_forward(), JIT_R0, 0x1);
@ -10979,6 +10982,7 @@ static int do_generate_common(mz_jit_state *jitter, void *_data)
/* R0 is argument */ /* R0 is argument */
unbox_code = jit_get_ip().ptr; unbox_code = jit_get_ip().ptr;
mz_prolog(JIT_R1); mz_prolog(JIT_R1);
JIT_UPDATE_THREAD_RSPTR();
jit_prepare(1); jit_prepare(1);
jit_pusharg_p(JIT_R0); jit_pusharg_p(JIT_R0);
(void)mz_finish(ts_scheme_unbox); (void)mz_finish(ts_scheme_unbox);
@ -10991,6 +10995,7 @@ static int do_generate_common(mz_jit_state *jitter, void *_data)
/* R0 is box, R1 is value */ /* R0 is box, R1 is value */
set_box_code = jit_get_ip().ptr; set_box_code = jit_get_ip().ptr;
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
JIT_UPDATE_THREAD_RSPTR();
jit_prepare(2); jit_prepare(2);
jit_pusharg_p(JIT_R1); jit_pusharg_p(JIT_R1);
jit_pusharg_p(JIT_R0); jit_pusharg_p(JIT_R0);