# HG changeset patch # User roland # Date 1538137462 -7200 # Node ID 755b367c213495d7d2a730570ee4e091f6a1e982 # Parent 1c8745e31fa37ff804bebc54e2a508934ccefc8e 8211232: GraphKit::make_runtime_call() sometimes attaches wrong memory state to call Reviewed-by: kvn diff -r 1c8745e31fa3 -r 755b367c2134 src/hotspot/share/opto/graphKit.cpp --- a/src/hotspot/share/opto/graphKit.cpp Wed Oct 10 14:13:32 2018 +0100 +++ b/src/hotspot/share/opto/graphKit.cpp Fri Sep 28 14:24:22 2018 +0200 @@ -1804,12 +1804,13 @@ // A better answer would be to separate out card marks from other memory. // For now, return the input memory state, so that it can be reused // after the call, if this call has restricted memory effects. -Node* GraphKit::set_predefined_input_for_runtime_call(SafePointNode* call) { +Node* GraphKit::set_predefined_input_for_runtime_call(SafePointNode* call, Node* narrow_mem) { // Set fixed predefined input arguments Node* memory = reset_memory(); + Node* m = narrow_mem == NULL ? memory : narrow_mem; call->init_req( TypeFunc::Control, control() ); call->init_req( TypeFunc::I_O, top() ); // does no i/o - call->init_req( TypeFunc::Memory, memory ); // may gc ptrs + call->init_req( TypeFunc::Memory, m ); // may gc ptrs call->init_req( TypeFunc::FramePtr, frameptr() ); call->init_req( TypeFunc::ReturnAdr, top() ); return memory; @@ -2465,9 +2466,7 @@ } else { assert(!wide_out, "narrow in => narrow out"); Node* narrow_mem = memory(adr_type); - prev_mem = reset_memory(); - map()->set_memory(narrow_mem); - set_predefined_input_for_runtime_call(call); + prev_mem = set_predefined_input_for_runtime_call(call, narrow_mem); } // Hook each parm in order. Stop looking at the first NULL. diff -r 1c8745e31fa3 -r 755b367c2134 src/hotspot/share/opto/graphKit.hpp --- a/src/hotspot/share/opto/graphKit.hpp Wed Oct 10 14:13:32 2018 +0100 +++ b/src/hotspot/share/opto/graphKit.hpp Fri Sep 28 14:24:22 2018 +0200 @@ -699,7 +699,7 @@ void set_predefined_output_for_runtime_call(Node* call, Node* keep_mem, const TypePtr* hook_mem); - Node* set_predefined_input_for_runtime_call(SafePointNode* call); + Node* set_predefined_input_for_runtime_call(SafePointNode* call, Node* narrow_mem = NULL); // Replace the call with the current state of the kit. Requires // that the call was generated with separate io_projs so that