unalligned long field offsets.
* src/vmcore/linker.c [__POWERPC__ && __DARWIN__]: Long fields are 4-byte
alligned in structs.
* src/vm/jit/patcher-common.c [TRACE_PATCHER]: Left patcher trace code hanging
around, might come handy again.
*******************************************************************************/
+/*#define TRACE_PATCHER*/
+
+#ifdef TRACE_PATCHER
+/* XXX this indent is not thread safe! */
+/* XXX if you want it thread safe, place patcher_depth in threadobject! */
+static int patcher_depth = 0;
+# define TRACE_PATCHER_INDENT for (i=0; i<patcher_depth; i++) printf("\t")
+#endif
+
java_objectheader *patcher_handler(u1 *pc)
{
codeinfo *code;
patchref_t *pr;
bool result;
java_objectheader *e;
+#ifdef TRACE_PATCHER
+ int i;
+#endif
/* define the patcher function */
return NULL;
}
+#ifdef TRACE_PATCHER
+ TRACE_PATCHER_INDENT; printf("patching in "); method_print(code->m); printf("\n");
+ TRACE_PATCHER_INDENT; printf("\texception program counter = %p\n", (void *) pr->mpc);
+ TRACE_PATCHER_INDENT; printf("\tmcodes before = "); for (i=0; i<5; i++) printf("0x%08x ", *((u4 *) pr->mpc + i)); printf("\n");
+ patcher_depth++;
+ assert(patcher_depth > 0);
+#endif
+
/* cast the passed function to a patcher function */
patcher_function = (bool (*)(patchref_t *)) (ptrint) pr->patcher;
result = (patcher_function)(pr);
+#ifdef TRACE_PATCHER
+ assert(patcher_depth > 0);
+ patcher_depth--;
+ TRACE_PATCHER_INDENT; printf("\tmcodes after = "); for (i=0; i<5; i++) printf("0x%08x ", *((u4 *) pr->mpc + i)); printf("\n");
+ if (result == false) {
+ TRACE_PATCHER_INDENT; printf("\tPATCHER EXCEPTION!\n");
+ }
+#endif
+
/* check for return value and exit accordingly */
if (result == false) {
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: patcher.c 8268 2007-08-07 13:24:43Z twisti $
+ $Id: patcher.c 8286 2007-08-10 10:46:17Z michi $
*/
disp = *((u4 *) (ra + 0 * 4));
if (disp == 4) {
+ *((u4 *) (ra + 0 * 4)) &= 0xffff0000;
*((u4 *) (ra + 0 * 4)) |= (s2) ((fi->offset + 4) & 0x0000ffff);
*((u4 *) (ra + 1 * 4)) |= (s2) ((fi->offset + 0) & 0x0000ffff);
}
else {
*((u4 *) (ra + 0 * 4)) |= (s2) ((fi->offset + 0) & 0x0000ffff);
+ *((u4 *) (ra + 1 * 4)) &= 0xffff0000;
*((u4 *) (ra + 1 * 4)) |= (s2) ((fi->offset + 4) & 0x0000ffff);
}
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: linker.c 8277 2007-08-08 16:42:11Z michi $
+ $Id: linker.c 8286 2007-08-10 10:46:17Z michi $
*/
/* Check for if alignment for long and double matches what we
assume for the current architecture. */
-#if defined(__I386__) || (defined(__ARM__) && !defined(__ARM_EABI__))
+#if defined(__I386__) || (defined(__ARM__) && !defined(__ARM_EABI__)) || (defined(__POWERPC__) && defined(__DARWIN__))
if (OFFSET(dummy_alignment_long_t, l) != 4)
vm_abort("linker_init: long alignment is different from what assumed: %d != %d",
OFFSET(dummy_alignment_long_t, l), 4);
if (!(f->flags & ACC_STATIC)) {
dsize = descriptor_typesize(f->parseddesc);
-#if defined(__I386__) || (defined(__ARM__) && !defined(__ARM_EABI__))
+#if defined(__I386__) || (defined(__ARM__) && !defined(__ARM_EABI__)) || (defined(__POWERPC__) && defined(__DARWIN__))
/* On i386 and ARM we align double and s8 fields to
4-bytes. This matches what GCC does for struct
members. We must do the same as gcc here because the