@@ -472,9 +472,7 @@ void ShenandoahBarrierSetC2::post_barrier(GraphKit* kit,
472
472
Node* val,
473
473
BasicType bt,
474
474
bool use_precise) const {
475
- if (!ShenandoahHeap::heap ()->mode ()->is_generational ()) {
476
- return ;
477
- }
475
+ assert (ShenandoahCardBarrier, " Did you mean to enable ShenandoahCardBarrier?" );
478
476
479
477
// No store check needed if we're storing a null.
480
478
if (val != nullptr && val->is_Con ()) {
@@ -604,11 +602,13 @@ Node* ShenandoahBarrierSetC2::store_at_resolved(C2Access& access, C2AccessValue&
604
602
605
603
Node* result = BarrierSetC2::store_at_resolved (access , val);
606
604
607
- bool anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0 ;
608
- bool is_array = (decorators & IS_ARRAY) != 0 ;
609
- bool use_precise = is_array || anonymous;
610
- post_barrier (kit, kit->control (), access .raw_access (), access .base (),
611
- adr, adr_idx, val.node (), access .type (), use_precise);
605
+ if (ShenandoahCardBarrier) {
606
+ const bool anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0 ;
607
+ const bool is_array = (decorators & IS_ARRAY) != 0 ;
608
+ const bool use_precise = is_array || anonymous;
609
+ post_barrier (kit, kit->control (), access .raw_access (), access .base (),
610
+ adr, adr_idx, val.node (), access .type (), use_precise);
611
+ }
612
612
return result;
613
613
} else {
614
614
assert (access .is_opt_access (), " only for optimization passes" );
@@ -734,8 +734,10 @@ Node* ShenandoahBarrierSetC2::atomic_cmpxchg_val_at_resolved(C2AtomicParseAccess
734
734
}
735
735
#endif
736
736
load_store = kit->gvn ().transform (new ShenandoahLoadReferenceBarrierNode (nullptr , load_store, access .decorators ()));
737
- post_barrier (kit, kit->control (), access .raw_access (), access .base (),
738
- access .addr ().node (), access .alias_idx (), new_val, T_OBJECT, true );
737
+ if (ShenandoahCardBarrier) {
738
+ post_barrier (kit, kit->control (), access .raw_access (), access .base (),
739
+ access .addr ().node (), access .alias_idx (), new_val, T_OBJECT, true );
740
+ }
739
741
return load_store;
740
742
}
741
743
return BarrierSetC2::atomic_cmpxchg_val_at_resolved (access , expected_val, new_val, value_type);
@@ -791,8 +793,10 @@ Node* ShenandoahBarrierSetC2::atomic_cmpxchg_bool_at_resolved(C2AtomicParseAcces
791
793
}
792
794
access .set_raw_access (load_store);
793
795
pin_atomic_op (access );
794
- post_barrier (kit, kit->control (), access .raw_access (), access .base (),
795
- access .addr ().node (), access .alias_idx (), new_val, T_OBJECT, true );
796
+ if (ShenandoahCardBarrier) {
797
+ post_barrier (kit, kit->control (), access .raw_access (), access .base (),
798
+ access .addr ().node (), access .alias_idx (), new_val, T_OBJECT, true );
799
+ }
796
800
return load_store;
797
801
}
798
802
return BarrierSetC2::atomic_cmpxchg_bool_at_resolved (access , expected_val, new_val, value_type);
@@ -809,8 +813,10 @@ Node* ShenandoahBarrierSetC2::atomic_xchg_at_resolved(C2AtomicParseAccess& acces
809
813
shenandoah_write_barrier_pre (kit, false /* do_load */ ,
810
814
nullptr , nullptr , max_juint, nullptr , nullptr ,
811
815
result /* pre_val */ , T_OBJECT);
812
- post_barrier (kit, kit->control (), access .raw_access (), access .base (),
813
- access .addr ().node (), access .alias_idx (), val, T_OBJECT, true );
816
+ if (ShenandoahCardBarrier) {
817
+ post_barrier (kit, kit->control (), access .raw_access (), access .base (),
818
+ access .addr ().node (), access .alias_idx (), val, T_OBJECT, true );
819
+ }
814
820
}
815
821
return result;
816
822
}
@@ -1013,7 +1019,7 @@ void ShenandoahBarrierSetC2::eliminate_gc_barrier(PhaseMacroExpand* macro, Node*
1013
1019
if (is_shenandoah_wb_pre_call (node)) {
1014
1020
shenandoah_eliminate_wb_pre (node, ¯o->igvn ());
1015
1021
}
1016
- if (node->Opcode () == Op_CastP2X && ShenandoahHeap::heap ()-> mode ()-> is_generational () ) {
1022
+ if (ShenandoahCardBarrier && node->Opcode () == Op_CastP2X) {
1017
1023
Node* shift = node->unique_out ();
1018
1024
Node* addp = shift->unique_out ();
1019
1025
for (DUIterator_Last jmin, j = addp->last_outs (jmin); j >= jmin; --j) {
0 commit comments