- M_RET (REG_ZERO, REG_RA); /* return to caller */
-
- M_AST (REG_ZERO, REG_ITMP3, 0); /* store NULL into exceptionptr */
-
-#if 1
- if (runverbosenat) {
- M_LDA(REG_SP, REG_SP, -8);
- M_AST(REG_ITMP1, REG_SP, 0);
- M_MOV(REG_ITMP1, argintregs[0]);
- M_ALD(argintregs[1], REG_PV, -6*8);
- M_ALD(argintregs[2], REG_SP, 0);
- M_CLR(argintregs[3]);
- M_ALD(REG_PV, REG_PV, -8*8);
+ /* copy or spill arguments to new locations */
+
+ for (i = md->paramcount - 1, j = i + nativeparams; i >= 0; i--, j--) {
+ t = md->paramtypes[i].type;
+
+ if (IS_INT_LNG_TYPE(t)) {
+ if (!md->params[i].inmemory) {
+ s1 = rd->argintregs[md->params[i].regoff];
+
+ if (!nmd->params[j].inmemory) {
+ s2 = rd->argintregs[nmd->params[j].regoff];
+ M_INTMOVE(s1, s2);
+
+ } else {
+ s2 = nmd->params[j].regoff;
+ M_LST(s1, REG_SP, s2 * 8);
+ }
+
+ } else {
+ s1 = md->params[i].regoff + stackframesize;
+ s2 = nmd->params[j].regoff;
+ M_LLD(REG_ITMP1, REG_SP, s1 * 8);
+ M_LST(REG_ITMP1, REG_SP, s2 * 8);
+ }
+
+ } else {
+ if (!md->params[i].inmemory) {
+ s1 = rd->argfltregs[md->params[i].regoff];
+
+ if (!nmd->params[j].inmemory) {
+ s2 = rd->argfltregs[nmd->params[j].regoff];
+ M_FLTMOVE(s1, s2);
+
+ } else {
+ s2 = nmd->params[j].regoff;
+ if (IS_2_WORD_TYPE(t))
+ M_DST(s1, REG_SP, s2 * 8);
+ else
+ M_FST(s1, REG_SP, s2 * 8);
+ }
+
+ } else {
+ s1 = md->params[i].regoff + stackframesize;
+ s2 = nmd->params[j].regoff;
+ M_DLD(REG_FTMP1, REG_SP, s1 * 8);
+ if (IS_2_WORD_TYPE(t))
+ M_DST(REG_FTMP1, REG_SP, s2 * 8);
+ else
+ M_FST(REG_FTMP1, REG_SP, s2 * 8);
+ }
+ }
+ }
+
+ /* put class into second argument register */
+
+ if (m->flags & ACC_STATIC) {
+ disp = dseg_addaddress(cd, m->class);
+ M_ALD(rd->argintregs[1], REG_PV, disp);
+ }
+
+ /* put env into first argument register */
+
+ disp = dseg_addaddress(cd, &env);
+ M_ALD(rd->argintregs[0], REG_PV, disp);
+
+ /* do the native function call */
+
+ M_ALD(REG_PV, REG_PV, funcdisp);
+ M_JSR(REG_RA, REG_PV); /* call native method */
+ disp = (s4) ((u1 *) mcodeptr - cd->mcodebase);
+ M_LDA(REG_PV, REG_RA, -disp); /* recompute pv from ra */
+
+ /* save return value */
+
+ if (IS_INT_LNG_TYPE(md->returntype.type))
+ M_LST(REG_RESULT, REG_SP, 0 * 8);
+ else
+ M_DST(REG_FRESULT, REG_SP, 0 * 8);
+
+ /* remove native stackframe info */
+
+ M_AADD_IMM(REG_SP,
+ stackframesize * 8 - SIZEOF_VOID_P - sizeof(stackframeinfo),
+ rd->argintregs[0]);
+ disp = dseg_addaddress(cd, stacktrace_remove_stackframeinfo);
+ M_ALD(REG_PV, REG_PV, disp);
+ M_JSR(REG_RA, REG_PV);
+ disp = (s4) ((u1 *) mcodeptr - cd->mcodebase);
+ M_LDA(REG_PV, REG_RA, -disp);
+
+ /* call finished trace */
+
+ if (runverbose) {
+ disp = dseg_addaddress(cd, m);
+ M_ALD(rd->argintregs[0], REG_PV, disp);
+
+ M_MOV(REG_RESULT, rd->argintregs[1]);
+ M_FMOV(REG_FRESULT, rd->argfltregs[2]);
+ M_FMOV(REG_FRESULT, rd->argfltregs[3]);
+
+ disp = dseg_addaddress(cd, builtin_displaymethodstop);
+ M_ALD(REG_PV, REG_PV, disp);