diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp index be0db18f615..00897a3b158 100644 --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -2310,6 +2310,8 @@ typedef HashtableEntry KlassHashtableEntry; declare_constant(InstanceKlass::_misc_is_shared_app_class) \ declare_constant(InstanceKlass::_misc_invalid_inline_super) \ declare_constant(InstanceKlass::_misc_invalid_identity_super) \ + declare_constant(InstanceKlass::_misc_has_injected_primitiveObject) \ + declare_constant(InstanceKlass::_misc_has_injected_identityObject) \ \ /*********************************/ \ /* Symbol* - symbol max length */ \ diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java index 079f7b6c83e..f43a16e050f 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java @@ -78,6 +78,8 @@ public void update(Observable o, Object data) { private static int MISC_IS_SHARED_BOOT_CLASS; private static int MISC_IS_SHARED_PLATFORM_CLASS; private static int MISC_IS_SHARED_APP_CLASS; + private static int MISC_HAS_INJECTED_PRIMITIVEOBJECT; + private static int MISC_HAS_INJECTED_IDENTITYOBJECT; private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { Type type = db.lookupType("InstanceKlass"); @@ -135,6 +137,8 @@ private static synchronized void initialize(TypeDataBase db) throws WrongTypeExc MISC_IS_SHARED_BOOT_CLASS = db.lookupIntConstant("InstanceKlass::_misc_is_shared_boot_class").intValue(); MISC_IS_SHARED_PLATFORM_CLASS = db.lookupIntConstant("InstanceKlass::_misc_is_shared_platform_class").intValue(); MISC_IS_SHARED_APP_CLASS = db.lookupIntConstant("InstanceKlass::_misc_is_shared_app_class").intValue(); + MISC_HAS_INJECTED_PRIMITIVEOBJECT = db.lookupIntConstant("InstanceKlass::_misc_has_injected_primitiveObject").intValue(); + MISC_HAS_INJECTED_IDENTITYOBJECT = db.lookupIntConstant("InstanceKlass::_misc_has_injected_identityObject").intValue(); } public InstanceKlass(Address addr) { @@ -569,6 +573,14 @@ private boolean isInInnerClasses(Symbol sym, boolean includeLocals) { } } + public boolean hasInjectedIdentityObject() { + return (getMiscFlags() & MISC_HAS_INJECTED_IDENTITYOBJECT) != 0; + } + + public boolean hasInjectedPrimitiveObject() { + return (getMiscFlags() & MISC_HAS_INJECTED_PRIMITIVEOBJECT) != 0; + } + public boolean implementsInterface(Klass k) { if (Assert.ASSERTS_ENABLED) { Assert.that(k.isInterface(), "should not reach here"); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java index d1c7f30d1fe..c8032c3c447 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java @@ -352,11 +352,15 @@ protected void writeSuperClass() throws IOException { protected void writeInterfaces() throws IOException { KlassArray interfaces = klass.getLocalInterfaces(); final int len = interfaces.length(); + int nb_interfaces = len; + if (klass.hasInjectedIdentityObject() || klass.hasInjectedPrimitiveObject()) { + nb_interfaces--; + } - if (DEBUG) debugMessage("number of interfaces = " + len); + if (DEBUG) debugMessage("number of interfaces = " + nb_interfaces); // write interfaces count - dos.writeShort((short) len); + dos.writeShort((short) nb_interfaces); for (int i = 0; i < len; i++) { Klass k = interfaces.getAt(i); Short index = (Short) classToIndex.get(k.getName().asString());