- /* recompute pv */
- s1 = (int) ((u1*) mcodeptr - mcodebase);
- if (s1 <= 32768) M_LDA(REG_PV, REG_RA, -s1);
- else {
- s4 ml = -s1, mh = 0;
- while (ml < -32768) { ml += 65536; mh--; }
- M_LUI(REG_PV, mh);
- M_IADD_IMM(REG_PV, ml, REG_PV);
- M_LADD(REG_PV, REG_RA, REG_PV);
- }
+ /* generate exception check stubs */
+
+ xcodeptr = NULL;
+
+ for (; xexceptionrefs != NULL; xexceptionrefs = xexceptionrefs->next) {
+ if ((exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ gen_resolvebranch((u1*) mcodebase + xexceptionrefs->branchpos,
+ xexceptionrefs->branchpos,
+ (u1*) xcodeptr - (u1*) mcodebase - 4);
+ continue;
+ }
+
+ gen_resolvebranch((u1*) mcodebase + xexceptionrefs->branchpos,
+ xexceptionrefs->branchpos,
+ (u1*) mcodeptr - mcodebase);
+
+ MCODECHECK(8);
+
+ M_LADD_IMM(REG_PV, xexceptionrefs->branchpos - 4, REG_ITMP2_XPC);
+
+ if (xcodeptr != NULL) {
+ M_BR(xcodeptr - mcodeptr);
+ M_NOP;
+
+ } else {
+ xcodeptr = mcodeptr;