8174995: SA: clhsdb 'where -a' throws Assertion Failure with illegal code 236 when CDS is used
Summary: Make SA aware of the new _nofast* (rewritten during CDS dump time) bytecodes.
Reviewed-by: iklam, cjplummer
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/Bytecodes.java Sat May 12 10:26:42 2018 +0200
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/Bytecodes.java Sat May 12 17:22:56 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2018, 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
@@ -274,9 +274,15 @@
public static final int _fast_aldc_w = 231;
public static final int _return_register_finalizer = 232;
public static final int _invokehandle = 233;
- public static final int _shouldnotreachhere = 234; // For debugging
- public static final int number_of_codes = 235;
+ // Bytecodes rewritten at CDS dump time
+ public static final int _nofast_getfield = 234;
+ public static final int _nofast_putfield = 235;
+ public static final int _nofast_aload_0 = 236;
+ public static final int _nofast_iload = 237;
+ public static final int _shouldnotreachhere = 238; // For debugging
+
+ public static final int number_of_codes = 239;
// Flag bits derived from format strings, can_trap, can_rewrite, etc.:
// semantic flags:
@@ -807,6 +813,12 @@
// special handling of signature-polymorphic methods
def(_invokehandle , "invokehandle" , "bJJ" , null , BasicType.getTIllegal(), -1, true, _invokevirtual );
+ // CDS specific. Bytecodes rewritten at CDS dump time
+ def(_nofast_getfield , "_nofast_getfield" , "bJJ" , null , BasicType.getTIllegal() , 0, true, _getfield );
+ def(_nofast_putfield , "_nofast_putfield" , "bJJ" , null , BasicType.getTIllegal() ,-2, true, _putfield );
+ def(_nofast_aload_0 , "_nofast_aload_0" , "b" , null , BasicType.getTIllegal() , 1, true, _aload_0 );
+ def(_nofast_iload , "_nofast_iload" , "bi" , null , BasicType.getTIllegal() , 1, false, _iload );
+
def(_shouldnotreachhere , "_shouldnotreachhere" , "b" , null , BasicType.getTVoid() , 0, false);
if (Assert.ASSERTS_ENABLED) {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java Sat May 12 10:26:42 2018 +0200
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java Sat May 12 17:22:56 2018 +0530
@@ -166,6 +166,9 @@
"No suitable match for type of address"));
expStrMap.put("printall", List.of(
"aload_0",
+ "_nofast_aload_0",
+ "_nofast_getfield",
+ "_nofast_putfield",
"Constant Pool of",
"public static void main(java.lang.String[])",
"Bytecode",
@@ -175,6 +178,8 @@
"invokedynamic"));
unExpStrMap.put("printall", List.of(
"sun.jvm.hotspot.types.WrongTypeException",
+ "illegal code",
+ "Failure occurred at bci",
"No suitable match for type of address"));
test.runOnCore(TEST_CDS_CORE_FILE_NAME, cmds, expStrMap, unExpStrMap);
} catch (Exception ex) {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java Sat May 12 10:26:42 2018 +0200
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java Sat May 12 17:22:56 2018 +0530
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8174994
- * @summary Test the clhsdb commands 'jstack', 'printall' with CDS enabled
+ * @summary Test the clhsdb commands 'jstack', 'printall', 'where' with CDS enabled
* @requires vm.cds
* @library /test/lib
* @run main/othervm/timeout=2400 -Xmx1g ClhsdbCDSJstackPrintAll
@@ -77,7 +77,7 @@
return;
}
- cmds = List.of("jstack -v", "printall");
+ cmds = List.of("jstack -v", "printall", "where -a");
Map<String, List<String>> expStrMap = new HashMap<>();
Map<String, List<String>> unExpStrMap = new HashMap<>();
@@ -92,6 +92,9 @@
"No suitable match for type of address"));
expStrMap.put("printall", List.of(
"aload_0",
+ "_nofast_aload_0",
+ "_nofast_getfield",
+ "_nofast_putfield",
"Constant Pool of",
"public static void main(java.lang.String[])",
"Bytecode",
@@ -100,7 +103,15 @@
"Exception Table",
"invokedynamic"));
unExpStrMap.put("printall", List.of(
- "No suitable match for type of address"));
+ "No suitable match for type of address",
+ "illegal code",
+ "Failure occurred at bci"));
+ expStrMap.put("where -a", List.of(
+ "Java Stack Trace for main",
+ "public static void main"));
+ unExpStrMap.put("where -a", List.of(
+ "illegal code",
+ "Failure occurred at bci"));
test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap);
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);