mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-20 15:25:27 +00:00
8377797: Remove SA support for MethodData and the printmdo command
Reviewed-by: kevinw, ysuenaga, cjplummer, kvn
This commit is contained in:
parent
4a6d359a45
commit
82fe8b9cd0
@ -159,7 +159,7 @@
|
||||
unchecked_nonstatic_field) \
|
||||
\
|
||||
/******************************************************************/ \
|
||||
/* OopDesc and Klass hierarchies (NOTE: MethodData* incomplete) */ \
|
||||
/* OopDesc and Klass hierarchies */ \
|
||||
/******************************************************************/ \
|
||||
\
|
||||
volatile_nonstatic_field(oopDesc, _mark, markWord) \
|
||||
@ -233,27 +233,7 @@
|
||||
nonstatic_field(Klass, _vtable_len, int) \
|
||||
nonstatic_field(Klass, _class_loader_data, ClassLoaderData*) \
|
||||
nonstatic_field(vtableEntry, _method, Method*) \
|
||||
nonstatic_field(MethodData, _size, int) \
|
||||
nonstatic_field(MethodData, _method, Method*) \
|
||||
nonstatic_field(MethodData, _data_size, int) \
|
||||
nonstatic_field(MethodData, _data[0], intptr_t) \
|
||||
nonstatic_field(MethodData, _parameters_type_data_di, int) \
|
||||
nonstatic_field(MethodData, _compiler_counters._nof_decompiles, uint) \
|
||||
nonstatic_field(MethodData, _compiler_counters._nof_overflow_recompiles, uint) \
|
||||
nonstatic_field(MethodData, _compiler_counters._nof_overflow_traps, uint) \
|
||||
nonstatic_field(MethodData, _compiler_counters._trap_hist._array[0], u1) \
|
||||
nonstatic_field(MethodData, _eflags, intx) \
|
||||
nonstatic_field(MethodData, _arg_local, intx) \
|
||||
nonstatic_field(MethodData, _arg_stack, intx) \
|
||||
nonstatic_field(MethodData, _arg_returned, intx) \
|
||||
nonstatic_field(MethodData, _tenure_traps, uint) \
|
||||
nonstatic_field(MethodData, _invoke_mask, int) \
|
||||
nonstatic_field(MethodData, _backedge_mask, int) \
|
||||
nonstatic_field(DataLayout, _header._struct._tag, u1) \
|
||||
nonstatic_field(DataLayout, _header._struct._flags, u1) \
|
||||
nonstatic_field(DataLayout, _header._struct._bci, u2) \
|
||||
nonstatic_field(DataLayout, _header._struct._traps, u4) \
|
||||
nonstatic_field(DataLayout, _cells[0], intptr_t) \
|
||||
nonstatic_field(MethodCounters, _invoke_mask, int) \
|
||||
nonstatic_field(MethodCounters, _backedge_mask, int) \
|
||||
COMPILER2_OR_JVMCI_PRESENT(nonstatic_field(MethodCounters, _interpreter_throwout_count, u2)) \
|
||||
@ -961,8 +941,6 @@
|
||||
declare_type(ConstMethod, MetaspaceObj) \
|
||||
declare_type(Annotations, MetaspaceObj) \
|
||||
\
|
||||
declare_toplevel_type(MethodData::CompilerCounters) \
|
||||
\
|
||||
declare_toplevel_type(narrowKlass) \
|
||||
\
|
||||
declare_toplevel_type(vtableEntry) \
|
||||
@ -971,7 +949,6 @@
|
||||
declare_toplevel_type(Symbol*) \
|
||||
declare_toplevel_type(volatile Metadata*) \
|
||||
\
|
||||
declare_toplevel_type(DataLayout) \
|
||||
declare_toplevel_type(BSMAttributeEntries) \
|
||||
\
|
||||
/********/ \
|
||||
|
||||
@ -57,7 +57,6 @@ Available commands:
|
||||
pmap <font color="red">show Solaris pmap-like output</font>
|
||||
print expression <font color="red">print given Klass*, Method* or arbitrary address</font>
|
||||
printas type expression <font color="red">print given address as given HotSpot type. eg. print JavaThread <address></font>
|
||||
printmdo -a | expression <font color="red">print method data oop</font>
|
||||
printstatics [ type ] <font color="red">print static fields of given HotSpot type (or all types if none specified)</font>
|
||||
pstack [-v] [-l] <font color="red">show mixed mode stack trace for all Java, non-Java threads. -v is verbose mode. -l includes info on owned java.util.concurrent locks.</font>
|
||||
quit <font color="red">quit CLHSDB tool</font>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2026, 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
|
||||
@ -60,7 +60,6 @@ import sun.jvm.hotspot.oops.InstanceKlass;
|
||||
import sun.jvm.hotspot.oops.Klass;
|
||||
import sun.jvm.hotspot.oops.Metadata;
|
||||
import sun.jvm.hotspot.oops.Method;
|
||||
import sun.jvm.hotspot.oops.MethodData;
|
||||
import sun.jvm.hotspot.oops.Oop;
|
||||
import sun.jvm.hotspot.oops.RawHeapVisitor;
|
||||
import sun.jvm.hotspot.oops.Symbol;
|
||||
@ -860,44 +859,8 @@ public class CommandProcessor {
|
||||
}
|
||||
}
|
||||
},
|
||||
new Command("printmdo", "printmdo [ -a | expression ]", false) {
|
||||
// Print every MDO in the heap or the one referenced by expression.
|
||||
public void doit(Tokens t) {
|
||||
if (t.countTokens() != 1) {
|
||||
usage();
|
||||
} else {
|
||||
String s = t.nextToken();
|
||||
if (s.equals("-a")) {
|
||||
ClassLoaderDataGraph cldg = VM.getVM().getClassLoaderDataGraph();
|
||||
cldg.classesDo(new ClassLoaderDataGraph.ClassVisitor() {
|
||||
public void visit(Klass k) {
|
||||
if (k instanceof InstanceKlass) {
|
||||
MethodArray methods = ((InstanceKlass)k).getMethods();
|
||||
for (int i = 0; i < methods.length(); i++) {
|
||||
Method m = methods.at(i);
|
||||
MethodData mdo = m.getMethodData();
|
||||
if (mdo != null) {
|
||||
out.println("MethodData " + mdo.getAddress() + " for " +
|
||||
"method " + m.getMethodHolder().getName().asString() + "." +
|
||||
m.getName().asString() +
|
||||
m.getSignature().asString() + "@" + m.getAddress());
|
||||
mdo.printDataOn(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
Address a = VM.getVM().getDebugger().parseAddress(s);
|
||||
MethodData mdo = (MethodData) Metadata.instantiateWrapperFor(a);
|
||||
mdo.printDataOn(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
new Command("printall", "printall", false) {
|
||||
// Print every MDO in the heap or the one referenced by expression.
|
||||
// Print every Method for every class loaded.
|
||||
public void doit(Tokens t) {
|
||||
if (t.countTokens() != 0) {
|
||||
usage();
|
||||
|
||||
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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.*;
|
||||
|
||||
public class ArgInfoData extends ArrayData {
|
||||
|
||||
public ArgInfoData(DataLayout layout) {
|
||||
super(layout);
|
||||
}
|
||||
|
||||
int numberOfArgs() {
|
||||
return arrayLen();
|
||||
}
|
||||
|
||||
int argModified(int arg) {
|
||||
return arrayUintAt(arg);
|
||||
}
|
||||
|
||||
public void printDataOn(PrintStream st) {
|
||||
printShared(st, "ArgInfoData");
|
||||
int nargs = numberOfArgs();
|
||||
for (int i = 0; i < nargs; i++) {
|
||||
st.print(" 0x" + Integer.toHexString(argModified(i)));
|
||||
}
|
||||
st.println();
|
||||
}
|
||||
}
|
||||
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2012, 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.*;
|
||||
|
||||
// ArrayData
|
||||
//
|
||||
// A ArrayData is a base class for accessing profiling data which does
|
||||
// not have a statically known size. It consists of an array length
|
||||
// and an array start.
|
||||
abstract class ArrayData extends ProfileData {
|
||||
|
||||
static final int arrayLenOffSet = 0;
|
||||
static final int arrayStartOffSet = 1;
|
||||
|
||||
int arrayUintAt(int index) {
|
||||
int aindex = index + arrayStartOffSet;
|
||||
return uintAt(aindex);
|
||||
}
|
||||
int arrayIntAt(int index) {
|
||||
int aindex = index + arrayStartOffSet;
|
||||
return intAt(aindex);
|
||||
}
|
||||
|
||||
// Code generation support for subclasses.
|
||||
static int arrayElementOffset(int index) {
|
||||
return cellOffset(arrayStartOffSet + index);
|
||||
}
|
||||
|
||||
ArrayData(DataLayout layout) {
|
||||
super(layout);
|
||||
}
|
||||
|
||||
static int staticCellCount() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int arrayLen() {
|
||||
return intAt(arrayLenOffSet);
|
||||
}
|
||||
|
||||
public int cellCount() {
|
||||
return arrayLen() + 1;
|
||||
}
|
||||
|
||||
// Code generation support
|
||||
static int arrayLenOffset() {
|
||||
return cellOffset(arrayLenOffSet);
|
||||
}
|
||||
static int arrayStartOffset() {
|
||||
return cellOffset(arrayStartOffSet);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 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.*;
|
||||
|
||||
// BitData
|
||||
//
|
||||
// A BitData holds a flag or two in its header.
|
||||
public class BitData extends ProfileData {
|
||||
|
||||
// nullSeen:
|
||||
// saw a null operand (cast/aastore/instanceof)
|
||||
static final int nullSeenFlag = DataLayout.firstFlag + 0;
|
||||
static final int bitCellCount = 0;
|
||||
|
||||
public BitData(DataLayout layout) {
|
||||
super(layout);
|
||||
}
|
||||
|
||||
static int staticCellCount() {
|
||||
return bitCellCount;
|
||||
}
|
||||
|
||||
public int cellCount() {
|
||||
return staticCellCount();
|
||||
}
|
||||
|
||||
// Accessor
|
||||
|
||||
// The nullSeen flag bit is specially known to the interpreter.
|
||||
// Consulting it allows the compiler to avoid setting up nullCheck traps.
|
||||
boolean nullSeen() { return flagAt(nullSeenFlag); }
|
||||
|
||||
// Code generation support
|
||||
// static int nullSeenByteConstant() {
|
||||
// return flagNumberToByteConstant(nullSeenFlag);
|
||||
// }
|
||||
|
||||
static int bitDataSize() {
|
||||
return cellOffset(bitCellCount);
|
||||
}
|
||||
|
||||
public void printDataOn(PrintStream st) {
|
||||
printShared(st, "BitData");
|
||||
}
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2012, 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.*;
|
||||
|
||||
// BranchData
|
||||
//
|
||||
// A BranchData is used to access profiling data for a two-way branch.
|
||||
// It consists of taken and notTaken counts as well as a data displacement
|
||||
// for the taken case.
|
||||
public class BranchData extends JumpData {
|
||||
|
||||
static final int notTakenOffSet = jumpCellCount;
|
||||
static final int branchCellCount = notTakenOffSet + 1;
|
||||
|
||||
public BranchData(DataLayout layout) {
|
||||
super(layout);
|
||||
//assert(layout.tag() == DataLayout.branchDataTag, "wrong type");
|
||||
}
|
||||
|
||||
static int staticCellCount() {
|
||||
return branchCellCount;
|
||||
}
|
||||
|
||||
public int cellCount() {
|
||||
return staticCellCount();
|
||||
}
|
||||
|
||||
// Direct accessor
|
||||
int notTaken() {
|
||||
return uintAt(notTakenOffSet);
|
||||
}
|
||||
|
||||
// Code generation support
|
||||
static int notTakenOffset() {
|
||||
return cellOffset(notTakenOffSet);
|
||||
}
|
||||
static int branchDataSize() {
|
||||
return cellOffset(branchCellCount);
|
||||
}
|
||||
|
||||
public void printDataOn(PrintStream st) {
|
||||
printShared(st, "BranchData");
|
||||
st.println("taken(" + taken() + ") displacement(" + displacement() + ")");
|
||||
tab(st);
|
||||
st.println("not taken(" + notTaken() + ")");
|
||||
}
|
||||
}
|
||||
@ -1,108 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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.*;
|
||||
|
||||
// CallTypeData
|
||||
//
|
||||
// A CallTypeData is used to access profiling information about a non
|
||||
// virtual call for which we collect type information about arguments
|
||||
// and return value.
|
||||
public class CallTypeData<K,M> extends CounterData implements CallTypeDataInterface<K> {
|
||||
final TypeStackSlotEntries<K,M> args;
|
||||
final ReturnTypeEntry<K,M> ret;
|
||||
|
||||
int cellCountGlobalOffset() {
|
||||
return CounterData.staticCellCount() + TypeEntriesAtCall.cellCountLocalOffset();
|
||||
}
|
||||
|
||||
int cellCountNoHeader() {
|
||||
return uintAt(cellCountGlobalOffset());
|
||||
}
|
||||
|
||||
public CallTypeData(MethodDataInterface<K,M> methodData, DataLayout layout) {
|
||||
super(layout);
|
||||
args = new TypeStackSlotEntries<K,M>(methodData, this, CounterData.staticCellCount()+TypeEntriesAtCall.headerCellCount(), numberOfArguments());
|
||||
ret = new ReturnTypeEntry<K,M>(methodData, this, cellCount() - ReturnTypeEntry.staticCellCount());
|
||||
}
|
||||
|
||||
static int staticCellCount() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int cellCount() {
|
||||
return CounterData.staticCellCount() +
|
||||
TypeEntriesAtCall.headerCellCount() +
|
||||
intAt(cellCountGlobalOffset());
|
||||
}
|
||||
|
||||
public int numberOfArguments() {
|
||||
return cellCountNoHeader() / TypeStackSlotEntries.perArgCount();
|
||||
}
|
||||
|
||||
public boolean hasArguments() {
|
||||
return cellCountNoHeader() >= TypeStackSlotEntries.perArgCount();
|
||||
}
|
||||
|
||||
public K argumentType(int i) {
|
||||
return args.type(i);
|
||||
}
|
||||
|
||||
public boolean hasReturn() {
|
||||
return (cellCountNoHeader() % TypeStackSlotEntries.perArgCount()) != 0;
|
||||
}
|
||||
|
||||
public K returnType() {
|
||||
return ret.type();
|
||||
}
|
||||
|
||||
public int argumentTypeIndex(int i) {
|
||||
return args.typeIndex(i);
|
||||
}
|
||||
|
||||
public int returnTypeIndex() {
|
||||
return ret.typeIndex();
|
||||
}
|
||||
|
||||
public void printDataOn(PrintStream st) {
|
||||
super.printDataOn(st);
|
||||
if (hasArguments()) {
|
||||
tab(st);
|
||||
st.print("argument types");
|
||||
args.printDataOn(st);
|
||||
}
|
||||
if (hasReturn()) {
|
||||
tab(st);
|
||||
st.print("return type");
|
||||
ret.printDataOn(st);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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;
|
||||
|
||||
public interface CallTypeDataInterface<K> {
|
||||
int numberOfArguments();
|
||||
boolean hasArguments();
|
||||
K argumentType(int i);
|
||||
boolean hasReturn();
|
||||
K returnType();
|
||||
int argumentTypeIndex(int i);
|
||||
int returnTypeIndex();
|
||||
}
|
||||
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2012, 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.*;
|
||||
|
||||
// CounterData
|
||||
//
|
||||
// A CounterData corresponds to a simple counter.
|
||||
public class CounterData extends BitData {
|
||||
|
||||
static final int countOff = 0;
|
||||
static final int counterCellCount = 1;
|
||||
|
||||
public CounterData(DataLayout layout) {
|
||||
super(layout);
|
||||
}
|
||||
|
||||
static int staticCellCount() {
|
||||
return counterCellCount;
|
||||
}
|
||||
|
||||
public int cellCount() {
|
||||
return staticCellCount();
|
||||
}
|
||||
|
||||
// Direct accessor
|
||||
int count() {
|
||||
return uintAt(countOff);
|
||||
}
|
||||
|
||||
// Code generation support
|
||||
static int countOffset() {
|
||||
return cellOffset(countOff);
|
||||
}
|
||||
static int counterDataSize() {
|
||||
return cellOffset(counterCellCount);
|
||||
}
|
||||
|
||||
public void printDataOn(PrintStream st) {
|
||||
printShared(st, "CounterData");
|
||||
st.println("count(" + count() + ")");
|
||||
}
|
||||
}
|
||||
@ -1,189 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 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.*;
|
||||
|
||||
public class DataLayout {
|
||||
public static final int noTag = 0;
|
||||
public static final int bitDataTag = 1;
|
||||
public static final int counterDataTag = 2;
|
||||
public static final int jumpDataTag= 3;
|
||||
public static final int receiverTypeDataTag = 4;
|
||||
public static final int virtualCallDataTag = 5;
|
||||
public static final int retDataTag = 6;
|
||||
public static final int branchDataTag = 7;
|
||||
public static final int multiBranchDataTag = 8;
|
||||
public static final int argInfoDataTag = 9;
|
||||
public static final int callTypeDataTag = 10;
|
||||
public static final int virtualCallTypeDataTag = 11;
|
||||
public static final int parametersTypeDataTag = 12;
|
||||
public static final int speculativeTrapDataTag = 13;
|
||||
|
||||
// The trap state breaks down as [recompile:1 | reason:31].
|
||||
// This further breakdown is defined in deoptimization.cpp.
|
||||
// See Deoptimization.trapStateReason for an assert that
|
||||
// trapBits is big enough to hold reasons < reasonRecordedLimit.
|
||||
//
|
||||
// The trapState is collected only if ProfileTraps is true.
|
||||
public static final int trapBits = 1+31; // 31: enough to distinguish [0..reasonRecordedLimit].
|
||||
public static final int trapMask = Bits.rightNBits(trapBits);
|
||||
public static final int firstFlag = 0;
|
||||
|
||||
private Address data;
|
||||
|
||||
private int offset;
|
||||
|
||||
public DataLayout(MethodData d, int o) {
|
||||
data = d.getAddress();
|
||||
offset = o;
|
||||
}
|
||||
|
||||
public DataLayout(Address d, int o) {
|
||||
data = d;
|
||||
offset = o;
|
||||
}
|
||||
|
||||
public int dp() { return offset; }
|
||||
|
||||
private int getU11(int at) {
|
||||
return data.getJByteAt(offset + at) & 0xff;
|
||||
}
|
||||
|
||||
private int getU22(int at) {
|
||||
return data.getJShortAt(offset + at) & 0xffff;
|
||||
}
|
||||
|
||||
long cellAt(int index) {
|
||||
return data.getCIntegerAt(offset + cellOffset(index), MethodData.cellSize, false);
|
||||
}
|
||||
|
||||
public Address addressAt(int index) {
|
||||
return data.getAddressAt(offset + cellOffset(index));
|
||||
}
|
||||
|
||||
// Every data layout begins with a header. This header
|
||||
// contains a tag, which is used to indicate the size/layout
|
||||
// of the data, 8 bits of flags, which can be used in any way,
|
||||
// 32 bits of trap history (none/one reason/many reasons),
|
||||
// and a bci, which is used to tie this piece of data to a
|
||||
// specific bci in the bytecodes.
|
||||
// union {
|
||||
// u8 _bits;
|
||||
// struct {
|
||||
// u1 _tag;
|
||||
// u1 _flags;
|
||||
// u2 _bci;
|
||||
// u4 _traps;
|
||||
// } _struct;
|
||||
// } _header;
|
||||
|
||||
// Some types of data layouts need a length field.
|
||||
static boolean needsArrayLen(int tag) {
|
||||
return (tag == multiBranchDataTag);
|
||||
}
|
||||
|
||||
public static final int counterIncrement = 1;
|
||||
|
||||
// Size computation
|
||||
static int headerSizeInBytes() {
|
||||
return MethodData.cellSize * headerSizeInCells();
|
||||
}
|
||||
static int headerSizeInCells() {
|
||||
return VM.getVM().isLP64() ? 1 : 2;
|
||||
}
|
||||
|
||||
public static int computeSizeInBytes(int cellCount) {
|
||||
return headerSizeInBytes() + cellCount * MethodData.cellSize;
|
||||
}
|
||||
|
||||
// Initialization
|
||||
// void initialize(int tag, int bci, int cellCount);
|
||||
|
||||
// Accessors
|
||||
public int tag() {
|
||||
return getU11(0);
|
||||
}
|
||||
|
||||
// Return a few bits of trap state. Range is [0..trapMask].
|
||||
// The state tells if traps with zero, one, or many reasons have occurred.
|
||||
// It also tells whether zero or many recompilations have occurred.
|
||||
// The associated trap histogram in the MDO itself tells whether
|
||||
// traps are common or not. If a BCI shows that a trap X has
|
||||
// occurred, and the MDO shows N occurrences of X, we make the
|
||||
// simplifying assumption that all N occurrences can be blamed
|
||||
// on that BCI.
|
||||
int trapState() {
|
||||
return data.getJIntAt(offset+4);
|
||||
}
|
||||
|
||||
int flags() {
|
||||
return getU11(1);
|
||||
}
|
||||
|
||||
int bci() {
|
||||
return getU22(2);
|
||||
}
|
||||
|
||||
boolean flagAt(int flagNumber) {
|
||||
// assert(flagNumber < flagLimit, "oob");
|
||||
return (flags() & (0x1 << flagNumber)) != 0;
|
||||
}
|
||||
|
||||
// Low-level support for code generation.
|
||||
static int headerOffset() {
|
||||
return 0;
|
||||
}
|
||||
static int tagOffset() {
|
||||
return 0;
|
||||
}
|
||||
static int flagsOffset() {
|
||||
return 1;
|
||||
}
|
||||
static int bciOffset() {
|
||||
return 2;
|
||||
}
|
||||
public static int cellOffset(int index) {
|
||||
return (headerSizeInCells() + index) * MethodData.cellSize;
|
||||
}
|
||||
// // Return a value which, when or-ed as a byte into _flags, sets the flag.
|
||||
// static int flagNumberToByteConstant(int flagNumber) {
|
||||
// assert(0 <= flagNumber && flagNumber < flagLimit, "oob");
|
||||
// DataLayout temp; temp.setHeader(0);
|
||||
// temp.setFlagAt(flagNumber);
|
||||
// return temp._header._struct._flags;
|
||||
// }
|
||||
// // Return a value which, when or-ed as a word into _header, sets the flag.
|
||||
// static intptrT flagMaskToHeaderMask(int byteConstant) {
|
||||
// DataLayout temp; temp.setHeader(0);
|
||||
// temp._header._struct._flags = byteConstant;
|
||||
// return temp._header._bits;
|
||||
// }
|
||||
}
|
||||
@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2012, 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.*;
|
||||
|
||||
// JumpData
|
||||
//
|
||||
// A JumpData is used to access profiling information for a direct
|
||||
// branch. It is a counter, used for counting the number of branches,
|
||||
// plus a data displacement, used for realigning the data pointer to
|
||||
// the corresponding target bci.
|
||||
public class JumpData extends ProfileData {
|
||||
static final int takenOffSet = 0;
|
||||
static final int displacementOffSet = 1;
|
||||
static final int jumpCellCount = 2;
|
||||
|
||||
public JumpData(DataLayout layout) {
|
||||
super(layout);
|
||||
//assert(layout.tag() == DataLayout.jumpDataTag ||
|
||||
// layout.tag() == DataLayout.branchDataTag, "wrong type");
|
||||
}
|
||||
|
||||
static int staticCellCount() {
|
||||
return jumpCellCount;
|
||||
}
|
||||
|
||||
public int cellCount() {
|
||||
return staticCellCount();
|
||||
}
|
||||
|
||||
// Direct accessor
|
||||
int taken() {
|
||||
return uintAt(takenOffSet);
|
||||
}
|
||||
|
||||
int displacement() {
|
||||
return intAt(displacementOffSet);
|
||||
}
|
||||
|
||||
// Code generation support
|
||||
static int takenOffset() {
|
||||
return cellOffset(takenOffSet);
|
||||
}
|
||||
|
||||
static int displacementOffset() {
|
||||
return cellOffset(displacementOffSet);
|
||||
}
|
||||
|
||||
public void printDataOn(PrintStream st) {
|
||||
printShared(st, "JumpData");
|
||||
st.println("taken(" + taken() + ") displacement(" + displacement() + ")");
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2026, 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
|
||||
@ -67,7 +67,6 @@ public abstract class Metadata extends VMObject {
|
||||
metadataConstructor.addMapping("TypeArrayKlass", TypeArrayKlass.class);
|
||||
metadataConstructor.addMapping("ObjArrayKlass", ObjArrayKlass.class);
|
||||
metadataConstructor.addMapping("Method", Method.class);
|
||||
metadataConstructor.addMapping("MethodData", MethodData.class);
|
||||
metadataConstructor.addMapping("ConstMethod", ConstMethod.class);
|
||||
metadataConstructor.addMapping("ConstantPool", ConstantPool.class);
|
||||
metadataConstructor.addMapping("ConstantPoolCache", ConstantPoolCache.class);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2026, 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
|
||||
@ -56,7 +56,6 @@ public class Method extends Metadata {
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
type = db.lookupType("Method");
|
||||
constMethod = type.getAddressField("_constMethod");
|
||||
methodData = type.getAddressField("_method_data");
|
||||
methodCounters = type.getAddressField("_method_counters");
|
||||
accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0);
|
||||
code = type.getAddressField("_code");
|
||||
@ -82,7 +81,6 @@ public class Method extends Metadata {
|
||||
|
||||
// Fields
|
||||
private static AddressField constMethod;
|
||||
private static AddressField methodData;
|
||||
private static AddressField methodCounters;
|
||||
private static CIntField accessFlags;
|
||||
private static CIntField vtableIndex;
|
||||
@ -126,10 +124,6 @@ public class Method extends Metadata {
|
||||
public U1Array getStackMapData() {
|
||||
return getConstMethod().getStackMapData();
|
||||
}
|
||||
public MethodData getMethodData() {
|
||||
Address addr = methodData.getValue(getAddress());
|
||||
return VMObjectFactory.newObject(MethodData.class, addr);
|
||||
}
|
||||
public MethodCounters getMethodCounters() {
|
||||
Address addr = methodCounters.getValue(getAddress());
|
||||
return VMObjectFactory.newObject(MethodCounters.class, addr);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2026, 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
|
||||
@ -35,92 +35,7 @@ import sun.jvm.hotspot.utilities.Observer;
|
||||
|
||||
// A MethodData provides interpreter profiling information
|
||||
|
||||
public class MethodData extends Metadata implements MethodDataInterface<Klass,Method> {
|
||||
static int TypeProfileWidth = 2;
|
||||
static int BciProfileWidth = 2;
|
||||
static int CompileThreshold;
|
||||
|
||||
static int Reason_many; // indicates presence of several reasons
|
||||
static int Reason_none; // indicates absence of a relevant deopt.
|
||||
static int Reason_LIMIT;
|
||||
static int Reason_RECORDED_LIMIT; // some are not recorded per bc
|
||||
|
||||
private static String[] trapReasonName;
|
||||
|
||||
static String trapReasonName(int reason) {
|
||||
if (reason == Reason_many) return "many";
|
||||
if (reason < Reason_LIMIT)
|
||||
return trapReasonName[reason];
|
||||
return "reason" + reason;
|
||||
}
|
||||
|
||||
|
||||
static int trapStateReason(int trapState) {
|
||||
// This assert provides the link between the width of DataLayout.trapBits
|
||||
// and the encoding of "recorded" reasons. It ensures there are enough
|
||||
// bits to store all needed reasons in the per-BCI MDO profile.
|
||||
// assert(dsReasonMask >= reasonRecordedLimit, "enough bits");
|
||||
int recompileBit = (trapState & dsRecompileBit);
|
||||
trapState -= recompileBit;
|
||||
if (trapState == dsReasonMask) {
|
||||
return Reason_many;
|
||||
} else {
|
||||
// assert((int)reasonNone == 0, "state=0 => Reason_none");
|
||||
return trapState;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static final int dsReasonMask = DataLayout.trapMask >> 1;
|
||||
static final int dsRecompileBit = DataLayout.trapMask - dsReasonMask;
|
||||
|
||||
static boolean trapStateIsRecompiled(int trapState) {
|
||||
return (trapState & dsRecompileBit) != 0;
|
||||
}
|
||||
|
||||
static boolean reasonIsRecordedPerBytecode(int reason) {
|
||||
return reason > Reason_none && reason < Reason_RECORDED_LIMIT;
|
||||
}
|
||||
static int trapStateAddReason(int trapState, int reason) {
|
||||
// assert(reasonIsRecordedPerBytecode((DeoptReason)reason) || reason == reasonMany, "valid reason");
|
||||
int recompileBit = (trapState & dsRecompileBit);
|
||||
trapState -= recompileBit;
|
||||
if (trapState == dsReasonMask) {
|
||||
return trapState + recompileBit; // already at state lattice bottom
|
||||
} else if (trapState == reason) {
|
||||
return trapState + recompileBit; // the condition is already true
|
||||
} else if (trapState == 0) {
|
||||
return reason + recompileBit; // no condition has yet been true
|
||||
} else {
|
||||
return dsReasonMask + recompileBit; // fall to state lattice bottom
|
||||
}
|
||||
}
|
||||
static int trapStateSetRecompiled(int trapState, boolean z) {
|
||||
if (z) return trapState | dsRecompileBit;
|
||||
else return trapState & ~dsRecompileBit;
|
||||
}
|
||||
|
||||
static String formatTrapState(int trapState) {
|
||||
int reason = trapStateReason(trapState);
|
||||
boolean recompFlag = trapStateIsRecompiled(trapState);
|
||||
// Re-encode the state from its decoded components.
|
||||
int decodedState = 0;
|
||||
if (reasonIsRecordedPerBytecode(reason) || reason == Reason_many)
|
||||
decodedState = trapStateAddReason(decodedState, reason);
|
||||
if (recompFlag)
|
||||
decodedState = trapStateSetRecompiled(decodedState, recompFlag);
|
||||
// If the state re-encodes properly, format it symbolically.
|
||||
// Because this routine is used for debugging and diagnostics,
|
||||
// be robust even if the state is a strange value.
|
||||
if (decodedState != trapState) {
|
||||
// Random buggy state that doesn't decode??
|
||||
return "#" + trapState;
|
||||
} else {
|
||||
return trapReasonName(reason) + (recompFlag ? " recompiled" : "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class MethodData extends Metadata {
|
||||
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
@ -132,96 +47,17 @@ public class MethodData extends Metadata implements MethodDataInterface<Klass,Me
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("MethodData");
|
||||
baseOffset = type.getSize();
|
||||
|
||||
size = new CIntField(type.getCIntegerField("_size"), 0);
|
||||
method = new MetadataField(type.getAddressField("_method"), 0);
|
||||
|
||||
VM.Flag[] flags = VM.getVM().getCommandLineFlags();
|
||||
for (int f = 0; f < flags.length; f++) {
|
||||
VM.Flag flag = flags[f];
|
||||
if (flag.getName().equals("TypeProfileWidth")) {
|
||||
TypeProfileWidth = (int)flag.getIntx();
|
||||
} else if (flag.getName().equals("BciProfileWidth")) {
|
||||
BciProfileWidth = (int)flag.getIntx();
|
||||
} else if (flag.getName().equals("CompileThreshold")) {
|
||||
CompileThreshold = (int)flag.getIntx();
|
||||
}
|
||||
}
|
||||
|
||||
cellSize = (int)VM.getVM().getAddressSize();
|
||||
|
||||
dataSize = new CIntField(type.getCIntegerField("_data_size"), 0);
|
||||
data = type.getAddressField("_data[0]");
|
||||
|
||||
parametersTypeDataDi = new CIntField(type.getCIntegerField("_parameters_type_data_di"), 0);
|
||||
|
||||
sizeofMethodDataOopDesc = (int)type.getSize();
|
||||
|
||||
Reason_many = db.lookupIntConstant("Deoptimization::Reason_many").intValue();
|
||||
Reason_none = db.lookupIntConstant("Deoptimization::Reason_none").intValue();
|
||||
Reason_LIMIT = db.lookupIntConstant("Deoptimization::Reason_LIMIT").intValue();
|
||||
Reason_RECORDED_LIMIT = db.lookupIntConstant("Deoptimization::Reason_RECORDED_LIMIT").intValue();
|
||||
|
||||
trapReasonName = new String[Reason_LIMIT];
|
||||
|
||||
// Find Deopt reasons
|
||||
Iterator i = db.getIntConstants();
|
||||
String prefix = "Deoptimization::Reason_";
|
||||
while (i.hasNext()) {
|
||||
String name = (String)i.next();
|
||||
if (name.startsWith(prefix)) {
|
||||
// Strip prefix
|
||||
if (!name.endsWith("Reason_many") &&
|
||||
!name.endsWith("Reason_LIMIT") &&
|
||||
!name.endsWith("Reason_RECORDED_LIMIT")) {
|
||||
String trimmed = name.substring(prefix.length());
|
||||
int value = db.lookupIntConstant(name).intValue();
|
||||
if (trapReasonName[value] != null) {
|
||||
throw new InternalError("duplicate reasons: " + trapReasonName[value] + " " + trimmed);
|
||||
}
|
||||
trapReasonName[value] = trimmed;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int index = 0; index < trapReasonName.length; index++) {
|
||||
if (trapReasonName[index] == null) {
|
||||
throw new InternalError("missing reason for " + index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static MetadataField method;
|
||||
|
||||
public MethodData(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public Klass getKlassAtAddress(Address addr) {
|
||||
return (Klass)Metadata.instantiateWrapperFor(addr);
|
||||
}
|
||||
|
||||
public Method getMethodAtAddress(Address addr) {
|
||||
return (Method)Metadata.instantiateWrapperFor(addr);
|
||||
}
|
||||
|
||||
public void printKlassValueOn(Klass klass, PrintStream st) {
|
||||
klass.printValueOn(st);
|
||||
}
|
||||
|
||||
public void printMethodValueOn(Method method, PrintStream st) {
|
||||
method.printValueOn(st);
|
||||
}
|
||||
|
||||
public boolean isMethodData() { return true; }
|
||||
|
||||
private static long baseOffset;
|
||||
private static CIntField size;
|
||||
private static MetadataField method;
|
||||
private static CIntField dataSize;
|
||||
private static AddressField data;
|
||||
private static CIntField parametersTypeDataDi;
|
||||
public static int sizeofMethodDataOopDesc;
|
||||
public static int cellSize;
|
||||
|
||||
public Method getMethod() {
|
||||
return (Method) method.getValue(this);
|
||||
}
|
||||
@ -234,209 +70,5 @@ public class MethodData extends Metadata implements MethodDataInterface<Klass,Me
|
||||
public void iterateFields(MetadataVisitor visitor) {
|
||||
super.iterateFields(visitor);
|
||||
visitor.doMetadata(method, true);
|
||||
visitor.doCInt(size, true);
|
||||
}
|
||||
|
||||
int dataSize() {
|
||||
if (dataSize == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return (int)dataSize.getValue(getAddress());
|
||||
}
|
||||
}
|
||||
|
||||
int sizeInBytes() {
|
||||
if (size == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return (int)size.getValue(getAddress());
|
||||
}
|
||||
}
|
||||
|
||||
int size() {
|
||||
return (int)alignSize(VM.getVM().alignUp(sizeInBytes(), VM.getVM().getBytesPerWord())/VM.getVM().getBytesPerWord());
|
||||
}
|
||||
|
||||
ParametersTypeData<Klass,Method> parametersTypeData() {
|
||||
int di = (int)parametersTypeDataDi.getValue(getAddress());
|
||||
if (di == -1 || di == -2) {
|
||||
return null;
|
||||
}
|
||||
DataLayout dataLayout = new DataLayout(this, di + (int)data.getOffset());
|
||||
return new ParametersTypeData<Klass,Method>(this, dataLayout);
|
||||
}
|
||||
|
||||
boolean outOfBounds(int dataIndex) {
|
||||
return dataIndex >= dataSize();
|
||||
}
|
||||
|
||||
ProfileData dataAt(int dataIndex) {
|
||||
if (outOfBounds(dataIndex)) {
|
||||
return null;
|
||||
}
|
||||
DataLayout dataLayout = new DataLayout(this, dataIndex + (int)data.getOffset());
|
||||
|
||||
switch (dataLayout.tag()) {
|
||||
case DataLayout.noTag:
|
||||
default:
|
||||
throw new InternalError(dataIndex + " " + dataSize() + " " + dataLayout.tag());
|
||||
case DataLayout.bitDataTag:
|
||||
return new BitData(dataLayout);
|
||||
case DataLayout.counterDataTag:
|
||||
return new CounterData(dataLayout);
|
||||
case DataLayout.jumpDataTag:
|
||||
return new JumpData(dataLayout);
|
||||
case DataLayout.receiverTypeDataTag:
|
||||
return new ReceiverTypeData<Klass,Method>(this, dataLayout);
|
||||
case DataLayout.virtualCallDataTag:
|
||||
return new VirtualCallData<Klass,Method>(this, dataLayout);
|
||||
case DataLayout.retDataTag:
|
||||
return new RetData(dataLayout);
|
||||
case DataLayout.branchDataTag:
|
||||
return new BranchData(dataLayout);
|
||||
case DataLayout.multiBranchDataTag:
|
||||
return new MultiBranchData(dataLayout);
|
||||
case DataLayout.callTypeDataTag:
|
||||
return new CallTypeData<Klass,Method>(this, dataLayout);
|
||||
case DataLayout.virtualCallTypeDataTag:
|
||||
return new VirtualCallTypeData<Klass,Method>(this, dataLayout);
|
||||
case DataLayout.parametersTypeDataTag:
|
||||
return new ParametersTypeData<Klass,Method>(this, dataLayout);
|
||||
}
|
||||
}
|
||||
|
||||
int dpToDi(int dp) {
|
||||
// this in an offset from the base of the MDO, so convert to offset into _data
|
||||
return dp - (int)data.getOffset();
|
||||
}
|
||||
|
||||
int firstDi() { return 0; }
|
||||
public ProfileData firstData() { return dataAt(firstDi()); }
|
||||
public ProfileData nextData(ProfileData current) {
|
||||
int currentIndex = dpToDi(current.dp());
|
||||
int nextIndex = currentIndex + current.sizeInBytes();
|
||||
return dataAt(nextIndex);
|
||||
}
|
||||
boolean isValid(ProfileData current) { return current != null; }
|
||||
|
||||
DataLayout limitDataPosition() {
|
||||
return new DataLayout(this, dataSize() + (int)data.getOffset());
|
||||
}
|
||||
|
||||
DataLayout extraDataBase() {
|
||||
return limitDataPosition();
|
||||
}
|
||||
|
||||
DataLayout extraDataLimit() {
|
||||
return new DataLayout(this, sizeInBytes());
|
||||
}
|
||||
|
||||
public static int extraNbCells(DataLayout dataLayout) {
|
||||
int nbCells = 0;
|
||||
switch(dataLayout.tag()) {
|
||||
case DataLayout.bitDataTag:
|
||||
case DataLayout.noTag:
|
||||
nbCells = BitData.staticCellCount();
|
||||
break;
|
||||
case DataLayout.speculativeTrapDataTag:
|
||||
nbCells = SpeculativeTrapData.staticCellCount();
|
||||
break;
|
||||
default:
|
||||
throw new InternalError("unexpected tag " + dataLayout.tag());
|
||||
}
|
||||
return nbCells;
|
||||
}
|
||||
|
||||
DataLayout nextExtra(DataLayout dataLayout) {
|
||||
return new DataLayout(this, dataLayout.dp() + DataLayout.computeSizeInBytes(extraNbCells(dataLayout)));
|
||||
}
|
||||
|
||||
public void printDataOn(PrintStream st) {
|
||||
if (parametersTypeData() != null) {
|
||||
parametersTypeData().printDataOn(st);
|
||||
}
|
||||
ProfileData data = firstData();
|
||||
for ( ; isValid(data); data = nextData(data)) {
|
||||
st.print(dpToDi(data.dp()));
|
||||
st.print(" ");
|
||||
// st->fillTo(6);
|
||||
data.printDataOn(st);
|
||||
}
|
||||
st.println("--- Extra data:");
|
||||
DataLayout dp = extraDataBase();
|
||||
DataLayout end = extraDataLimit();
|
||||
for (;; dp = nextExtra(dp)) {
|
||||
switch(dp.tag()) {
|
||||
case DataLayout.noTag:
|
||||
continue;
|
||||
case DataLayout.bitDataTag:
|
||||
data = new BitData(dp);
|
||||
break;
|
||||
case DataLayout.speculativeTrapDataTag:
|
||||
data = new SpeculativeTrapData<Klass,Method>(this, dp);
|
||||
break;
|
||||
case DataLayout.argInfoDataTag:
|
||||
data = new ArgInfoData(dp);
|
||||
dp = end; // ArgInfoData is at the end of extra data section.
|
||||
break;
|
||||
default:
|
||||
throw new InternalError("unexpected tag " + dp.tag());
|
||||
}
|
||||
st.print(dpToDi(data.dp()));
|
||||
st.print(" ");
|
||||
data.printDataOn(st);
|
||||
if (dp == end) return;
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] fetchDataAt(Address base, long offset, long size) {
|
||||
byte[] result = new byte[(int)size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
result[i] = base.getJByteAt(offset + i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public byte[] orig() {
|
||||
// fetch the orig MethodData data between header and dataSize
|
||||
return fetchDataAt(getAddress(), 0, sizeofMethodDataOopDesc);
|
||||
}
|
||||
|
||||
public long[] data() {
|
||||
// Read the data as an array of intptr_t elements
|
||||
Address base = getAddress();
|
||||
long offset = data.getOffset();
|
||||
int elements = dataSize() / cellSize;
|
||||
long[] result = new long[elements];
|
||||
for (int i = 0; i < elements; i++) {
|
||||
Address value = base.getAddressAt(offset + i * MethodData.cellSize);
|
||||
if (value != null) {
|
||||
result[i] = value.minus(null);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Get a measure of how much mileage the method has on it.
|
||||
int mileageOf(Method method) {
|
||||
long mileage = 0;
|
||||
long iic = method.interpreterInvocationCount();
|
||||
if (mileage < iic) mileage = iic;
|
||||
|
||||
long ic = method.getInvocationCount();
|
||||
long bc = method.getBackedgeCount();
|
||||
|
||||
long icval = ic >> 3;
|
||||
if ((ic & 4) != 0) icval += CompileThreshold;
|
||||
if (mileage < icval) mileage = icval;
|
||||
long bcval = bc >> 3;
|
||||
if ((bc & 4) != 0) bcval += CompileThreshold;
|
||||
if (mileage < bcval) mileage = bcval;
|
||||
return (int)mileage;
|
||||
}
|
||||
|
||||
public int currentMileage() {
|
||||
return 20000;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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.*;
|
||||
|
||||
public interface MethodDataInterface<K, M> {
|
||||
K getKlassAtAddress(Address addr);
|
||||
M getMethodAtAddress(Address addr);
|
||||
void printKlassValueOn(K klass, PrintStream st);
|
||||
void printMethodValueOn(M klass, PrintStream st);
|
||||
}
|
||||
@ -1,113 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2022, 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.*;
|
||||
|
||||
// MultiBranchData
|
||||
//
|
||||
// A MultiBranchData is used to access profiling information for
|
||||
// a multi-way branch (*switch bytecodes). It consists of a series
|
||||
// of (count, displacement) pairs, which count the number of times each
|
||||
// case was taken and specify the data displacement for each branch target.
|
||||
public class MultiBranchData extends ArrayData {
|
||||
static final int defaultCountOffSet = 0;
|
||||
static final int defaultDisaplacementOffSet = 1;
|
||||
static final int caseArrayStart = 2;
|
||||
static final int relativeCountOffSet = 0;
|
||||
static final int relativeDisplacementOffSet = 1;
|
||||
static final int perCaseCellCount = 2;
|
||||
|
||||
public MultiBranchData(DataLayout layout) {
|
||||
super(layout);
|
||||
//assert(layout.tag() == DataLayout.multiBranchDataTag, "wrong type");
|
||||
}
|
||||
|
||||
// static int computeCellCount(BytecodeStream stream);
|
||||
|
||||
int numberOfCases() {
|
||||
int alen = arrayLen() - 2; // get rid of default case here.
|
||||
//assert(alen % perCaseCellCount == 0, "must be even");
|
||||
return (alen / perCaseCellCount);
|
||||
}
|
||||
|
||||
int defaultCount() {
|
||||
return arrayUintAt(defaultCountOffSet);
|
||||
}
|
||||
int defaultDisplacement() {
|
||||
return arrayIntAt(defaultDisaplacementOffSet);
|
||||
}
|
||||
|
||||
int countAt(int index) {
|
||||
return arrayUintAt(caseArrayStart +
|
||||
index * perCaseCellCount +
|
||||
relativeCountOffSet);
|
||||
}
|
||||
int displacementAt(int index) {
|
||||
return arrayIntAt(caseArrayStart +
|
||||
index * perCaseCellCount +
|
||||
relativeDisplacementOffSet);
|
||||
}
|
||||
|
||||
// Code generation support
|
||||
static int defaultCountOffset() {
|
||||
return arrayElementOffset(defaultCountOffSet);
|
||||
}
|
||||
static int defaultDisplacementOffset() {
|
||||
return arrayElementOffset(defaultDisaplacementOffSet);
|
||||
}
|
||||
static int caseCountOffset(int index) {
|
||||
return caseArrayOffset() +
|
||||
(perCaseSize() * index) +
|
||||
relativeCountOffset();
|
||||
}
|
||||
static int caseArrayOffset() {
|
||||
return arrayElementOffset(caseArrayStart);
|
||||
}
|
||||
static int perCaseSize() {
|
||||
return (perCaseCellCount) * MethodData.cellSize;
|
||||
}
|
||||
static int relativeCountOffset() {
|
||||
return (relativeCountOffSet) * MethodData.cellSize;
|
||||
}
|
||||
static int relativeDisplacementOffset() {
|
||||
return (relativeDisplacementOffSet) * MethodData.cellSize;
|
||||
}
|
||||
|
||||
public void printDataOn(PrintStream st) {
|
||||
printShared(st, "MultiBranchData");
|
||||
st.println("default_count(" + defaultCount() + ") displacement(" + defaultDisplacement() + ")");
|
||||
int cases = numberOfCases();
|
||||
for (int i = 0; i < cases; i++) {
|
||||
tab(st);
|
||||
st.println("count(" + countAt(i) + ") displacement(" + displacementAt(i) + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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.*;
|
||||
|
||||
// ParametersTypeData
|
||||
//
|
||||
// A ParametersTypeData is used to access profiling information about
|
||||
// types of parameters to a method
|
||||
public class ParametersTypeData<K,M> extends ArrayData {
|
||||
final TypeStackSlotEntries<K,M> parameters;
|
||||
|
||||
static int stackSlotLocalOffset(int i) {
|
||||
return arrayStartOffSet + TypeStackSlotEntries.stackSlotLocalOffset(i);
|
||||
}
|
||||
|
||||
static int typeLocalOffset(int i) {
|
||||
return arrayStartOffSet + TypeStackSlotEntries.typeLocalOffset(i);
|
||||
}
|
||||
|
||||
public ParametersTypeData(MethodDataInterface<K,M> methodData, DataLayout layout) {
|
||||
super(layout);
|
||||
parameters = new TypeStackSlotEntries<K,M>(methodData, this, 1, numberOfParameters());
|
||||
}
|
||||
|
||||
public int numberOfParameters() {
|
||||
return arrayLen() / TypeStackSlotEntries.perArgCount();
|
||||
}
|
||||
|
||||
int stackSlot(int i) {
|
||||
return parameters.stackSlot(i);
|
||||
}
|
||||
|
||||
public K type(int i) {
|
||||
return parameters.type(i);
|
||||
}
|
||||
|
||||
public static int typeIndex(int i) {
|
||||
return typeLocalOffset(i);
|
||||
}
|
||||
|
||||
public void printDataOn(PrintStream st) {
|
||||
st.print("parameter types");
|
||||
parameters.printDataOn(st);
|
||||
}
|
||||
}
|
||||
@ -1,123 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 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.*;
|
||||
|
||||
public abstract class ProfileData {
|
||||
// This is a pointer to a section of profiling data.
|
||||
private DataLayout _data;
|
||||
|
||||
public DataLayout data() { return _data; }
|
||||
|
||||
// How many cells are in this?
|
||||
public abstract int cellCount();
|
||||
|
||||
|
||||
// Return the size of this data.
|
||||
public int sizeInBytes() {
|
||||
return DataLayout.computeSizeInBytes(cellCount());
|
||||
}
|
||||
|
||||
public int dp() {
|
||||
return data().dp();
|
||||
}
|
||||
|
||||
// Low-level accessors for underlying data
|
||||
long intptrAt(int index) {
|
||||
//assert(0 <= index && index < cellCount(), "oob");
|
||||
return data().cellAt(index);
|
||||
}
|
||||
int intAt(int index) {
|
||||
return (int)intptrAt(index);
|
||||
}
|
||||
int uintAt(int index) {
|
||||
return (int)intptrAt(index);
|
||||
}
|
||||
public Address addressAt(int index) {
|
||||
return data().addressAt(index);
|
||||
}
|
||||
|
||||
boolean flagAt(int flagNumber) {
|
||||
return data().flagAt(flagNumber);
|
||||
}
|
||||
|
||||
// two convenient imports for use by subclasses:
|
||||
public static int cellOffset(int index) {
|
||||
return DataLayout.cellOffset(index);
|
||||
}
|
||||
|
||||
public ProfileData(DataLayout data) {
|
||||
_data = data;
|
||||
}
|
||||
|
||||
// Constructor for invalid ProfileData.
|
||||
ProfileData() {
|
||||
_data = null;
|
||||
}
|
||||
|
||||
int bci() {
|
||||
return data().bci();
|
||||
}
|
||||
|
||||
int trapState() {
|
||||
return data().trapState();
|
||||
}
|
||||
public abstract void printDataOn(PrintStream st);
|
||||
|
||||
void tab(PrintStream st) {
|
||||
st.print("\t");
|
||||
}
|
||||
|
||||
void printShared(PrintStream st, String name) {
|
||||
st.print("bci: " + bci());
|
||||
// st.fillTo(tabWidthOne);
|
||||
st.print(" " + name + " ");
|
||||
tab(st);
|
||||
int trap = trapState();
|
||||
if (trap != 0) {
|
||||
st.print("trap(" + MethodData.formatTrapState(trap) + ") ");
|
||||
}
|
||||
int flags = data().flags();
|
||||
if (flags != 0)
|
||||
st.print("flags(" + flags + ") ");
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
PrintStream ps = new PrintStream(baos);
|
||||
try {
|
||||
printDataOn(ps);
|
||||
} finally {
|
||||
ps.close();
|
||||
}
|
||||
return baos.toString();
|
||||
}
|
||||
}
|
||||
@ -1,132 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2016, 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.*;
|
||||
|
||||
// ReceiverTypeData
|
||||
//
|
||||
// A ReceiverTypeData is used to access profiling information about a
|
||||
// dynamic type check. It consists of a counter which counts the total times
|
||||
// that the check is reached, and a series of (Klass, count) pairs
|
||||
// which are used to store a type profile for the receiver of the check.
|
||||
public class ReceiverTypeData<K,M> extends CounterData {
|
||||
static final int nonProfiledCountOffset = counterCellCount;
|
||||
static final int receiver0Offset;
|
||||
static final int count0Offset;
|
||||
static final int receiverTypeRowCellCount;
|
||||
static {
|
||||
receiver0Offset = counterCellCount;
|
||||
count0Offset = receiver0Offset + 1;
|
||||
receiverTypeRowCellCount = (count0Offset + 1) - receiver0Offset;
|
||||
}
|
||||
final MethodDataInterface<K,M> methodData;
|
||||
|
||||
public ReceiverTypeData(MethodDataInterface<K,M> methodData, DataLayout layout) {
|
||||
super(layout);
|
||||
this.methodData = methodData;
|
||||
//assert(layout.tag() == DataLayout.receiverTypeDataTag ||
|
||||
// layout.tag() == DataLayout.virtualCallDataTag, "wrong type");
|
||||
}
|
||||
|
||||
boolean isReceivertypedata() { return true; }
|
||||
|
||||
static int staticCellCount() {
|
||||
int cellCount = counterCellCount + MethodData.TypeProfileWidth * receiverTypeRowCellCount;
|
||||
return cellCount;
|
||||
}
|
||||
|
||||
public int cellCount() {
|
||||
return staticCellCount();
|
||||
}
|
||||
|
||||
// Direct accessors
|
||||
public static int rowLimit() {
|
||||
return MethodData.TypeProfileWidth;
|
||||
}
|
||||
public static int receiverCellIndex(int row) {
|
||||
return receiver0Offset + row * receiverTypeRowCellCount;
|
||||
}
|
||||
public static int receiverCountCellIndex(int row) {
|
||||
return count0Offset + row * receiverTypeRowCellCount;
|
||||
}
|
||||
|
||||
// Get the receiver at row. The 'unchecked' version is needed by parallel old
|
||||
// gc; it does not assert the receiver is a klass. During compaction of the
|
||||
// perm gen, the klass may already have moved, so the isKlass() predicate
|
||||
// would fail. The 'normal' version should be used whenever possible.
|
||||
K receiverUnchecked(int row) {
|
||||
//assert(row < rowLimit(), "oob");
|
||||
Address recv = addressAt(receiverCellIndex(row));
|
||||
return methodData.getKlassAtAddress(recv);
|
||||
}
|
||||
|
||||
public K receiver(int row) {
|
||||
K recv = receiverUnchecked(row);
|
||||
//assert(recv == NULL || ((oop)recv).isKlass(), "wrong type");
|
||||
return recv;
|
||||
}
|
||||
|
||||
public int receiverCount(int row) {
|
||||
//assert(row < rowLimit(), "oob");
|
||||
return uintAt(receiverCountCellIndex(row));
|
||||
}
|
||||
|
||||
// Code generation support
|
||||
static int receiverOffset(int row) {
|
||||
return cellOffset(receiverCellIndex(row));
|
||||
}
|
||||
static int receiverCountOffset(int row) {
|
||||
return cellOffset(receiverCountCellIndex(row));
|
||||
}
|
||||
static int receiverTypeDataSize() {
|
||||
return cellOffset(staticCellCount());
|
||||
}
|
||||
|
||||
void printReceiverDataOn(PrintStream st) {
|
||||
int row;
|
||||
int entries = 0;
|
||||
for (row = 0; row < rowLimit(); row++) {
|
||||
if (receiver(row) != null) entries++;
|
||||
}
|
||||
st.println("count(" + count() + ") entries(" + entries + ")");
|
||||
for (row = 0; row < rowLimit(); row++) {
|
||||
if (receiver(row) != null) {
|
||||
tab(st);
|
||||
methodData.printKlassValueOn(receiver(row), st);
|
||||
st.println("(" + receiverCount(row) + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
public void printDataOn(PrintStream st) {
|
||||
printShared(st, "ReceiverTypeData");
|
||||
printReceiverDataOn(st);
|
||||
}
|
||||
}
|
||||
@ -1,113 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 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.*;
|
||||
|
||||
// RetData
|
||||
//
|
||||
// A RetData is used to access profiling information for a ret bytecode.
|
||||
// It is composed of a count of the number of times that the ret has
|
||||
// been executed, followed by a series of triples of the form
|
||||
// (bci, count, di) which count the number of times that some bci was the
|
||||
// target of the ret and cache a corresponding data displacement.
|
||||
public class RetData extends CounterData {
|
||||
|
||||
static final int bci0Offset = counterCellCount;
|
||||
static final int count0Offset = bci0Offset + 1;
|
||||
static final int displacement0Offset = count0Offset + 1;
|
||||
static final int retRowCellCount = (displacement0Offset + 1) - bci0Offset;
|
||||
|
||||
public RetData(DataLayout layout) {
|
||||
super(layout);
|
||||
//assert(layout.tag() == DataLayout.retDataTag, "wrong type");
|
||||
}
|
||||
|
||||
static final int noBci = -1; // value of bci when bci1/2 are not in use.
|
||||
|
||||
static int staticCellCount() {
|
||||
return counterCellCount + MethodData.BciProfileWidth * retRowCellCount;
|
||||
}
|
||||
|
||||
public int cellCount() {
|
||||
return staticCellCount();
|
||||
}
|
||||
|
||||
static int rowLimit() {
|
||||
return MethodData.BciProfileWidth;
|
||||
}
|
||||
static int bciCellIndex(int row) {
|
||||
return bci0Offset + row * retRowCellCount;
|
||||
}
|
||||
static int bciCountCellIndex(int row) {
|
||||
return count0Offset + row * retRowCellCount;
|
||||
}
|
||||
static int bciDisplacementCellIndex(int row) {
|
||||
return displacement0Offset + row * retRowCellCount;
|
||||
}
|
||||
|
||||
// Direct accessors
|
||||
int bci(int row) {
|
||||
return intAt(bciCellIndex(row));
|
||||
}
|
||||
int bciCount(int row) {
|
||||
return uintAt(bciCountCellIndex(row));
|
||||
}
|
||||
int bciDisplacement(int row) {
|
||||
return intAt(bciDisplacementCellIndex(row));
|
||||
}
|
||||
|
||||
// Code generation support
|
||||
static int bciOffset(int row) {
|
||||
return cellOffset(bciCellIndex(row));
|
||||
}
|
||||
static int bciCountOffset(int row) {
|
||||
return cellOffset(bciCountCellIndex(row));
|
||||
}
|
||||
static int bciDisplacementOffset(int row) {
|
||||
return cellOffset(bciDisplacementCellIndex(row));
|
||||
}
|
||||
|
||||
public void printDataOn(PrintStream st) {
|
||||
printShared(st, "RetData");
|
||||
int row;
|
||||
int entries = 0;
|
||||
for (row = 0; row < rowLimit(); row++) {
|
||||
if (bci(row) != noBci) entries++;
|
||||
}
|
||||
st.println("count(" + count() + ") entries(" + entries + ")");
|
||||
for (row = 0; row < rowLimit(); row++) {
|
||||
if (bci(row) != noBci) {
|
||||
tab(st);
|
||||
st.println(" bci(" + bci(row) + ": count(" + bciCount(row) + ") displacement(" + bciDisplacement(row) + "))");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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.*;
|
||||
|
||||
// Type entry used for return from a call. A single cell to record the
|
||||
// type.
|
||||
public class ReturnTypeEntry<K,M> extends TypeEntries<K,M> {
|
||||
static final int cellCount = 1;
|
||||
|
||||
ReturnTypeEntry(MethodDataInterface<K,M> methodData, ProfileData pd, int baseOff) {
|
||||
super(methodData, pd, baseOff);
|
||||
}
|
||||
|
||||
K type() {
|
||||
return validKlass(baseOff);
|
||||
}
|
||||
|
||||
static int staticCellCount() {
|
||||
return cellCount;
|
||||
}
|
||||
|
||||
int typeIndex() {
|
||||
return baseOff;
|
||||
}
|
||||
|
||||
void printDataOn(PrintStream st) {
|
||||
pd.tab(st);
|
||||
printKlass(st, baseOff);
|
||||
st.println();
|
||||
}
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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.*;
|
||||
|
||||
// SpeculativeTrapData
|
||||
//
|
||||
// A SpeculativeTrapData is used to record traps due to type
|
||||
// speculation. It records the root of the compilation.
|
||||
public class SpeculativeTrapData<K, M> extends ProfileData {
|
||||
static final int speculativeTrapMethod = 0;
|
||||
static final int speculativeTrapCellCount = 1;
|
||||
final MethodDataInterface<K, M> methodData;
|
||||
|
||||
public SpeculativeTrapData(MethodDataInterface<K,M> methodData, DataLayout layout) {
|
||||
super(layout);
|
||||
this.methodData = methodData;
|
||||
}
|
||||
|
||||
static int staticCellCount() {
|
||||
return speculativeTrapCellCount;
|
||||
}
|
||||
|
||||
public int cellCount() {
|
||||
return staticCellCount();
|
||||
}
|
||||
|
||||
public M method() {
|
||||
return methodData.getMethodAtAddress(addressAt(speculativeTrapMethod));
|
||||
}
|
||||
|
||||
public static int methodIndex() {
|
||||
return speculativeTrapMethod;
|
||||
}
|
||||
|
||||
public void printDataOn(PrintStream st) {
|
||||
printShared(st, "SpeculativeTrapData");
|
||||
tab(st);
|
||||
methodData.printMethodValueOn(method(), st);
|
||||
st.println();
|
||||
}
|
||||
}
|
||||
@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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.*;
|
||||
|
||||
// Entries in a ProfileData object to record types: it can either be
|
||||
// none (no profile), unknown (conflicting profile data) or a klass if
|
||||
// a single one is seen. Whether a null reference was seen is also
|
||||
// recorded. No counter is associated with the type and a single type
|
||||
// is tracked (unlike VirtualCallData).
|
||||
public abstract class TypeEntries<K,M> {
|
||||
static final int nullSeen = 1;
|
||||
static final int typeMask = ~nullSeen;
|
||||
static final int typeUnknown = 2;
|
||||
static final int statusBits = nullSeen | typeUnknown;
|
||||
static final int typeKlassMask = ~statusBits;
|
||||
|
||||
final ProfileData pd;
|
||||
final int baseOff;
|
||||
final MethodDataInterface<K,M> methodData;
|
||||
|
||||
boolean wasNullSeen(int index) {
|
||||
long v = pd.intptrAt(index);
|
||||
return (v & nullSeen) != 0;
|
||||
}
|
||||
|
||||
boolean isTypeUnknown(int index) {
|
||||
long v = pd.intptrAt(index);
|
||||
return (v & typeUnknown) != 0;
|
||||
}
|
||||
|
||||
boolean isTypeNone(int index) {
|
||||
long v = pd.intptrAt(index);
|
||||
return (v & typeMask) == 0;
|
||||
}
|
||||
|
||||
K validKlass(int index) {
|
||||
if (!isTypeNone(index) &&
|
||||
!isTypeUnknown(index)) {
|
||||
return methodData.getKlassAtAddress(pd.addressAt(index).andWithMask(typeKlassMask));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
void printKlass(PrintStream st, int index) {
|
||||
if (isTypeNone(index)) {
|
||||
st.print("none");
|
||||
} else if (isTypeUnknown(index)) {
|
||||
st.print("unknown");
|
||||
} else {
|
||||
methodData.printKlassValueOn(validKlass(index), st);
|
||||
}
|
||||
if (wasNullSeen(index)) {
|
||||
st.print(" (null seen)");
|
||||
}
|
||||
}
|
||||
|
||||
TypeEntries(MethodDataInterface<K,M> methodData, ProfileData pd, int baseOff) {
|
||||
this.pd = pd;
|
||||
this.baseOff = baseOff;
|
||||
this.methodData = methodData;
|
||||
}
|
||||
|
||||
long intptrAt(int index) {
|
||||
return pd.intptrAt(index);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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.*;
|
||||
|
||||
// Entries to collect type information at a call: contains arguments
|
||||
// (TypeStackSlotEntries), a return type (ReturnTypeEntry) and a
|
||||
// number of cells.
|
||||
public abstract class TypeEntriesAtCall {
|
||||
|
||||
static int stackSlotLocalOffset(int i) {
|
||||
return headerCellCount() + TypeStackSlotEntries.stackSlotLocalOffset(i);
|
||||
}
|
||||
|
||||
static int argumentTypeLocalOffset(int i) {
|
||||
return headerCellCount() + TypeStackSlotEntries.typeLocalOffset(i);
|
||||
}
|
||||
|
||||
static int headerCellCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cellCountLocalOffset() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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.*;
|
||||
|
||||
// Type entries used for arguments passed at a call and parameters on
|
||||
// method entry. 2 cells per entry: one for the type encoded as in
|
||||
// TypeEntries and one initialized with the stack slot where the
|
||||
// profiled object is to be found so that the interpreter can locate
|
||||
// it quickly.
|
||||
public class TypeStackSlotEntries<K,M> extends TypeEntries<K,M> {
|
||||
static final int stackSlotEntry = 0;
|
||||
static final int typeEntry = 1;
|
||||
static final int perArgCellCount = 2;
|
||||
|
||||
int stackSlotOffset(int i) {
|
||||
return baseOff + stackSlotLocalOffset(i);
|
||||
}
|
||||
|
||||
final int numberOfEntries;
|
||||
|
||||
int typeOffsetInCells(int i) {
|
||||
return baseOff + typeLocalOffset(i);
|
||||
}
|
||||
|
||||
TypeStackSlotEntries(MethodDataInterface<K,M> methodData, ProfileData pd, int baseOff, int nbEntries) {
|
||||
super(methodData, pd, baseOff);
|
||||
numberOfEntries = nbEntries;
|
||||
}
|
||||
|
||||
static int stackSlotLocalOffset(int i) {
|
||||
return i * perArgCellCount + stackSlotEntry;
|
||||
}
|
||||
|
||||
static int typeLocalOffset(int i) {
|
||||
return i * perArgCellCount + typeEntry;
|
||||
}
|
||||
|
||||
int stackSlot(int i) {
|
||||
return pd.uintAt(stackSlotOffset(i));
|
||||
}
|
||||
|
||||
K type(int i) {
|
||||
return validKlass(typeOffsetInCells(i));
|
||||
}
|
||||
|
||||
static int perArgCount() {
|
||||
return perArgCellCount;
|
||||
}
|
||||
|
||||
int typeIndex(int i) {
|
||||
return typeOffsetInCells(i);
|
||||
}
|
||||
|
||||
void printDataOn(PrintStream st) {
|
||||
for (int i = 0; i < numberOfEntries; i++) {
|
||||
pd.tab(st);
|
||||
st.print(i + ": stack(" + stackSlot(i)+ ") ");
|
||||
printKlass(st, typeOffsetInCells(i));
|
||||
st.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2016, 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.*;
|
||||
|
||||
// VirtualCallData
|
||||
//
|
||||
// A VirtualCallData is used to access profiling information about a
|
||||
// call. For now, it has nothing more than a ReceiverTypeData.
|
||||
public class VirtualCallData<K,M> extends ReceiverTypeData<K,M> {
|
||||
public VirtualCallData(MethodDataInterface<K,M> methodData, DataLayout layout) {
|
||||
super(methodData, layout);
|
||||
//assert(layout.tag() == DataLayout.virtualCallDataTag, "wrong type");
|
||||
}
|
||||
|
||||
static int staticCellCount() {
|
||||
// At this point we could add more profile state, e.g., for arguments.
|
||||
// But for now it's the same size as the base record type.
|
||||
int cellCount = ReceiverTypeData.staticCellCount();
|
||||
return cellCount;
|
||||
}
|
||||
|
||||
public int cellCount() {
|
||||
return staticCellCount();
|
||||
}
|
||||
|
||||
// Direct accessors
|
||||
static int virtualCallDataSize() {
|
||||
return cellOffset(staticCellCount());
|
||||
}
|
||||
|
||||
public void printDataOn(PrintStream st) {
|
||||
printShared(st, "VirtualCallData");
|
||||
printReceiverDataOn(st);
|
||||
}
|
||||
}
|
||||
@ -1,108 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2020, 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.*;
|
||||
|
||||
// VirtualCallTypeData
|
||||
//
|
||||
// A VirtualCallTypeData is used to access profiling information about
|
||||
// a virtual call for which we collect type information about
|
||||
// arguments and return value.
|
||||
public class VirtualCallTypeData<K,M> extends VirtualCallData<K,M> implements CallTypeDataInterface<K> {
|
||||
final TypeStackSlotEntries<K,M> args;
|
||||
final ReturnTypeEntry<K,M> ret;
|
||||
|
||||
int cellCountGlobalOffset() {
|
||||
return VirtualCallData.staticCellCount() + TypeEntriesAtCall.cellCountLocalOffset();
|
||||
}
|
||||
|
||||
int cellCountNoHeader() {
|
||||
return uintAt(cellCountGlobalOffset());
|
||||
}
|
||||
|
||||
public VirtualCallTypeData(MethodDataInterface<K,M> methodData, DataLayout layout) {
|
||||
super(methodData, layout);
|
||||
args = new TypeStackSlotEntries<K,M>(methodData, this, VirtualCallData.staticCellCount()+TypeEntriesAtCall.headerCellCount(), numberOfArguments());
|
||||
ret = new ReturnTypeEntry<K,M>(methodData, this, cellCount() - ReturnTypeEntry.staticCellCount());
|
||||
}
|
||||
|
||||
static int staticCellCount() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int cellCount() {
|
||||
return VirtualCallData.staticCellCount() +
|
||||
TypeEntriesAtCall.headerCellCount() +
|
||||
intAt(cellCountGlobalOffset());
|
||||
}
|
||||
|
||||
public int numberOfArguments() {
|
||||
return cellCountNoHeader() / TypeStackSlotEntries.perArgCount();
|
||||
}
|
||||
|
||||
public boolean hasArguments() {
|
||||
return cellCountNoHeader() >= TypeStackSlotEntries.perArgCount();
|
||||
}
|
||||
|
||||
public K argumentType(int i) {
|
||||
return args.type(i);
|
||||
}
|
||||
|
||||
public boolean hasReturn() {
|
||||
return (cellCountNoHeader() % TypeStackSlotEntries.perArgCount()) != 0;
|
||||
}
|
||||
|
||||
public K returnType() {
|
||||
return ret.type();
|
||||
}
|
||||
|
||||
public int argumentTypeIndex(int i) {
|
||||
return args.typeIndex(i);
|
||||
}
|
||||
|
||||
public int returnTypeIndex() {
|
||||
return ret.typeIndex();
|
||||
}
|
||||
|
||||
public void printDataOn(PrintStream st) {
|
||||
super.printDataOn(st);
|
||||
if (hasArguments()) {
|
||||
tab(st);
|
||||
st.print("argument types");
|
||||
args.printDataOn(st);
|
||||
}
|
||||
if (hasReturn()) {
|
||||
tab(st);
|
||||
st.print("return type");
|
||||
ret.printDataOn(st);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2026, 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
|
||||
@ -24,7 +24,7 @@
|
||||
/**
|
||||
* @test
|
||||
* @bug 8174994 8200613
|
||||
* @summary Test the clhsdb commands 'printmdo', 'printall', 'jstack' on a CDS enabled corefile.
|
||||
* @summary Test the clhsdb commands 'printall', 'jstack' on a CDS enabled corefile.
|
||||
* @requires vm.cds
|
||||
* @requires vm.hasSA
|
||||
* @requires vm.flavor == "server"
|
||||
@ -124,24 +124,10 @@ public class ClhsdbCDSCore {
|
||||
throw new SkippedException("The CDS archive is not mapped");
|
||||
}
|
||||
|
||||
List testJavaOpts = Arrays.asList(Utils.getTestJavaOpts());
|
||||
|
||||
if (testJavaOpts.contains("-XX:TieredStopAtLevel=1")) {
|
||||
// No MDOs are allocated in -XX:TieredStopAtLevel=1
|
||||
// The reason is methods being compiled aren't hot enough
|
||||
// Let's not call printmdo in such scenario
|
||||
cmds = List.of("printall", "jstack -v");
|
||||
} else {
|
||||
cmds = List.of("printmdo -a", "printall", "jstack -v");
|
||||
}
|
||||
cmds = List.of("printall", "jstack -v");
|
||||
|
||||
Map<String, List<String>> expStrMap = new HashMap<>();
|
||||
Map<String, List<String>> unExpStrMap = new HashMap<>();
|
||||
expStrMap.put("printmdo -a", List.of(
|
||||
"CounterData",
|
||||
"BranchData"));
|
||||
unExpStrMap.put("printmdo -a", List.of(
|
||||
"No suitable match for type of address"));
|
||||
expStrMap.put("printall", List.of(
|
||||
"aload_0",
|
||||
"_nofast_aload_0",
|
||||
|
||||
@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2025, 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.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import jdk.test.lib.apps.LingeredApp;
|
||||
import jdk.test.lib.Utils;
|
||||
import jtreg.SkippedException;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @library /test/lib
|
||||
* @requires vm.hasSA
|
||||
* @requires (os.arch != "riscv64" | !(vm.cpu.features ~= ".*qemu.*"))
|
||||
* @requires vm.flavor == "server" & !vm.emulatedClient & !(vm.opt.TieredStopAtLevel == 1)
|
||||
* @run main/othervm TestPrintMdo
|
||||
*/
|
||||
|
||||
public class TestPrintMdo {
|
||||
|
||||
public static void main (String... args) throws Exception {
|
||||
System.out.println("Starting TestPrintMdo test");
|
||||
LingeredApp app = null;
|
||||
try {
|
||||
ClhsdbLauncher test = new ClhsdbLauncher();
|
||||
app = LingeredApp.startApp("-XX:+ProfileInterpreter", "-XX:CompileThreshold=100");
|
||||
System.out.println ("Started LingeredApp with pid " + app.getPid());
|
||||
List<String> cmds = List.of("printmdo -a");
|
||||
|
||||
Map<String, List<String>> expStrMap = new HashMap<>();
|
||||
Map<String, List<String>> unExpStrMap = new HashMap<>();
|
||||
expStrMap.put("printmdo -a", List.of(
|
||||
"VirtualCallData",
|
||||
"CounterData",
|
||||
"bci",
|
||||
"MethodData",
|
||||
"java/lang/Object"));
|
||||
unExpStrMap.put("printmdo -a", List.of(
|
||||
"missing reason for "));
|
||||
test.run(app.getPid(), cmds, expStrMap, unExpStrMap);
|
||||
} catch (SkippedException se) {
|
||||
throw se;
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException("Test ERROR " + ex, ex);
|
||||
} finally {
|
||||
LingeredApp.stopApp(app);
|
||||
}
|
||||
|
||||
System.out.println("Test PASSED");
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user