Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 5330 2006-09-05 18:43:12Z edwin $
-
*/
return reg;
}
-
-/* emit_patcher_stubs **********************************************************
-
- Generates the code for the patcher stubs.
-
-*******************************************************************************/
-void emit_patcher_stubs(jitdata *jd)
-{
- codegendata *cd;
- patchref *pref;
- u8 mcode;
- u1 *savedmcodeptr;
- u1 *tmpmcodeptr;
- s4 targetdisp;
- s4 disp;
-
- /* get required compiler data */
-
- cd = jd->cd;
-
- /* generate code patching stub call code */
-
- targetdisp = 0;
-
- for (pref = cd->patchrefs; pref != NULL; pref = pref->next) {
- /* check code segment size */
-
- MCODECHECK(512);
-
- /* Get machine code which is patched back in later. A
- `bsr.l' is 6 bytes long. */
-
- savedmcodeptr = cd->mcodebase + pref->branchpos;
- mcode = *((u8 *) savedmcodeptr);
-
- /* patch in `bsr.l' to call the following code */
-
- tmpmcodeptr = cd->mcodeptr; /* save current mcodeptr */
- cd->mcodeptr = savedmcodeptr; /* set mcodeptr to patch position */
-
- M_BSR_IMM(tmpmcodeptr - (savedmcodeptr + PATCHER_CALL_SIZE) + 4);
-
- cd->mcodeptr = tmpmcodeptr; /* restore the current mcodeptr */
-
- /* save REG_ITMP3, restored in asm_patcher_wrapper */
- M_IPUSH(REG_ITMP3);
-
- /* move pointer to java_objectheader onto stack */
-
-#if defined(ENABLE_THREADS)
- (void) dseg_add_unique_address(cd, NULL); /* flcword */
- (void) dseg_add_unique_address(cd, lock_get_initial_lock_word());
- disp = dseg_add_unique_address(cd, NULL); /* vftbl */
-
- M_IMOV_IMM32(0, REG_ITMP3);
- dseg_adddata(cd);
- M_IADD_IMM(disp, REG_ITMP3);
- M_IPUSH(REG_ITMP3);
-#else
- M_IPUSH_IMM(0);
-#endif
-
- /* push move machine code bytes and classinfo pointer */
-
- M_IPUSH_IMM(mcode >> 32);
- M_IPUSH_IMM(mcode);
- M_IPUSH_IMM(pref->ref);
- M_IPUSH_IMM(pref->patcher);
-
- M_JMP_IMM(asm_patcher_wrapper);
- }
-}
s4 emit_load_low(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
{
codegendata *cd;
/* travel up stack to the first argument of the function which needs to be copied */
for (i=0; (i < md->paramcount) && (i < TRACE_ARGS_NUM); i++) {
- disp += 4;
- if (IS_2_WORD_TYPE(md->paramtypes[i].type)) {
- disp += 4;
- }
+ disp += 8;
}
/* disp now points to the first arg which gets copied to the trace stack, relative to REG_SP! */
/* traced function has such an argument */
t = md->paramtypes[i].type;
- if (IS_2_WORD_TYPE(t)) {
- /* copy from original argument stack */
- M_ILD(REG_ITMP1, REG_SP, disp);
- M_IPUSH(REG_ITMP1);
- M_ILD(REG_ITMP1, REG_SP, disp);
- M_IPUSH(REG_ITMP1);
- } else {
- /* displacment is increased as 4 byte on original stack but 8 byte on trace stack */
- M_ILD(REG_ITMP1, REG_SP, disp);
- M_IPUSH(REG_ITMP1);
- M_IPUSH_IMM(0);
- disp += 4;
- }
+ /* copy from original argument stack */
+ M_ILD(REG_ITMP1, REG_SP, disp);
+ M_ILD(REG_ITMP2, REG_SP, disp-4);
+ M_IPUSH(REG_ITMP2);
+ M_IPUSH(REG_ITMP1);
} else {
/* function has no arg here, push nothing and adapt displacement */
M_IPUSH_IMM(0);
#if !defined(ENABLE_SOFTFLOAT)
M_AADD_IMM(-8, REG_SP);
- M_FSTORE(REG_F1, REG_SP, 0);
+ M_FSTORE(REG_D1, REG_SP, 0);
#endif
M_IPUSH_IMM(m); /* push methodinfo */
M_AADD_IMM(3*4 + 4, REG_SP);
#if !defined(ENABLE_SOFTFLOAT)
- M_FLOAD(REG_F1, REG_SP, 0)
+ M_FLOAD(REG_D1, REG_SP, 0)
M_AADD_IMM(8, REG_SP);
#endif
void emit_arrayindexoutofbounds_check(codegendata *cd, instruction *iptr, s4 s1, s4 s2)
{
if (INSTRUCTION_MUST_CHECK(iptr)) {
- M_ILD(REG_ITMP3, s1, OFFSET(java_arrayheader, size));
+ M_ILD(REG_ITMP3, s1, OFFSET(java_array_t, size));
M_ICMP(s2, REG_ITMP3);
M_BHI(4);
M_TRAP_SETREGISTER(s2);
}
}
+
+/* emit_arraystore_check *******************************************************
+
+ Emit an ArrayStoreException check.
+
+*******************************************************************************/
+
+void emit_arraystore_check(codegendata *cd, instruction *iptr)
+{
+ if (INSTRUCTION_MUST_CHECK(iptr)) {
+ M_ITST(REG_RESULT);
+ M_BNE(2);
+ /*M_ALD_INTERN(REG_ZERO, REG_ZERO, EXCEPTION_HARDWARE_ARRAYSTORE);*/
+ M_TRAP(EXCEPTION_HARDWARE_ARRAYSTORE);
+ }
+}
+
+
/* emit_nullpointer_check ******************************************************
Emit a NullPointerException check.