27 #include "c1/c1_Defs.hpp"
28 #include "c1/c1_FrameMap.hpp"
29 #include "c1/c1_Instruction.hpp"
30 #include "c1/c1_LIRAssembler.hpp"
31 #include "c1/c1_LIRGenerator.hpp"
32 #include "c1/c1_ValueStack.hpp"
33 #include "ci/ciArrayKlass.hpp"
34 #include "ci/ciInstance.hpp"
35 #include "ci/ciObjArray.hpp"
36 #include "ci/ciUtilities.hpp"
37 #include "gc/shared/cardTable.hpp"
38 #include "gc/shared/cardTableBarrierSet.hpp"
39 #include "gc/shared/collectedHeap.hpp"
40 #include "runtime/arguments.hpp"
41 #include "runtime/sharedRuntime.hpp"
42 #include "runtime/stubRoutines.hpp"
43 #include "runtime/vm_version.hpp"
44 #include "utilities/bitMap.inline.hpp"
45 #include "utilities/macros.hpp"
46 #if INCLUDE_ALL_GCS
47 #include "gc/g1/heapRegion.hpp"
48 #endif // INCLUDE_ALL_GCS
49 #ifdef TRACE_HAVE_INTRINSICS
50 #include "trace/traceMacros.hpp"
51 #endif
52
53 #ifdef ASSERT
54 #define __ gen()->lir(__FILE__, __LINE__)->
55 #else
56 #define __ gen()->lir()->
57 #endif
58
59 #ifndef PATCHED_ADDR
60 #define PATCHED_ADDR (max_jint)
61 #endif
62
63 void PhiResolverState::reset(int max_vregs) {
64 // Initialize array sizes
65 _virtual_operands.at_put_grow(max_vregs - 1, NULL, NULL);
66 _virtual_operands.trunc_to(0);
1489 }
1490
1491 ////////////////////////////////////////////////////////////////////////
1492 #if INCLUDE_ALL_GCS
1493
1494 void LIRGenerator::G1BarrierSet_pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val,
1495 bool do_load, bool patch, CodeEmitInfo* info) {
1496 // First we test whether marking is in progress.
1497 BasicType flag_type;
1498 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
1499 flag_type = T_INT;
1500 } else {
1501 guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1,
1502 "Assumption");
1503 // Use unsigned type T_BOOLEAN here rather than signed T_BYTE since some platforms, eg. ARM,
1504 // need to use unsigned instructions to use the large offset to load the satb_mark_queue.
1505 flag_type = T_BOOLEAN;
1506 }
1507 LIR_Opr thrd = getThreadPointer();
1508 LIR_Address* mark_active_flag_addr =
1509 new LIR_Address(thrd,
1510 in_bytes(JavaThread::satb_mark_queue_offset() +
1511 SATBMarkQueue::byte_offset_of_active()),
1512 flag_type);
1513 // Read the marking-in-progress flag.
1514 LIR_Opr flag_val = new_register(T_INT);
1515 __ load(mark_active_flag_addr, flag_val);
1516 __ cmp(lir_cond_notEqual, flag_val, LIR_OprFact::intConst(0));
1517
1518 LIR_PatchCode pre_val_patch_code = lir_patch_none;
1519
1520 CodeStub* slow;
1521
1522 if (do_load) {
1523 assert(pre_val == LIR_OprFact::illegalOpr, "sanity");
1524 assert(addr_opr != LIR_OprFact::illegalOpr, "sanity");
1525
1526 if (patch)
1527 pre_val_patch_code = lir_patch_normal;
1528
1529 pre_val = new_register(T_OBJECT);
1530
1531 if (!addr_opr->is_address()) {
1532 assert(addr_opr->is_register(), "must be");
|
27 #include "c1/c1_Defs.hpp"
28 #include "c1/c1_FrameMap.hpp"
29 #include "c1/c1_Instruction.hpp"
30 #include "c1/c1_LIRAssembler.hpp"
31 #include "c1/c1_LIRGenerator.hpp"
32 #include "c1/c1_ValueStack.hpp"
33 #include "ci/ciArrayKlass.hpp"
34 #include "ci/ciInstance.hpp"
35 #include "ci/ciObjArray.hpp"
36 #include "ci/ciUtilities.hpp"
37 #include "gc/shared/cardTable.hpp"
38 #include "gc/shared/cardTableBarrierSet.hpp"
39 #include "gc/shared/collectedHeap.hpp"
40 #include "runtime/arguments.hpp"
41 #include "runtime/sharedRuntime.hpp"
42 #include "runtime/stubRoutines.hpp"
43 #include "runtime/vm_version.hpp"
44 #include "utilities/bitMap.inline.hpp"
45 #include "utilities/macros.hpp"
46 #if INCLUDE_ALL_GCS
47 #include "gc/g1/g1ThreadLocalData.hpp"
48 #include "gc/g1/heapRegion.hpp"
49 #endif // INCLUDE_ALL_GCS
50 #ifdef TRACE_HAVE_INTRINSICS
51 #include "trace/traceMacros.hpp"
52 #endif
53
54 #ifdef ASSERT
55 #define __ gen()->lir(__FILE__, __LINE__)->
56 #else
57 #define __ gen()->lir()->
58 #endif
59
60 #ifndef PATCHED_ADDR
61 #define PATCHED_ADDR (max_jint)
62 #endif
63
64 void PhiResolverState::reset(int max_vregs) {
65 // Initialize array sizes
66 _virtual_operands.at_put_grow(max_vregs - 1, NULL, NULL);
67 _virtual_operands.trunc_to(0);
1490 }
1491
1492 ////////////////////////////////////////////////////////////////////////
1493 #if INCLUDE_ALL_GCS
1494
1495 void LIRGenerator::G1BarrierSet_pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val,
1496 bool do_load, bool patch, CodeEmitInfo* info) {
1497 // First we test whether marking is in progress.
1498 BasicType flag_type;
1499 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
1500 flag_type = T_INT;
1501 } else {
1502 guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1,
1503 "Assumption");
1504 // Use unsigned type T_BOOLEAN here rather than signed T_BYTE since some platforms, eg. ARM,
1505 // need to use unsigned instructions to use the large offset to load the satb_mark_queue.
1506 flag_type = T_BOOLEAN;
1507 }
1508 LIR_Opr thrd = getThreadPointer();
1509 LIR_Address* mark_active_flag_addr =
1510 new LIR_Address(thrd, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()), flag_type);
1511 // Read the marking-in-progress flag.
1512 LIR_Opr flag_val = new_register(T_INT);
1513 __ load(mark_active_flag_addr, flag_val);
1514 __ cmp(lir_cond_notEqual, flag_val, LIR_OprFact::intConst(0));
1515
1516 LIR_PatchCode pre_val_patch_code = lir_patch_none;
1517
1518 CodeStub* slow;
1519
1520 if (do_load) {
1521 assert(pre_val == LIR_OprFact::illegalOpr, "sanity");
1522 assert(addr_opr != LIR_OprFact::illegalOpr, "sanity");
1523
1524 if (patch)
1525 pre_val_patch_code = lir_patch_normal;
1526
1527 pre_val = new_register(T_OBJECT);
1528
1529 if (!addr_opr->is_address()) {
1530 assert(addr_opr->is_register(), "must be");
|