From 88db4ebe6db0c968ede31bf71aa0cf8ee196d6c0 Mon Sep 17 00:00:00 2001 From: never Date: Wed, 4 Feb 2009 23:17:38 -0800 Subject: [PATCH] 6442502: assert(bits,"Use TypePtr for NULL") on linux-x86 Reviewed-by: kvn --- src/share/vm/opto/graphKit.cpp | 15 ++------------- src/share/vm/opto/graphKit.hpp | 12 ++++++++++++ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/share/vm/opto/graphKit.cpp b/src/share/vm/opto/graphKit.cpp index 36a6eafde..d5d03d68c 100644 --- a/src/share/vm/opto/graphKit.cpp +++ b/src/share/vm/opto/graphKit.cpp @@ -1836,10 +1836,7 @@ void GraphKit::write_barrier_post(Node* oop_store, Node* obj, Node* adr, (CardTableModRefBS*)(Universe::heap()->barrier_set()); Node *b = _gvn.transform(new (C, 3) URShiftXNode( cast, _gvn.intcon(CardTableModRefBS::card_shift) )); // We store into a byte array, so do not bother to left-shift by zero - // Get base of card map - assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), - "adjust this code"); - Node *c = makecon(TypeRawPtr::make((address)ct->byte_map_base)); + Node *c = byte_map_base_node(); // Combine Node *sb_ctl = control(); Node *sb_adr = _gvn.transform(new (C, 4) AddPNode( top()/*no base ptr*/, c, b )); @@ -3365,14 +3362,6 @@ void GraphKit::g1_write_barrier_post(Node* store, const TypeFunc *tf = OptoRuntime::g1_wb_post_Type(); - // Get the address of the card table - CardTableModRefBS* ct = - (CardTableModRefBS*)(Universe::heap()->barrier_set()); - Node *card_table = __ makecon(TypeRawPtr::make((address)ct->byte_map_base)); - // Get base of card map - assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); - - // Offsets into the thread const int index_offset = in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_index()); @@ -3402,7 +3391,7 @@ void GraphKit::g1_write_barrier_post(Node* store, Node* card_offset = __ URShiftX( cast, __ ConI(CardTableModRefBS::card_shift) ); // Combine card table base and card offset - Node *card_adr = __ AddP(no_base, card_table, card_offset ); + Node *card_adr = __ AddP(no_base, byte_map_base_node(), card_offset ); // If we know the value being stored does it cross regions? diff --git a/src/share/vm/opto/graphKit.hpp b/src/share/vm/opto/graphKit.hpp index 0817ed3bf..160e3376c 100644 --- a/src/share/vm/opto/graphKit.hpp +++ b/src/share/vm/opto/graphKit.hpp @@ -83,6 +83,18 @@ class GraphKit : public Phase { Node* zerocon(BasicType bt) const { return _gvn.zerocon(bt); } // (See also macro MakeConX in type.hpp, which uses intcon or longcon.) + // Helper for byte_map_base + Node* byte_map_base_node() { + // Get base of card map + CardTableModRefBS* ct = (CardTableModRefBS*)(Universe::heap()->barrier_set()); + assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust users of this code"); + if (ct->byte_map_base != NULL) { + return makecon(TypeRawPtr::make((address)ct->byte_map_base)); + } else { + return null(); + } + } + jint find_int_con(Node* n, jint value_if_unknown) { return _gvn.find_int_con(n, value_if_unknown); } -- GitLab