* src/vm/jit/replace.h: Use a type union replace_val_t for all source
authoredwin <none@none>
Fri, 8 Dec 2006 00:16:21 +0000 (00:16 +0000)
committeredwin <none@none>
Fri, 8 Dec 2006 00:16:21 +0000 (00:16 +0000)
state values. Give the registers in the execution state meaningful
types. Properly convert float/double values.
* src/vm/jit/replace.c: Likewise.

* src/vm/jit/powerpc/asmpart.S: Adapted to new execution state layout.
* src/vm/jit/i386/asmpart.S: Likewise.

src/vm/jit/powerpc/asmpart.S
src/vm/jit/replace.c
src/vm/jit/replace.h

index 0406911ac2977602daaded57b3c9a4e1c9e41486..f73b9aada66a48a953fc8c463ba5af3105ee37d1 100644 (file)
@@ -31,7 +31,7 @@
    Changes: Christian Thalinger
             Edwin Steiner
 
-   $Id: asmpart.S 6147 2006-12-07 23:54:40Z edwin $
+   $Id: asmpart.S 6154 2006-12-08 00:16:21Z edwin $
 
 */
 
@@ -1156,38 +1156,38 @@ asm_replacement_out:
        mflr    itmp3
 
        /* save registers in execution state */
-       stw     r0 ,( 0*8+4+offes_intregs)(sp)
-       stw     r1 ,( 1*8+4+offes_intregs)(sp)
-       stw     r2 ,( 2*8+4+offes_intregs)(sp)
-       stw     r3 ,( 3*8+4+offes_intregs)(sp)
-       stw     r4 ,( 4*8+4+offes_intregs)(sp)
-       stw     r5 ,( 5*8+4+offes_intregs)(sp)
-       stw     r6 ,( 6*8+4+offes_intregs)(sp)
-       stw     r7 ,( 7*8+4+offes_intregs)(sp)
-       stw     r8 ,( 8*8+4+offes_intregs)(sp)
-       stw     r9 ,( 9*8+4+offes_intregs)(sp)
-       stw     r10,(10*8+4+offes_intregs)(sp)
-       stw     r11,(11*8+4+offes_intregs)(sp)
-       stw     r12,(12*8+4+offes_intregs)(sp)
-       stw     r13,(13*8+4+offes_intregs)(sp)
-       stw     r14,(14*8+4+offes_intregs)(sp)
-       stw     r15,(15*8+4+offes_intregs)(sp)
-       stw     r16,(16*8+4+offes_intregs)(sp) /* link register stored as itmp3 */
-       stw     r17,(17*8+4+offes_intregs)(sp)
-       stw     r18,(18*8+4+offes_intregs)(sp)
-       stw     r19,(19*8+4+offes_intregs)(sp)
-       stw     r20,(20*8+4+offes_intregs)(sp)
-       stw     r21,(21*8+4+offes_intregs)(sp)
-       stw     r22,(22*8+4+offes_intregs)(sp)
-       stw     r23,(23*8+4+offes_intregs)(sp)
-       stw     r24,(24*8+4+offes_intregs)(sp)
-       stw     r25,(25*8+4+offes_intregs)(sp)
-       stw     r26,(26*8+4+offes_intregs)(sp)
-       stw     r27,(27*8+4+offes_intregs)(sp)
-       stw     r28,(28*8+4+offes_intregs)(sp)
-       stw     r29,(29*8+4+offes_intregs)(sp)
-       stw     r30,(30*8+4+offes_intregs)(sp)
-       stw     r31,(31*8+4+offes_intregs)(sp)
+       stw     r0 ,( 0*4+offes_intregs)(sp)
+       stw     r1 ,( 1*4+offes_intregs)(sp)
+       stw     r2 ,( 2*4+offes_intregs)(sp)
+       stw     r3 ,( 3*4+offes_intregs)(sp)
+       stw     r4 ,( 4*4+offes_intregs)(sp)
+       stw     r5 ,( 5*4+offes_intregs)(sp)
+       stw     r6 ,( 6*4+offes_intregs)(sp)
+       stw     r7 ,( 7*4+offes_intregs)(sp)
+       stw     r8 ,( 8*4+offes_intregs)(sp)
+       stw     r9 ,( 9*4+offes_intregs)(sp)
+       stw     r10,(10*4+offes_intregs)(sp)
+       stw     r11,(11*4+offes_intregs)(sp)
+       stw     r12,(12*4+offes_intregs)(sp)
+       stw     r13,(13*4+offes_intregs)(sp)
+       stw     r14,(14*4+offes_intregs)(sp)
+       stw     r15,(15*4+offes_intregs)(sp)
+       stw     r16,(16*4+offes_intregs)(sp) /* link register stored as itmp3 */
+       stw     r17,(17*4+offes_intregs)(sp)
+       stw     r18,(18*4+offes_intregs)(sp)
+       stw     r19,(19*4+offes_intregs)(sp)
+       stw     r20,(20*4+offes_intregs)(sp)
+       stw     r21,(21*4+offes_intregs)(sp)
+       stw     r22,(22*4+offes_intregs)(sp)
+       stw     r23,(23*4+offes_intregs)(sp)
+       stw     r24,(24*4+offes_intregs)(sp)
+       stw     r25,(25*4+offes_intregs)(sp)
+       stw     r26,(26*4+offes_intregs)(sp)
+       stw     r27,(27*4+offes_intregs)(sp)
+       stw     r28,(28*4+offes_intregs)(sp)
+       stw     r29,(29*4+offes_intregs)(sp)
+       stw     r30,(30*4+offes_intregs)(sp)
+       stw     r31,(31*4+offes_intregs)(sp)
        
        stfd    fr0 ,( 0*8+offes_fltregs)(sp)
        stfd    fr1 ,( 1*8+offes_fltregs)(sp)
