< prev index next >
src/share/vm/opto/graphKit.cpp
Print this page
*** 25,34 ****
--- 25,35 ----
#include "precompiled.hpp"
#include "compiler/compileLog.hpp"
#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
#include "gc_implementation/g1/heapRegion.hpp"
#include "gc_interface/collectedHeap.hpp"
+ #include "gc_implementation/shenandoah/shenandoahHeap.hpp"
#include "memory/barrierSet.hpp"
#include "memory/cardTableModRefBS.hpp"
#include "opto/addnode.hpp"
#include "opto/graphKit.hpp"
#include "opto/idealKit.hpp"
*** 38,47 ****
--- 39,53 ----
#include "opto/rootnode.hpp"
#include "opto/runtime.hpp"
#include "runtime/deoptimization.hpp"
#include "runtime/sharedRuntime.hpp"
+ #if INCLUDE_ALL_GCS
+ #include "gc_implementation/shenandoah/c2/shenandoahBarrierSetC2.hpp"
+ #include "gc_implementation/shenandoah/c2/shenandoahSupport.hpp"
+ #endif
+
//----------------------------GraphKit-----------------------------------------
// Main utility constructor.
GraphKit::GraphKit(JVMState* jvms)
: Phase(Phase::Parser),
_env(C->env()),
*** 1533,1543 ****
switch (bs->kind()) {
case BarrierSet::G1SATBCT:
case BarrierSet::G1SATBCTLogging:
g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt);
break;
!
case BarrierSet::CardTableModRef:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
break;
--- 1539,1553 ----
switch (bs->kind()) {
case BarrierSet::G1SATBCT:
case BarrierSet::G1SATBCTLogging:
g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt);
break;
! case BarrierSet::ShenandoahBarrierSet:
! if (ShenandoahSATBBarrier) {
! g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt);
! }
! break;
case BarrierSet::CardTableModRef:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
break;
*** 1551,1560 ****
--- 1561,1571 ----
bool GraphKit::can_move_pre_barrier() const {
BarrierSet* bs = Universe::heap()->barrier_set();
switch (bs->kind()) {
case BarrierSet::G1SATBCT:
case BarrierSet::G1SATBCTLogging:
+ case BarrierSet::ShenandoahBarrierSet:
return true; // Can move it if no safepoint
case BarrierSet::CardTableModRef:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
*** 1580,1590 ****
switch (bs->kind()) {
case BarrierSet::G1SATBCT:
case BarrierSet::G1SATBCTLogging:
g1_write_barrier_post(store, obj, adr, adr_idx, val, bt, use_precise);
break;
!
case BarrierSet::CardTableModRef:
case BarrierSet::CardTableExtension:
write_barrier_post(store, obj, adr, adr_idx, val, use_precise);
break;
--- 1591,1605 ----
switch (bs->kind()) {
case BarrierSet::G1SATBCT:
case BarrierSet::G1SATBCTLogging:
g1_write_barrier_post(store, obj, adr, adr_idx, val, bt, use_precise);
break;
! case BarrierSet::ShenandoahBarrierSet:
! if (ShenandoahStoreValEnqueueBarrier) {
! g1_write_barrier_pre(false, NULL, NULL, max_juint, NULL, NULL, val, bt);
! }
! break;
case BarrierSet::CardTableModRef:
case BarrierSet::CardTableExtension:
write_barrier_post(store, obj, adr, adr_idx, val, use_precise);
break;
*** 1705,1714 ****
--- 1720,1734 ----
Node* adr = array_element_address(ary, idx, elembt, arytype->size());
if (elembt == T_NARROWOOP) {
elembt = T_OBJECT; // To satisfy switch in LoadNode::make()
}
Node* ld = make_load(ctl, adr, elemtype, elembt, arytype, MemNode::unordered);
+ #if INCLUDE_ALL_GCS
+ if (UseShenandoahGC && (elembt == T_OBJECT || elembt == T_ARRAY)) {
+ ld = ShenandoahBarrierSetC2::bsc2()->load_reference_barrier(this, ld);
+ }
+ #endif
return ld;
}
//-------------------------set_arguments_for_java_call-------------------------
// Arguments (pre-popped from the stack) are taken from the JVMS.
*** 3663,3672 ****
--- 3683,3698 ----
// Given an oop pointer or raw pointer, see if it feeds from an AllocateNode.
AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseTransform* phase) {
if (ptr == NULL) { // reduce dumb test in callers
return NULL;
}
+
+ #if INCLUDE_ALL_GCS
+ if (UseShenandoahGC) {
+ ptr = ShenandoahBarrierSetC2::bsc2()->step_over_gc_barrier(ptr);
+ }
+ #endif
if (ptr->is_CheckCastPP()) { // strip only one raw-to-oop cast
ptr = ptr->in(1);
if (ptr == NULL) return NULL;
}
// Return NULL for allocations with several casts:
*** 3921,3931 ****
Node* marking_adr = __ AddP(no_base, tls, __ ConX(marking_offset));
Node* buffer_adr = __ AddP(no_base, tls, __ ConX(buffer_offset));
Node* index_adr = __ AddP(no_base, tls, __ ConX(index_offset));
// Now some of the values
! Node* marking = __ load(__ ctrl(), marking_adr, TypeInt::INT, active_type, Compile::AliasIdxRaw);
// if (!marking)
__ if_then(marking, BoolTest::ne, zero, unlikely); {
BasicType index_bt = TypeX_X->basic_type();
assert(sizeof(size_t) == type2aelembytes(index_bt), "Loading G1 PtrQueue::_index with wrong size.");
--- 3947,3966 ----
Node* marking_adr = __ AddP(no_base, tls, __ ConX(marking_offset));
Node* buffer_adr = __ AddP(no_base, tls, __ ConX(buffer_offset));
Node* index_adr = __ AddP(no_base, tls, __ ConX(index_offset));
// Now some of the values
! Node* marking;
! if (UseShenandoahGC) {
! Node* gc_state = __ AddP(no_base, tls, __ ConX(in_bytes(JavaThread::gc_state_offset())));
! Node* ld = __ load(__ ctrl(), gc_state, TypeInt::BYTE, T_BYTE, Compile::AliasIdxRaw);
! marking = __ AndI(ld, __ ConI(ShenandoahHeap::MARKING));
! assert(ShenandoahBarrierC2Support::is_gc_state_load(ld), "Should match the shape");
! } else {
! assert(UseG1GC, "should be");
! marking = __ load(__ ctrl(), marking_adr, TypeInt::INT, active_type, Compile::AliasIdxRaw);
! }
// if (!marking)
__ if_then(marking, BoolTest::ne, zero, unlikely); {
BasicType index_bt = TypeX_X->basic_type();
assert(sizeof(size_t) == type2aelembytes(index_bt), "Loading G1 PtrQueue::_index with wrong size.");
*** 3962,3971 ****
--- 3997,4015 ----
} __ end_if(); // (pre_val != NULL)
} __ end_if(); // (!marking)
// Final sync IdealKit and GraphKit.
final_sync(ideal);
+
+ #if INCLUDE_ALL_GCS
+ if (UseShenandoahGC && adr != NULL) {
+ Node* c = control();
+ Node* call = c->in(1)->in(1)->in(1)->in(0);
+ assert(call->is_g1_wb_pre_call(), "g1_wb_pre call expected");
+ call->add_req(adr);
+ }
+ #endif
}
//
// Update the card table and add card address to the queue
//
*** 4153,4162 ****
--- 4197,4211 ----
TypeAry::make(TypeInt::CHAR,TypeInt::POS),
ciTypeArrayKlass::make(T_CHAR), true, 0);
int value_field_idx = C->get_alias_index(value_field_type);
Node* load = make_load(ctrl, basic_plus_adr(str, str, value_offset),
value_type, T_OBJECT, value_field_idx, MemNode::unordered);
+ #if INCLUDE_ALL_GCS
+ if (UseShenandoahGC) {
+ load = ShenandoahBarrierSetC2::bsc2()->load_reference_barrier(this, load);
+ }
+ #endif
// String.value field is known to be @Stable.
if (UseImplicitStableValues) {
load = cast_array_to_stable(load, value_type);
}
return load;
< prev index next >