- codegen_createlinenumbertable(cd);
-
- {
- /* generate bound check stubs */
-
- s4 *xcodeptr = NULL;
- branchref *bref;
-
- for (bref = cd->xboundrefs; bref != NULL; bref = bref->next) {
- gen_resolvebranch((u1*) cd->mcodebase + bref->branchpos,
- bref->branchpos,
- (u1*) mcodeptr - cd->mcodebase);
-
- MCODECHECK(8);
-
- /* move index register into REG_ITMP1 */
- M_MOV(bref->reg, REG_ITMP1);
- M_LDA(REG_ITMP2_XPC, REG_PV, bref->branchpos - 4);
-
- if (xcodeptr != NULL) {
- M_BR(xcodeptr - mcodeptr - 1);
-
- } else {
- xcodeptr = mcodeptr;
-
- a = dseg_addaddress(cd, asm_throw_and_handle_arrayindexoutofbounds_exception);
- M_ALD(REG_PV, REG_PV, a);
-
- M_JSR(REG_RA, REG_PV);
-
- /* recompute pv */
- s1 = (s4) ((u1 *) mcodeptr - cd->mcodebase);
- if (s1 <= 32768) M_LDA(REG_PV, REG_RA, -s1);
- else {
- s4 ml = -s1, mh = 0;
- while (ml < -32768) { ml += 65536; mh--; }
- M_LDA(REG_PV, REG_RA, ml);
- M_LDAH(REG_PV, REG_PV, mh);
- }
- }
- }
-
- /* generate negative array size check stubs */
-
- xcodeptr = NULL;
-
- for (bref = cd->xcheckarefs; bref != NULL; bref = bref->next) {
- if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
- gen_resolvebranch((u1 *) cd->mcodebase + bref->branchpos,
- bref->branchpos,
- (u1 *) xcodeptr - (u1 *) cd->mcodebase - 4);
- continue;
- }
-
- gen_resolvebranch((u1 *) cd->mcodebase + bref->branchpos,
- bref->branchpos,
- (u1 *) mcodeptr - cd->mcodebase);
-
- MCODECHECK(8);
-
- M_LDA(REG_ITMP2_XPC, REG_PV, bref->branchpos - 4);
-
- if (xcodeptr != NULL) {
- M_BR(xcodeptr - mcodeptr - 1);
-
- } else {
- xcodeptr = mcodeptr;
-
-
- a = dseg_addaddress(cd, string_java_lang_NegativeArraySizeException);
- M_ALD(REG_ITMP1_XPTR,REG_PV,a);
-
- a = dseg_addaddress(cd, asm_throw_and_handle_nat_exception);
- M_ALD(REG_PV, REG_PV, a);
-
- M_JSR(REG_RA, REG_PV);
-
- /* recompute pv */
- s1 = (s4) ((u1 *) mcodeptr - cd->mcodebase);
- if (s1 <= 32768) M_LDA(REG_PV, REG_RA, -s1);
- else {
- s4 ml = -s1, mh = 0;
- while (ml < -32768) { ml += 65536; mh--; }
- M_LDA(REG_PV, REG_RA, ml);
- M_LDAH(REG_PV, REG_PV, mh);
- }
-
-
- }
- }
-
- /* generate cast check stubs */
-
- xcodeptr = NULL;
-
- for (bref = cd->xcastrefs; bref != NULL; bref = bref->next) {
- if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
- gen_resolvebranch((u1 *) cd->mcodebase + bref->branchpos,
- bref->branchpos,
- (u1 *) xcodeptr - (u1 *) cd->mcodebase - 4);
- continue;
- }
-
- gen_resolvebranch((u1 *) cd->mcodebase + bref->branchpos,
- bref->branchpos,
- (u1 *) mcodeptr - cd->mcodebase);
-
- MCODECHECK(8);
-
- M_LDA(REG_ITMP2_XPC, REG_PV, bref->branchpos - 4);
-
- if (xcodeptr != NULL) {
- M_BR(xcodeptr - mcodeptr - 1);
-
- } else {
- xcodeptr = mcodeptr;
-
- a = dseg_addaddress(cd, string_java_lang_ClassCastException);
- M_ALD(REG_ITMP1_XPTR,REG_PV,a);
-
- a = dseg_addaddress(cd, asm_throw_and_handle_nat_exception);
- M_ALD(REG_PV, REG_PV, a);
-
- M_JSR(REG_RA, REG_PV);
-
- /* recompute pv */
- s1 = (s4) ((u1 *) mcodeptr - cd->mcodebase);
- if (s1 <= 32768) M_LDA(REG_PV, REG_RA, -s1);
- else {
- s4 ml = -s1, mh = 0;
- while (ml < -32768) { ml += 65536; mh--; }
- M_LDA(REG_PV, REG_RA, ml);
- M_LDAH(REG_PV, REG_PV, mh);
- }
-
- }
- }
-
- /* generate exception check stubs */
-
- xcodeptr = NULL;
-
- for (bref = cd->xexceptionrefs; bref != NULL; bref = bref->next) {
- if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
- gen_resolvebranch((u1 *) cd->mcodebase + bref->branchpos,
- bref->branchpos,
- (u1 *) xcodeptr - (u1 *) cd->mcodebase - 4);
- continue;
- }
-
- gen_resolvebranch((u1 *) cd->mcodebase + bref->branchpos,
- bref->branchpos,
- (u1 *) mcodeptr - cd->mcodebase);
-
- MCODECHECK(8);
-
- M_LDA(REG_ITMP2_XPC, REG_PV, bref->branchpos - 4);
-
- if (xcodeptr != NULL) {
- M_BR(xcodeptr - mcodeptr - 1);
-
- } else {
- xcodeptr = mcodeptr;
-
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
- M_LSUB_IMM(REG_SP, 1 * 8, REG_SP);
- M_LST(REG_ITMP2_XPC, REG_SP, 0 * 8);
-
- a = dseg_addaddress(cd, &builtin_get_exceptionptrptr);
- M_ALD(REG_PV, REG_PV, a);
- M_JSR(REG_RA, REG_PV);
-
- /* recompute pv */
- s1 = (s4) ((u1 *) mcodeptr - cd->mcodebase);
- if (s1 <= 32768) M_LDA(REG_PV, REG_RA, -s1);
- else {
- s4 ml = -s1, mh = 0;
- while (ml < -32768) { ml += 65536; mh--; }
- M_LDA(REG_PV, REG_RA, ml);
- M_LDAH(REG_PV, REG_PV, mh);
- }
-
- M_ALD(REG_ITMP1_XPTR, REG_RESULT, 0);
- M_AST(REG_ZERO, REG_RESULT, 0);
-
- M_LLD(REG_ITMP2_XPC, REG_SP, 0 * 8);
- M_LADD_IMM(REG_SP, 1 * 8, REG_SP);
-#else
- a = dseg_addaddress(cd, &_exceptionptr);
- M_ALD(REG_ITMP3, REG_PV, a);
- M_ALD(REG_ITMP1_XPTR, REG_ITMP3, 0);
- M_AST(REG_ZERO, REG_ITMP3, 0);
-#endif
-
- a = dseg_addaddress(cd, asm_refillin_and_handle_exception);
- M_ALD(REG_PV, REG_PV, a);
-
- M_JMP(REG_RA, REG_PV);
-
- /* recompute pv */
- s1 = (s4) ((u1 *) mcodeptr - cd->mcodebase);
- if (s1 <= 32768) M_LDA(REG_PV, REG_RA, -s1);
- else {
- s4 ml = -s1, mh = 0;
- while (ml < -32768) { ml += 65536; mh--; }
- M_LDA(REG_PV, REG_RA, ml);
- M_LDAH(REG_PV, REG_PV, mh);
- }
-
- }
- }
-
- /* generate null pointer check stubs */
-
- xcodeptr = NULL;
-
- for (bref = cd->xnullrefs; bref != NULL; bref = bref->next) {
- if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
- gen_resolvebranch((u1 *) cd->mcodebase + bref->branchpos,
- bref->branchpos,
- (u1 *) xcodeptr - (u1 *) cd->mcodebase - 4);
- continue;
- }
-
- gen_resolvebranch((u1 *) cd->mcodebase + bref->branchpos,
- bref->branchpos,
- (u1 *) mcodeptr - cd->mcodebase);
-
- MCODECHECK(8);