@@ -1284,38 +1284,38 @@ asm_replacement_in:
        lwz     pv,(offes_pv)(sp)
        
        /* copy registers from execution state */
-       lwz     r0 ,( 0*8+4+offes_intregs)(sp)
-       /* r1 is sp                         */
-       /* r2 is reserved                   */
-       lwz     a0 ,( 3*8+4+offes_intregs)(sp)
-       lwz     r4 ,( 4*8+4+offes_intregs)(sp)
-       lwz     r5 ,( 5*8+4+offes_intregs)(sp)
-       lwz     r6 ,( 6*8+4+offes_intregs)(sp)
-       lwz     r7 ,( 7*8+4+offes_intregs)(sp)
-       lwz     r8 ,( 8*8+4+offes_intregs)(sp)
-       lwz     r9 ,( 9*8+4+offes_intregs)(sp)
-       lwz     r10,(10*8+4+offes_intregs)(sp)
-       lwz     r11,(11*8+4+offes_intregs)(sp)
-       lwz     r12,(12*8+4+offes_intregs)(sp)
-       /* r13 is pv                        */
-       lwz     r14,(14*8+4+offes_intregs)(sp)
-       lwz     r15,(15*8+4+offes_intregs)(sp)
-       lwz     r16,(16*8+4+offes_intregs)(sp) /* itmp3, later to link register */
-       lwz     r17,(17*8+4+offes_intregs)(sp)
-       lwz     r18,(18*8+4+offes_intregs)(sp)
-       lwz     r19,(19*8+4+offes_intregs)(sp)
-       lwz     r20,(20*8+4+offes_intregs)(sp)
-       lwz     r21,(21*8+4+offes_intregs)(sp)
-       lwz     r22,(22*8+4+offes_intregs)(sp)
-       lwz     r23,(23*8+4+offes_intregs)(sp)
-       lwz     r24,(24*8+4+offes_intregs)(sp)
-       lwz     r25,(25*8+4+offes_intregs)(sp)
-       lwz     r26,(26*8+4+offes_intregs)(sp)
-       lwz     r27,(27*8+4+offes_intregs)(sp)
-       lwz     r28,(28*8+4+offes_intregs)(sp)
-       lwz     r29,(29*8+4+offes_intregs)(sp)
-       lwz     r30,(30*8+4+offes_intregs)(sp)
-       lwz     r31,(31*8+4+offes_intregs)(sp)
+       lwz     r0 ,( 0*4+offes_intregs)(sp)
+       /* r1 is sp                       */
+       /* r2 is reserved                 */
+       lwz     a0 ,( 3*4+offes_intregs)(sp)
+       lwz     r4 ,( 4*4+offes_intregs)(sp)
+       lwz     r5 ,( 5*4+offes_intregs)(sp)
+       lwz     r6 ,( 6*4+offes_intregs)(sp)
+       lwz     r7 ,( 7*4+offes_intregs)(sp)
+       lwz     r8 ,( 8*4+offes_intregs)(sp)
+       lwz     r9 ,( 9*4+offes_intregs)(sp)
+       lwz     r10,(10*4+offes_intregs)(sp)
+       lwz     r11,(11*4+offes_intregs)(sp)
+       lwz     r12,(12*4+offes_intregs)(sp)
+       /* r13 is pv                      */
+       lwz     r14,(14*4+offes_intregs)(sp)
+       lwz     r15,(15*4+offes_intregs)(sp)
+       lwz     r16,(16*4+offes_intregs)(sp) /* itmp3, later to link register */
+       lwz     r17,(17*4+offes_intregs)(sp)
+       lwz     r18,(18*4+offes_intregs)(sp)
+       lwz     r19,(19*4+offes_intregs)(sp)
+       lwz     r20,(20*4+offes_intregs)(sp)
+       lwz     r21,(21*4+offes_intregs)(sp)
+       lwz     r22,(22*4+offes_intregs)(sp)
+       lwz     r23,(23*4+offes_intregs)(sp)
+       lwz     r24,(24*4+offes_intregs)(sp)
+       lwz     r25,(25*4+offes_intregs)(sp)
+       lwz     r26,(26*4+offes_intregs)(sp)
+       lwz     r27,(27*4+offes_intregs)(sp)
+       lwz     r28,(28*4+offes_intregs)(sp)
+       lwz     r29,(29*4+offes_intregs)(sp)
+       lwz     r30,(30*4+offes_intregs)(sp)
+       lwz     r31,(31*4+offes_intregs)(sp)
        
        lfd     fr0 ,( 0*8+offes_fltregs)(sp)
        lfd     fr1 ,( 1*8+offes_fltregs)(sp)
