31 #include "gc/shared/cardTableBarrierSet.hpp"
32 #include "gc/shared/collectedHeap.inline.hpp"
33 #include "interpreter/interpreter.hpp"
34 #include "memory/resourceArea.hpp"
35 #include "memory/universe.hpp"
36 #include "oops/klass.inline.hpp"
37 #include "prims/methodHandles.hpp"
38 #include "runtime/biasedLocking.hpp"
39 #include "runtime/interfaceSupport.inline.hpp"
40 #include "runtime/objectMonitor.hpp"
41 #include "runtime/os.hpp"
42 #include "runtime/safepoint.hpp"
43 #include "runtime/safepointMechanism.hpp"
44 #include "runtime/sharedRuntime.hpp"
45 #include "runtime/stubRoutines.hpp"
46 #include "runtime/thread.hpp"
47 #include "utilities/macros.hpp"
48 #if INCLUDE_ALL_GCS
49 #include "gc/g1/g1BarrierSet.hpp"
50 #include "gc/g1/g1CardTable.hpp"
51 #include "gc/g1/heapRegion.hpp"
52 #endif // INCLUDE_ALL_GCS
53 #include "crc32c.h"
54 #ifdef COMPILER2
55 #include "opto/intrinsicnode.hpp"
56 #endif
57
58 #ifdef PRODUCT
59 #define BLOCK_COMMENT(str) /* nothing */
60 #define STOP(error) stop(error)
61 #else
62 #define BLOCK_COMMENT(str) block_comment(str)
63 #define STOP(error) block_comment(error); stop(error)
64 #endif
65
66 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
67
68 #ifdef ASSERT
69 bool AbstractAssembler::pd_check_instruction_mark() { return true; }
70 #endif
5288 bool expand_call) {
5289
5290 // If expand_call is true then we expand the call_VM_leaf macro
5291 // directly to skip generating the check by
5292 // InterpreterMacroAssembler::call_VM_leaf_base that checks _last_sp.
5293
5294 #ifdef _LP64
5295 assert(thread == r15_thread, "must be");
5296 #endif // _LP64
5297
5298 Label done;
5299 Label runtime;
5300
5301 assert(pre_val != noreg, "check this code");
5302
5303 if (obj != noreg) {
5304 assert_different_registers(obj, pre_val, tmp);
5305 assert(pre_val != rax, "check this code");
5306 }
5307
5308 Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
5309 SATBMarkQueue::byte_offset_of_active()));
5310 Address index(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
5311 SATBMarkQueue::byte_offset_of_index()));
5312 Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
5313 SATBMarkQueue::byte_offset_of_buf()));
5314
5315
5316 // Is marking active?
5317 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
5318 cmpl(in_progress, 0);
5319 } else {
5320 assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
5321 cmpb(in_progress, 0);
5322 }
5323 jcc(Assembler::equal, done);
5324
5325 // Do we need to load the previous value?
5326 if (obj != noreg) {
5327 load_heap_oop(pre_val, Address(obj, 0));
5328 }
5329
5330 // Is the previous value null?
5331 cmpptr(pre_val, (int32_t) NULL_WORD);
5332 jcc(Assembler::equal, done);
5333
5386 if (pre_val != rax)
5387 pop(pre_val);
5388
5389 if (obj != noreg && obj != rax)
5390 pop(obj);
5391
5392 if(tosca_live) pop(rax);
5393
5394 bind(done);
5395 }
5396
5397 void MacroAssembler::g1_write_barrier_post(Register store_addr,
5398 Register new_val,
5399 Register thread,
5400 Register tmp,
5401 Register tmp2) {
5402 #ifdef _LP64
5403 assert(thread == r15_thread, "must be");
5404 #endif // _LP64
5405
5406 Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
5407 DirtyCardQueue::byte_offset_of_index()));
5408 Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
5409 DirtyCardQueue::byte_offset_of_buf()));
5410
5411 CardTableBarrierSet* ctbs =
5412 barrier_set_cast<CardTableBarrierSet>(Universe::heap()->barrier_set());
5413 CardTable* ct = ctbs->card_table();
5414 assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "adjust this code");
5415
5416 Label done;
5417 Label runtime;
5418
5419 // Does store cross heap regions?
5420
5421 movptr(tmp, store_addr);
5422 xorptr(tmp, new_val);
5423 shrptr(tmp, HeapRegion::LogOfHRGrainBytes);
5424 jcc(Assembler::equal, done);
5425
5426 // crosses regions, storing NULL?
5427
5428 cmpptr(new_val, (int32_t) NULL_WORD);
5429 jcc(Assembler::equal, done);
|
31 #include "gc/shared/cardTableBarrierSet.hpp"
32 #include "gc/shared/collectedHeap.inline.hpp"
33 #include "interpreter/interpreter.hpp"
34 #include "memory/resourceArea.hpp"
35 #include "memory/universe.hpp"
36 #include "oops/klass.inline.hpp"
37 #include "prims/methodHandles.hpp"
38 #include "runtime/biasedLocking.hpp"
39 #include "runtime/interfaceSupport.inline.hpp"
40 #include "runtime/objectMonitor.hpp"
41 #include "runtime/os.hpp"
42 #include "runtime/safepoint.hpp"
43 #include "runtime/safepointMechanism.hpp"
44 #include "runtime/sharedRuntime.hpp"
45 #include "runtime/stubRoutines.hpp"
46 #include "runtime/thread.hpp"
47 #include "utilities/macros.hpp"
48 #if INCLUDE_ALL_GCS
49 #include "gc/g1/g1BarrierSet.hpp"
50 #include "gc/g1/g1CardTable.hpp"
51 #include "gc/g1/g1ThreadLocalData.hpp"
52 #include "gc/g1/heapRegion.hpp"
53 #endif // INCLUDE_ALL_GCS
54 #include "crc32c.h"
55 #ifdef COMPILER2
56 #include "opto/intrinsicnode.hpp"
57 #endif
58
59 #ifdef PRODUCT
60 #define BLOCK_COMMENT(str) /* nothing */
61 #define STOP(error) stop(error)
62 #else
63 #define BLOCK_COMMENT(str) block_comment(str)
64 #define STOP(error) block_comment(error); stop(error)
65 #endif
66
67 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
68
69 #ifdef ASSERT
70 bool AbstractAssembler::pd_check_instruction_mark() { return true; }
71 #endif
5289 bool expand_call) {
5290
5291 // If expand_call is true then we expand the call_VM_leaf macro
5292 // directly to skip generating the check by
5293 // InterpreterMacroAssembler::call_VM_leaf_base that checks _last_sp.
5294
5295 #ifdef _LP64
5296 assert(thread == r15_thread, "must be");
5297 #endif // _LP64
5298
5299 Label done;
5300 Label runtime;
5301
5302 assert(pre_val != noreg, "check this code");
5303
5304 if (obj != noreg) {
5305 assert_different_registers(obj, pre_val, tmp);
5306 assert(pre_val != rax, "check this code");
5307 }
5308
5309 Address in_progress(thread, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()));
5310 Address index(thread, in_bytes(G1ThreadLocalData::satb_mark_queue_index_offset()));
5311 Address buffer(thread, in_bytes(G1ThreadLocalData::satb_mark_queue_buffer_offset()));
5312
5313
5314 // Is marking active?
5315 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
5316 cmpl(in_progress, 0);
5317 } else {
5318 assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
5319 cmpb(in_progress, 0);
5320 }
5321 jcc(Assembler::equal, done);
5322
5323 // Do we need to load the previous value?
5324 if (obj != noreg) {
5325 load_heap_oop(pre_val, Address(obj, 0));
5326 }
5327
5328 // Is the previous value null?
5329 cmpptr(pre_val, (int32_t) NULL_WORD);
5330 jcc(Assembler::equal, done);
5331
5384 if (pre_val != rax)
5385 pop(pre_val);
5386
5387 if (obj != noreg && obj != rax)
5388 pop(obj);
5389
5390 if(tosca_live) pop(rax);
5391
5392 bind(done);
5393 }
5394
5395 void MacroAssembler::g1_write_barrier_post(Register store_addr,
5396 Register new_val,
5397 Register thread,
5398 Register tmp,
5399 Register tmp2) {
5400 #ifdef _LP64
5401 assert(thread == r15_thread, "must be");
5402 #endif // _LP64
5403
5404 Address queue_index(thread, in_bytes(G1ThreadLocalData::dirty_card_queue_index_offset()));
5405 Address buffer(thread, in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset()));
5406
5407 CardTableBarrierSet* ctbs =
5408 barrier_set_cast<CardTableBarrierSet>(Universe::heap()->barrier_set());
5409 CardTable* ct = ctbs->card_table();
5410 assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "adjust this code");
5411
5412 Label done;
5413 Label runtime;
5414
5415 // Does store cross heap regions?
5416
5417 movptr(tmp, store_addr);
5418 xorptr(tmp, new_val);
5419 shrptr(tmp, HeapRegion::LogOfHRGrainBytes);
5420 jcc(Assembler::equal, done);
5421
5422 // crosses regions, storing NULL?
5423
5424 cmpptr(new_val, (int32_t) NULL_WORD);
5425 jcc(Assembler::equal, done);
|