Skip to content

Commit

Permalink
[JIT] Attempted to fix up context accesses for AMD64, PPC, and Sparc …
Browse files Browse the repository at this point in the history
…JITs as

well.  This might be unfruitful, because they probably don't work anyway... but
why not try?

git-svn-id: https://svn.parrot.org/parrot/branches/context_pmc3@40933 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
chromatic committed Sep 2, 2009
1 parent 6619b6e commit 7fcc4b0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/jit/amd64/jit_defs.c
Expand Up @@ -153,7 +153,9 @@ Parrot_emit_jump_to_rax(Parrot_jit_info_t *jit_info, Interp *interp)
#endif
}
/* Base pointer */
emit_mov_r_mr(jit_info->native_ptr, RBX, INTERP, (long)offsetof(Interp, ctx.bp));
emit_mov_r_mr(jit_info->native_ptr, RBX, INTERP, (long)offsetof(Interp, ctx));
emit_mov_r_mr(jit_info->native_ptr, RBX, RBX, (long)offsetof(PMC, data));
emit_mov_r_mr(jit_info->native_ptr, RBX, RBX, (long)offsetof(Parrot_Context, bp));

#ifdef USE_OP_MAP_AND_CODE_START
emit_jmp_r_r(jit_info->native_ptr, RAX, OP_MAP);
Expand Down
14 changes: 8 additions & 6 deletions src/jit/ppc/core.jit
Expand Up @@ -1223,8 +1223,8 @@ Parrot_set_p_pc {
; or just JIT (TODO) the 2 easy ones
Parrot_set_args_pc {
if (jit_info->code_type == JIT_CODE_FILE) {
jit_emit_mov_ri_i(NATIVECODE, ISR1, jit_info->cur_op);
jit_emit_stw(NATIVECODE, ISR1, offsetof(Interp, current_args), r16);
jit_emit_mov_ri_i(NATIVECODE, ISR1, jit_info->cur_op);
jit_emit_stw(NATIVECODE, ISR1, offsetof(Interp, current_args), r16);
}
else {
jit_set_args_pc(jit_info, interp,
Expand Down Expand Up @@ -1294,10 +1294,12 @@ extern Parrot_get_params_pc {

Parrot_get_results_pc {
if (jit_info->code_type == JIT_CODE_FILE) {
jit_emit_mov_ri_i(NATIVECODE, ISR1, jit_info->cur_op);
jit_emit_lwz(NATIVECODE, ISR2, offsetof(Interp, ctx.state), r16);
jit_emit_stw(NATIVECODE, ISR1,
offsetof(Parrot_Context, current_results), ISR2);
jit_emit_mov_ri_i(NATIVECODE, ISR1, jit_info->cur_op);
jit_emit_lwz(NATIVECODE, ISR2, offsetof(Interp, ctx), r16);
jit_emit_lwz(NATIVECODE, ISR2, offsetof(PMC, data), ISR2);
jit_emit_lwz(NATIVECODE, ISR2, offsetof(Parrot_Context, state), ISR2);
jit_emit_stw(NATIVECODE, ISR1,
offsetof(Parrot_Context, current_results), ISR2);
}
else {
PackFile_Constant **constants = CONTEXT(interp)->constants;
Expand Down
4 changes: 3 additions & 1 deletion src/jit/ppc/jit_emit.h
Expand Up @@ -675,7 +675,9 @@ jit_emit_bx(Parrot_jit_info_t *jit_info, char type, opcode_t disp)
jit_emit_lwz((pc), r15, offsetof(PackFile_Segment, data), ISR1)

# define jit_emit_branch_to_opcode(pc, D) \
jit_emit_lwz((pc), r13, offsetof(Interp, ctx.bp), r16); \
jit_emit_lwz((pc), r13, offsetof(Interp, ctx), r16); \
jit_emit_lwz((pc), r13, offsetof(PMC, data), r13); \
jit_emit_lwz((pc), r13, offsetof(Parrot_Context, bp), r13); \
jit_emit_sub_rrr(jit_info->native_ptr, ISR1, (D), r15); \
jit_emit_lwzx(jit_info->native_ptr, ISR1, ISR1, r14); \
jit_emit_mtctr(jit_info->native_ptr, ISR1); \
Expand Down
8 changes: 6 additions & 2 deletions src/jit/sun4/jit_emit.h
Expand Up @@ -413,8 +413,12 @@ Parrot_jit_bytejump(Parrot_jit_info_t *jit_info,
emitm_jumpl_i(jit_info->native_ptr, XSR1, 0, XSR1);

/* fixup where we have the Parrot registers - context switches */
emitm_ld_i(jit_info->native_ptr, Parrot_jit_intrp, offsetof(Interp, ctx.bp),
Parrot_jit_regbase);
emitm_ld_i(jit_info->native_ptr, Parrot_jit_intrp, offsetof(Interp, ctx),
Parrot_jit_intrp);
emitm_ld_i(jit_info->native_ptr, Parrot_jit_intrp, offsetof(PMC, data),
Parrot_jit_intrp);
emitm_ld_i(jit_info->native_ptr, Parrot_jit_intrp,
offsetof(Parrot_Context, bp), Parrot_jit_intrp);
}

/* Generate conditional branch to offset from current parrot op */
Expand Down

0 comments on commit 7fcc4b0

Please sign in to comment.