diff --git a/src/racket/src/fun.c b/src/racket/src/fun.c index 071c99259c..3052129f49 100644 --- a/src/racket/src/fun.c +++ b/src/racket/src/fun.c @@ -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) { post = argv2[0]; - memmove(argv2, argv2 + 1, sizeof(Scheme_Object*)*c); + memmove(argv2, argv2 + 1, sizeof(Scheme_Object*)*argc); } else post = NULL; 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); } } else { - /* Last element is a filter for the result(s) */ + /* First element is a filter for the result(s) */ if (!SCHEME_PROCP(post)) scheme_raise_exn(MZEXN_FAIL_CONTRACT, - "procedure chaperone: %V: expected as last result, produced: %V", + "procedure chaperone: %V: expected as first result, produced: %V", px->redirects, post); if (auto_val) { diff --git a/src/racket/src/jit.c b/src/racket/src/jit.c index 494ca0e9cb..6fd38c94d9 100644 --- a/src/racket/src/jit.c +++ b/src/racket/src/jit.c @@ -6767,7 +6767,7 @@ static int generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in mz_runstack_unskipped(jitter, 1); - mz_rs_sync_fail_branch(); + mz_rs_sync(); __START_TINY_JUMPS__(1); 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_rs_sync(); + /* check for chaperone: */ __START_TINY_JUMPS__(1); 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); CHECK_LIMIT(); + mz_rs_sync(); __START_TINY_JUMPS__(1); if (!unsafe) 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 */ unbox_code = jit_get_ip().ptr; mz_prolog(JIT_R1); + JIT_UPDATE_THREAD_RSPTR(); jit_prepare(1); jit_pusharg_p(JIT_R0); (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 */ set_box_code = jit_get_ip().ptr; mz_prolog(JIT_R2); + JIT_UPDATE_THREAD_RSPTR(); jit_prepare(2); jit_pusharg_p(JIT_R1); jit_pusharg_p(JIT_R0);