< prev index next >

src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp

Print this page




  26 
  27 #include "precompiled.hpp"
  28 #include "asm/assembler.hpp"
  29 #include "c1/c1_CodeStubs.hpp"
  30 #include "c1/c1_Defs.hpp"
  31 #include "c1/c1_MacroAssembler.hpp"
  32 #include "c1/c1_Runtime1.hpp"
  33 #include "compiler/disassembler.hpp"
  34 #include "interpreter/interpreter.hpp"
  35 #include "nativeInst_aarch64.hpp"
  36 #include "oops/compiledICHolder.hpp"
  37 #include "oops/oop.inline.hpp"
  38 #include "prims/jvmtiExport.hpp"
  39 #include "register_aarch64.hpp"
  40 #include "runtime/sharedRuntime.hpp"
  41 #include "runtime/signature.hpp"
  42 #include "runtime/vframe.hpp"
  43 #include "runtime/vframeArray.hpp"
  44 #include "vmreg_aarch64.inline.hpp"
  45 #if INCLUDE_ALL_GCS

  46 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"

  47 #endif
  48 
  49 
  50 // Implementation of StubAssembler
  51 
  52 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, int args_size) {
  53   // setup registers
  54   assert(!(oop_result1->is_valid() || metadata_result->is_valid()) || oop_result1 != metadata_result, "registers must be different");
  55   assert(oop_result1 != rthread && metadata_result != rthread, "registers must be different");
  56   assert(args_size >= 0, "illegal args_size");
  57   bool align_stack = false;
  58 
  59   mov(c_rarg0, rthread);
  60   set_num_rt_args(0); // Nothing on stack
  61 
  62   Label retaddr;
  63   set_last_Java_frame(sp, rfp, retaddr, rscratch1);
  64 
  65   // do the call
  66   lea(rscratch1, RuntimeAddress(entry));


1161         oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_index_exception), true);
1162       }
1163       break;
1164 
1165     case throw_array_store_exception_id:
1166       { StubFrame f(sasm, "throw_array_store_exception", dont_gc_arguments);
1167         // tos + 0: link
1168         //     + 1: return address
1169         oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true);
1170       }
1171       break;
1172 
1173 #if INCLUDE_ALL_GCS
1174 
1175     case g1_pre_barrier_slow_id:
1176       {
1177         StubFrame f(sasm, "g1_pre_barrier", dont_gc_arguments);
1178         // arg0 : previous value of memory
1179 
1180         BarrierSet* bs = Universe::heap()->barrier_set();
1181         if (bs->kind() != BarrierSet::G1SATBCTLogging) {
1182           __ mov(r0, (int)id);
1183           __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), r0);
1184           __ should_not_reach_here();
1185           break;
1186         }
1187 
1188         const Register pre_val = r0;
1189         const Register thread = rthread;
1190         const Register tmp = rscratch1;
1191 
1192         Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1193                                              PtrQueue::byte_offset_of_active()));
1194 
1195         Address queue_index(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1196                                              PtrQueue::byte_offset_of_index()));
1197         Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1198                                         PtrQueue::byte_offset_of_buf()));
1199 
1200         Label done;
1201         Label runtime;


1211         f.load_argument(0, rscratch2);
1212         __ str(rscratch2, Address(tmp, 0));
1213         __ b(done);
1214 
1215         __ bind(runtime);
1216         __ push_call_clobbered_registers();
1217         f.load_argument(0, pre_val);
1218         __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), pre_val, thread);
1219         __ pop_call_clobbered_registers();
1220         __ bind(done);
1221       }
1222       break;
1223     case g1_post_barrier_slow_id:
1224       {
1225         StubFrame f(sasm, "g1_post_barrier", dont_gc_arguments);
1226 
1227         // arg0: store_address
1228         Address store_addr(rfp, 2*BytesPerWord);
1229 
1230         BarrierSet* bs = Universe::heap()->barrier_set();







1231         CardTableModRefBS* ct = (CardTableModRefBS*)bs;
1232         assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
1233 
1234         Label done;
1235         Label runtime;
1236 
1237         // At this point we know new_value is non-NULL and the new_value crosses regions.
1238         // Must check to see if card is already dirty
1239 
1240         const Register thread = rthread;
1241 
1242         Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
1243                                              PtrQueue::byte_offset_of_index()));
1244         Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
1245                                         PtrQueue::byte_offset_of_buf()));
1246 
1247         const Register card_offset = rscratch2;
1248         // LR is free here, so we can use it to hold the byte_map_base.
1249         const Register byte_map_base = lr;
1250 


