Skip to content

Commit

Permalink
8336837: [lworld] Invalid monitor information in JVMState when buffer…
Browse files Browse the repository at this point in the history
…ing at return
  • Loading branch information
TobiHartmann committed Aug 13, 2024
1 parent e30fca0 commit 99a2cb0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/hotspot/share/opto/parse1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2399,17 +2399,6 @@ void Parse::return_current(Node* value) {
call_register_finalizer();
}

// Do not set_parse_bci, so that return goo is credited to the return insn.
// vreturn can trigger an allocation so vreturn can throw. Setting
// the bci here breaks exception handling. Commenting this out
// doesn't seem to break anything.
// set_bci(InvocationEntryBci);
if (method()->is_synchronized() && GenerateSynchronizationCode) {
shared_unlock(_synch_lock->box_node(), _synch_lock->obj_node());
}
if (C->env()->dtrace_method_probes()) {
make_dtrace_method_exit(method());
}
// frame pointer is always same, already captured
if (value != nullptr) {
Node* phi = _exits.argument(0);
Expand Down Expand Up @@ -2445,6 +2434,15 @@ void Parse::return_current(Node* value) {
phi->add_req(value);
}

// Do not set_parse_bci, so that return goo is credited to the return insn.
set_bci(InvocationEntryBci);
if (method()->is_synchronized() && GenerateSynchronizationCode) {
shared_unlock(_synch_lock->box_node(), _synch_lock->obj_node());
}
if (C->env()->dtrace_method_probes()) {
make_dtrace_method_exit(method());
}

SafePointNode* exit_return = _exits.map();
exit_return->in( TypeFunc::Control )->add_req( control() );
exit_return->in( TypeFunc::I_O )->add_req( i_o () );
Expand Down
12 changes: 12 additions & 0 deletions test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestLWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -4400,6 +4400,7 @@ static value class MyValue161 {
int x = 0;
}

// Test merging value classes with Object fields
@Test
public MyValueContainer test161(boolean b) {
MyValueContainer res = b ? new MyValueContainer(new MyValue161()) : null;
Expand Down Expand Up @@ -4483,4 +4484,15 @@ public void test166_verifier() {
Asserts.assertEquals(test166(true), new MyValueContainer(42));
Asserts.assertEquals(test166(false), new MyValueContainer(new MyValue161()));
}

// Verify that monitor information in JVMState is correct at method exit
@Test
public synchronized Object test167() {
return MyValue1.createWithFieldsInline(rI, rL); // Might trigger buffering which requires JVMState
}

@Run(test = "test167")
public void test167_verifier() {
Asserts.assertEquals(((MyValue1)test167()).hash(), hash());
}
}

0 comments on commit 99a2cb0

Please sign in to comment.