< prev index next >

src/hotspot/share/opto/graphKit.cpp

Print this page

        

*** 41,50 **** --- 41,54 ---- #include "opto/parse.hpp" #include "opto/rootnode.hpp" #include "opto/runtime.hpp" #include "runtime/deoptimization.hpp" #include "runtime/sharedRuntime.hpp" + #include "utilities/macros.hpp" + #if INCLUDE_SHENANDOAHGC + #include "gc/shenandoah/c2/shenandoahBarrierSetC2.hpp" + #endif //----------------------------GraphKit----------------------------------------- // Main utility constructor. GraphKit::GraphKit(JVMState* jvms) : Phase(Phase::Parser),
*** 595,604 **** --- 599,610 ---- C->log()->elem("hot_throw preallocated='1' reason='%s'", Deoptimization::trap_reason_name(reason)); const TypeInstPtr* ex_con = TypeInstPtr::make(ex_obj); Node* ex_node = _gvn.transform(ConNode::make(ex_con)); + ex_node = access_resolve_for_write(ex_node); + // Clear the detail message of the preallocated exception object. // Weblogic sometimes mutates the detail message of exceptions // using reflection. int offset = java_lang_Throwable::get_detailMessage_offset(); const TypePtr* adr_typ = ex_con->add_offset(offset);
*** 1679,1688 **** --- 1685,1703 ---- void GraphKit::access_clone(Node* ctl, Node* src, Node* dst, Node* size, bool is_array) { set_control(ctl); return _barrier_set->clone(this, src, dst, size, is_array); } + Node* GraphKit::access_resolve_for_read(Node* n) { + return _barrier_set->resolve_for_read(this, n); + } + + Node* GraphKit::access_resolve_for_write(Node* n) { + return _barrier_set->resolve_for_write(this, n); + } + + //-------------------------array_element_address------------------------- Node* GraphKit::array_element_address(Node* ary, Node* idx, BasicType elembt, const TypeInt* sizetype, Node* ctrl) { uint shift = exact_log2(type2aelembytes(elembt)); uint header = arrayOopDesc::base_offset_in_bytes(elembt);
*** 3216,3225 **** --- 3231,3242 ---- if (stopped()) // Dead monitor? return NULL; assert(dead_locals_are_killed(), "should kill locals before sync. point"); + obj = access_resolve_for_write(obj); + // Box the stack location Node* box = _gvn.transform(new BoxLockNode(next_monitor())); Node* mem = reset_memory(); FastLockNode * flock = _gvn.transform(new FastLockNode(0, obj, box) )->as_FastLock();
*** 3711,3720 **** --- 3728,3743 ---- // 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_SHENANDOAHGC + // Attempt to see through Shenandoah barriers. + ptr = ShenandoahBarrierNode::skip_through_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:
*** 3837,3846 **** --- 3860,3876 ---- false, NULL, 0); const TypePtr* value_field_type = string_type->add_offset(value_offset); const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull, TypeAry::make(TypeInt::BYTE, TypeInt::POS), ciTypeArrayKlass::make(T_BYTE), true, 0); + + #if INCLUDE_SHENANDOAHGC + if (!ShenandoahOptimizeInstanceFinals) { + str = access_resolve_for_read(str); + } + #endif + Node* p = basic_plus_adr(str, str, value_offset); Node* load = access_load_at(str, p, value_field_type, value_type, T_OBJECT, IN_HEAP | C2_CONTROL_DEPENDENT_LOAD); // String.value field is known to be @Stable. if (UseImplicitStableValues) {
*** 3856,3885 **** int coder_offset = java_lang_String::coder_offset_in_bytes(); const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), false, NULL, 0); const TypePtr* coder_field_type = string_type->add_offset(coder_offset); int coder_field_idx = C->get_alias_index(coder_field_type); return make_load(ctrl, basic_plus_adr(str, str, coder_offset), TypeInt::BYTE, T_BYTE, coder_field_idx, MemNode::unordered); } void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) { int value_offset = java_lang_String::value_offset_in_bytes(); const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), false, NULL, 0); const TypePtr* value_field_type = string_type->add_offset(value_offset); access_store_at(ctrl, str, basic_plus_adr(str, value_offset), value_field_type, value, TypeAryPtr::BYTES, T_OBJECT, IN_HEAP); } void GraphKit::store_String_coder(Node* ctrl, Node* str, Node* value) { int coder_offset = java_lang_String::coder_offset_in_bytes(); const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), false, NULL, 0); const TypePtr* coder_field_type = string_type->add_offset(coder_offset); int coder_field_idx = C->get_alias_index(coder_field_type); ! store_to_memory(ctrl, basic_plus_adr(str, coder_offset), value, T_BYTE, coder_field_idx, MemNode::unordered); } // Capture src and dst memory state with a MergeMemNode Node* GraphKit::capture_memory(const TypePtr* src_type, const TypePtr* dst_type) { --- 3886,3928 ---- int coder_offset = java_lang_String::coder_offset_in_bytes(); const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), false, NULL, 0); const TypePtr* coder_field_type = string_type->add_offset(coder_offset); int coder_field_idx = C->get_alias_index(coder_field_type); + + #if INCLUDE_SHENANDOAHGC + if (!ShenandoahOptimizeInstanceFinals) { + str = access_resolve_for_read(str); + } + #endif + return make_load(ctrl, basic_plus_adr(str, str, coder_offset), TypeInt::BYTE, T_BYTE, coder_field_idx, MemNode::unordered); } void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) { int value_offset = java_lang_String::value_offset_in_bytes(); const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), false, NULL, 0); const TypePtr* value_field_type = string_type->add_offset(value_offset); + + str = access_resolve_for_write(str); + access_store_at(ctrl, str, basic_plus_adr(str, value_offset), value_field_type, value, TypeAryPtr::BYTES, T_OBJECT, IN_HEAP); } void GraphKit::store_String_coder(Node* ctrl, Node* str, Node* value) { int coder_offset = java_lang_String::coder_offset_in_bytes(); const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), false, NULL, 0); + + str = access_resolve_for_write(str); + const TypePtr* coder_field_type = string_type->add_offset(coder_offset); int coder_field_idx = C->get_alias_index(coder_field_type); ! store_to_memory(control(), basic_plus_adr(str, coder_offset), value, T_BYTE, coder_field_idx, MemNode::unordered); } // Capture src and dst memory state with a MergeMemNode Node* GraphKit::capture_memory(const TypePtr* src_type, const TypePtr* dst_type) {
*** 3927,3936 **** --- 3970,3982 ---- StrInflatedCopyNode* str = new StrInflatedCopyNode(control(), mem, src, dst, count); set_memory(_gvn.transform(str), dst_type); } void GraphKit::inflate_string_slow(Node* src, Node* dst, Node* start, Node* count) { + src = access_resolve_for_read(src); + dst = access_resolve_for_write(dst); + /** * int i_char = start; * for (int i_byte = 0; i_byte < count; i_byte++) { * dst[i_char++] = (char)(src[i_byte] & 0xff); * }
< prev index next >