Skip to content
Permalink
Browse files
8272400: [lworld] serviceability/sa/CDSJMapClstats.java fails: No sui…
…table match for type of address

Reviewed-by: fparain
  • Loading branch information
iklam committed Aug 17, 2021
1 parent 96f2052 commit 9d05484027b9d1c525c194f40c22fb8d0eac07ff
Showing 6 changed files with 126 additions and 2 deletions.
@@ -53,6 +53,7 @@
// into our own tables.

// Currently, the archive contains ONLY the following types of objects that have C++ vtables.
// NOTE: this table must be in-sync with sun.jvm.hotspot.memory.FileMapInfo::populateMetadataTypeArray().
#define CPP_VTABLE_TYPES_DO(f) \
f(ConstantPool) \
f(InstanceKlass) \
@@ -66,6 +66,8 @@
#include "oops/constMethod.hpp"
#include "oops/constantPool.hpp"
#include "oops/cpCache.hpp"
#include "oops/flatArrayKlass.hpp"
#include "oops/inlineKlass.hpp"
#include "oops/instanceClassLoaderKlass.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/instanceMirrorKlass.hpp"
@@ -1220,9 +1222,11 @@
declare_type(Metadata, MetaspaceObj) \
declare_type(Klass, Metadata) \
declare_type(ArrayKlass, Klass) \
declare_type(FlatArrayKlass, ArrayKlass) \
declare_type(ObjArrayKlass, ArrayKlass) \
declare_type(TypeArrayKlass, ArrayKlass) \
declare_type(InstanceKlass, Klass) \
declare_type(InlineKlass, InstanceKlass) \
declare_type(InstanceClassLoaderKlass, InstanceKlass) \
declare_type(InstanceMirrorKlass, InstanceKlass) \
declare_type(InstanceRefKlass, InstanceKlass) \
@@ -113,7 +113,7 @@ private static void initialize(TypeDataBase db) {
}

private static void populateMetadataTypeArray(TypeDataBase db) {
metadataTypeArray = new Type[8];
metadataTypeArray = new Type[10];

metadataTypeArray[0] = db.lookupType("ConstantPool");
metadataTypeArray[1] = db.lookupType("InstanceKlass");
@@ -123,6 +123,8 @@ private static void populateMetadataTypeArray(TypeDataBase db) {
metadataTypeArray[5] = db.lookupType("Method");
metadataTypeArray[6] = db.lookupType("ObjArrayKlass");
metadataTypeArray[7] = db.lookupType("TypeArrayKlass");
metadataTypeArray[8] = db.lookupType("FlatArrayKlass");
metadataTypeArray[9] = db.lookupType("InlineKlass");
}

public FileMapHeader getHeader() {
@@ -0,0 +1,59 @@
/*
* Copyright (c) 2021, 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.oops;

import java.io.*;
import java.util.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.types.*;
import sun.jvm.hotspot.utilities.*;
import sun.jvm.hotspot.utilities.Observable;
import sun.jvm.hotspot.utilities.Observer;

// FlatArrayKlass is a proxy for FlatArrayKlass in the JVM

public class FlatArrayKlass extends ArrayKlass {
static {
VM.registerVMInitializedObserver(new Observer() {
public void update(Observable o, Object data) {
initialize(VM.getVM().getTypeDataBase());
}
});
}

private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
Type t = db.lookupType("FlatArrayKlass");
// TODO: implement similar features as in ObjArrayKlass
}

public FlatArrayKlass(Address addr) {
super(addr);
}

public void printValueOn(PrintStream tty) {
tty.print("FlatArrayKlass");
}
}
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2021, 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.oops;

import java.io.*;
import java.util.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.types.*;
import sun.jvm.hotspot.utilities.*;
import sun.jvm.hotspot.utilities.Observable;
import sun.jvm.hotspot.utilities.Observer;

// An InstanceKlass is the VM level representation of a Java class.

public class InlineKlass extends InstanceKlass {
static {
VM.registerVMInitializedObserver(new Observer() {
public void update(Observable o, Object data) {
initialize(VM.getVM().getTypeDataBase());
}
});
}

private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
// Just make sure it's there for now
Type type = db.lookupType("InlineKlass");
}

public InlineKlass(Address addr) {
super(addr);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, 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
@@ -63,8 +63,10 @@ private static synchronized void initialize(TypeDataBase db) throws WrongTypeExc
metadataConstructor.addMapping("InstanceMirrorKlass", InstanceMirrorKlass.class);
metadataConstructor.addMapping("InstanceRefKlass", InstanceRefKlass.class);
metadataConstructor.addMapping("InstanceClassLoaderKlass", InstanceClassLoaderKlass.class);
metadataConstructor.addMapping("InlineKlass", InlineKlass.class);
metadataConstructor.addMapping("TypeArrayKlass", TypeArrayKlass.class);
metadataConstructor.addMapping("ObjArrayKlass", ObjArrayKlass.class);
metadataConstructor.addMapping("FlatArrayKlass", FlatArrayKlass.class);
metadataConstructor.addMapping("Method", Method.class);
metadataConstructor.addMapping("MethodData", MethodData.class);
metadataConstructor.addMapping("ConstMethod", ConstMethod.class);

0 comments on commit 9d05484

Please sign in to comment.