< prev index next >

src/cpu/aarch32/vm/stubGenerator_aarch32.cpp

Print this page
rev 8069 : 8164652: aarch32: C1 port


1199   // AbstractCompiler::continuation_for_implicit_null_exception or
1200   // continuation_for_implicit_division_by_zero_exception. All other
1201   // implicit exceptions (e.g., NullPointerException or
1202   // AbstractMethodError on entry) are either at call sites or
1203   // otherwise assume that stack unwinding will be initiated, so
1204   // caller saved registers were assumed volatile in the compiler.
1205 
1206 #undef __
1207 #define __ masm->
1208 
1209   address generate_throw_exception(const char* name,
1210                                    address runtime_entry,
1211                                    Register arg1 = noreg,
1212                                    Register arg2 = noreg) {
1213     // Information about frame layout at time of blocking runtime call.
1214     // Note that we only have to preserve callee-saved registers since
1215     // the compilers are responsible for supplying a continuation point
1216     // if they expect all registers to be preserved.
1217     // n.b. aarch32 asserts that frame::arg_reg_save_area_bytes == 0
1218     enum layout {
1219       rfp_off = frame::arg_reg_save_area_bytes/BytesPerInt,
1220       return_off,
1221       framesize // inclusive of return address
1222     };
1223 
1224     int insts_size = 512;
1225     int locs_size  = 64;
1226 
1227     CodeBuffer code(name, insts_size, locs_size);
1228     OopMapSet* oop_maps  = new OopMapSet();
1229     MacroAssembler* masm = new MacroAssembler(&code);
1230 
1231     address start = __ pc();
1232 
1233     // This is an inlined and slightly modified version of call_VM
1234     // which has the ability to fetch the return PC out of
1235     // thread-local storage and also sets up last_Java_sp slightly
1236     // differently than the real call_VM
1237 
1238     __ enter(); // Save FP and LR before call
1239 
1240     // lr and fp are already in place
1241     assert(frame::arg_reg_save_area_bytes == 0, "please modify this code");
1242     // __ sub(sp, rfp, frame::arg_reg_save_area_bytes + wordSize); // prolog
1243     assert(is_even(framesize), "sp not 8-byte aligned");
1244 
1245     int frame_complete = __ pc() - start;
1246 
1247     // Set up last_Java_sp and last_Java_fp
1248     address the_pc = __ pc();
1249     __ set_last_Java_frame(sp, rfp, (address)NULL, rscratch1);
1250 
1251     // Call runtime
1252     if (arg1 != noreg) {
1253       assert(arg2 != c_rarg1, "clobbered");
1254       __ mov(c_rarg1, arg1);
1255     }
1256     if (arg2 != noreg) {
1257       __ mov(c_rarg2, arg2);
1258     }
1259     __ mov(c_rarg0, rthread);
1260     BLOCK_COMMENT("call runtime_entry");
1261     __ align_stack();
1262     __ mov(rscratch1, runtime_entry);


1271     __ maybe_isb();
1272 
1273     __ leave();
1274 
1275     // check for pending exceptions
1276 #ifdef ASSERT
1277     Label L;
1278     __ ldr(rscratch1, Address(rthread, Thread::pending_exception_offset()));
1279     __ cbnz(rscratch1, L);
1280     __ should_not_reach_here();
1281     __ bind(L);
1282 #endif // ASSERT
1283     __ far_jump(RuntimeAddress(StubRoutines::forward_exception_entry()));
1284 
1285 
1286     // codeBlob framesize is in words (not VMRegImpl::slot_size)
1287     RuntimeStub* stub =
1288       RuntimeStub::new_runtime_stub(name,
1289                                     &code,
1290                                     frame_complete,
1291                                     (framesize >> (LogBytesPerWord - LogBytesPerInt)),
1292                                     oop_maps, false);
1293     return stub->entry_point();
1294   }
1295 
1296   // Initialization
1297   void generate_initial() {
1298     // Generate initial stubs and initializes the entry points
1299 
1300     // entry points that exist in all platforms Note: This is code
1301     // that could be shared among different platforms - however the
1302     // benefit seems to be smaller than the disadvantage of having a
1303     // much more complicated generator structure. See also comment in
1304     // stubRoutines.hpp.
1305 
1306     StubRoutines::_forward_exception_entry = generate_forward_exception();
1307 
1308     StubRoutines::_call_stub_entry =
1309       generate_call_stub(StubRoutines::_call_stub_return_address);
1310 
1311     // is referenced by megamorphic call




1199   // AbstractCompiler::continuation_for_implicit_null_exception or
1200   // continuation_for_implicit_division_by_zero_exception. All other
1201   // implicit exceptions (e.g., NullPointerException or
1202   // AbstractMethodError on entry) are either at call sites or
1203   // otherwise assume that stack unwinding will be initiated, so
1204   // caller saved registers were assumed volatile in the compiler.
1205 
1206 #undef __
1207 #define __ masm->
1208 
1209   address generate_throw_exception(const char* name,
1210                                    address runtime_entry,
1211                                    Register arg1 = noreg,
1212                                    Register arg2 = noreg) {
1213     // Information about frame layout at time of blocking runtime call.
1214     // Note that we only have to preserve callee-saved registers since
1215     // the compilers are responsible for supplying a continuation point
1216     // if they expect all registers to be preserved.
1217     // n.b. aarch32 asserts that frame::arg_reg_save_area_bytes == 0
1218     enum layout {
1219       rfp_off = 0,
1220       return_off,
1221       framesize // inclusive of return address
1222     };
1223 
1224     int insts_size = 512;
1225     int locs_size  = 64;
1226 
1227     CodeBuffer code(name, insts_size, locs_size);
1228     OopMapSet* oop_maps  = new OopMapSet();
1229     MacroAssembler* masm = new MacroAssembler(&code);
1230 
1231     address start = __ pc();
1232 
1233     // This is an inlined and slightly modified version of call_VM
1234     // which has the ability to fetch the return PC out of
1235     // thread-local storage and also sets up last_Java_sp slightly
1236     // differently than the real call_VM
1237 
1238     __ enter(); // Save FP and LR before call
1239 



1240     assert(is_even(framesize), "sp not 8-byte aligned");
1241 
1242     int frame_complete = __ pc() - start;
1243 
1244     // Set up last_Java_sp and last_Java_fp
1245     address the_pc = __ pc();
1246     __ set_last_Java_frame(sp, rfp, (address)NULL, rscratch1);
1247 
1248     // Call runtime
1249     if (arg1 != noreg) {
1250       assert(arg2 != c_rarg1, "clobbered");
1251       __ mov(c_rarg1, arg1);
1252     }
1253     if (arg2 != noreg) {
1254       __ mov(c_rarg2, arg2);
1255     }
1256     __ mov(c_rarg0, rthread);
1257     BLOCK_COMMENT("call runtime_entry");
1258     __ align_stack();
1259     __ mov(rscratch1, runtime_entry);


1268     __ maybe_isb();
1269 
1270     __ leave();
1271 
1272     // check for pending exceptions
1273 #ifdef ASSERT
1274     Label L;
1275     __ ldr(rscratch1, Address(rthread, Thread::pending_exception_offset()));
1276     __ cbnz(rscratch1, L);
1277     __ should_not_reach_here();
1278     __ bind(L);
1279 #endif // ASSERT
1280     __ far_jump(RuntimeAddress(StubRoutines::forward_exception_entry()));
1281 
1282 
1283     // codeBlob framesize is in words (not VMRegImpl::slot_size)
1284     RuntimeStub* stub =
1285       RuntimeStub::new_runtime_stub(name,
1286                                     &code,
1287                                     frame_complete,
1288                                     framesize,
1289                                     oop_maps, false);
1290     return stub->entry_point();
1291   }
1292 
1293   // Initialization
1294   void generate_initial() {
1295     // Generate initial stubs and initializes the entry points
1296 
1297     // entry points that exist in all platforms Note: This is code
1298     // that could be shared among different platforms - however the
1299     // benefit seems to be smaller than the disadvantage of having a
1300     // much more complicated generator structure. See also comment in
1301     // stubRoutines.hpp.
1302 
1303     StubRoutines::_forward_exception_entry = generate_forward_exception();
1304 
1305     StubRoutines::_call_stub_entry =
1306       generate_call_stub(StubRoutines::_call_stub_return_address);
1307 
1308     // is referenced by megamorphic call


< prev index next >