-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
8318682: SA decoding of scalar replaced objects is broken
Reviewed-by: cjplummer, cslucas
- Loading branch information
Tom Rodriguez
committed
Apr 30, 2024
1 parent
a863ef5
commit b96b38c
Showing
13 changed files
with
423 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/MarkerValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
* | ||
*/ | ||
|
||
package sun.jvm.hotspot.code; | ||
|
||
import java.io.PrintStream; | ||
|
||
/** A placeholder value that has no concrete meaning other than helping constructing | ||
* other values. | ||
*/ | ||
public class MarkerValue extends ScopeValue { | ||
public boolean isMarker() { return true; } | ||
|
||
public void printOn(PrintStream tty) { | ||
tty.print("marker"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/ObjectMergeValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
* | ||
*/ | ||
|
||
package sun.jvm.hotspot.code; | ||
|
||
import java.io.PrintStream; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
class ObjectMergeValue extends ObjectValue { | ||
|
||
private ScopeValue selector; | ||
private ScopeValue mergePointer; | ||
private List<ScopeValue> possibleObjects; | ||
|
||
public ObjectMergeValue(int id) { | ||
super(id); | ||
} | ||
|
||
public boolean isObjectMerge() { return true; } | ||
|
||
void readObject(DebugInfoReadStream stream) { | ||
selector = ScopeValue.readFrom(stream); | ||
mergePointer = ScopeValue.readFrom(stream); | ||
possibleObjects = new ArrayList<>(); | ||
int length = stream.readInt(); | ||
for (int i = 0; i < length; i++) { | ||
ScopeValue val = readFrom(stream); | ||
possibleObjects.add(val); | ||
} | ||
} | ||
|
||
@Override | ||
public void printOn(PrintStream tty) { | ||
tty.print("merge_obj[" + id + "]"); | ||
tty.print(" selector=\""); | ||
selector.printOn(tty); | ||
tty.print("\""); | ||
|
||
tty.print(" merge_pointer=\""); | ||
mergePointer.printOn(tty); | ||
tty.print("\""); | ||
|
||
tty.print(", candidate_objs=[" + ((ObjectValue) possibleObjects.get(0)).id); | ||
for (int i = 1; i < possibleObjects.size(); i++) { | ||
tty.print("," + ((ObjectValue) possibleObjects.get(i)).id); | ||
} | ||
tty.print("]"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
test/hotspot/jtreg/serviceability/sa/ClhsdbTestAllocationMerge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
import java.util.List; | ||
import jdk.test.lib.apps.LingeredApp; | ||
import jtreg.SkippedException; | ||
|
||
/** | ||
* @test | ||
* @bug 8318682 | ||
* @summary Test clhsdb that decoding of AllocationMerge objects in debug info works correctly | ||
* @requires vm.hasSA | ||
* @library /test/lib | ||
* @run main/othervm ClhsdbTestAllocationMerge | ||
*/ | ||
|
||
public class ClhsdbTestAllocationMerge { | ||
|
||
public static void main(String[] args) throws Exception { | ||
System.out.println("Starting ClhsdbTestDebugInfodDecode test"); | ||
|
||
LingeredApp theApp = null; | ||
try { | ||
ClhsdbLauncher test = new ClhsdbLauncher(); | ||
|
||
theApp = new LingeredAppWithAllocationMerge(); | ||
LingeredApp.startApp(theApp); | ||
System.out.println("Started LingeredAppWithAllocationMerge with pid " + theApp.getPid()); | ||
|
||
List<String> cmds = List.of("jstack -v"); | ||
|
||
// sun.jvm.hotspot.utilities.AssertionFailure is caught by the harness so it's not | ||
// necessary to include extra filters here. | ||
test.run(theApp.getPid(), cmds, null, null); | ||
} catch (SkippedException se) { | ||
throw se; | ||
} catch (Exception ex) { | ||
throw new RuntimeException("Test ERROR " + ex, ex); | ||
} finally { | ||
LingeredApp.stopApp(theApp); | ||
} | ||
System.out.println("Test PASSED"); | ||
} | ||
} |
Oops, something went wrong.