1272         __ add(card_addr, byte_map_base, card_addr);
1273 
1274         __ ldr(rscratch1, queue_index);
1275         __ cbz(rscratch1, runtime);
1276         __ sub(rscratch1, rscratch1, wordSize);
1277         __ str(rscratch1, queue_index);
1278 
1279         // Reuse LR to hold buffer_addr
1280         const Register buffer_addr = lr;
1281 
1282         __ ldr(buffer_addr, buffer);
1283         __ str(card_addr, Address(buffer_addr, rscratch1));
1284         __ b(done);
1285 
1286         __ bind(runtime);
1287         __ push_call_clobbered_registers();
1288         __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread);
1289         __ pop_call_clobbered_registers();
1290         __ bind(done);
1291 



















1292       }
1293       break;
1294 #endif
1295 
1296     case predicate_failed_trap_id:
1297       {
1298         StubFrame f(sasm, "predicate_failed_trap", dont_gc_arguments);
1299 
1300         OopMap* map = save_live_registers(sasm);
1301 
1302         int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, predicate_failed_trap));
1303         oop_maps = new OopMapSet();
1304         oop_maps->add_gc_map(call_offset, map);
1305         restore_live_registers(sasm);
1306         __ leave();
1307         DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();
1308         assert(deopt_blob != NULL, "deoptimization blob must have been created");
1309 
1310         __ far_jump(RuntimeAddress(deopt_blob->unpack_with_reexecution()));
1311       }




  26 
  27 #include "precompiled.hpp"
  28 #include "asm/assembler.hpp"
  29 #include "c1/c1_CodeStubs.hpp"
  30 #include "c1/c1_Defs.hpp"
  31 #include "c1/c1_MacroAssembler.hpp"
  32 #include "c1/c1_Runtime1.hpp"
  33 #include "compiler/disassembler.hpp"
  34 #include "interpreter/interpreter.hpp"
  35 #include "nativeInst_aarch64.hpp"
  36 #include "oops/compiledICHolder.hpp"
  37 #include "oops/oop.inline.hpp"
  38 #include "prims/jvmtiExport.hpp"
  39 #include "register_aarch64.hpp"
  40 #include "runtime/sharedRuntime.hpp"
  41 #include "runtime/signature.hpp"
  42 #include "runtime/vframe.hpp"
  43 #include "runtime/vframeArray.hpp"
  44 #include "vmreg_aarch64.inline.hpp"
  45 #if INCLUDE_ALL_GCS
  46 #include "gc_implementation/shenandoah/shenandoahBarrierSet.hpp"
  47 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
  48 #include "gc_implementation/shenandoah/shenandoahRuntime.hpp"
  49 #endif
  50 
  51 
  52 // Implementation of StubAssembler
  53 
  54 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, int args_size) {
  55   // setup registers
  56   assert(!(oop_result1->is_valid() || metadata_result->is_valid()) || oop_result1 != metadata_result, "registers must be different");
  57   assert(oop_result1 != rthread && metadata_result != rthread, "registers must be different");
  58   assert(args_size >= 0, "illegal args_size");
  59   bool align_stack = false;
  60 
  61   mov(c_rarg0, rthread);
  62   set_num_rt_args(0); // Nothing on stack
  63 
  64   Label retaddr;
  65   set_last_Java_frame(sp, rfp, retaddr, rscratch1);
  66 
  67   // do the call
  68   lea(rscratch1, RuntimeAddress(entry));


1163         oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_index_exception), true);
1164       }
1165       break;
1166 
1167     case throw_array_store_exception_id:
1168       { StubFrame f(sasm, "throw_array_store_exception", dont_gc_arguments);
1169         // tos + 0: link
1170         //     + 1: return address
1171         oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true);
1172       }
1173       break;
1174 
1175 #if INCLUDE_ALL_GCS
1176 
1177     case g1_pre_barrier_slow_id:
1178       {
1179         StubFrame f(sasm, "g1_pre_barrier", dont_gc_arguments);
1180         // arg0 : previous value of memory
1181 
1182         BarrierSet* bs = Universe::heap()->barrier_set();
1183         if (bs->kind() != BarrierSet::G1SATBCTLogging && bs->kind() != BarrierSet::ShenandoahBarrierSet) {
1184           __ mov(r0, (int)id);
1185           __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), r0);
1186           __ should_not_reach_here();
1187           break;
1188         }
1189 
1190         const Register pre_val = r0;
1191         const Register thread = rthread;
1192         const Register tmp = rscratch1;
1193 
1194         Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1195                                              PtrQueue::byte_offset_of_active()));
1196 
1197         Address queue_index(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1198                                              PtrQueue::byte_offset_of_index()));
1199         Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1200                                         PtrQueue::byte_offset_of_buf()));
1201 
1202         Label done;
1203         Label runtime;


