fixes for PPC JIT

Related to recent structure-operation changes.
This commit is contained in:
Matthew Flatt 2012-11-02 09:54:12 -06:00
parent 948e898406
commit 466d6e7394
4 changed files with 21 additions and 11 deletions

View File

@ -1113,15 +1113,15 @@ static void emit_indentation(mz_jit_state *jitter)
#endif
#define PAST_LIMIT() ((uintptr_t)jit_get_ip().ptr > (uintptr_t)jitter->limit)
#define CHECK_LIMIT() if (PAST_LIMIT()) return past_limit(jitter);
#define CHECK_LIMIT() if (PAST_LIMIT()) return past_limit(jitter, __FILE__, __LINE__);
#if 1
# define past_limit(j) 0
# define past_limit(j, f, l) 0
#else
static int past_limit(mz_jit_state *jitter)
static int past_limit(mz_jit_state *jitter, const char *file, int line)
{
if (((uintptr_t)jit_get_ip().ptr > (uintptr_t)jitter->limit + JIT_BUFFER_PAD_SIZE)
|| (jitter->retain_start)) {
printf("way past\n"); abort();
printf("way past %s %d\n", file, line); abort();
}
return 0;
}

View File

@ -988,7 +988,7 @@ int scheme_generate_non_tail_call(mz_jit_state *jitter, int num_rands, int direc
#endif
if (unboxed_args) {
/* no slow path here; return NULL to box arguments fall back to generic */
jit_movi_p(JIT_R0, NULL);
(void)jit_movi_p(JIT_R0, NULL);
if (pop_and_jump) {
mz_epilog(JIT_V1);
}

View File

@ -605,6 +605,7 @@ static int common2(mz_jit_state *jitter, void *_data)
int argc, j;
void *code;
for (j = 0; j < 2; j++) {
CHECK_LIMIT();
code = jit_get_ip().ptr;
if (!i) {
if (!j)
@ -1463,6 +1464,7 @@ int scheme_generate_struct_op(mz_jit_state *jitter, int kind, int for_branch,
__START_INNER_TINY__(1);
ref2 = jit_beqi_i(jit_forward(), JIT_R2, scheme_structure_type);
ref3 = jit_beqi_i(jit_forward(), JIT_R2, scheme_proc_struct_type);
CHECK_LIMIT();
ref9 = jit_beqi_i(jit_forward(), JIT_R2, scheme_chaperone_type);
__END_INNER_TINY__(1);
bref2 = jit_bnei_i(jit_forward(), JIT_R2, scheme_proc_chaperone_type);
@ -1576,6 +1578,7 @@ int scheme_generate_struct_op(mz_jit_state *jitter, int kind, int for_branch,
} else {
refdone = NULL;
}
CHECK_LIMIT();
/* False branch: */
if (branch_info) {
@ -2101,7 +2104,8 @@ static int common4c(mz_jit_state *jitter, void *_data)
else
sjc.struct_constr_nary_code = code;
num_args =-1;
}
} else
num_args = 0;
scheme_generate_struct_alloc(jitter, num_args, 1, 1, ii == 2, ii == 1);

View File

@ -407,6 +407,7 @@ static int generate_inlined_struct_op(int kind, mz_jit_state *jitter,
if (kind == INLINE_STRUCT_PROC_SET)
scheme_restore_struct_temp(jitter, JIT_V1);
__END_SHORT_JUMPS__(1);
CHECK_LIMIT();
} else {
ref = NULL;
refslow = NULL;
@ -482,6 +483,7 @@ static int generate_inlined_struct_op(int kind, mz_jit_state *jitter,
}
} else if (kind == INLINE_STRUCT_PROC_CONSTR) {
scheme_generate_struct_alloc(jitter, rand2 ? 2 : 1, 0, 0, is_tail, multi_ok);
CHECK_LIMIT();
} else {
scheme_signal_error("internal error: unknown struct-op mode");
}
@ -512,12 +514,14 @@ static int generate_inlined_struct_op(int kind, mz_jit_state *jitter,
} else
jkind = 1;
CHECK_LIMIT();
scheme_generate_struct_op(jitter, jkind, !!for_branch,
for_branch, branch_short,
result_ignored,
0, 0,
tpos, pos,
0, refslow, refslow, NULL, NULL);
CHECK_LIMIT();
if (ref2) {
__START_SHORT_JUMPS__(1);
@ -808,13 +812,14 @@ int scheme_generate_struct_alloc(mz_jit_state *jitter, int num_args,
#ifdef CAN_INLINE_ALLOC
int i;
jit_movr_p(JIT_R0, JIT_R2);
jit_movi_p(JIT_R1, 0); /* clear register that might get saved as a pointer */
(void)jit_movi_p(JIT_R1, 0); /* clear register that might get saved as a pointer */
inline_struct_alloc(jitter, num_args, inline_slow);
/* allocation result is in V1 */
jit_stxi_p((intptr_t)&((Scheme_Structure *)0x0)->stype + OBJHEAD_SIZE, JIT_V1, JIT_R0);
for (i = 0; i < num_args; i++) {
jit_ldxi_p(JIT_R1, JIT_RUNSTACK, WORDS_TO_BYTES(i));
jit_stxi_p((intptr_t)&(((Scheme_Structure *)0x0)->slots[0]) + OBJHEAD_SIZE + WORDS_TO_BYTES(i), JIT_V1, JIT_R1);
CHECK_LIMIT();
}
jit_addi_p(JIT_R0, JIT_V1, OBJHEAD_SIZE);
#else
@ -827,6 +832,7 @@ int scheme_generate_struct_alloc(mz_jit_state *jitter, int num_args,
jit_retval(JIT_R0);
#endif
}
CHECK_LIMIT();
if (pop_and_jump) {
mz_epilog(JIT_V1);
@ -853,7 +859,7 @@ static int generate_inlined_constant_varref_test(mz_jit_state *jitter, Scheme_Ob
int pos;
if (SCHEME_VARREF_FLAGS(obj) & 0x1) {
jit_movi_p(JIT_R0, scheme_true);
(void)jit_movi_p(JIT_R0, scheme_true);
return 1;
}
@ -3329,11 +3335,11 @@ int scheme_generate_inlined_nary(mz_jit_state *jitter, Scheme_App_Rec *app, int
scheme_add_branch_false(for_branch, reffalse);
__END_SHORT_JUMPS__(branch_short);
} else {
jit_movi_p(JIT_R0, scheme_true);
(void)jit_movi_p(JIT_R0, scheme_true);
reftrue = jit_jmpi(jit_forward());
mz_patch_branch(reffalse);
jit_movi_p(JIT_R0, scheme_false);
(void)jit_movi_p(JIT_R0, scheme_false);
mz_patch_branch(reftrue);
__END_TINY_JUMPS__(1);