index fc8b3f122917b74eb442c58653fa942f5f69e425..407f05ed228d2b7f117dc31d1dc6a73b2f3e1ca5 100644 (file)
@@ -102,7 +102,7 @@ typedef u8 stackslot_t;
 /*#define REPLACE_VERBOSE*/
 
 #if !defined(NDEBUG)
-static void java_value_print(s4 type, u8 value);
+static void java_value_print(s4 type, replace_val_t value);
 #endif /* !defined(NDEBUG) */
 
 #if !defined(NDEBUG) && defined(REPLACE_VERBOSE)
@@ -900,17 +900,17 @@ void replace_deactivate_replacement_points(codeinfo *code)
 static void replace_read_value(executionstate_t *es,
                                                           stackslot_t *sp,
                                                           rplalloc *ra,
-                                                          u8 *javaval)
+                                                          replace_val_t *javaval)
 {
        if (ra->flags & INMEMORY) {
                /* XXX HAS_4BYTE_STACKSLOT may not be the right discriminant here */
 #ifdef HAS_4BYTE_STACKSLOT
                if (IS_2_WORD_TYPE(ra->type)) {
-                       *javaval = *(u8*)(sp + ra->regoff);
+                       javaval->l = *(u8*)(sp + ra->regoff);
                }
                else {
 #endif
-                       *javaval = sp[ra->regoff];
+                       javaval->p = sp[ra->regoff];
 #ifdef HAS_4BYTE_STACKSLOT
                }
 #endif
@@ -918,10 +918,20 @@ static void replace_read_value(executionstate_t *es,
        else {
                /* allocated register */
                if (IS_FLT_DBL_TYPE(ra->type)) {
-                       *javaval = es->fltregs[ra->regoff];
+                       javaval->d = es->fltregs[ra->regoff];
+
+                       if (ra->type == TYPE_FLT)
+                               javaval->f = javaval->d;
                }
                else {
-                       *javaval = es->intregs[ra->regoff];
+#if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
+                       if (ra->type == TYPE_LNG) {
+                               javaval->words.lo = es->intregs[GET_LOW_REG(ra->regoff)];
+                               javaval->words.hi = es->intregs[GET_HIGH_REG(ra->regoff)];
+                       }
+                       else
+#endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
+                               javaval->p = es->intregs[ra->regoff];
                }
        }
 }
@@ -942,28 +952,38 @@ static void replace_read_value(executionstate_t *es,
 static void replace_write_value(executionstate_t *es,
                                                            stackslot_t *sp,
                                                            rplalloc *ra,
-                                                           u8 *javaval)
+                                                           replace_val_t *javaval)
 {
        if (ra->flags & INMEMORY) {
                /* XXX HAS_4BYTE_STACKSLOT may not be the right discriminant here */
 #ifdef HAS_4BYTE_STACKSLOT
                if (IS_2_WORD_TYPE(ra->type)) {
-                       *(u8*)(sp + ra->regoff) = *javaval;
+                       *(u8*)(sp + ra->regoff) = javaval->l;
                }
                else {
 #endif
-                       sp[ra->regoff] = *javaval;
+                       sp[ra->regoff] = javaval->p;
 #ifdef HAS_4BYTE_STACKSLOT
                }
 #endif
        }
        else {
                /* allocated register */
-               if (IS_FLT_DBL_TYPE(ra->type)) {
-                       es->fltregs[ra->regoff] = *javaval;
-               }
-               else {
-                       es->intregs[ra->regoff] = *javaval;
+               switch (ra->type) {
+                       case TYPE_FLT:
+                               es->fltregs[ra->regoff] = (double) javaval->f;
+                               break;
+                       case TYPE_DBL:
+                               es->fltregs[ra->regoff] = javaval->d;
+                               break;
+#if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
+                       case TYPE_LNG:
+                               es->intregs[GET_LOW_REG(ra->regoff)] = javaval->words.lo;
+                               es->intregs[GET_HIGH_REG(ra->regoff)] = javaval->words.hi;
+                               break;
+#endif
+                       default:
+                               es->intregs[ra->regoff] = javaval->p;
                }
        }
 }
@@ -1034,7 +1054,7 @@ static void replace_read_executionstate(rplpoint *rp,
        frame->id = rp->id;
        assert(rp->type >= 0 && rp->type < sizeof(replace_normalize_type_map)/sizeof(s4));
        frame->type = replace_normalize_type_map[rp->type];
-       frame->instance = 0;
+       frame->instance.a = NULL;
        frame->syncslotcount = 0;
        frame->syncslots = NULL;
        frame->fromrp = rp;
@@ -1048,21 +1068,21 @@ static void replace_read_executionstate(rplpoint *rp,
 
        count = m->maxlocals;
        frame->javalocalcount = count;
-       frame->javalocals = DMNEW(u8, count);
+       frame->javalocals = DMNEW(replace_val_t, count);
        frame->javalocaltype = DMNEW(u1, count);
 
 #if !defined(NDEBUG)
        /* mark values as undefined */
        for (i=0; i<count; ++i) {
-               frame->javalocals[i] = (u8) 0x00dead0000dead00ULL;
+               frame->javalocals[i].l = (u8) 0x00dead0000dead00ULL;
                frame->javalocaltype[i] = TYPE_VOID;
        }
 
        /* some entries in the intregs array are not meaningful */
        /*es->intregs[REG_ITMP3] = (u8) 0x11dead1111dead11ULL;*/
-       es->intregs[REG_SP   ] = (u8) 0x11dead1111dead11ULL;
+       es->intregs[REG_SP   ] = (ptrint) 0x11dead1111dead11ULL;
 #ifdef REG_PV
-       es->intregs[REG_PV   ] = (u8) 0x11dead1111dead11ULL;
+       es->intregs[REG_PV   ] = (ptrint) 0x11dead1111dead11ULL;
 #endif
 #endif /* !defined(NDEBUG) */
 
@@ -1075,7 +1095,7 @@ static void replace_read_executionstate(rplpoint *rp,
                assert(i < m->maxlocals);
                frame->javalocaltype[i] = ra->type;
                if (ra->type == TYPE_RET)
-                       frame->javalocals[i] = ra->regoff;
+                       frame->javalocals[i].i = ra->regoff;
                else
                        replace_read_value(es, sp, ra, frame->javalocals + i);
                ra++;
@@ -1115,13 +1135,13 @@ static void replace_read_executionstate(rplpoint *rp,
        /* read stack slots */
 
        frame->javastackdepth = count;
-       frame->javastack = DMNEW(u8, count);
+       frame->javastack = DMNEW(replace_val_t, count);
        frame->javastacktype = DMNEW(u1, count);
 
 #if !defined(NDEBUG)
        /* mark values as undefined */
        for (i=0; i<count; ++i) {
-               frame->javastack[i] = (u8) 0x00dead0000dead00ULL;
+               frame->javastack[i].l = (u8) 0x00dead0000dead00ULL;
                frame->javastacktype[i] = TYPE_VOID;
        }
 #endif /* !defined(NDEBUG) */
@@ -1134,7 +1154,8 @@ static void replace_read_executionstate(rplpoint *rp,
                assert(count);
 
                assert(ra->index == RPLALLOC_STACK);
-               frame->javastack[i] = sp[-1];
+               assert(ra->type == TYPE_ADR);
+               frame->javastack[i].p = sp[-1];
                frame->javastacktype[i] = TYPE_ADR; /* XXX RET */
                count--;
                i++;
@@ -1144,7 +1165,8 @@ static void replace_read_executionstate(rplpoint *rp,
                assert(count);
 
                assert(ra->index == RPLALLOC_STACK);
-               frame->javastack[i] = es->intregs[REG_ITMP1];
+               assert(ra->type == TYPE_ADR);
+               frame->javastack[i].p = es->intregs[REG_ITMP1];
                frame->javastacktype[i] = TYPE_ADR; /* XXX RET */
                count--;
                i++;
@@ -1154,7 +1176,7 @@ static void replace_read_executionstate(rplpoint *rp,
                assert(count);
 
                assert(ra->index == RPLALLOC_STACK);
-               frame->javastack[i] = 0;
+               frame->javastack[i].l = 0;
                frame->javastacktype[i] = TYPE_VOID;
                count--;
                i++;
@@ -1176,7 +1198,7 @@ static void replace_read_executionstate(rplpoint *rp,
                                assert(calleeframe->syncslots == NULL);
 
                                calleeframe->syncslotcount = 1;
-                               calleeframe->syncslots = DMNEW(u8, 1);
+                               calleeframe->syncslots = DMNEW(replace_val_t, 1);
                                replace_read_value(es,sp,ra,calleeframe->syncslots);
                        }
 
@@ -1193,7 +1215,7 @@ static void replace_read_executionstate(rplpoint *rp,
                }
                else {
                        if (ra->type == TYPE_RET)
-                               frame->javastack[i] = ra->regoff;
+                               frame->javastack[i].i = ra->regoff;
                        else
                                replace_read_value(es,sp,ra,frame->javastack + i);
                        frame->javastacktype[i] = ra->type;
@@ -1285,7 +1307,7 @@ static void replace_write_executionstate(rplpoint *rp,
                assert(ra->index == RPLALLOC_STACK);
                assert(i < frame->javastackdepth);
                assert(frame->javastacktype[i] == TYPE_ADR);
-               sp[-1] = frame->javastack[i];
+               sp[-1] = frame->javastack[i].p;
                count--;
                i++;
                ra++;
@@ -1296,7 +1318,7 @@ static void replace_write_executionstate(rplpoint *rp,
                assert(ra->index == RPLALLOC_STACK);
                assert(i < frame->javastackdepth);
                assert(frame->javastacktype[i] == TYPE_ADR);
-               es->intregs[REG_ITMP1] = frame->javastack[i];
+               es->intregs[REG_ITMP1] = frame->javastack[i].p;
                count--;
                i++;
                ra++;
@@ -1426,9 +1448,9 @@ u1* replace_pop_activation_record(executionstate_t *es,
        assert(frame->syncslots == NULL);
        count = code_get_sync_slot_count(es->code);
        frame->syncslotcount = count;
-       frame->syncslots = DMNEW(u8, count);
+       frame->syncslots = DMNEW(replace_val_t, count);
        for (i=0; i<count; ++i) {
-               frame->syncslots[i] = sp[es->code->memuse + i];
+               frame->syncslots[i].p = sp[es->code->memuse + i]; /* XXX */
        }
 
        /* restore return address, if part of frame */
@@ -1464,7 +1486,7 @@ u1* replace_pop_activation_record(executionstate_t *es,
                while (nregdescfloat[--reg] != REG_SAV)
                        ;
                basesp -= STACK_SLOTS_PER_FLOAT;
-               es->fltregs[reg] = *(u8*)basesp;
+               es->fltregs[reg] = *(double*)basesp;
        }
 
        /* Set the new pc. Subtract one so we do not hit the replacement point */
@@ -1491,10 +1513,10 @@ u1* replace_pop_activation_record(executionstate_t *es,
                                && (i != REPLACE_REG_RA)
 #endif
                        )
-                       es->intregs[i] = 0x33dead3333dead33ULL;
+                       es->intregs[i] = (ptrint) 0x33dead3333dead33ULL;
        for (i=0; i<FLT_REG_CNT; ++i)
                if (nregdescfloat[i] != REG_SAV)
-                       es->fltregs[i] = 0x33dead3333dead33ULL;
+                       *(u8*)&(es->fltregs[i]) = 0x33dead3333dead33ULL;
 #endif /* !defined(NDEBUG) */
 
        return ra;
@@ -1608,14 +1630,14 @@ void replace_patch_future_calls(u1 *ra,
 
                /* we need to know the instance */
 
-               if (!calleeframe->instance) {
+               if (!calleeframe->instance.a) {
                        DOLOG_SHORT( printf("WARNING: object instance unknown!\n"); );
                        return;
                }
 
                /* get the vftbl */
 
-               obj = (java_objectheader *) (ptrint) calleeframe->instance;
+               obj = calleeframe->instance.a;
                vftbl = obj->vftbl;
 
                assert(vftbl->class->vftbl == vftbl);
@@ -1705,7 +1727,7 @@ void replace_push_activation_record(executionstate_t *es,
 #endif /* REPLACE_RA_BETWEEN_FRAMES */
 
 #if defined(REPLACE_REG_RA)
-       es->intregs[REPLACE_REG_RA] = (u8) (ptrint) ra;
+       es->intregs[REPLACE_REG_RA] = (ptrint) ra;
 #endif
 
        /* we move into a new code unit */
@@ -1760,7 +1782,7 @@ void replace_push_activation_record(executionstate_t *es,
                *--basesp = es->intregs[reg];
 
 #if !defined(NDEBUG)
-               es->intregs[reg] = 0x44dead4444dead44ULL;
+               es->intregs[reg] = (ptrint) 0x44dead4444dead44ULL;
 #endif
        }
 
@@ -1772,10 +1794,10 @@ void replace_push_activation_record(executionstate_t *es,
                while (nregdescfloat[--reg] != REG_SAV)
                        ;
                basesp -= STACK_SLOTS_PER_FLOAT;
-               *(u8*)basesp = es->fltregs[reg];
+               *(double*)basesp = es->fltregs[reg];
 
 #if !defined(NDEBUG)
-               es->fltregs[reg] = 0x44dead4444dead44ULL;
+               *(u8*)&(es->fltregs[reg]) = 0x44dead4444dead44ULL;
 #endif
        }
 
@@ -1784,7 +1806,7 @@ void replace_push_activation_record(executionstate_t *es,
        count = code_get_sync_slot_count(calleecode);
        assert(count == calleeframe->syncslotcount);
        for (i=0; i<count; ++i) {
-               sp[calleecode->memuse + i] = calleeframe->syncslots[i];
+               sp[calleecode->memuse + i] = calleeframe->syncslots[i].p;
        }
 
        /* set the PV */
@@ -1854,13 +1876,13 @@ rplpoint * replace_find_replacement_point(codeinfo *code,
                                if (ra->type == TYPE_RET) {
                                        if (ra->index == RPLALLOC_STACK) {
                                                assert(stacki < frame->javastackdepth);
-                                               if (frame->javastack[stacki] != ra->regoff)
+                                               if (frame->javastack[stacki].i != ra->regoff)
                                                        goto no_match;
                                                stacki++;
                                        }
                                        else {
                                                assert(ra->index >= 0 && ra->index < frame->javalocalcount);
-                                               if (frame->javalocals[ra->index] != ra->regoff)
+                                               if (frame->javalocals[ra->index].i != ra->regoff)
                                                        goto no_match;
                                        }
                                }
@@ -2657,20 +2679,20 @@ void replace_executionstate_println(executionstate_t *es)
 #endif
 
 #if !defined(NDEBUG)
-static void java_value_print(s4 type, u8 value)
+static void java_value_print(s4 type, replace_val_t value)
 {
        java_objectheader *obj;
        utf               *u;
 
-       printf("%016llx",(unsigned long long) value);
+       printf("%016llx",(unsigned long long) value.l);
 
        if (type < 0 || type > TYPE_RET)
                printf(" <INVALID TYPE:%d>", type);
        else
                printf(" %s", show_jit_type_names[type]);
 
-       if (type == TYPE_ADR && value != 0) {
-               obj = (java_objectheader *) (ptrint) value;
+       if (type == TYPE_ADR && value.a != NULL) {
+               obj = value.a;
                putchar(' ');
                utf_display_printable_ascii_classname(obj->vftbl->class->name);
 
@@ -2681,8 +2703,17 @@ static void java_value_print(s4 type, u8 value)
                        printf("\"");
                }
        }
-       else if (type == TYPE_INT || type == TYPE_LNG) {
-               printf(" %lld", (long long) value);
+       else if (type == TYPE_INT) {
+               printf(" %ld", (long) value.i);
+       }
+       else if (type == TYPE_LNG) {
+               printf(" %lld", (long long) value.l);
+       }
+       else if (type == TYPE_FLT) {
+               printf(" %f", value.f);
+       }
+       else if (type == TYPE_DBL) {
+               printf(" %f", value.d);
        }
 }
 #endif /* !defined(NDEBUG) */
@@ -2700,7 +2731,7 @@ void replace_source_frame_println(sourceframe_t *frame)
        printf("\ttype: %s\n", replace_type_str[frame->type]);
        printf("\n");
 
-       if (frame->instance) {
+       if (frame->instance.a) {
                printf("\tinstance: ");
                java_value_print(TYPE_ADR, frame->instance);
                printf("\n");
@@ -2743,9 +2774,9 @@ void replace_source_frame_println(sourceframe_t *frame)
                for (i=0; i<frame->syncslotcount; ++i) {
                        printf("\tslot[%2d] = ",i);
 #ifdef HAS_4BYTE_STACKSLOT
-                       printf("%08lx\n",(unsigned long) frame->syncslots[i]);
+                       printf("%08lx\n",(unsigned long) frame->syncslots[i].p);
 #else
-                       printf("%016llx\n",(unsigned long long) frame->syncslots[i]);
+                       printf("%016llx\n",(unsigned long long) frame->syncslots[i].p);
 #endif
                }
                printf("\n");
index 8d8a06a3a94d8a70554b0c90849a6d4ef79434a5..16cfa032ded2361776b10b8f1b9f5c13c5f82470 100644 (file)
@@ -43,6 +43,7 @@ typedef struct executionstate_t executionstate_t;
 typedef struct sourcestate_t sourcestate_t;
 typedef struct sourceframe_t sourceframe_t;
 typedef struct replace_safestack_t replace_safestack_t;
+typedef union  replace_val_t replace_val_t;
 
 #include "config.h"
 #include "vm/types.h"
@@ -126,6 +127,20 @@ struct rplpoint {
 };
 
 
+union replace_val_t {
+       s4                 i;
+       s8                 l;
+       ptrint             p;
+       struct {
+               u4 lo;
+               u4 hi;
+       }                  words;
+       float              f;
+       double             d;
+       java_objectheader *a;
+};
+
+
 /* An `executionsstate` represents the state of a thread as it reached */
 /* an replacement point or is about to enter one.                      */
 
@@ -135,8 +150,8 @@ struct executionstate_t {
        u1           *pv;                   /* procedure value. NULL means */
                                            /* search the AVL tree         */
 
-       u8            intregs[INT_REG_CNT];             /* register values */
-       u8            fltregs[FLT_REG_CNT];             /* register values */
+       ptrint        intregs[INT_REG_CNT];             /* register values */
+       double        fltregs[FLT_REG_CNT];             /* register values */
 
        codeinfo     *code;            /* codeinfo corresponding to the pv */
 };
@@ -149,17 +164,17 @@ struct sourceframe_t {
        s4             id;
        s4             type;
 
-       u8             instance;
+       replace_val_t  instance;
 
-       u8            *javastack;                  /* values of stack vars */
+       replace_val_t *javastack;                  /* values of stack vars */
        u1            *javastacktype;              /*  types of stack vars */
        s4             javastackdepth;             /* number of stack vars */
 
-       u8            *javalocals;                 /* values of javalocals */
+       replace_val_t *javalocals;                 /* values of javalocals */
        u1            *javalocaltype;              /*  types of javalocals */
        s4             javalocalcount;             /* number of javalocals */
 
-       u8            *syncslots;
+       replace_val_t *syncslots;
        s4             syncslotcount; /* XXX do we need more than one? */
 
        rplpoint      *fromrp;         /* rplpoint used to read this frame */