1213         f.load_argument(0, rscratch2);
1214         __ str(rscratch2, Address(tmp, 0));
1215         __ b(done);
1216 
1217         __ bind(runtime);
1218         __ push_call_clobbered_registers();
1219         f.load_argument(0, pre_val);
1220         __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), pre_val, thread);
1221         __ pop_call_clobbered_registers();
1222         __ bind(done);
1223       }
1224       break;
1225     case g1_post_barrier_slow_id:
1226       {
1227         StubFrame f(sasm, "g1_post_barrier", dont_gc_arguments);
1228 
1229         // arg0: store_address
1230         Address store_addr(rfp, 2*BytesPerWord);
1231 
1232         BarrierSet* bs = Universe::heap()->barrier_set();
1233         if (bs->kind() == BarrierSet::ShenandoahBarrierSet) {
1234           __ movptr(r0, (int)id);
1235           __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), r0);
1236           __ should_not_reach_here();
1237           break;
1238         }
1239 
1240         CardTableModRefBS* ct = (CardTableModRefBS*)bs;
1241         assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
1242 
1243         Label done;
1244         Label runtime;
1245 
1246         // At this point we know new_value is non-NULL and the new_value crosses regions.
1247         // Must check to see if card is already dirty
1248 
1249         const Register thread = rthread;
1250 
1251         Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
1252                                              PtrQueue::byte_offset_of_index()));
1253         Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
1254                                         PtrQueue::byte_offset_of_buf()));
1255 
1256         const Register card_offset = rscratch2;
1257         // LR is free here, so we can use it to hold the byte_map_base.
1258         const Register byte_map_base = lr;
1259 


1281         __ add(card_addr, byte_map_base, card_addr);
1282 
1283         __ ldr(rscratch1, queue_index);
1284         __ cbz(rscratch1, runtime);
1285         __ sub(rscratch1, rscratch1, wordSize);
1286         __ str(rscratch1, queue_index);
1287 
1288         // Reuse LR to hold buffer_addr
1289         const Register buffer_addr = lr;
1290 
1291         __ ldr(buffer_addr, buffer);
1292         __ str(card_addr, Address(buffer_addr, rscratch1));
1293         __ b(done);
1294 
1295         __ bind(runtime);
1296         __ push_call_clobbered_registers();
1297         __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread);
1298         __ pop_call_clobbered_registers();
1299         __ bind(done);
1300 
1301       }
1302       break;
1303     case shenandoah_lrb_slow_id:
1304       {
1305         StubFrame f(sasm, "shenandoah_load_reference_barrier", dont_gc_arguments);
1306         // arg0 : object to be resolved
1307         
1308         __ push_call_clobbered_registers();
1309         f.load_argument(0, r0);
1310         f.load_argument(1, r1);
1311         if (UseCompressedOops) {
1312           __ mov(lr, CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_narrow));
1313         } else {
1314           __ mov(lr, CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier));
1315         }
1316         __ blr(lr);
1317         __ mov(rscratch1, r0);
1318         __ pop_call_clobbered_registers();
1319         __ mov(r0, rscratch1);
1320       }
1321       break;
1322 #endif
1323 
1324     case predicate_failed_trap_id:
1325       {
1326         StubFrame f(sasm, "predicate_failed_trap", dont_gc_arguments);
1327 
1328         OopMap* map = save_live_registers(sasm);
1329 
1330         int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, predicate_failed_trap));
1331         oop_maps = new OopMapSet();
1332         oop_maps->add_gc_map(call_offset, map);
1333         restore_live_registers(sasm);
1334         __ leave();
1335         DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();
1336         assert(deopt_blob != NULL, "deoptimization blob must have been created");
1337 
1338         __ far_jump(RuntimeAddress(deopt_blob->unpack_with_reexecution()));
1339       }


< prev index next >