Merge
This commit is contained in:
commit
6f3e1a0593
@ -276,4 +276,5 @@ e8fb566b94667f88462164defa654203f0ab6820 jdk8-b54
|
||||
09ea7e0752b306b8ae74713aeb4eb6263e1c6836 hs24-b22
|
||||
af0c8a0808516317333dcf9af15567cdd52761ce jdk8-b55
|
||||
6124ff4218296c91e4a72f1a76c064892d39d61b jdk8-b56
|
||||
9b076bc3ab67d42d1d02144ef8dcd6006a7fc0d6 hs25-b01
|
||||
d70102c4cb73158902acaa6016f47c7bc14e0d67 jdk8-b57
|
||||
|
@ -38,10 +38,10 @@ Available commands:
|
||||
assert true | false <font color="red">turn on/off asserts in SA code</font>
|
||||
attach pid | exec core <font color="red">attach SA to a process or core</font>
|
||||
class name <font color="red">find a Java class from debuggee and print oop</font>
|
||||
classes <font color="red">print all loaded Java classes with klassOop</font>
|
||||
classes <font color="red">print all loaded Java classes with Klass*</font>
|
||||
detach <font color="red">detach SA from current target</font>
|
||||
dis address [ length ] <font color="red">disassemble (sparc/x86) specified number of instructions from given address</font>
|
||||
dumpclass { address | name } [ directory ] <font color="red">dump .class file for given klassOop or class name</font>
|
||||
dumpclass { address | name } [ directory ] <font color="red">dump .class file for given Klass* or class name</font>
|
||||
dumpheap [ file ] <font color="red">dump heap in hprof binary format</font>
|
||||
echo [ true | false ] <font color="red">turn on/off command echo mode</font>
|
||||
examine [ address/count ] | [ address,address] <font color="red">show contents of memory from given address</font>
|
||||
@ -51,7 +51,7 @@ Available commands:
|
||||
help [ command ] <font color="red">print help message for all commands or just given command</font>
|
||||
history <font color="red">show command history. usual !command-number syntax works.</font>
|
||||
inspect expression <font color="red">inspect a given oop</font>
|
||||
jdis address <font color="red">show bytecode disassembly of a given methodOop</font>
|
||||
jdis address <font color="red">show bytecode disassembly of a given Method*</font>
|
||||
jhisto <font color="red">show Java heap histogram</font>
|
||||
jseval script <font color="red">evaluate a given string as JavaScript code</font>
|
||||
jsload file <font color="red">load and evaluate a JavaScript file</font>
|
||||
@ -59,7 +59,7 @@ Available commands:
|
||||
livenmethods <font color="red">show all live nmethods</font>
|
||||
mem address [ length ] <font color="red">show contents of memory -- also shows closest ELF/COFF symbol if found</font>
|
||||
pmap <font color="red">show Solaris pmap-like output</font>
|
||||
print expression <font color="red">print given klassOop, methodOop or arbitrary address</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>
|
||||
printstatics [ type ] <font color="red">print static fields of given HotSpot type (or all types if none specified)</font>
|
||||
pstack [-v] <font color="red">show mixed mode stack trace for all Java, non-Java threads. -v is verbose mode</font>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -210,7 +210,6 @@ static map_info* core_lookup(struct ps_prochandle *ph, uintptr_t addr)
|
||||
// mapped. This structure gets written to a file. It is not a class,
|
||||
// so that the compilers don't add any compiler-private data to it.
|
||||
|
||||
// Refer to CompactingPermGenGen::n_regions in compactingPermGenGen.hpp
|
||||
#define NUM_SHARED_MAPS 4
|
||||
|
||||
// Refer to FileMapInfo::_current_version in filemap.hpp
|
||||
@ -234,7 +233,7 @@ struct FileMapHeader {
|
||||
char _read_only; // read only space?
|
||||
char _allow_exec; // executable code in space?
|
||||
|
||||
} _space[NUM_SHARED_MAPS]; // was _space[CompactingPermGenGen::n_regions];
|
||||
} _space[NUM_SHARED_MAPS];
|
||||
|
||||
// Ignore the rest of the FileMapHeader. We don't need those fields here.
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -209,7 +209,6 @@ static map_info* core_lookup(struct ps_prochandle *ph, uintptr_t addr)
|
||||
// mapped. This structure gets written to a file. It is not a class,
|
||||
// so that the compilers don't add any compiler-private data to it.
|
||||
|
||||
// Refer to CompactingPermGenGen::n_regions in compactingPermGenGen.hpp
|
||||
#define NUM_SHARED_MAPS 4
|
||||
|
||||
// Refer to FileMapInfo::_current_version in filemap.hpp
|
||||
@ -233,7 +232,7 @@ struct FileMapHeader {
|
||||
char _read_only; // read only space?
|
||||
char _allow_exec; // executable code in space?
|
||||
|
||||
} _space[NUM_SHARED_MAPS]; // was _space[CompactingPermGenGen::n_regions];
|
||||
} _space[NUM_SHARED_MAPS];
|
||||
|
||||
// Ignore the rest of the FileMapHeader. We don't need those fields here.
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -510,7 +510,6 @@ wrapper_fill_cframe_list(void *cd, const prgregset_t regs, uint_t argc,
|
||||
// mapped. This structure gets written to a file. It is not a class, so
|
||||
// that the compilers don't add any compiler-private data to it.
|
||||
|
||||
// Refer to CompactingPermGenGen::n_regions in compactingPermGenGen.hpp
|
||||
const int NUM_SHARED_MAPS = 4;
|
||||
|
||||
// Refer to FileMapInfo::_current_version in filemap.hpp
|
||||
@ -531,7 +530,7 @@ struct FileMapHeader {
|
||||
bool _read_only; // read only space?
|
||||
bool _allow_exec; // executable code in space?
|
||||
|
||||
} _space[NUM_SHARED_MAPS]; // was _space[CompactingPermGenGen::n_regions];
|
||||
} _space[NUM_SHARED_MAPS];
|
||||
|
||||
// Ignore the rest of the FileMapHeader. We don't need those fields here.
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 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
|
||||
@ -634,29 +634,57 @@ public class CommandProcessor {
|
||||
} else {
|
||||
String s = t.nextToken();
|
||||
if (s.equals("-a")) {
|
||||
HeapVisitor iterator = new DefaultHeapVisitor() {
|
||||
public boolean doObj(Oop obj) {
|
||||
if (obj instanceof MethodData) {
|
||||
Method m = ((MethodData)obj).getMethod();
|
||||
out.println("MethodData " + obj.getHandle() + " for " +
|
||||
SystemDictionary sysDict = VM.getVM().getSystemDictionary();
|
||||
sysDict.allClassesDo(new SystemDictionary.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.getHandle());
|
||||
((MethodData)obj).printDataOn(out);
|
||||
m.getSignature().asString() + "@" + m.getAddress());
|
||||
mdo.printDataOn(out);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
VM.getVM().getObjectHeap().iteratePerm(iterator);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
Address a = VM.getVM().getDebugger().parseAddress(s);
|
||||
OopHandle handle = a.addOffsetToAsOopHandle(0);
|
||||
MethodData mdo = (MethodData)VM.getVM().getObjectHeap().newOop(handle);
|
||||
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.
|
||||
public void doit(Tokens t) {
|
||||
if (t.countTokens() != 0) {
|
||||
usage();
|
||||
} else {
|
||||
SystemDictionary sysDict = VM.getVM().getSystemDictionary();
|
||||
sysDict.allClassesDo(new SystemDictionary.ClassVisitor() {
|
||||
public void visit(Klass k) {
|
||||
if (k instanceof InstanceKlass && ((InstanceKlass)k).getConstants().getCache() != null) {
|
||||
MethodArray methods = ((InstanceKlass)k).getMethods();
|
||||
for (int i = 0; i < methods.length(); i++) {
|
||||
Method m = methods.at(i);
|
||||
HTMLGenerator gen = new HTMLGenerator(false);
|
||||
out.println(gen.genHTML(m));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
new Command("dumpideal", "dumpideal { -a | id }", false) {
|
||||
// Do a full dump of the nodes reachabile from root in each compiler thread.
|
||||
public void doit(Tokens t) {
|
||||
@ -1229,7 +1257,7 @@ public class CommandProcessor {
|
||||
}
|
||||
};
|
||||
VM.getVM().getObjectHeap().iterateRaw(iterator);
|
||||
} else if (type.equals("heap") || type.equals("perm")) {
|
||||
} else if (type.equals("heap")) {
|
||||
HeapVisitor iterator = new DefaultHeapVisitor() {
|
||||
public boolean doObj(Oop obj) {
|
||||
int index = 0;
|
||||
@ -1246,11 +1274,7 @@ public class CommandProcessor {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
if (type.equals("heap")) {
|
||||
VM.getVM().getObjectHeap().iterate(iterator);
|
||||
} else {
|
||||
VM.getVM().getObjectHeap().iteratePerm(iterator);
|
||||
}
|
||||
} else if (type.equals("codecache")) {
|
||||
CodeCacheVisitor v = new CodeCacheVisitor() {
|
||||
public void prologue(Address start, Address end) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -998,7 +998,7 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
|
||||
curFrame.addressOfInterpreterFrameLocal((int) interpreterFrameMethod.getMaxLocals() + offset),
|
||||
"Interpreter locals area for frame with SP = " + curFrame.getSP()));
|
||||
}
|
||||
String methodAnno = "Interpreter frame methodOop";
|
||||
String methodAnno = "Interpreter frame Method*";
|
||||
if (interpreterFrameMethod == null) {
|
||||
methodAnno += " (BAD OOP)";
|
||||
}
|
||||
@ -1054,13 +1054,6 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
|
||||
}
|
||||
}
|
||||
|
||||
if (bad) {
|
||||
// Try perm gen
|
||||
if (heap.permGen().isIn(handle)) {
|
||||
anno = "PermGen ";
|
||||
bad = false;
|
||||
}
|
||||
}
|
||||
} else if (collHeap instanceof ParallelScavengeHeap) {
|
||||
ParallelScavengeHeap heap = (ParallelScavengeHeap) collHeap;
|
||||
if (heap.youngGen().isIn(handle)) {
|
||||
@ -1069,9 +1062,6 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
|
||||
} else if (heap.oldGen().isIn(handle)) {
|
||||
anno = "PSOldGen ";
|
||||
bad = false;
|
||||
} else if (heap.permGen().isIn(handle)) {
|
||||
anno = "PSPermGen ";
|
||||
bad = false;
|
||||
}
|
||||
} else {
|
||||
// Optimistically assume the oop isn't bad
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -50,6 +50,7 @@ public class HotSpotTypeDataBase extends BasicTypeDataBase {
|
||||
private static final int C_INT8_SIZE = 1;
|
||||
private static final int C_INT32_SIZE = 4;
|
||||
private static final int C_INT64_SIZE = 8;
|
||||
private static int pointerSize = UNINITIALIZED_SIZE;
|
||||
|
||||
private static final boolean DEBUG;
|
||||
static {
|
||||
@ -185,6 +186,9 @@ public class HotSpotTypeDataBase extends BasicTypeDataBase {
|
||||
long size = entryAddr.getCIntegerAt(typeEntrySizeOffset, C_INT64_SIZE, true);
|
||||
|
||||
createType(typeName, superclassName, isOopType, isIntegerType, isUnsigned, size);
|
||||
if (pointerSize == UNINITIALIZED_SIZE && typeName.equals("void*")) {
|
||||
pointerSize = (int)size;
|
||||
}
|
||||
}
|
||||
|
||||
entryAddr = entryAddr.addOffsetTo(typeEntryArrayStride);
|
||||
@ -678,7 +682,11 @@ public class HotSpotTypeDataBase extends BasicTypeDataBase {
|
||||
}
|
||||
}
|
||||
result = new BasicPointerType(this, typeName, targetType);
|
||||
result.setSize(UNINITIALIZED_SIZE);
|
||||
if (pointerSize == UNINITIALIZED_SIZE && !typeName.equals("void*")) {
|
||||
// void* must be declared early so that other pointer types can use that to set their size.
|
||||
throw new InternalError("void* type hasn't been seen when parsing " + typeName);
|
||||
}
|
||||
result.setSize(pointerSize);
|
||||
addType(result);
|
||||
return result;
|
||||
}
|
||||
@ -731,9 +739,11 @@ public class HotSpotTypeDataBase extends BasicTypeDataBase {
|
||||
"had its size redefined (old was " + curType.getSize() + ", new is " + size + ").");
|
||||
}
|
||||
|
||||
if (!typeNameIsPointerType(typeName)) {
|
||||
System.err.println("Warning: the type \"" + typeName + "\" (declared in the remote VM in VMStructs::localHotSpotVMTypes) " +
|
||||
"had its size declared as " + size + " twice. Continuing.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 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
|
||||
@ -24,14 +24,14 @@
|
||||
|
||||
package sun.jvm.hotspot.ci;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
public class ciArrayKlassKlass extends ciKlassKlass {
|
||||
public class ciBaseObject extends VMObject {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
@ -41,11 +41,13 @@ public class ciArrayKlassKlass extends ciKlassKlass {
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("ciArrayKlassKlass");
|
||||
Type type = db.lookupType("ciBaseObject");
|
||||
identField = new CIntField(type.getCIntegerField("_ident"), 0);
|
||||
}
|
||||
|
||||
private static CIntField identField;
|
||||
|
||||
public ciArrayKlassKlass(Address addr) {
|
||||
public ciBaseObject(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -47,8 +47,8 @@ public class ciInstanceKlass extends ciKlass {
|
||||
Type type = db.lookupType("ciInstanceKlass");
|
||||
initStateField = new CIntField(type.getCIntegerField("_init_state"), 0);
|
||||
isSharedField = new CIntField(type.getCIntegerField("_is_shared"), 0);
|
||||
CLASS_STATE_LINKED = db.lookupIntConstant("instanceKlass::linked").intValue();
|
||||
CLASS_STATE_FULLY_INITIALIZED = db.lookupIntConstant("instanceKlass::fully_initialized").intValue();
|
||||
CLASS_STATE_LINKED = db.lookupIntConstant("InstanceKlass::linked").intValue();
|
||||
CLASS_STATE_FULLY_INITIALIZED = db.lookupIntConstant("InstanceKlass::fully_initialized").intValue();
|
||||
}
|
||||
|
||||
private static CIntField initStateField;
|
||||
@ -63,7 +63,7 @@ public class ciInstanceKlass extends ciKlass {
|
||||
public int initState() {
|
||||
int initState = (int)initStateField.getValue(getAddress());
|
||||
if (isShared() && initState < CLASS_STATE_LINKED) {
|
||||
InstanceKlass ik = (InstanceKlass)getOop();
|
||||
InstanceKlass ik = (InstanceKlass)getMetadata();
|
||||
initState = ik.getInitStateAsInt();
|
||||
}
|
||||
return initState;
|
||||
|
@ -1,51 +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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.ci;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.*;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
public class ciKlassKlass extends ciKlass {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
initialize(VM.getVM().getTypeDataBase());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("ciKlassKlass");
|
||||
}
|
||||
|
||||
|
||||
public ciKlassKlass(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 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
|
||||
@ -24,13 +24,14 @@
|
||||
|
||||
package sun.jvm.hotspot.ci;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
public class ciInstanceKlassKlass extends ciKlassKlass {
|
||||
public class ciMetadata extends ciBaseObject {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
@ -40,11 +41,25 @@ public class ciInstanceKlassKlass extends ciKlassKlass {
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("ciInstanceKlassKlass");
|
||||
Type type = db.lookupType("ciMetadata");
|
||||
metadataField = new MetadataField(type.getAddressField("_metadata"), 0);
|
||||
}
|
||||
|
||||
private static MetadataField metadataField;
|
||||
|
||||
public ciInstanceKlassKlass(Address addr) {
|
||||
public Metadata getMetadata() {
|
||||
return metadataField.getValue(getAddress());
|
||||
}
|
||||
|
||||
public ciMetadata(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public void printOn(PrintStream out) {
|
||||
getMetadata().printValueOn(out);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return getMetadata().toString();
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -32,7 +32,7 @@ import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
public class ciMethod extends ciObject {
|
||||
public class ciMethod extends ciMetadata {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
@ -61,7 +61,7 @@ public class ciMethod extends ciObject {
|
||||
}
|
||||
|
||||
public Method method() {
|
||||
return (Method)getOop();
|
||||
return (Method)getMetadata();
|
||||
}
|
||||
|
||||
public int interpreterThrowoutCount() {
|
||||
@ -75,7 +75,7 @@ public class ciMethod extends ciObject {
|
||||
public int instructionsSize() {
|
||||
if (instructionsSizeField == null) {
|
||||
// XXX
|
||||
Method method = (Method)getOop();
|
||||
Method method = method();
|
||||
NMethod nm = method.getNativeMethod();
|
||||
if (nm != null) return (int)nm.codeEnd().minus(nm.getVerifiedEntryPoint());
|
||||
return 0;
|
||||
@ -84,7 +84,7 @@ public class ciMethod extends ciObject {
|
||||
}
|
||||
|
||||
public void printShortName(PrintStream st) {
|
||||
Method method = (Method)getOop();
|
||||
Method method = method();
|
||||
st.printf(" %s::%s", method.getMethodHolder().getName().asString().replace('/', '.'),
|
||||
method.getName().asString());
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -31,7 +31,7 @@ import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
public class ciMethodData extends ciObject {
|
||||
public class ciMethodData extends ciMetadata {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
@ -54,7 +54,7 @@ public class ciMethodData extends ciObject {
|
||||
extraDataSizeField = new CIntField(type.getCIntegerField("_extra_data_size"), 0);
|
||||
dataSizeField = new CIntField(type.getCIntegerField("_data_size"), 0);
|
||||
stateField = new CIntField(type.getCIntegerField("_state"), 0);
|
||||
sizeofMethodDataOopDesc = (int)db.lookupType("methodDataOopDesc").getSize();;
|
||||
sizeofMethodDataOopDesc = (int)db.lookupType("MethodData").getSize();;
|
||||
}
|
||||
|
||||
private static AddressField origField;
|
||||
@ -83,7 +83,7 @@ public class ciMethodData extends ciObject {
|
||||
}
|
||||
|
||||
public byte[] orig() {
|
||||
// fetch the orig methodDataOopDesc data between header and dataSize
|
||||
// fetch the orig MethodData data between header and dataSize
|
||||
Address base = getAddress().addOffsetTo(origField.getOffset());
|
||||
byte[] result = new byte[MethodData.sizeofMethodDataOopDesc];
|
||||
for (int i = 0; i < MethodData.sizeofMethodDataOopDesc; i++) {
|
||||
|
@ -1,50 +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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.ci;
|
||||
|
||||
import java.util.*;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
public class ciMethodKlass extends ciKlass {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
initialize(VM.getVM().getTypeDataBase());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("ciMethodKlass");
|
||||
}
|
||||
|
||||
|
||||
public ciMethodKlass(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -31,7 +31,7 @@ import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
public class ciObject extends VMObject {
|
||||
public class ciObject extends ciBaseObject {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
@ -42,12 +42,10 @@ public class ciObject extends VMObject {
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("ciObject");
|
||||
identField = new CIntField(type.getCIntegerField("_ident"), 0);
|
||||
klassField = type.getAddressField("_klass");
|
||||
handleField = type.getAddressField("_handle");
|
||||
}
|
||||
|
||||
private static CIntField identField;
|
||||
private static AddressField klassField;
|
||||
private static AddressField handleField;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -44,18 +44,20 @@ public class ciObjectFactory extends VMObject {
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("ciObjectFactory");
|
||||
unloadedMethodsField = type.getAddressField("_unloaded_methods");
|
||||
ciObjectsField = type.getAddressField("_ci_objects");
|
||||
ciMetadataField = type.getAddressField("_ci_metadata");
|
||||
symbolsField = type.getAddressField("_symbols");
|
||||
|
||||
ciObjectConstructor = new VirtualBaseConstructor<ciObject>(db, db.lookupType("ciObject"), "sun.jvm.hotspot.ci", ciObject.class);
|
||||
ciMetadataConstructor = new VirtualBaseConstructor<ciMetadata>(db, db.lookupType("ciMetadata"), "sun.jvm.hotspot.ci", ciMetadata.class);
|
||||
ciSymbolConstructor = new VirtualBaseConstructor<ciSymbol>(db, db.lookupType("ciSymbol"), "sun.jvm.hotspot.ci", ciSymbol.class);
|
||||
}
|
||||
|
||||
private static AddressField unloadedMethodsField;
|
||||
private static AddressField ciObjectsField;
|
||||
private static AddressField ciMetadataField;
|
||||
private static AddressField symbolsField;
|
||||
|
||||
private static VirtualBaseConstructor<ciObject> ciObjectConstructor;
|
||||
private static VirtualBaseConstructor<ciMetadata> ciMetadataConstructor;
|
||||
private static VirtualBaseConstructor<ciSymbol> ciSymbolConstructor;
|
||||
|
||||
public static ciObject get(Address addr) {
|
||||
@ -64,8 +66,14 @@ public class ciObjectFactory extends VMObject {
|
||||
return (ciObject)ciObjectConstructor.instantiateWrapperFor(addr);
|
||||
}
|
||||
|
||||
public GrowableArray<ciObject> objects() {
|
||||
return GrowableArray.create(ciObjectsField.getValue(getAddress()), ciObjectConstructor);
|
||||
public static ciMetadata getMetadata(Address addr) {
|
||||
if (addr == null) return null;
|
||||
|
||||
return (ciMetadata)ciMetadataConstructor.instantiateWrapperFor(addr);
|
||||
}
|
||||
|
||||
public GrowableArray<ciMetadata> objects() {
|
||||
return GrowableArray.create(ciMetadataField.getValue(getAddress()), ciMetadataConstructor);
|
||||
}
|
||||
|
||||
public GrowableArray<ciSymbol> symbols() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -42,7 +42,7 @@ public class ciReceiverTypeData extends ReceiverTypeData {
|
||||
|
||||
public ciKlass receiverAt(int row) {
|
||||
//assert((uint)row < rowLimit(), "oob");
|
||||
ciObject recv = ciObjectFactory.get(addressAt(receiverCellIndex(row)));
|
||||
ciMetadata recv = ciObjectFactory.getMetadata(addressAt(receiverCellIndex(row)));
|
||||
if (recv != null && !(recv instanceof ciKlass)) {
|
||||
System.err.println(recv);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -31,7 +31,7 @@ import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
public class ciSymbol extends VMObject {
|
||||
public class ciSymbol extends ciMetadata {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
@ -42,12 +42,10 @@ public class ciSymbol extends VMObject {
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("ciSymbol");
|
||||
identField = type.getCIntegerField("_ident");
|
||||
symbolField = type.getAddressField("_symbol");
|
||||
}
|
||||
|
||||
private static AddressField symbolField;
|
||||
private static CIntegerField identField;
|
||||
|
||||
public String asUtf88() {
|
||||
Symbol sym = Symbol.create(symbolField.getValue(getAddress()));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -30,7 +30,7 @@ import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
public class ciType extends ciObject {
|
||||
public class ciType extends ciMetadata {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
|
@ -1,51 +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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.ci;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.*;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
public class ciTypeArrayKlassKlass extends ciArrayKlassKlass {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
initialize(VM.getVM().getTypeDataBase());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("ciTypeArrayKlassKlass");
|
||||
}
|
||||
|
||||
|
||||
public ciTypeArrayKlassKlass(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -42,7 +42,7 @@ public class ciVirtualCallData extends VirtualCallData {
|
||||
|
||||
public ciKlass receiverAt(int row) {
|
||||
//assert((uint)row < rowLimit(), "oob");
|
||||
ciObject recv = ciObjectFactory.get(addressAt(receiverCellIndex(row)));
|
||||
ciMetadata recv = ciObjectFactory.getMetadata(addressAt(receiverCellIndex(row)));
|
||||
if (recv != null && !(recv instanceof ciKlass)) {
|
||||
System.err.println(recv);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 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
|
||||
@ -22,7 +22,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.ci;
|
||||
package sun.jvm.hotspot.classfile;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.*;
|
||||
@ -31,7 +31,7 @@ import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
public class ciObjArrayKlassKlass extends ciArrayKlassKlass {
|
||||
public class ClassLoaderData extends VMObject {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
@ -41,11 +41,26 @@ public class ciObjArrayKlassKlass extends ciArrayKlassKlass {
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("ciObjArrayKlassKlass");
|
||||
Type type = db.lookupType("ClassLoaderData");
|
||||
classLoaderField = type.getOopField("_class_loader");
|
||||
nextField = type.getAddressField("_next");
|
||||
}
|
||||
|
||||
private static sun.jvm.hotspot.types.OopField classLoaderField;
|
||||
private static AddressField nextField;
|
||||
|
||||
public ciObjArrayKlassKlass(Address addr) {
|
||||
public ClassLoaderData(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public static ClassLoaderData instantiateWrapperFor(Address addr) {
|
||||
if (addr == null) {
|
||||
return null;
|
||||
}
|
||||
return new ClassLoaderData(addr);
|
||||
}
|
||||
|
||||
public Oop getClassLoader() {
|
||||
return VM.getVM().getObjectHeap().newOop(classLoaderField.getValue(getAddress()));
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -29,6 +29,7 @@ import java.util.*;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.VM;
|
||||
import sun.jvm.hotspot.utilities.*;
|
||||
import sun.jvm.hotspot.oops.Method;
|
||||
|
||||
public class DebugInfoReadStream extends CompressedReadStream {
|
||||
private NMethod code;
|
||||
@ -53,6 +54,10 @@ public class DebugInfoReadStream extends CompressedReadStream {
|
||||
return code.getOopAt(readInt());
|
||||
}
|
||||
|
||||
public Method readMethod() {
|
||||
return code.getMethodAt(readInt());
|
||||
}
|
||||
|
||||
ScopeValue readObjectValue() {
|
||||
int id = readInt();
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -35,7 +35,7 @@ import sun.jvm.hotspot.utilities.*;
|
||||
|
||||
public class NMethod extends CodeBlob {
|
||||
private static long pcDescSize;
|
||||
private static sun.jvm.hotspot.types.OopField methodField;
|
||||
private static AddressField methodField;
|
||||
/** != InvocationEntryBci if this nmethod is an on-stack replacement method */
|
||||
private static CIntegerField entryBCIField;
|
||||
/** To support simple linked-list chaining of nmethods */
|
||||
@ -50,6 +50,7 @@ public class NMethod extends CodeBlob {
|
||||
private static CIntegerField origPCOffsetField;
|
||||
private static CIntegerField stubOffsetField;
|
||||
private static CIntegerField oopsOffsetField;
|
||||
private static CIntegerField metadataOffsetField;
|
||||
private static CIntegerField scopesDataOffsetField;
|
||||
private static CIntegerField scopesPCsOffsetField;
|
||||
private static CIntegerField dependenciesOffsetField;
|
||||
@ -88,7 +89,7 @@ public class NMethod extends CodeBlob {
|
||||
private static void initialize(TypeDataBase db) {
|
||||
Type type = db.lookupType("nmethod");
|
||||
|
||||
methodField = type.getOopField("_method");
|
||||
methodField = type.getAddressField("_method");
|
||||
entryBCIField = type.getCIntegerField("_entry_bci");
|
||||
osrLinkField = type.getAddressField("_osr_link");
|
||||
scavengeRootLinkField = type.getAddressField("_scavenge_root_link");
|
||||
@ -100,6 +101,7 @@ public class NMethod extends CodeBlob {
|
||||
origPCOffsetField = type.getCIntegerField("_orig_pc_offset");
|
||||
stubOffsetField = type.getCIntegerField("_stub_offset");
|
||||
oopsOffsetField = type.getCIntegerField("_oops_offset");
|
||||
metadataOffsetField = type.getCIntegerField("_metadata_offset");
|
||||
scopesDataOffsetField = type.getCIntegerField("_scopes_data_offset");
|
||||
scopesPCsOffsetField = type.getCIntegerField("_scopes_pcs_offset");
|
||||
dependenciesOffsetField = type.getCIntegerField("_dependencies_offset");
|
||||
@ -126,7 +128,7 @@ public class NMethod extends CodeBlob {
|
||||
}
|
||||
|
||||
public Method getMethod() {
|
||||
return (Method) VM.getVM().getObjectHeap().newOop(methodField.getValue(addr));
|
||||
return (Method)Metadata.instantiateWrapperFor(methodField.getValue(addr));
|
||||
}
|
||||
|
||||
// Type info
|
||||
@ -146,7 +148,9 @@ public class NMethod extends CodeBlob {
|
||||
public Address stubBegin() { return headerBegin().addOffsetTo(getStubOffset()); }
|
||||
public Address stubEnd() { return headerBegin().addOffsetTo(getOopsOffset()); }
|
||||
public Address oopsBegin() { return headerBegin().addOffsetTo(getOopsOffset()); }
|
||||
public Address oopsEnd() { return headerBegin().addOffsetTo(getScopesDataOffset()); }
|
||||
public Address oopsEnd() { return headerBegin().addOffsetTo(getMetadataOffset()); }
|
||||
public Address metadataBegin() { return headerBegin().addOffsetTo(getMetadataOffset()); }
|
||||
public Address metadataEnd() { return headerBegin().addOffsetTo(getScopesDataOffset()); }
|
||||
public Address scopesDataBegin() { return headerBegin().addOffsetTo(getScopesDataOffset()); }
|
||||
public Address scopesDataEnd() { return headerBegin().addOffsetTo(getScopesPCsOffset()); }
|
||||
public Address scopesPCsBegin() { return headerBegin().addOffsetTo(getScopesPCsOffset()); }
|
||||
@ -162,6 +166,7 @@ public class NMethod extends CodeBlob {
|
||||
public int instsSize() { return (int) instsEnd() .minus(instsBegin()); }
|
||||
public int stubSize() { return (int) stubEnd() .minus(stubBegin()); }
|
||||
public int oopsSize() { return (int) oopsEnd() .minus(oopsBegin()); }
|
||||
public int metadataSize() { return (int) metadataEnd() .minus(metadataBegin()); }
|
||||
public int scopesDataSize() { return (int) scopesDataEnd() .minus(scopesDataBegin()); }
|
||||
public int scopesPCsSize() { return (int) scopesPCsEnd() .minus(scopesPCsBegin()); }
|
||||
public int dependenciesSize() { return (int) dependenciesEnd().minus(dependenciesBegin()); }
|
||||
@ -185,12 +190,14 @@ public class NMethod extends CodeBlob {
|
||||
public boolean instsContains (Address addr) { return instsBegin() .lessThanOrEqual(addr) && instsEnd() .greaterThan(addr); }
|
||||
public boolean stubContains (Address addr) { return stubBegin() .lessThanOrEqual(addr) && stubEnd() .greaterThan(addr); }
|
||||
public boolean oopsContains (Address addr) { return oopsBegin() .lessThanOrEqual(addr) && oopsEnd() .greaterThan(addr); }
|
||||
public boolean metadataContains (Address addr) { return metadataBegin() .lessThanOrEqual(addr) && metadataEnd() .greaterThan(addr); }
|
||||
public boolean scopesDataContains (Address addr) { return scopesDataBegin() .lessThanOrEqual(addr) && scopesDataEnd() .greaterThan(addr); }
|
||||
public boolean scopesPCsContains (Address addr) { return scopesPCsBegin() .lessThanOrEqual(addr) && scopesPCsEnd() .greaterThan(addr); }
|
||||
public boolean handlerTableContains(Address addr) { return handlerTableBegin().lessThanOrEqual(addr) && handlerTableEnd().greaterThan(addr); }
|
||||
public boolean nulChkTableContains (Address addr) { return nulChkTableBegin() .lessThanOrEqual(addr) && nulChkTableEnd() .greaterThan(addr); }
|
||||
|
||||
public int getOopsLength() { return (int) (oopsSize() / VM.getVM().getOopSize()); }
|
||||
public int getMetadataLength() { return (int) (metadataSize() / VM.getVM().getOopSize()); }
|
||||
|
||||
/** Entry points */
|
||||
public Address getEntryPoint() { return entryPointField.getValue(addr); }
|
||||
@ -205,6 +212,19 @@ public class NMethod extends CodeBlob {
|
||||
return oopsBegin().getOopHandleAt((index - 1) * VM.getVM().getOopSize());
|
||||
}
|
||||
|
||||
/** Support for metadata in scopes and relocs. Note: index 0 is reserved for null. */
|
||||
public Address getMetadataAt(int index) {
|
||||
if (index == 0) return null;
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(index > 0 && index <= getMetadataLength(), "must be a valid non-zero index");
|
||||
}
|
||||
return metadataBegin().getAddressAt((index - 1) * VM.getVM().getOopSize());
|
||||
}
|
||||
|
||||
public Method getMethodAt(int index) {
|
||||
return (Method)Metadata.instantiateWrapperFor(getMetadataAt(index));
|
||||
}
|
||||
|
||||
// FIXME: add interpreter_entry_point()
|
||||
// FIXME: add lazy_interpreter_entry_point() for C2
|
||||
|
||||
@ -412,6 +432,7 @@ public class NMethod extends CodeBlob {
|
||||
private int getDeoptMhOffset() { return (int) deoptMhOffsetField .getValue(addr); }
|
||||
private int getStubOffset() { return (int) stubOffsetField .getValue(addr); }
|
||||
private int getOopsOffset() { return (int) oopsOffsetField .getValue(addr); }
|
||||
private int getMetadataOffset() { return (int) metadataOffsetField .getValue(addr); }
|
||||
private int getScopesDataOffset() { return (int) scopesDataOffsetField .getValue(addr); }
|
||||
private int getScopesPCsOffset() { return (int) scopesPCsOffsetField .getValue(addr); }
|
||||
private int getDependenciesOffset() { return (int) dependenciesOffsetField.getValue(addr); }
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -61,7 +61,7 @@ public class ScopeDesc {
|
||||
DebugInfoReadStream stream = streamAt(decodeOffset);
|
||||
|
||||
senderDecodeOffset = stream.readInt();
|
||||
method = (Method) VM.getVM().getObjectHeap().newOop(stream.readOopHandle());
|
||||
method = stream.readMethod();
|
||||
bci = stream.readBCI();
|
||||
// Decode offsets for body and sender
|
||||
localsDecodeOffset = stream.readInt();
|
||||
@ -79,7 +79,7 @@ public class ScopeDesc {
|
||||
DebugInfoReadStream stream = streamAt(decodeOffset);
|
||||
|
||||
senderDecodeOffset = stream.readInt();
|
||||
method = (Method) VM.getVM().getObjectHeap().newOop(stream.readOopHandle());
|
||||
method = stream.readMethod();
|
||||
bci = stream.readBCI();
|
||||
// Decode offsets for body and sender
|
||||
localsDecodeOffset = stream.readInt();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -56,8 +56,8 @@ public class CompileTask extends VMObject {
|
||||
}
|
||||
|
||||
public Method method() {
|
||||
OopHandle oh = methodField.getValue(getAddress()).getOopHandleAt(0);
|
||||
return (Method)VM.getVM().getObjectHeap().newOop(oh);
|
||||
Address oh = methodField.getValue(getAddress()).getAddressAt(0);
|
||||
return (Method)Metadata.instantiateWrapperFor(oh);
|
||||
}
|
||||
|
||||
public int osrBci() {
|
||||
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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.gc_implementation.parallelScavenge;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.gc_implementation.shared.*;
|
||||
import sun.jvm.hotspot.memory.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
public class PSPermGen extends PSOldGen {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
initialize(VM.getVM().getTypeDataBase());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) {
|
||||
// just checking type existence
|
||||
Type type = db.lookupType("PSPermGen");
|
||||
}
|
||||
|
||||
public PSPermGen(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public void printOn(PrintStream tty) {
|
||||
tty.print("PSPermGen [ ");
|
||||
objectSpace().printOn(tty);
|
||||
tty.print(" ] ");
|
||||
}
|
||||
|
||||
// FIXME: no other stuff yet
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -45,7 +45,6 @@ public class ParallelScavengeHeap extends CollectedHeap {
|
||||
Type type = db.lookupType("ParallelScavengeHeap");
|
||||
youngGenField = type.getAddressField("_young_gen");
|
||||
oldGenField = type.getAddressField("_old_gen");
|
||||
permGenField = type.getAddressField("_perm_gen");
|
||||
}
|
||||
|
||||
public ParallelScavengeHeap(Address addr) {
|
||||
@ -55,7 +54,6 @@ public class ParallelScavengeHeap extends CollectedHeap {
|
||||
// Fields
|
||||
private static AddressField youngGenField;
|
||||
private static AddressField oldGenField;
|
||||
private static AddressField permGenField;
|
||||
|
||||
// Accessors
|
||||
public PSYoungGen youngGen() {
|
||||
@ -66,10 +64,6 @@ public class ParallelScavengeHeap extends CollectedHeap {
|
||||
return (PSOldGen) VMObjectFactory.newObject(PSOldGen.class, oldGenField.getValue());
|
||||
}
|
||||
|
||||
public PSPermGen permGen() {
|
||||
return (PSPermGen) VMObjectFactory.newObject(PSPermGen.class, permGenField.getValue());
|
||||
}
|
||||
|
||||
public long capacity() {
|
||||
return youngGen().capacity() + oldGen().capacity();
|
||||
}
|
||||
@ -87,10 +81,6 @@ public class ParallelScavengeHeap extends CollectedHeap {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (permGen().isIn(a)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -102,7 +92,6 @@ public class ParallelScavengeHeap extends CollectedHeap {
|
||||
tty.print("ParallelScavengeHeap [ ");
|
||||
youngGen().printOn(tty);
|
||||
oldGen().printOn(tty);
|
||||
permGen().printOn(tty);
|
||||
tty.print(" ] ");
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -138,9 +138,9 @@ public class BytecodeDisassembler {
|
||||
}
|
||||
}
|
||||
|
||||
Object bytecodeObj = null;
|
||||
Bytecode bytecodeObj = null;
|
||||
try {
|
||||
bytecodeObj = cstr.newInstance(new Object[] { method, new Integer(bci) });
|
||||
bytecodeObj = (Bytecode)cstr.newInstance(new Object[] { method, new Integer(bci) });
|
||||
} catch (Exception exp) {
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(false, "Bytecode instance of class "
|
||||
@ -153,11 +153,10 @@ public class BytecodeDisassembler {
|
||||
}
|
||||
|
||||
try {
|
||||
visitor.visit((Bytecode) bytecodeObj);
|
||||
visitor.visit(bytecodeObj);
|
||||
} catch(ClassCastException castfail) {
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(false, clazz.getName() + " is not derived from Bytecode!");
|
||||
}
|
||||
castfail.printStackTrace();
|
||||
System.err.println(method.getAddress() + " " + bci);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 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
|
||||
@ -55,8 +55,7 @@ public class BytecodeInvoke extends BytecodeWithCPIndex {
|
||||
public Symbol name() {
|
||||
ConstantPool cp = method().getConstants();
|
||||
if (isInvokedynamic()) {
|
||||
int[] nt = cp.getNameAndTypeAt(indexForFieldOrMethod());
|
||||
return cp.getSymbolAt(nt[0]);
|
||||
return cp.uncachedGetNameRefAt(indexForFieldOrMethod());
|
||||
}
|
||||
return cp.getNameRefAt(index());
|
||||
}
|
||||
@ -65,20 +64,11 @@ public class BytecodeInvoke extends BytecodeWithCPIndex {
|
||||
public Symbol signature() {
|
||||
ConstantPool cp = method().getConstants();
|
||||
if (isInvokedynamic()) {
|
||||
int[] nt = cp.getNameAndTypeAt(indexForFieldOrMethod());
|
||||
return cp.getSymbolAt(nt[1]);
|
||||
return cp.uncachedGetSignatureRefAt(indexForFieldOrMethod());
|
||||
}
|
||||
return cp.getSignatureRefAt(index());
|
||||
}
|
||||
|
||||
public int getSecondaryIndex() {
|
||||
if (isInvokedynamic()) {
|
||||
// change byte-ordering of 4-byte integer
|
||||
return VM.getVM().getBytes().swapInt(javaSignedWordAt(1));
|
||||
}
|
||||
return super.getSecondaryIndex(); // throw an error
|
||||
}
|
||||
|
||||
public Method getInvokedMethod() {
|
||||
return method().getConstants().getMethodRefAt(index());
|
||||
}
|
||||
@ -123,7 +113,7 @@ public class BytecodeInvoke extends BytecodeWithCPIndex {
|
||||
buf.append(Integer.toString(indexForFieldOrMethod()));
|
||||
if (isInvokedynamic()) {
|
||||
buf.append('(');
|
||||
buf.append(Integer.toString(getSecondaryIndex()));
|
||||
buf.append(Integer.toString(index()));
|
||||
buf.append(')');
|
||||
}
|
||||
buf.append(" [Method ");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -46,12 +46,11 @@ public class BytecodeLoadConstant extends Bytecode {
|
||||
}
|
||||
|
||||
public int poolIndex() {
|
||||
int i = rawIndex();
|
||||
int index = rawIndex();
|
||||
if (hasCacheIndex()) {
|
||||
ConstantPoolCache cpCache = method().getConstants().getCache();
|
||||
return cpCache.getEntryAt(i).getConstantPoolIndex();
|
||||
return method().getConstants().objectToCPIndex(index);
|
||||
} else {
|
||||
return i;
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,8 +71,7 @@ public class BytecodeLoadConstant extends Bytecode {
|
||||
private Oop getCachedConstant() {
|
||||
int i = cacheIndex();
|
||||
if (i >= 0) {
|
||||
ConstantPoolCache cpCache = method().getConstants().getCache();
|
||||
return cpCache.getEntryAt(i).getF1();
|
||||
throw new InternalError("invokedynamic not implemented yet");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -96,7 +94,7 @@ public class BytecodeLoadConstant extends Bytecode {
|
||||
return (ctag.isDouble() || ctag.isLong()) ? true: false;
|
||||
} else {
|
||||
// has to be int or float or String or Klass
|
||||
return (ctag.isUnresolvedString() || ctag.isString()
|
||||
return (ctag.isString()
|
||||
|| ctag.isUnresolvedKlass() || ctag.isKlass()
|
||||
|| ctag.isMethodHandle() || ctag.isMethodType()
|
||||
|| ctag.isInt() || ctag.isFloat())? true: false;
|
||||
@ -124,9 +122,9 @@ public class BytecodeLoadConstant extends Bytecode {
|
||||
ConstantPool cpool = method().getConstants();
|
||||
int cpIndex = poolIndex();
|
||||
ConstantPool.CPSlot oop = cpool.getSlotAt(cpIndex);
|
||||
if (oop.isOop()) {
|
||||
return (Klass) oop.getOop();
|
||||
} else if (oop.isMetaData()) {
|
||||
if (oop.isResolved()) {
|
||||
return oop.getKlass();
|
||||
} else if (oop.isUnresolved()) {
|
||||
return oop.getSymbol();
|
||||
} else {
|
||||
throw new RuntimeException("should not reach here");
|
||||
@ -163,28 +161,21 @@ public class BytecodeLoadConstant extends Bytecode {
|
||||
return "<float " + Float.toString(cpool.getFloatAt(cpIndex)) + "F>";
|
||||
} else if (ctag.isDouble()) {
|
||||
return "<double " + Double.toString(cpool.getDoubleAt(cpIndex)) + "D>";
|
||||
} else if (ctag.isString() || ctag.isUnresolvedString()) {
|
||||
} else if (ctag.isString()) {
|
||||
// tag change from 'unresolved' to 'string' does not happen atomically.
|
||||
// We just look at the object at the corresponding index and
|
||||
// decide based on the oop type.
|
||||
ConstantPool.CPSlot obj = cpool.getSlotAt(cpIndex);
|
||||
if (obj.isMetaData()) {
|
||||
Symbol sym = obj.getSymbol();
|
||||
Symbol sym = cpool.getUnresolvedStringAt(cpIndex);
|
||||
return "<String \"" + sym.asString() + "\">";
|
||||
} else if (obj.isOop()) {
|
||||
return "<String \"" + OopUtilities.stringOopToString(obj.getOop()) + "\">";
|
||||
} else {
|
||||
throw new RuntimeException("should not reach here");
|
||||
}
|
||||
} else if (ctag.isKlass() || ctag.isUnresolvedKlass()) {
|
||||
// tag change from 'unresolved' to 'klass' does not happen atomically.
|
||||
// We just look at the object at the corresponding index and
|
||||
// decide based on the oop type.
|
||||
ConstantPool.CPSlot obj = cpool.getSlotAt(cpIndex);
|
||||
if (obj.isOop()) {
|
||||
Klass k = (Klass) obj.getOop();
|
||||
return "<Class " + k.getName().asString() + "@" + k.getHandle() + ">";
|
||||
} else if (obj.isMetaData()) {
|
||||
if (obj.isResolved()) {
|
||||
Klass k = obj.getKlass();
|
||||
return "<Class " + k.getName().asString() + "@" + k.getAddress() + ">";
|
||||
} else if (obj.isUnresolved()) {
|
||||
Symbol sym = obj.getSymbol();
|
||||
return "<Class " + sym.asString() + ">";
|
||||
} else {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -35,10 +35,17 @@ public abstract class BytecodeWithCPIndex extends Bytecode {
|
||||
}
|
||||
|
||||
// the constant pool index for this bytecode
|
||||
public int index() { return getIndexU2(code(), false); }
|
||||
|
||||
public int getSecondaryIndex() {
|
||||
throw new IllegalArgumentException("must be invokedynamic");
|
||||
public int index() {
|
||||
if (code() == Bytecodes._invokedynamic) {
|
||||
int index = getIndexU4();
|
||||
if (ConstantPool.isInvokedynamicIndex(index)) {
|
||||
return ConstantPool.decodeInvokedynamicIndex(index);
|
||||
} else {
|
||||
return index;
|
||||
}
|
||||
} else {
|
||||
return getIndexU2(code(), false);
|
||||
}
|
||||
}
|
||||
|
||||
protected int indexForFieldOrMethod() {
|
||||
@ -47,12 +54,8 @@ public abstract class BytecodeWithCPIndex extends Bytecode {
|
||||
int cpCacheIndex = index();
|
||||
if (cpCache == null) {
|
||||
return cpCacheIndex;
|
||||
} else if (code() == Bytecodes._invokedynamic) {
|
||||
int secondaryIndex = getSecondaryIndex();
|
||||
return cpCache.getMainEntryAt(secondaryIndex).getConstantPoolIndex();
|
||||
} else {
|
||||
// change byte-ordering and go via cache
|
||||
return cpCache.getEntryAt((int) (0xFFFF & VM.getVM().getBytes().swapShort((short) cpCacheIndex))).getConstantPoolIndex();
|
||||
return cpCache.getEntryAt((int) (0xFFFF & cpCacheIndex)).getConstantPoolIndex();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -33,15 +33,15 @@ public class BytecodeWithKlass extends BytecodeWithCPIndex {
|
||||
}
|
||||
|
||||
protected Klass getKlass() {
|
||||
return method().getConstants().getKlassRefAt(index());
|
||||
return method().getConstants().getKlassAt(index());
|
||||
}
|
||||
|
||||
public Symbol getClassName() {
|
||||
ConstantPool.CPSlot obj = method().getConstants().getSlotAt(index());
|
||||
if (obj.isMetaData()) {
|
||||
if (obj.isUnresolved()) {
|
||||
return obj.getSymbol();
|
||||
} else {
|
||||
return ((Klass)obj.getOop()).getName();
|
||||
return obj.getKlass().getName();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 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
|
||||
@ -362,7 +362,7 @@ public class Bytecodes {
|
||||
|
||||
// find a bytecode, behind a breakpoint if necessary:
|
||||
// FIXME: not yet implementable
|
||||
// static Code non_breakpoint_code_at(address bcp, methodOop method = null);
|
||||
// static Code non_breakpoint_code_at(address bcp, Method* method = null);
|
||||
|
||||
// Bytecode attributes
|
||||
public static boolean isDefined (int code) { return 0 <= code && code < number_of_codes && flags(code, false) != 0; }
|
||||
@ -743,7 +743,7 @@ public class Bytecodes {
|
||||
def(_invokespecial , "invokespecial" , "bJJ" , null , BasicType.getTIllegal(), -1, true );
|
||||
def(_invokestatic , "invokestatic" , "bJJ" , null , BasicType.getTIllegal(), 0, true );
|
||||
def(_invokeinterface , "invokeinterface" , "bJJ__", null , BasicType.getTIllegal(), -1, true );
|
||||
def(_invokedynamic , "invokedynamic" , "bJJJJ", null , BasicType.getTIllegal(), -1, true );
|
||||
def(_invokedynamic , "invokedynamic" , "bJJJJ", null , BasicType.getTIllegal(), 0, true );
|
||||
def(_new , "new" , "bkk" , null , BasicType.getTObject() , 1, true );
|
||||
def(_newarray , "newarray" , "bc" , null , BasicType.getTObject() , 0, true );
|
||||
def(_anewarray , "anewarray" , "bkk" , null , BasicType.getTObject() , 0, true );
|
||||
@ -763,6 +763,7 @@ public class Bytecodes {
|
||||
|
||||
// JVM bytecodes
|
||||
// bytecode bytecode name format wide f. result tp stk traps std code
|
||||
|
||||
def(_fast_agetfield , "fast_agetfield" , "bJJ" , null , BasicType.getTObject() , 0, true , _getfield );
|
||||
def(_fast_bgetfield , "fast_bgetfield" , "bJJ" , null , BasicType.getTInt() , 0, true , _getfield );
|
||||
def(_fast_cgetfield , "fast_cgetfield" , "bJJ" , null , BasicType.getTChar() , 0, true , _getfield );
|
||||
|
@ -135,15 +135,15 @@ implements ReferenceType {
|
||||
ReferenceTypeImpl other = (ReferenceTypeImpl)refType;
|
||||
int comp = name().compareTo(other.name());
|
||||
if (comp == 0) {
|
||||
Oop rf1 = ref();
|
||||
Oop rf2 = other.ref();
|
||||
Klass rf1 = ref();
|
||||
Klass rf2 = other.ref();
|
||||
// optimize for typical case: refs equal and VMs equal
|
||||
if (rf1.equals(rf2)) {
|
||||
// sequenceNumbers are always positive
|
||||
comp = vm.sequenceNumber -
|
||||
((VirtualMachineImpl)(other.virtualMachine())).sequenceNumber;
|
||||
} else {
|
||||
comp = rf1.getHandle().minus(rf2.getHandle()) < 0? -1 : 1;
|
||||
comp = rf1.getAddress().minus(rf2.getAddress()) < 0? -1 : 1;
|
||||
}
|
||||
}
|
||||
return comp;
|
||||
@ -225,7 +225,7 @@ implements ReferenceType {
|
||||
private boolean isThrowableBacktraceField(sun.jvm.hotspot.oops.Field fld) {
|
||||
// refer to JvmtiEnv::GetClassFields in jvmtiEnv.cpp.
|
||||
// We want to filter out java.lang.Throwable.backtrace (see 4446677).
|
||||
// It contains some methodOops that aren't quite real Objects.
|
||||
// It contains some Method*s that aren't quite real Objects.
|
||||
if (fld.getFieldHolder().getName().equals(vm.javaLangThrowable()) &&
|
||||
fld.getID().getName().equals("backtrace")) {
|
||||
return true;
|
||||
@ -932,7 +932,7 @@ implements ReferenceType {
|
||||
}
|
||||
|
||||
long uniqueID() {
|
||||
return vm.getAddressValue(ref());
|
||||
return vm.getAddressValue(ref().getJavaMirror());
|
||||
}
|
||||
|
||||
// new method since 1.6
|
||||
|
@ -447,7 +447,7 @@ public class VirtualMachineImpl extends MirrorImpl implements PathSearchingVirtu
|
||||
newRefType = new ClassTypeImpl(this, (InstanceKlass)kk);
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("should not reach here");
|
||||
throw new RuntimeException("should not reach here:" + kk);
|
||||
}
|
||||
|
||||
typesByID.put(kk, newRefType);
|
||||
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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.memory;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
|
||||
public class CMSPermGenGen extends ConcurrentMarkSweepGeneration {
|
||||
public CMSPermGenGen(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return "concurrent-mark-sweep perm gen";
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -168,7 +168,7 @@ public class CompactibleFreeListSpace extends CompactibleSpace {
|
||||
final long addressSize = vm.getAddressSize();
|
||||
|
||||
for (; cur.lessThan(limit);) {
|
||||
Address klassOop = cur.getAddressAt(addressSize);
|
||||
Address k = cur.getAddressAt(addressSize);
|
||||
if (FreeChunk.indicatesFreeChunk(cur)) {
|
||||
if (! cur.equals(regionStart)) {
|
||||
res.add(new MemRegion(regionStart, cur));
|
||||
@ -181,7 +181,7 @@ public class CompactibleFreeListSpace extends CompactibleSpace {
|
||||
// note that fc.size() gives chunk size in heap words
|
||||
cur = cur.addOffsetTo(chunkSize * addressSize);
|
||||
regionStart = cur;
|
||||
} else if (klassOop != null) {
|
||||
} else if (k != null) {
|
||||
Oop obj = heap.newOop(cur.addOffsetToAsOopHandle(0));
|
||||
long objectSize = obj.getObjectSize();
|
||||
cur = cur.addOffsetTo(adjustObjectSizeInBytes(objectSize));
|
||||
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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.memory;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
/** A PermGen implemented with a contiguous space. */
|
||||
|
||||
public class CompactingPermGen extends PermGen {
|
||||
// The "generation" view.
|
||||
private static AddressField genField;
|
||||
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
initialize(VM.getVM().getTypeDataBase());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) {
|
||||
Type type = db.lookupType("CompactingPermGen");
|
||||
|
||||
genField = type.getAddressField("_gen");
|
||||
}
|
||||
|
||||
public CompactingPermGen(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public Generation asGen() {
|
||||
return GenerationFactory.newObject(genField.getValue(addr));
|
||||
}
|
||||
}
|
@ -1,161 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2005, 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.memory;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
/** This is the "generation" view of a CompactingPermGen. */
|
||||
public class CompactingPermGenGen extends OneContigSpaceCardGeneration {
|
||||
private static AddressField unsharedBottomField;
|
||||
private static AddressField unsharedEndField;
|
||||
private static AddressField sharedBottomField;
|
||||
private static AddressField sharedEndField;
|
||||
private static AddressField readOnlyBottomField;
|
||||
private static AddressField readOnlyEndField;
|
||||
private static AddressField readWriteBottomField;
|
||||
private static AddressField readWriteEndField;
|
||||
private static AddressField roSpaceField;
|
||||
private static AddressField rwSpaceField;
|
||||
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
initialize(VM.getVM().getTypeDataBase());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) {
|
||||
Type type = db.lookupType("CompactingPermGenGen");
|
||||
unsharedBottomField = type.getAddressField("unshared_bottom");
|
||||
unsharedEndField = type.getAddressField("unshared_end");
|
||||
sharedBottomField = type.getAddressField("shared_bottom");
|
||||
sharedEndField = type.getAddressField("shared_end");
|
||||
readOnlyBottomField = type.getAddressField("readonly_bottom");
|
||||
readOnlyEndField = type.getAddressField("readonly_end");
|
||||
readWriteBottomField = type.getAddressField("readwrite_bottom");
|
||||
readWriteEndField = type.getAddressField("readwrite_end");
|
||||
roSpaceField = type.getAddressField("_ro_space");
|
||||
rwSpaceField = type.getAddressField("_rw_space");
|
||||
}
|
||||
|
||||
public boolean isSharingEnabled() {
|
||||
return VM.getVM().isSharingEnabled();
|
||||
}
|
||||
|
||||
// NEEDS_CLEANUP
|
||||
public CompactingPermGenGen(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public OffsetTableContigSpace roSpace() {
|
||||
return newOffsetTableContigSpace(roSpaceField.getValue(addr));
|
||||
}
|
||||
|
||||
public OffsetTableContigSpace rwSpace() {
|
||||
return newOffsetTableContigSpace(rwSpaceField.getValue(addr));
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return "compacting permanent generation";
|
||||
}
|
||||
|
||||
public static Address unsharedBottom() {
|
||||
return unsharedBottomField.getValue();
|
||||
}
|
||||
|
||||
public static Address unsharedEnd() {
|
||||
return unsharedEndField.getValue();
|
||||
}
|
||||
|
||||
public static Address sharedBottom() {
|
||||
return sharedBottomField.getValue();
|
||||
}
|
||||
|
||||
public static Address sharedEnd() {
|
||||
return sharedEndField.getValue();
|
||||
}
|
||||
|
||||
public static Address readOnlyBottom() {
|
||||
return readOnlyBottomField.getValue();
|
||||
}
|
||||
|
||||
public static Address readOnlyEnd() {
|
||||
return readOnlyEndField.getValue();
|
||||
}
|
||||
|
||||
public static Address readWriteBottom() {
|
||||
return readWriteBottomField.getValue();
|
||||
}
|
||||
|
||||
public static Address readWriteEnd() {
|
||||
return readWriteEndField.getValue();
|
||||
}
|
||||
|
||||
public static boolean isShared(Address p) {
|
||||
return sharedBottom().lessThanOrEqual(p) && sharedEnd().greaterThan(p);
|
||||
}
|
||||
|
||||
public static boolean isSharedReadOnly(Address p) {
|
||||
return readOnlyBottom().lessThanOrEqual(p) && readOnlyEnd().greaterThan(p);
|
||||
}
|
||||
|
||||
public static boolean isSharedReadWrite(Address p) {
|
||||
return readWriteBottom().lessThanOrEqual(p) && readWriteEnd().greaterThan(p);
|
||||
}
|
||||
|
||||
public boolean isIn(Address p) {
|
||||
return unsharedBottom().lessThanOrEqual(p) && sharedEnd().greaterThan(p);
|
||||
}
|
||||
|
||||
public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
|
||||
super.spaceIterate(blk, usedOnly);
|
||||
if (isSharingEnabled()) {
|
||||
blk.doSpace(roSpace());
|
||||
blk.doSpace(rwSpace());
|
||||
}
|
||||
}
|
||||
|
||||
public void printOn(PrintStream tty) {
|
||||
tty.print(" perm");
|
||||
theSpace().printOn(tty);
|
||||
if (isSharingEnabled()) {
|
||||
tty.print(" ro space: ");
|
||||
roSpace().printOn(tty);
|
||||
tty.print(", rw space: ");
|
||||
rwSpace().printOn(tty);
|
||||
}
|
||||
}
|
||||
|
||||
private OffsetTableContigSpace newOffsetTableContigSpace(Address addr) {
|
||||
return (OffsetTableContigSpace) VMObjectFactory.newObject(
|
||||
OffsetTableContigSpace.class, addr);
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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.memory;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
|
||||
/** No additional functionality for now */
|
||||
|
||||
public class ContigPermSpace extends OffsetTableContigSpace {
|
||||
public ContigPermSpace(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -63,10 +63,9 @@ public class Dictionary extends TwoOopHashtable {
|
||||
for (int index = 0; index < tblSize; index++) {
|
||||
for (DictionaryEntry probe = (DictionaryEntry) bucket(index); probe != null;
|
||||
probe = (DictionaryEntry) probe.next()) {
|
||||
Oop k = probe.klass();
|
||||
if (k.isKlass() &&
|
||||
heap.equal(probe.loader(), ((InstanceKlass) k).getClassLoader())) {
|
||||
v.visit((Klass) k);
|
||||
Klass k = probe.klass();
|
||||
if (heap.equal(probe.loader(), ((InstanceKlass) k).getClassLoader())) {
|
||||
v.visit(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -78,10 +77,8 @@ public class Dictionary extends TwoOopHashtable {
|
||||
for (int index = 0; index < tblSize; index++) {
|
||||
for (DictionaryEntry probe = (DictionaryEntry) bucket(index); probe != null;
|
||||
probe = (DictionaryEntry) probe.next()) {
|
||||
Oop k = probe.klass();
|
||||
if (k.isKlass()) {
|
||||
v.visit((Klass) k, probe.loader());
|
||||
}
|
||||
Klass k = probe.klass();
|
||||
v.visit(k, probe.loader());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -25,6 +25,7 @@
|
||||
package sun.jvm.hotspot.memory;
|
||||
|
||||
import java.util.*;
|
||||
import sun.jvm.hotspot.classfile.ClassLoaderData;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
@ -43,12 +44,12 @@ public class DictionaryEntry extends sun.jvm.hotspot.utilities.HashtableEntry {
|
||||
private static synchronized void initialize(TypeDataBase db) {
|
||||
Type type = db.lookupType("DictionaryEntry");
|
||||
pdSetField = type.getAddressField("_pd_set");
|
||||
loaderField = type.getOopField("_loader");
|
||||
loaderDataField = type.getAddressField("_loader_data");
|
||||
}
|
||||
|
||||
// Fields
|
||||
private static AddressField pdSetField;
|
||||
private static sun.jvm.hotspot.types.OopField loaderField;
|
||||
private static AddressField loaderDataField;
|
||||
|
||||
// Accessors
|
||||
|
||||
@ -59,11 +60,15 @@ public class DictionaryEntry extends sun.jvm.hotspot.utilities.HashtableEntry {
|
||||
}
|
||||
|
||||
public Oop loader() {
|
||||
return VM.getVM().getObjectHeap().newOop(loaderField.getValue(addr));
|
||||
return loaderData().getClassLoader();
|
||||
}
|
||||
|
||||
public ClassLoaderData loaderData() {
|
||||
return ClassLoaderData.instantiateWrapperFor(loaderDataField.getValue(addr));
|
||||
}
|
||||
|
||||
public Klass klass() {
|
||||
return (Klass)VM.getVM().getObjectHeap().newOop(literalValue().addOffsetToAsOopHandle(0));
|
||||
return (Klass)Metadata.instantiateWrapperFor(literalValue());
|
||||
}
|
||||
|
||||
public DictionaryEntry(Address addr) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -90,7 +90,7 @@ public class GenCollectedHeap extends SharedHeap {
|
||||
}
|
||||
}
|
||||
|
||||
return permGen().isIn(a);
|
||||
return false;
|
||||
}
|
||||
|
||||
public long capacity() {
|
||||
@ -140,7 +140,5 @@ public class GenCollectedHeap extends SharedHeap {
|
||||
tty.println("Invocations: " + getGen(i).invocations());
|
||||
tty.println();
|
||||
}
|
||||
permGen().printOn(tty);
|
||||
tty.println("Invocations: " + permGen().invocations());
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -39,7 +39,6 @@ import sun.jvm.hotspot.runtime.*;
|
||||
<ul>
|
||||
<li> OneContigSpaceCardGeneration
|
||||
<ul>
|
||||
<li> CompactingPermGenGen
|
||||
<li> TenuredGeneration
|
||||
</ul>
|
||||
</ul>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -47,8 +47,6 @@ public class GenerationFactory {
|
||||
private static synchronized void initialize(TypeDataBase db) {
|
||||
ctor = new VirtualConstructor(db);
|
||||
|
||||
ctor.addMapping("CompactingPermGenGen", CompactingPermGenGen.class);
|
||||
ctor.addMapping("CMSPermGenGen", CMSPermGenGen.class);
|
||||
ctor.addMapping("DefNewGeneration", DefNewGeneration.class);
|
||||
ctor.addMapping("ParNewGeneration", ParNewGeneration.class);
|
||||
ctor.addMapping("TenuredGeneration", TenuredGeneration.class);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -25,6 +25,7 @@
|
||||
package sun.jvm.hotspot.memory;
|
||||
|
||||
import java.util.*;
|
||||
import sun.jvm.hotspot.classfile.ClassLoaderData;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
@ -42,15 +43,19 @@ public class PlaceholderEntry extends sun.jvm.hotspot.utilities.HashtableEntry {
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) {
|
||||
Type type = db.lookupType("PlaceholderEntry");
|
||||
loaderField = type.getOopField("_loader");
|
||||
loaderDataField = type.getAddressField("_loader_data");
|
||||
}
|
||||
|
||||
// Field
|
||||
private static sun.jvm.hotspot.types.OopField loaderField;
|
||||
private static AddressField loaderDataField;
|
||||
|
||||
// Accessor
|
||||
public Oop loader() {
|
||||
return VM.getVM().getObjectHeap().newOop(loaderField.getValue(addr));
|
||||
return loaderData().getClassLoader();
|
||||
}
|
||||
|
||||
public ClassLoaderData loaderData() {
|
||||
return ClassLoaderData.instantiateWrapperFor(loaderDataField.getValue(addr));
|
||||
}
|
||||
|
||||
public PlaceholderEntry(Address addr) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -33,7 +33,6 @@ import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
public abstract class SharedHeap extends CollectedHeap {
|
||||
private static AddressField permGenField;
|
||||
private static VirtualConstructor ctor;
|
||||
|
||||
static {
|
||||
@ -46,31 +45,14 @@ public abstract class SharedHeap extends CollectedHeap {
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) {
|
||||
Type type = db.lookupType("SharedHeap");
|
||||
permGenField = type.getAddressField("_perm_gen");
|
||||
ctor = new VirtualConstructor(db);
|
||||
ctor.addMapping("CompactingPermGen", CompactingPermGen.class);
|
||||
ctor.addMapping("CMSPermGen", CMSPermGen.class);
|
||||
|
||||
}
|
||||
|
||||
public SharedHeap(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
/** These functions return the "permanent" generation, in which
|
||||
reflective objects are allocated and stored. Two versions, the
|
||||
second of which returns the view of the perm gen as a
|
||||
generation. (FIXME: this distinction is strange and seems
|
||||
unnecessary, and should be cleaned up.) */
|
||||
public PermGen perm() {
|
||||
return (PermGen) ctor.instantiateWrapperFor(permGenField.getValue(addr));
|
||||
}
|
||||
|
||||
public CollectedHeapName kind() {
|
||||
return CollectedHeapName.SHARED_HEAP;
|
||||
}
|
||||
|
||||
public Generation permGen() {
|
||||
return perm().asGen();
|
||||
}
|
||||
}
|
||||
|
@ -37,13 +37,13 @@ public class SystemDictionary {
|
||||
private static AddressField loaderConstraintTableField;
|
||||
private static sun.jvm.hotspot.types.OopField javaSystemLoaderField;
|
||||
|
||||
private static sun.jvm.hotspot.types.OopField objectKlassField;
|
||||
private static sun.jvm.hotspot.types.OopField classLoaderKlassField;
|
||||
private static sun.jvm.hotspot.types.OopField stringKlassField;
|
||||
private static sun.jvm.hotspot.types.OopField systemKlassField;
|
||||
private static sun.jvm.hotspot.types.OopField threadKlassField;
|
||||
private static sun.jvm.hotspot.types.OopField threadGroupKlassField;
|
||||
private static sun.jvm.hotspot.types.OopField methodHandleKlassField;
|
||||
private static AddressField objectKlassField;
|
||||
private static AddressField classLoaderKlassField;
|
||||
private static AddressField stringKlassField;
|
||||
private static AddressField systemKlassField;
|
||||
private static AddressField threadKlassField;
|
||||
private static AddressField threadGroupKlassField;
|
||||
private static AddressField methodHandleKlassField;
|
||||
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
@ -62,13 +62,13 @@ public class SystemDictionary {
|
||||
loaderConstraintTableField = type.getAddressField("_loader_constraints");
|
||||
javaSystemLoaderField = type.getOopField("_java_system_loader");
|
||||
|
||||
objectKlassField = type.getOopField(WK_KLASS("Object_klass"));
|
||||
classLoaderKlassField = type.getOopField(WK_KLASS("ClassLoader_klass"));
|
||||
stringKlassField = type.getOopField(WK_KLASS("String_klass"));
|
||||
systemKlassField = type.getOopField(WK_KLASS("System_klass"));
|
||||
threadKlassField = type.getOopField(WK_KLASS("Thread_klass"));
|
||||
threadGroupKlassField = type.getOopField(WK_KLASS("ThreadGroup_klass"));
|
||||
methodHandleKlassField = type.getOopField(WK_KLASS("MethodHandle_klass"));
|
||||
objectKlassField = type.getAddressField(WK_KLASS("Object_klass"));
|
||||
classLoaderKlassField = type.getAddressField(WK_KLASS("ClassLoader_klass"));
|
||||
stringKlassField = type.getAddressField(WK_KLASS("String_klass"));
|
||||
systemKlassField = type.getAddressField(WK_KLASS("System_klass"));
|
||||
threadKlassField = type.getAddressField(WK_KLASS("Thread_klass"));
|
||||
threadGroupKlassField = type.getAddressField(WK_KLASS("ThreadGroup_klass"));
|
||||
methodHandleKlassField = type.getAddressField(WK_KLASS("MethodHandle_klass"));
|
||||
}
|
||||
|
||||
// This WK functions must follow the definitions in systemDictionary.hpp:
|
||||
@ -104,31 +104,31 @@ public class SystemDictionary {
|
||||
// few well known classes -- not all are added here.
|
||||
// add more if needed.
|
||||
public static InstanceKlass getThreadKlass() {
|
||||
return (InstanceKlass) newOop(threadKlassField.getValue());
|
||||
return (InstanceKlass)Metadata.instantiateWrapperFor(threadKlassField.getValue());
|
||||
}
|
||||
|
||||
public static InstanceKlass getThreadGroupKlass() {
|
||||
return (InstanceKlass) newOop(threadGroupKlassField.getValue());
|
||||
return (InstanceKlass)Metadata.instantiateWrapperFor(threadGroupKlassField.getValue());
|
||||
}
|
||||
|
||||
public static InstanceKlass getObjectKlass() {
|
||||
return (InstanceKlass) newOop(objectKlassField.getValue());
|
||||
return (InstanceKlass)Metadata.instantiateWrapperFor(objectKlassField.getValue());
|
||||
}
|
||||
|
||||
public static InstanceKlass getStringKlass() {
|
||||
return (InstanceKlass) newOop(stringKlassField.getValue());
|
||||
return (InstanceKlass)Metadata.instantiateWrapperFor(stringKlassField.getValue());
|
||||
}
|
||||
|
||||
public static InstanceKlass getClassLoaderKlass() {
|
||||
return (InstanceKlass) newOop(classLoaderKlassField.getValue());
|
||||
return (InstanceKlass)Metadata.instantiateWrapperFor(classLoaderKlassField.getValue());
|
||||
}
|
||||
|
||||
public static InstanceKlass getSystemKlass() {
|
||||
return (InstanceKlass) newOop(systemKlassField.getValue());
|
||||
return (InstanceKlass)Metadata.instantiateWrapperFor(systemKlassField.getValue());
|
||||
}
|
||||
|
||||
public static InstanceKlass getMethodHandleKlass() {
|
||||
return (InstanceKlass) newOop(methodHandleKlassField.getValue());
|
||||
return (InstanceKlass)Metadata.instantiateWrapperFor(methodHandleKlassField.getValue());
|
||||
}
|
||||
|
||||
public InstanceKlass getAbstractOwnableSynchronizerKlass() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -42,17 +42,14 @@ public class Universe {
|
||||
private static sun.jvm.hotspot.types.OopField systemThreadGroupField;
|
||||
|
||||
// single dimensional primitive array klasses
|
||||
private static sun.jvm.hotspot.types.OopField boolArrayKlassObjField;
|
||||
private static sun.jvm.hotspot.types.OopField byteArrayKlassObjField;
|
||||
private static sun.jvm.hotspot.types.OopField charArrayKlassObjField;
|
||||
private static sun.jvm.hotspot.types.OopField intArrayKlassObjField;
|
||||
private static sun.jvm.hotspot.types.OopField shortArrayKlassObjField;
|
||||
private static sun.jvm.hotspot.types.OopField longArrayKlassObjField;
|
||||
private static sun.jvm.hotspot.types.OopField singleArrayKlassObjField;
|
||||
private static sun.jvm.hotspot.types.OopField doubleArrayKlassObjField;
|
||||
|
||||
// system obj array klass object
|
||||
private static sun.jvm.hotspot.types.OopField systemObjArrayKlassObjField;
|
||||
private static sun.jvm.hotspot.types.AddressField boolArrayKlassField;
|
||||
private static sun.jvm.hotspot.types.AddressField byteArrayKlassField;
|
||||
private static sun.jvm.hotspot.types.AddressField charArrayKlassField;
|
||||
private static sun.jvm.hotspot.types.AddressField intArrayKlassField;
|
||||
private static sun.jvm.hotspot.types.AddressField shortArrayKlassField;
|
||||
private static sun.jvm.hotspot.types.AddressField longArrayKlassField;
|
||||
private static sun.jvm.hotspot.types.AddressField singleArrayKlassField;
|
||||
private static sun.jvm.hotspot.types.AddressField doubleArrayKlassField;
|
||||
|
||||
private static AddressField narrowOopBaseField;
|
||||
private static CIntegerField narrowOopShiftField;
|
||||
@ -78,16 +75,14 @@ public class Universe {
|
||||
mainThreadGroupField = type.getOopField("_main_thread_group");
|
||||
systemThreadGroupField = type.getOopField("_system_thread_group");
|
||||
|
||||
boolArrayKlassObjField = type.getOopField("_boolArrayKlassObj");
|
||||
byteArrayKlassObjField = type.getOopField("_byteArrayKlassObj");
|
||||
charArrayKlassObjField = type.getOopField("_charArrayKlassObj");
|
||||
intArrayKlassObjField = type.getOopField("_intArrayKlassObj");
|
||||
shortArrayKlassObjField = type.getOopField("_shortArrayKlassObj");
|
||||
longArrayKlassObjField = type.getOopField("_longArrayKlassObj");
|
||||
singleArrayKlassObjField = type.getOopField("_singleArrayKlassObj");
|
||||
doubleArrayKlassObjField = type.getOopField("_doubleArrayKlassObj");
|
||||
|
||||
systemObjArrayKlassObjField = type.getOopField("_systemObjArrayKlassObj");
|
||||
boolArrayKlassField = type.getAddressField("_boolArrayKlassObj");
|
||||
byteArrayKlassField = type.getAddressField("_byteArrayKlassObj");
|
||||
charArrayKlassField = type.getAddressField("_charArrayKlassObj");
|
||||
intArrayKlassField = type.getAddressField("_intArrayKlassObj");
|
||||
shortArrayKlassField = type.getAddressField("_shortArrayKlassObj");
|
||||
longArrayKlassField = type.getAddressField("_longArrayKlassObj");
|
||||
singleArrayKlassField = type.getAddressField("_singleArrayKlassObj");
|
||||
doubleArrayKlassField = type.getAddressField("_doubleArrayKlassObj");
|
||||
|
||||
narrowOopBaseField = type.getAddressField("_narrow_oop._base");
|
||||
narrowOopShiftField = type.getCIntegerField("_narrow_oop._shift");
|
||||
@ -138,21 +133,17 @@ public class Universe {
|
||||
return newOop(systemThreadGroupField.getValue());
|
||||
}
|
||||
|
||||
public Oop systemObjArrayKlassObj() {
|
||||
return newOop(systemObjArrayKlassObjField.getValue());
|
||||
}
|
||||
|
||||
// iterate through the single dimensional primitive array klasses
|
||||
// refer to basic_type_classes_do(void f(klassOop)) in universe.cpp
|
||||
// refer to basic_type_classes_do(void f(Klass*)) in universe.cpp
|
||||
public void basicTypeClassesDo(SystemDictionary.ClassVisitor visitor) {
|
||||
visitor.visit((Klass)newOop(boolArrayKlassObjField.getValue()));
|
||||
visitor.visit((Klass)newOop(byteArrayKlassObjField.getValue()));
|
||||
visitor.visit((Klass)newOop(charArrayKlassObjField.getValue()));
|
||||
visitor.visit((Klass)newOop(intArrayKlassObjField.getValue()));
|
||||
visitor.visit((Klass)newOop(shortArrayKlassObjField.getValue()));
|
||||
visitor.visit((Klass)newOop(longArrayKlassObjField.getValue()));
|
||||
visitor.visit((Klass)newOop(singleArrayKlassObjField.getValue()));
|
||||
visitor.visit((Klass)newOop(doubleArrayKlassObjField.getValue()));
|
||||
visitor.visit(new TypeArrayKlass(boolArrayKlassField.getValue()));
|
||||
visitor.visit(new TypeArrayKlass(byteArrayKlassField.getValue()));
|
||||
visitor.visit(new TypeArrayKlass(charArrayKlassField.getValue()));
|
||||
visitor.visit(new TypeArrayKlass(intArrayKlassField.getValue()));
|
||||
visitor.visit(new TypeArrayKlass(shortArrayKlassField.getValue()));
|
||||
visitor.visit(new TypeArrayKlass(longArrayKlassField.getValue()));
|
||||
visitor.visit(new TypeArrayKlass(singleArrayKlassField.getValue()));
|
||||
visitor.visit(new TypeArrayKlass(doubleArrayKlassField.getValue()));
|
||||
}
|
||||
|
||||
public void print() { printOn(System.out); }
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -57,7 +57,7 @@ public class AccessFlags implements /* imports */ ClassConstants {
|
||||
public long getValue () { return flags; }
|
||||
|
||||
// Hotspot internal flags
|
||||
// methodOop flags
|
||||
// Method* flags
|
||||
public boolean isMonitorMatching () { return (flags & JVM_ACC_MONITOR_MATCH ) != 0; }
|
||||
public boolean hasMonitorBytecodes () { return (flags & JVM_ACC_HAS_MONITOR_BYTECODES ) != 0; }
|
||||
public boolean hasLoops () { return (flags & JVM_ACC_HAS_LOOPS ) != 0; }
|
||||
@ -69,13 +69,13 @@ public class AccessFlags implements /* imports */ ClassConstants {
|
||||
public boolean hasJsrs () { return (flags & JVM_ACC_HAS_JSRS ) != 0; }
|
||||
public boolean isObsolete () { return (flags & JVM_ACC_IS_OBSOLETE ) != 0; }
|
||||
|
||||
// klassOop flags
|
||||
// Klass* flags
|
||||
public boolean hasMirandaMethods () { return (flags & JVM_ACC_HAS_MIRANDA_METHODS ) != 0; }
|
||||
public boolean hasVanillaConstructor() { return (flags & JVM_ACC_HAS_VANILLA_CONSTRUCTOR) != 0; }
|
||||
public boolean hasFinalizer () { return (flags & JVM_ACC_HAS_FINALIZER ) != 0; }
|
||||
public boolean isCloneable () { return (flags & JVM_ACC_IS_CLONEABLE ) != 0; }
|
||||
|
||||
// klassOop and methodOop flags
|
||||
// Klass* and Method* flags
|
||||
public boolean hasLocalVariableTable() { return (flags & JVM_ACC_HAS_LOCAL_VARIABLE_TABLE ) != 0; }
|
||||
|
||||
// field flags
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -59,7 +59,7 @@ public class Array extends Oop {
|
||||
if (headerSize != 0) {
|
||||
return headerSize;
|
||||
}
|
||||
if (VM.getVM().isCompressedOopsEnabled()) {
|
||||
if (VM.getVM().isCompressedHeadersEnabled()) {
|
||||
headerSize = typeSize;
|
||||
} else {
|
||||
headerSize = VM.getVM().alignUp(typeSize + VM.getVM().getIntSize(),
|
||||
@ -80,7 +80,7 @@ public class Array extends Oop {
|
||||
if (lengthOffsetInBytes != 0) {
|
||||
return lengthOffsetInBytes;
|
||||
}
|
||||
if (VM.getVM().isCompressedOopsEnabled()) {
|
||||
if (VM.getVM().isCompressedHeadersEnabled()) {
|
||||
lengthOffsetInBytes = typeSize - VM.getVM().getIntSize();
|
||||
} else {
|
||||
lengthOffsetInBytes = typeSize;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -49,10 +49,6 @@ abstract class ArrayData extends ProfileData {
|
||||
int aindex = index + arrayStartOffSet;
|
||||
return intAt(aindex);
|
||||
}
|
||||
Oop arrayOopAt(int index) {
|
||||
int aindex = index + arrayStartOffSet;
|
||||
return oopAt(aindex);
|
||||
}
|
||||
|
||||
// Code generation support for subclasses.
|
||||
static int arrayElementOffset(int index) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -45,24 +45,24 @@ public class ArrayKlass extends Klass {
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("arrayKlass");
|
||||
dimension = new CIntField(type.getCIntegerField("_dimension"), Oop.getHeaderSize());
|
||||
higherDimension = new OopField(type.getOopField("_higher_dimension"), Oop.getHeaderSize());
|
||||
lowerDimension = new OopField(type.getOopField("_lower_dimension"), Oop.getHeaderSize());
|
||||
vtableLen = new CIntField(type.getCIntegerField("_vtable_len"), Oop.getHeaderSize());
|
||||
allocSize = new CIntField(type.getCIntegerField("_alloc_size"), Oop.getHeaderSize());
|
||||
componentMirror = new OopField(type.getOopField("_component_mirror"), Oop.getHeaderSize());
|
||||
dimension = new CIntField(type.getCIntegerField("_dimension"), 0);
|
||||
higherDimension = new MetadataField(type.getAddressField("_higher_dimension"), 0);
|
||||
lowerDimension = new MetadataField(type.getAddressField("_lower_dimension"), 0);
|
||||
vtableLen = new CIntField(type.getCIntegerField("_vtable_len"), 0);
|
||||
allocSize = new CIntField(type.getCIntegerField("_alloc_size"), 0);
|
||||
componentMirror = new OopField(type.getOopField("_component_mirror"), 0);
|
||||
javaLangCloneableName = null;
|
||||
javaLangObjectName = null;
|
||||
javaIoSerializableName = null;
|
||||
}
|
||||
|
||||
ArrayKlass(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
public ArrayKlass(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
private static CIntField dimension;
|
||||
private static OopField higherDimension;
|
||||
private static OopField lowerDimension;
|
||||
private static MetadataField higherDimension;
|
||||
private static MetadataField lowerDimension;
|
||||
private static CIntField vtableLen;
|
||||
private static CIntField allocSize;
|
||||
private static OopField componentMirror;
|
||||
@ -141,19 +141,13 @@ public class ArrayKlass extends Klass {
|
||||
tty.print("ArrayKlass");
|
||||
}
|
||||
|
||||
public long getObjectSize() {
|
||||
return alignObjectSize(InstanceKlass.getHeaderSize() + getVtableLen() * getHeap().getOopSize());
|
||||
}
|
||||
|
||||
public void iterateFields(OopVisitor visitor, boolean doVMFields) {
|
||||
super.iterateFields(visitor, doVMFields);
|
||||
if (doVMFields) {
|
||||
public void iterateFields(MetadataVisitor visitor) {
|
||||
super.iterateFields(visitor);
|
||||
visitor.doCInt(dimension, true);
|
||||
visitor.doOop(higherDimension, true);
|
||||
visitor.doOop(lowerDimension, true);
|
||||
visitor.doMetadata(higherDimension, true);
|
||||
visitor.doMetadata(lowerDimension, true);
|
||||
visitor.doCInt(vtableLen, true);
|
||||
visitor.doCInt(allocSize, true);
|
||||
visitor.doOop(componentMirror, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -25,6 +25,7 @@
|
||||
package sun.jvm.hotspot.oops;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.VMObject;
|
||||
|
||||
// The class for a boolean field simply provides access to the value.
|
||||
public class BooleanField extends Field {
|
||||
@ -41,6 +42,7 @@ public class BooleanField extends Field {
|
||||
}
|
||||
|
||||
public boolean getValue(Oop obj) { return obj.getHandle().getJBooleanAt(getOffset()); }
|
||||
public boolean getValue(VMObject obj) { return obj.getAddress().getJBooleanAt(getOffset()); }
|
||||
public void setValue(Oop obj, boolean value) throws MutationException {
|
||||
// Fix this: setJBooleanAt is missing in Address
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -25,6 +25,7 @@
|
||||
package sun.jvm.hotspot.oops;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.VMObject;
|
||||
|
||||
// The class for a byte field simply provides access to the value.
|
||||
public class ByteField extends Field {
|
||||
@ -41,6 +42,7 @@ public class ByteField extends Field {
|
||||
}
|
||||
|
||||
public byte getValue(Oop obj) { return obj.getHandle().getJByteAt(getOffset()); }
|
||||
public byte getValue(VMObject obj) { return obj.getAddress().getJByteAt(getOffset()); }
|
||||
public void setValue(Oop obj, char value) throws MutationException {
|
||||
// Fix this: setJCharAt is missing in Address
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -24,6 +24,7 @@
|
||||
|
||||
package sun.jvm.hotspot.oops;
|
||||
|
||||
import sun.jvm.hotspot.runtime.VMObject;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
|
||||
// The class for an C int field simply provides access to the value.
|
||||
@ -39,7 +40,10 @@ public class CIntField extends Field {
|
||||
private boolean isUnsigned;
|
||||
|
||||
public long getValue(Oop obj) {
|
||||
return obj.getHandle().getCIntegerAt(getOffset(), size, isUnsigned);
|
||||
return getValue(obj.getHandle());
|
||||
}
|
||||
public long getValue(VMObject obj) {
|
||||
return getValue(obj.getAddress());
|
||||
}
|
||||
public long getValue(Address addr) {
|
||||
return addr.getCIntegerAt(getOffset(), size, isUnsigned);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -25,6 +25,7 @@
|
||||
package sun.jvm.hotspot.oops;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.VMObject;
|
||||
|
||||
// The class for a char field simply provides access to the value.
|
||||
public class CharField extends Field {
|
||||
@ -41,6 +42,7 @@ public class CharField extends Field {
|
||||
}
|
||||
|
||||
public char getValue(Oop obj) { return obj.getHandle().getJCharAt(getOffset()); }
|
||||
public char getValue(VMObject obj) { return obj.getAddress().getJCharAt(getOffset()); }
|
||||
public void setValue(Oop obj, char value) throws MutationException {
|
||||
// Fix this: setJCharAt is missing in Address
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 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
|
||||
@ -48,10 +48,10 @@ public class CheckedExceptionElement {
|
||||
|
||||
private static long offsetOfClassCPIndex;
|
||||
|
||||
private OopHandle handle;
|
||||
private Address handle;
|
||||
private long offset;
|
||||
|
||||
public CheckedExceptionElement(OopHandle handle, long offset) {
|
||||
public CheckedExceptionElement(Address handle, long offset) {
|
||||
this.handle = handle;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -30,7 +30,7 @@ import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
public class CompiledICHolder extends Oop {
|
||||
public class CompiledICHolder extends VMObject {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
@ -40,14 +40,14 @@ public class CompiledICHolder extends Oop {
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("compiledICHolderOopDesc");
|
||||
holderMethod = new OopField(type.getOopField("_holder_method"), 0);
|
||||
holderKlass = new OopField(type.getOopField("_holder_klass"), 0);
|
||||
Type type = db.lookupType("CompiledICHolder");
|
||||
holderMethod = new MetadataField(type.getAddressField("_holder_method"), 0);
|
||||
holderKlass = new MetadataField(type.getAddressField("_holder_klass"), 0);
|
||||
headerSize = type.getSize();
|
||||
}
|
||||
|
||||
CompiledICHolder(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
public CompiledICHolder(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public boolean isCompiledICHolder() { return true; }
|
||||
@ -55,8 +55,8 @@ public class CompiledICHolder extends Oop {
|
||||
private static long headerSize;
|
||||
|
||||
// Fields
|
||||
private static OopField holderMethod;
|
||||
private static OopField holderKlass;
|
||||
private static MetadataField holderMethod;
|
||||
private static MetadataField holderKlass;
|
||||
|
||||
// Accessors for declared fields
|
||||
public Method getHolderMethod() { return (Method) holderMethod.getValue(this); }
|
||||
@ -65,16 +65,4 @@ public class CompiledICHolder extends Oop {
|
||||
public void printValueOn(PrintStream tty) {
|
||||
tty.print("CompiledICHolder");
|
||||
}
|
||||
|
||||
public long getObjectSize() {
|
||||
return alignObjectSize(headerSize);
|
||||
}
|
||||
|
||||
void iterateFields(OopVisitor visitor, boolean doVMFields) {
|
||||
super.iterateFields(visitor, doVMFields);
|
||||
if (doVMFields) {
|
||||
visitor.doOop(holderMethod, true);
|
||||
visitor.doOop(holderKlass, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
import sun.jvm.hotspot.utilities.*;
|
||||
|
||||
public class ConstMethod extends Oop {
|
||||
public class ConstMethod extends VMObject {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
@ -50,18 +50,18 @@ public class ConstMethod extends Oop {
|
||||
private static int HAS_EXCEPTION_TABLE;
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("constMethodOopDesc");
|
||||
constants = new OopField(type.getOopField("_constants"), 0);
|
||||
Type type = db.lookupType("ConstMethod");
|
||||
constants = new MetadataField(type.getAddressField("_constants"), 0);
|
||||
constMethodSize = new CIntField(type.getCIntegerField("_constMethod_size"), 0);
|
||||
flags = new ByteField(type.getJByteField("_flags"), 0);
|
||||
|
||||
// enum constants for flags
|
||||
HAS_LINENUMBER_TABLE = db.lookupIntConstant("constMethodOopDesc::_has_linenumber_table").intValue();
|
||||
HAS_CHECKED_EXCEPTIONS = db.lookupIntConstant("constMethodOopDesc::_has_checked_exceptions").intValue();
|
||||
HAS_LOCALVARIABLE_TABLE = db.lookupIntConstant("constMethodOopDesc::_has_localvariable_table").intValue();
|
||||
HAS_EXCEPTION_TABLE = db.lookupIntConstant("constMethodOopDesc::_has_exception_table").intValue();
|
||||
HAS_LINENUMBER_TABLE = db.lookupIntConstant("ConstMethod::_has_linenumber_table").intValue();
|
||||
HAS_CHECKED_EXCEPTIONS = db.lookupIntConstant("ConstMethod::_has_checked_exceptions").intValue();
|
||||
HAS_LOCALVARIABLE_TABLE = db.lookupIntConstant("ConstMethod::_has_localvariable_table").intValue();
|
||||
HAS_EXCEPTION_TABLE = db.lookupIntConstant("ConstMethod::_has_exception_table").intValue();
|
||||
|
||||
// Size of Java bytecodes allocated immediately after constMethodOop.
|
||||
// Size of Java bytecodes allocated immediately after ConstMethod*.
|
||||
codeSize = new CIntField(type.getCIntegerField("_code_size"), 0);
|
||||
nameIndex = new CIntField(type.getCIntegerField("_name_index"), 0);
|
||||
signatureIndex = new CIntField(type.getCIntegerField("_signature_index"), 0);
|
||||
@ -81,12 +81,12 @@ public class ConstMethod extends Oop {
|
||||
exceptionTableElementSize = type.getSize();
|
||||
}
|
||||
|
||||
ConstMethod(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
public ConstMethod(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
// Fields
|
||||
private static OopField constants;
|
||||
private static MetadataField constants;
|
||||
private static CIntField constMethodSize;
|
||||
private static ByteField flags;
|
||||
private static CIntField codeSize;
|
||||
@ -104,8 +104,8 @@ public class ConstMethod extends Oop {
|
||||
|
||||
public Method getMethod() {
|
||||
InstanceKlass ik = (InstanceKlass)getConstants().getPoolHolder();
|
||||
ObjArray methods = ik.getMethods();
|
||||
return (Method)methods.getObjAt(getIdNum());
|
||||
MethodArray methods = ik.getMethods();
|
||||
return methods.at((int)getIdNum());
|
||||
}
|
||||
|
||||
// Accessors for declared fields
|
||||
@ -157,7 +157,7 @@ public class ConstMethod extends Oop {
|
||||
|
||||
/** Get a bytecode or breakpoint at the given bci */
|
||||
public int getBytecodeOrBPAt(int bci) {
|
||||
return getHandle().getJByteAt(bytecodeOffset + bci) & 0xFF;
|
||||
return getAddress().getJByteAt(bytecodeOffset + bci) & 0xFF;
|
||||
}
|
||||
|
||||
public byte getBytecodeByteArg(int bci) {
|
||||
@ -215,23 +215,21 @@ public class ConstMethod extends Oop {
|
||||
for( int i=0; i < bc.length; i++ )
|
||||
{
|
||||
long offs = bytecodeOffset + i;
|
||||
bc[i] = getHandle().getJByteAt( offs );
|
||||
bc[i] = getAddress().getJByteAt( offs );
|
||||
}
|
||||
return bc;
|
||||
}
|
||||
|
||||
public long getObjectSize() {
|
||||
return getConstMethodSize() * getHeap().getOopSize();
|
||||
public long getSize() {
|
||||
return getConstMethodSize();
|
||||
}
|
||||
|
||||
public void printValueOn(PrintStream tty) {
|
||||
tty.print("ConstMethod " + getName().asString() + getSignature().asString() + "@" + getHandle());
|
||||
tty.print("ConstMethod " + getName().asString() + getSignature().asString() + "@" + getAddress());
|
||||
}
|
||||
|
||||
public void iterateFields(OopVisitor visitor, boolean doVMFields) {
|
||||
super.iterateFields(visitor, doVMFields);
|
||||
if (doVMFields) {
|
||||
visitor.doOop(constants, true);
|
||||
public void iterateFields(MetadataVisitor visitor) {
|
||||
visitor.doMetadata(constants, true);
|
||||
visitor.doCInt(constMethodSize, true);
|
||||
visitor.doByte(flags, true);
|
||||
visitor.doCInt(codeSize, true);
|
||||
@ -240,7 +238,6 @@ public class ConstMethod extends Oop {
|
||||
visitor.doCInt(genericSignatureIndex, true);
|
||||
visitor.doCInt(codeSize, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Accessors
|
||||
|
||||
@ -266,7 +263,7 @@ public class ConstMethod extends Oop {
|
||||
// The line numbers are a short array of 2-tuples [start_pc, line_number].
|
||||
// Not necessarily sorted and not necessarily one-to-one.
|
||||
CompressedLineNumberReadStream stream =
|
||||
new CompressedLineNumberReadStream(getHandle(), (int) offsetOfCompressedLineNumberTable());
|
||||
new CompressedLineNumberReadStream(getAddress(), (int) offsetOfCompressedLineNumberTable());
|
||||
while (stream.readPair()) {
|
||||
if (stream.bci() == bci) {
|
||||
// perfect match
|
||||
@ -290,7 +287,7 @@ public class ConstMethod extends Oop {
|
||||
}
|
||||
int len = getLineNumberTableLength();
|
||||
CompressedLineNumberReadStream stream =
|
||||
new CompressedLineNumberReadStream(getHandle(), (int) offsetOfCompressedLineNumberTable());
|
||||
new CompressedLineNumberReadStream(getAddress(), (int) offsetOfCompressedLineNumberTable());
|
||||
LineNumberTableElement[] ret = new LineNumberTableElement[len];
|
||||
|
||||
for (int idx = 0; idx < len; idx++) {
|
||||
@ -316,7 +313,7 @@ public class ConstMethod extends Oop {
|
||||
LocalVariableTableElement[] ret = new LocalVariableTableElement[getLocalVariableTableLength()];
|
||||
long offset = offsetOfLocalVariableTable();
|
||||
for (int i = 0; i < ret.length; i++) {
|
||||
ret[i] = new LocalVariableTableElement(getHandle(), offset);
|
||||
ret[i] = new LocalVariableTableElement(getAddress(), offset);
|
||||
offset += localVariableTableElementSize;
|
||||
}
|
||||
return ret;
|
||||
@ -333,7 +330,7 @@ public class ConstMethod extends Oop {
|
||||
ExceptionTableElement[] ret = new ExceptionTableElement[getExceptionTableLength()];
|
||||
long offset = offsetOfExceptionTable();
|
||||
for (int i = 0; i < ret.length; i++) {
|
||||
ret[i] = new ExceptionTableElement(getHandle(), offset);
|
||||
ret[i] = new ExceptionTableElement(getAddress(), offset);
|
||||
offset += exceptionTableElementSize;
|
||||
}
|
||||
return ret;
|
||||
@ -350,7 +347,7 @@ public class ConstMethod extends Oop {
|
||||
CheckedExceptionElement[] ret = new CheckedExceptionElement[getCheckedExceptionsLength()];
|
||||
long offset = offsetOfCheckedExceptions();
|
||||
for (int i = 0; i < ret.length; i++) {
|
||||
ret[i] = new CheckedExceptionElement(getHandle(), offset);
|
||||
ret[i] = new CheckedExceptionElement(getAddress(), offset);
|
||||
offset += checkedExceptionElementSize;
|
||||
}
|
||||
return ret;
|
||||
@ -370,14 +367,14 @@ public class ConstMethod extends Oop {
|
||||
return bytecodeOffset + getCodeSize();
|
||||
}
|
||||
|
||||
// Offset of start of compressed line number table (see methodOop.hpp)
|
||||
// Offset of start of compressed line number table (see method.hpp)
|
||||
private long offsetOfCompressedLineNumberTable() {
|
||||
return offsetOfCodeEnd() + (isNative() ? 2 * VM.getVM().getAddressSize() : 0);
|
||||
}
|
||||
|
||||
// Offset of last short in methodOop
|
||||
// Offset of last short in Method*
|
||||
private long offsetOfLastU2Element() {
|
||||
return getObjectSize() - 2;
|
||||
return getSize() * VM.getVM().getObjectHeap().getOopSize() - 2;
|
||||
}
|
||||
|
||||
private long offsetOfCheckedExceptionsLength() {
|
||||
@ -386,7 +383,7 @@ public class ConstMethod extends Oop {
|
||||
|
||||
private int getCheckedExceptionsLength() {
|
||||
if (hasCheckedExceptions()) {
|
||||
return (int) getHandle().getCIntegerAt(offsetOfCheckedExceptionsLength(), 2, true);
|
||||
return (int) getAddress().getCIntegerAt(offsetOfCheckedExceptionsLength(), 2, true);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@ -407,7 +404,7 @@ public class ConstMethod extends Oop {
|
||||
int len = 0;
|
||||
if (hasLineNumberTable()) {
|
||||
CompressedLineNumberReadStream stream =
|
||||
new CompressedLineNumberReadStream(getHandle(), (int) offsetOfCompressedLineNumberTable());
|
||||
new CompressedLineNumberReadStream(getAddress(), (int) offsetOfCompressedLineNumberTable());
|
||||
while (stream.readPair()) {
|
||||
len += 1;
|
||||
}
|
||||
@ -417,7 +414,7 @@ public class ConstMethod extends Oop {
|
||||
|
||||
private int getLocalVariableTableLength() {
|
||||
if (hasLocalVariableTable()) {
|
||||
return (int) getHandle().getCIntegerAt(offsetOfLocalVariableTableLength(), 2, true);
|
||||
return (int) getAddress().getCIntegerAt(offsetOfLocalVariableTableLength(), 2, true);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@ -450,7 +447,7 @@ public class ConstMethod extends Oop {
|
||||
|
||||
private int getExceptionTableLength() {
|
||||
if (hasExceptionTable()) {
|
||||
return (int) getHandle().getCIntegerAt(offsetOfExceptionTableLength(), 2, true);
|
||||
return (int) getAddress().getCIntegerAt(offsetOfExceptionTableLength(), 2, true);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -34,8 +34,7 @@ import sun.jvm.hotspot.utilities.*;
|
||||
// A ConstantPool is an oop containing class constants
|
||||
// as described in the class file
|
||||
|
||||
public class ConstantPool extends Oop implements ClassConstants {
|
||||
|
||||
public class ConstantPool extends Metadata implements ClassConstants {
|
||||
public class CPSlot {
|
||||
private Address ptr;
|
||||
|
||||
@ -46,24 +45,20 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
this.ptr = sym.getAddress().orWithMask(1);
|
||||
}
|
||||
|
||||
public boolean isOop() {
|
||||
public boolean isResolved() {
|
||||
return (ptr.minus(null) & 1) == 0;
|
||||
}
|
||||
public boolean isMetaData() {
|
||||
public boolean isUnresolved() {
|
||||
return (ptr.minus(null) & 1) == 1;
|
||||
}
|
||||
|
||||
public Symbol getSymbol() {
|
||||
if (isMetaData()) {
|
||||
if (!isUnresolved()) throw new InternalError("not a symbol");
|
||||
return Symbol.create(ptr.xorWithMask(1));
|
||||
}
|
||||
throw new InternalError("not a symbol");
|
||||
}
|
||||
public Oop getOop() {
|
||||
if (isOop()) {
|
||||
return VM.getVM().getObjectHeap().newOop(ptr.addOffsetToAsOopHandle(0));
|
||||
}
|
||||
throw new InternalError("not an oop");
|
||||
public Klass getKlass() {
|
||||
if (!isResolved()) throw new InternalError("not klass");
|
||||
return (Klass)Metadata.instantiateWrapperFor(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,31 +78,35 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("constantPoolOopDesc");
|
||||
tags = new OopField(type.getOopField("_tags"), 0);
|
||||
operands = new OopField(type.getOopField("_operands"), 0);
|
||||
cache = new OopField(type.getOopField("_cache"), 0);
|
||||
poolHolder = new OopField(type.getOopField("_pool_holder"), 0);
|
||||
Type type = db.lookupType("ConstantPool");
|
||||
tags = type.getAddressField("_tags");
|
||||
operands = type.getAddressField("_operands");
|
||||
cache = type.getAddressField("_cache");
|
||||
poolHolder = new MetadataField(type.getAddressField("_pool_holder"), 0);
|
||||
length = new CIntField(type.getCIntegerField("_length"), 0);
|
||||
resolvedReferences = type.getAddressField("_resolved_references");
|
||||
referenceMap = type.getAddressField("_reference_map");
|
||||
headerSize = type.getSize();
|
||||
elementSize = 0;
|
||||
// fetch constants:
|
||||
INDY_BSM_OFFSET = db.lookupIntConstant("constantPoolOopDesc::_indy_bsm_offset").intValue();
|
||||
INDY_ARGC_OFFSET = db.lookupIntConstant("constantPoolOopDesc::_indy_argc_offset").intValue();
|
||||
INDY_ARGV_OFFSET = db.lookupIntConstant("constantPoolOopDesc::_indy_argv_offset").intValue();
|
||||
INDY_BSM_OFFSET = db.lookupIntConstant("ConstantPool::_indy_bsm_offset").intValue();
|
||||
INDY_ARGC_OFFSET = db.lookupIntConstant("ConstantPool::_indy_argc_offset").intValue();
|
||||
INDY_ARGV_OFFSET = db.lookupIntConstant("ConstantPool::_indy_argv_offset").intValue();
|
||||
}
|
||||
|
||||
ConstantPool(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
public ConstantPool(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public boolean isConstantPool() { return true; }
|
||||
|
||||
private static OopField tags;
|
||||
private static OopField operands;
|
||||
private static OopField cache;
|
||||
private static OopField poolHolder;
|
||||
private static AddressField tags;
|
||||
private static AddressField operands;
|
||||
private static AddressField cache;
|
||||
private static MetadataField poolHolder;
|
||||
private static CIntField length; // number of elements in oop
|
||||
private static AddressField resolvedReferences;
|
||||
private static AddressField referenceMap;
|
||||
|
||||
private static long headerSize;
|
||||
private static long elementSize;
|
||||
@ -116,11 +115,31 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
private static int INDY_ARGC_OFFSET;
|
||||
private static int INDY_ARGV_OFFSET;
|
||||
|
||||
public TypeArray getTags() { return (TypeArray) tags.getValue(this); }
|
||||
public TypeArray getOperands() { return (TypeArray) operands.getValue(this); }
|
||||
public ConstantPoolCache getCache() { return (ConstantPoolCache) cache.getValue(this); }
|
||||
public U1Array getTags() { return new U1Array(tags.getValue(getAddress())); }
|
||||
public U2Array getOperands() { return new U2Array(operands.getValue(getAddress())); }
|
||||
public ConstantPoolCache getCache() {
|
||||
Address addr = cache.getValue(getAddress());
|
||||
return (ConstantPoolCache) VMObjectFactory.newObject(ConstantPoolCache.class, addr);
|
||||
}
|
||||
public Klass getPoolHolder() { return (Klass) poolHolder.getValue(this); }
|
||||
public int getLength() { return (int)length.getValue(this); }
|
||||
public int getLength() { return (int)length.getValue(getAddress()); }
|
||||
public Oop getResolvedReferences() {
|
||||
Address handle = resolvedReferences.getValue(getAddress());
|
||||
if (handle != null) {
|
||||
// Load through the handle
|
||||
OopHandle refs = handle.getOopHandleAt(0);
|
||||
return VM.getVM().getObjectHeap().newOop(refs);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public U2Array referenceMap() {
|
||||
return new U2Array(referenceMap.getValue(getAddress()));
|
||||
}
|
||||
|
||||
public int objectToCPIndex(int index) {
|
||||
return referenceMap().at(index);
|
||||
}
|
||||
|
||||
private long getElementSize() {
|
||||
if (elementSize !=0 ) {
|
||||
@ -139,33 +158,32 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
}
|
||||
|
||||
public ConstantTag getTagAt(long index) {
|
||||
return new ConstantTag(getTags().getByteAt((int) index));
|
||||
return new ConstantTag((byte)getTags().at((int) index));
|
||||
}
|
||||
|
||||
public CPSlot getSlotAt(long index) {
|
||||
return new CPSlot(getHandle().getAddressAt(indexOffset(index)));
|
||||
return new CPSlot(getAddressAtRaw(index));
|
||||
}
|
||||
|
||||
public Oop getObjAtRaw(long index){
|
||||
return getHeap().newOop(getHandle().getOopHandleAt(indexOffset(index)));
|
||||
public Address getAddressAtRaw(long index) {
|
||||
return getAddress().getAddressAt(indexOffset(index));
|
||||
}
|
||||
|
||||
public Symbol getSymbolAt(long index) {
|
||||
CPSlot slot = getSlotAt(index);
|
||||
return slot.getSymbol();
|
||||
return Symbol.create(getAddressAtRaw(index));
|
||||
}
|
||||
|
||||
public int getIntAt(long index){
|
||||
return getHandle().getJIntAt(indexOffset(index));
|
||||
return getAddress().getJIntAt(indexOffset(index));
|
||||
}
|
||||
|
||||
public float getFloatAt(long index){
|
||||
return getHandle().getJFloatAt(indexOffset(index));
|
||||
return getAddress().getJFloatAt(indexOffset(index));
|
||||
}
|
||||
|
||||
public long getLongAt(long index) {
|
||||
int oneHalf = getHandle().getJIntAt(indexOffset(index + 1));
|
||||
int otherHalf = getHandle().getJIntAt(indexOffset(index));
|
||||
int oneHalf = getAddress().getJIntAt(indexOffset(index + 1));
|
||||
int otherHalf = getAddress().getJIntAt(indexOffset(index));
|
||||
// buildLongFromIntsPD accepts higher address value, lower address value
|
||||
// in that order.
|
||||
return VM.getVM().buildLongFromIntsPD(oneHalf, otherHalf);
|
||||
@ -185,7 +203,7 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
i = which;
|
||||
} else {
|
||||
// change byte-ordering and go via cache
|
||||
i = cache.getEntryAt(0xFFFF & VM.getVM().getBytes().swapShort((short) which)).getConstantPoolIndex();
|
||||
i = cache.getEntryAt(0xFFFF & which).getConstantPoolIndex();
|
||||
}
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(getTagAt(i).isFieldOrMethod(), "Corrupted constant pool");
|
||||
@ -202,7 +220,7 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
|
||||
public int[] getNameAndTypeAt(int which) {
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(getTagAt(which).isNameAndType(), "Corrupted constant pool");
|
||||
Assert.that(getTagAt(which).isNameAndType(), "Corrupted constant pool: " + which + " " + getTagAt(which));
|
||||
}
|
||||
int i = getIntAt(which);
|
||||
if (DEBUG) {
|
||||
@ -215,6 +233,10 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
return implGetNameRefAt(which, false);
|
||||
}
|
||||
|
||||
public Symbol uncachedGetNameRefAt(int which) {
|
||||
return implGetNameRefAt(which, true);
|
||||
}
|
||||
|
||||
private Symbol implGetNameRefAt(int which, boolean uncached) {
|
||||
int signatureIndex = getNameRefIndexAt(implNameAndTypeRefIndexAt(which, uncached));
|
||||
return getSymbolAt(signatureIndex);
|
||||
@ -224,35 +246,57 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
return implGetSignatureRefAt(which, false);
|
||||
}
|
||||
|
||||
public Symbol uncachedGetSignatureRefAt(int which) {
|
||||
return implGetSignatureRefAt(which, true);
|
||||
}
|
||||
|
||||
private Symbol implGetSignatureRefAt(int which, boolean uncached) {
|
||||
int signatureIndex = getSignatureRefIndexAt(implNameAndTypeRefIndexAt(which, uncached));
|
||||
return getSymbolAt(signatureIndex);
|
||||
}
|
||||
|
||||
public static boolean isInvokedynamicIndex(int i) { return (i < 0); }
|
||||
|
||||
public static int decodeInvokedynamicIndex(int i) { Assert.that(isInvokedynamicIndex(i), ""); return ~i; }
|
||||
|
||||
// The invokedynamic points at the object index. The object map points at
|
||||
// the cpCache index and the cpCache entry points at the original constant
|
||||
// pool index.
|
||||
public int invokedynamicCPCacheIndex(int index) {
|
||||
Assert.that(isInvokedynamicIndex(index), "should be a invokedynamic index");
|
||||
int rawIndex = decodeInvokedynamicIndex(index);
|
||||
return referenceMap().at(rawIndex);
|
||||
}
|
||||
|
||||
ConstantPoolCacheEntry invokedynamicCPCacheEntryAt(int index) {
|
||||
// decode index that invokedynamic points to.
|
||||
int cpCacheIndex = invokedynamicCPCacheIndex(index);
|
||||
return getCache().getEntryAt(cpCacheIndex);
|
||||
}
|
||||
|
||||
private int implNameAndTypeRefIndexAt(int which, boolean uncached) {
|
||||
int i = which;
|
||||
if (!uncached && getCache() != null) {
|
||||
if (ConstantPoolCache.isSecondaryIndex(which)) {
|
||||
// Invokedynamic index.
|
||||
int pool_index = getCache().getMainEntryAt(which).getConstantPoolIndex();
|
||||
pool_index = invokeDynamicNameAndTypeRefIndexAt(pool_index);
|
||||
// assert(tagAt(pool_index).isNameAndType(), "");
|
||||
return pool_index;
|
||||
if (isInvokedynamicIndex(which)) {
|
||||
// Invokedynamic index is index into resolved_references
|
||||
int poolIndex = invokedynamicCPCacheEntryAt(which).getConstantPoolIndex();
|
||||
poolIndex = invokeDynamicNameAndTypeRefIndexAt(poolIndex);
|
||||
Assert.that(getTagAt(poolIndex).isNameAndType(), "");
|
||||
return poolIndex;
|
||||
}
|
||||
// change byte-ordering and go via cache
|
||||
i = remapInstructionOperandFromCache(which);
|
||||
} else {
|
||||
if (getTagAt(which).isInvokeDynamic()) {
|
||||
int pool_index = invokeDynamicNameAndTypeRefIndexAt(which);
|
||||
// assert(tag_at(pool_index).is_name_and_type(), "");
|
||||
return pool_index;
|
||||
int poolIndex = invokeDynamicNameAndTypeRefIndexAt(which);
|
||||
Assert.that(getTagAt(poolIndex).isNameAndType(), "");
|
||||
return poolIndex;
|
||||
}
|
||||
}
|
||||
// assert(tag_at(i).is_field_or_method(), "Corrupted constant pool");
|
||||
// assert(!tag_at(i).is_invoke_dynamic(), "Must be handled above");
|
||||
int ref_index = getIntAt(i);
|
||||
return extractHighShortFromInt(ref_index);
|
||||
int refIndex = getIntAt(i);
|
||||
return extractHighShortFromInt(refIndex);
|
||||
}
|
||||
|
||||
private int remapInstructionOperandFromCache(int operand) {
|
||||
@ -269,16 +313,29 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
}
|
||||
|
||||
// returns null, if not resolved.
|
||||
public Klass getKlassRefAt(int which) {
|
||||
public Klass getKlassAt(int which) {
|
||||
if( ! getTagAt(which).isKlass()) return null;
|
||||
return (Klass) getObjAtRaw(which);
|
||||
return (Klass)Metadata.instantiateWrapperFor(getAddressAtRaw(which));
|
||||
}
|
||||
|
||||
public Symbol getKlassNameAt(int which) {
|
||||
CPSlot entry = getSlotAt(which);
|
||||
if (entry.isResolved()) {
|
||||
return entry.getKlass().getName();
|
||||
} else {
|
||||
return entry.getSymbol();
|
||||
}
|
||||
}
|
||||
|
||||
public Symbol getUnresolvedStringAt(int which) {
|
||||
return getSymbolAt(which);
|
||||
}
|
||||
|
||||
// returns null, if not resolved.
|
||||
public InstanceKlass getFieldOrMethodKlassRefAt(int which) {
|
||||
int refIndex = getFieldOrMethodAt(which);
|
||||
int klassIndex = extractLowShortFromInt(refIndex);
|
||||
return (InstanceKlass) getKlassRefAt(klassIndex);
|
||||
return (InstanceKlass) getKlassAt(klassIndex);
|
||||
}
|
||||
|
||||
// returns null, if not resolved.
|
||||
@ -371,16 +428,16 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
Assert.that(getTagAt(i).isInvokeDynamic(), "Corrupted constant pool");
|
||||
}
|
||||
int bsmSpec = extractLowShortFromInt(this.getIntAt(i));
|
||||
TypeArray operands = getOperands();
|
||||
U2Array operands = getOperands();
|
||||
if (operands == null) return null; // safety first
|
||||
int basePos = VM.getVM().buildIntFromShorts(operands.getShortAt(bsmSpec * 2 + 0),
|
||||
operands.getShortAt(bsmSpec * 2 + 1));
|
||||
int basePos = VM.getVM().buildIntFromShorts(operands.at(bsmSpec * 2 + 0),
|
||||
operands.at(bsmSpec * 2 + 1));
|
||||
int argv = basePos + INDY_ARGV_OFFSET;
|
||||
int argc = operands.getShortAt(basePos + INDY_ARGC_OFFSET);
|
||||
int argc = operands.at(basePos + INDY_ARGC_OFFSET);
|
||||
int endPos = argv + argc;
|
||||
short[] values = new short[endPos - basePos];
|
||||
for (int j = 0; j < values.length; j++) {
|
||||
values[j] = operands.getShortAt(basePos+j);
|
||||
values[j] = operands.at(basePos+j);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
@ -407,25 +464,24 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
case JVM_CONSTANT_InvokeDynamic: return "JVM_CONSTANT_InvokeDynamic";
|
||||
case JVM_CONSTANT_Invalid: return "JVM_CONSTANT_Invalid";
|
||||
case JVM_CONSTANT_UnresolvedClass: return "JVM_CONSTANT_UnresolvedClass";
|
||||
case JVM_CONSTANT_UnresolvedClassInError: return "JVM_CONSTANT_UnresolvedClassInError";
|
||||
case JVM_CONSTANT_ClassIndex: return "JVM_CONSTANT_ClassIndex";
|
||||
case JVM_CONSTANT_UnresolvedString: return "JVM_CONSTANT_UnresolvedString";
|
||||
case JVM_CONSTANT_StringIndex: return "JVM_CONSTANT_StringIndex";
|
||||
case JVM_CONSTANT_UnresolvedClassInError: return "JVM_CONSTANT_UnresolvedClassInError";
|
||||
case JVM_CONSTANT_MethodHandleInError:return "JVM_CONSTANT_MethodHandleInError";
|
||||
case JVM_CONSTANT_MethodTypeInError: return "JVM_CONSTANT_MethodTypeInError";
|
||||
case JVM_CONSTANT_Object: return "JVM_CONSTANT_Object";
|
||||
}
|
||||
throw new InternalError("Unknown tag: " + tag);
|
||||
}
|
||||
|
||||
public void iterateFields(OopVisitor visitor, boolean doVMFields) {
|
||||
super.iterateFields(visitor, doVMFields);
|
||||
if (doVMFields) {
|
||||
visitor.doOop(tags, true);
|
||||
visitor.doOop(cache, true);
|
||||
visitor.doOop(poolHolder, true);
|
||||
public void iterateFields(MetadataVisitor visitor) {
|
||||
super.iterateFields(visitor);
|
||||
visitor.doMetadata(poolHolder, true);
|
||||
|
||||
final int length = (int) getLength();
|
||||
// zero'th pool entry is always invalid. ignore it.
|
||||
for (int index = 1; index < length; index++) {
|
||||
int ctag = (int) getTags().getByteAt((int) index);
|
||||
int ctag = (int) getTags().at((int) index);
|
||||
switch (ctag) {
|
||||
case JVM_CONSTANT_ClassIndex:
|
||||
case JVM_CONSTANT_StringIndex:
|
||||
@ -452,7 +508,6 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
case JVM_CONSTANT_UnresolvedClassInError:
|
||||
case JVM_CONSTANT_UnresolvedClass:
|
||||
case JVM_CONSTANT_Class:
|
||||
case JVM_CONSTANT_UnresolvedString:
|
||||
case JVM_CONSTANT_Utf8:
|
||||
visitor.doOop(new OopField(new NamedFieldIdentifier(nameForTag(ctag)), indexOffset(index), true), true);
|
||||
break;
|
||||
@ -469,27 +524,19 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
int length = getLength();
|
||||
for (int index = 0; index < length; index++) {
|
||||
long offset = baseOffset + (index + typeDataBase.getOopSize());
|
||||
visitor.doOop(new IndexableField(index, offset, false), getObjAt(index));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public void writeBytes(OutputStream os) throws IOException {
|
||||
// Map between any modified UTF-8 and it's constant pool index.
|
||||
Map utf8ToIndex = new HashMap();
|
||||
DataOutputStream dos = new DataOutputStream(os);
|
||||
TypeArray tags = getTags();
|
||||
U1Array tags = getTags();
|
||||
int len = (int)getLength();
|
||||
int ci = 0; // constant pool index
|
||||
|
||||
// collect all modified UTF-8 Strings from Constant Pool
|
||||
|
||||
for (ci = 1; ci < len; ci++) {
|
||||
byte cpConstType = tags.getByteAt(ci);
|
||||
int cpConstType = tags.at(ci);
|
||||
if(cpConstType == JVM_CONSTANT_Utf8) {
|
||||
Symbol sym = getSymbolAt(ci);
|
||||
utf8ToIndex.put(sym.asString(), new Short((short) ci));
|
||||
@ -502,7 +549,7 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
|
||||
|
||||
for(ci = 1; ci < len; ci++) {
|
||||
int cpConstType = (int)tags.getByteAt(ci);
|
||||
int cpConstType = tags.at(ci);
|
||||
// write cp_info
|
||||
// write constant type
|
||||
switch(cpConstType) {
|
||||
@ -548,8 +595,8 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
|
||||
case JVM_CONSTANT_Class: {
|
||||
dos.writeByte(cpConstType);
|
||||
// Klass already resolved. ConstantPool constains klassOop.
|
||||
Klass refKls = (Klass) getObjAtRaw(ci);
|
||||
// Klass already resolved. ConstantPool constains Klass*.
|
||||
Klass refKls = (Klass)Metadata.instantiateWrapperFor(getAddressAtRaw(ci));
|
||||
String klassName = refKls.getName().asString();
|
||||
Short s = (Short) utf8ToIndex.get(klassName);
|
||||
dos.writeShort(s.shortValue());
|
||||
@ -570,24 +617,13 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
|
||||
case JVM_CONSTANT_String: {
|
||||
dos.writeByte(cpConstType);
|
||||
String str = OopUtilities.stringOopToString(getObjAtRaw(ci));
|
||||
String str = getUnresolvedStringAt(ci).asString();
|
||||
Short s = (Short) utf8ToIndex.get(str);
|
||||
dos.writeShort(s.shortValue());
|
||||
if (DEBUG) debugMessage("CP[" + ci + "] = string " + s);
|
||||
break;
|
||||
}
|
||||
|
||||
// case JVM_CONSTANT_StringIndex:
|
||||
case JVM_CONSTANT_UnresolvedString: {
|
||||
dos.writeByte(JVM_CONSTANT_String);
|
||||
String val = getSymbolAt(ci).asString();
|
||||
|
||||
Short s = (Short) utf8ToIndex.get(val);
|
||||
dos.writeShort(s.shortValue());
|
||||
if (DEBUG) debugMessage("CP[" + ci + "] = string " + s);
|
||||
break;
|
||||
}
|
||||
|
||||
// all external, internal method/field references
|
||||
case JVM_CONSTANT_Fieldref:
|
||||
case JVM_CONSTANT_Methodref:
|
||||
@ -618,12 +654,21 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
case JVM_CONSTANT_MethodHandle: {
|
||||
dos.writeByte(cpConstType);
|
||||
int value = getIntAt(ci);
|
||||
short nameIndex = (short) extractLowShortFromInt(value);
|
||||
short signatureIndex = (short) extractHighShortFromInt(value);
|
||||
dos.writeShort(nameIndex);
|
||||
dos.writeShort(signatureIndex);
|
||||
if (DEBUG) debugMessage("CP[" + ci + "] = N&T name = " + nameIndex
|
||||
+ ", type = " + signatureIndex);
|
||||
byte refKind = (byte) extractLowShortFromInt(value);
|
||||
short memberIndex = (short) extractHighShortFromInt(value);
|
||||
dos.writeByte(refKind);
|
||||
dos.writeShort(memberIndex);
|
||||
if (DEBUG) debugMessage("CP[" + ci + "] = MH kind = " +
|
||||
refKind + ", mem = " + memberIndex);
|
||||
break;
|
||||
}
|
||||
|
||||
case JVM_CONSTANT_MethodType: {
|
||||
dos.writeByte(cpConstType);
|
||||
int value = getIntAt(ci);
|
||||
short refIndex = (short) value;
|
||||
dos.writeShort(refIndex);
|
||||
if (DEBUG) debugMessage("CP[" + ci + "] = MT index = " + refIndex);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -634,13 +679,13 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
short nameAndTypeIndex = (short) extractHighShortFromInt(value);
|
||||
dos.writeShort(bsmIndex);
|
||||
dos.writeShort(nameAndTypeIndex);
|
||||
if (DEBUG) debugMessage("CP[" + ci + "] = indy BSM = " + bsmIndex
|
||||
+ ", N&T = " + nameAndTypeIndex);
|
||||
if (DEBUG) debugMessage("CP[" + ci + "] = INDY bsm = " +
|
||||
bsmIndex + ", N&T = " + nameAndTypeIndex);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw new InternalError("unknown tag: " + cpConstType);
|
||||
throw new InternalError("Unknown tag: " + cpConstType);
|
||||
} // switch
|
||||
}
|
||||
dos.flush();
|
||||
@ -648,16 +693,11 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
}
|
||||
|
||||
public void printValueOn(PrintStream tty) {
|
||||
Oop holder = poolHolder.getValue(this);
|
||||
if (holder instanceof Klass) {
|
||||
tty.print("ConstantPool for " + ((Klass)holder).getName().asString());
|
||||
} else {
|
||||
tty.print("ConstantPool for partially loaded class");
|
||||
}
|
||||
tty.print("ConstantPool for " + getPoolHolder().getName().asString());
|
||||
}
|
||||
|
||||
public long getObjectSize() {
|
||||
return alignObjectSize(headerSize + (getLength() * getElementSize()));
|
||||
public long getSize() {
|
||||
return Oop.alignObjectSize(headerSize + getLength());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@ -665,12 +705,12 @@ public class ConstantPool extends Oop implements ClassConstants {
|
||||
//
|
||||
|
||||
private static int extractHighShortFromInt(int val) {
|
||||
// must stay in sync with constantPoolOopDesc::name_and_type_at_put, method_at_put, etc.
|
||||
// must stay in sync with ConstantPool::name_and_type_at_put, method_at_put, etc.
|
||||
return (val >> 16) & 0xFFFF;
|
||||
}
|
||||
|
||||
private static int extractLowShortFromInt(int val) {
|
||||
// must stay in sync with constantPoolOopDesc::name_and_type_at_put, method_at_put, etc.
|
||||
// must stay in sync with ConstantPool::name_and_type_at_put, method_at_put, etc.
|
||||
return val & 0xFFFF;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -31,10 +31,10 @@ import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
import sun.jvm.hotspot.utilities.*;
|
||||
|
||||
// ConstantPoolCache : A constant pool cache (constantPoolCacheOopDesc).
|
||||
// See cpCacheOop.hpp for details about this class.
|
||||
// ConstantPoolCache : A constant pool cache (ConstantPoolCache).
|
||||
// See cpCache.hpp for details about this class.
|
||||
//
|
||||
public class ConstantPoolCache extends Oop {
|
||||
public class ConstantPoolCache extends Metadata {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
@ -44,31 +44,33 @@ public class ConstantPoolCache extends Oop {
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("constantPoolCacheOopDesc");
|
||||
constants = new OopField(type.getOopField("_constant_pool"), 0);
|
||||
Type type = db.lookupType("ConstantPoolCache");
|
||||
constants = new MetadataField(type.getAddressField("_constant_pool"), 0);
|
||||
baseOffset = type.getSize();
|
||||
Type elType = db.lookupType("ConstantPoolCacheEntry");
|
||||
elementSize = elType.getSize();
|
||||
length = new CIntField(type.getCIntegerField("_length"), 0);
|
||||
intSize = VM.getVM().getObjectHeap().getIntSize();
|
||||
}
|
||||
|
||||
ConstantPoolCache(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
public ConstantPoolCache(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public boolean isConstantPoolCache() { return true; }
|
||||
|
||||
private static OopField constants;
|
||||
private static MetadataField constants;
|
||||
|
||||
private static long baseOffset;
|
||||
private static long elementSize;
|
||||
private static CIntField length;
|
||||
private static long intSize;
|
||||
|
||||
|
||||
public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); }
|
||||
|
||||
public long getObjectSize() {
|
||||
return alignObjectSize(baseOffset + getLength() * elementSize);
|
||||
public long getSize() {
|
||||
return Oop.alignObjectSize(baseOffset + getLength() * elementSize);
|
||||
}
|
||||
|
||||
public ConstantPoolCacheEntry getEntryAt(int i) {
|
||||
@ -76,41 +78,10 @@ public class ConstantPoolCache extends Oop {
|
||||
return new ConstantPoolCacheEntry(this, i);
|
||||
}
|
||||
|
||||
public static boolean isSecondaryIndex(int i) { return (i < 0); }
|
||||
public static int decodeSecondaryIndex(int i) { return isSecondaryIndex(i) ? ~i : i; }
|
||||
public static int encodeSecondaryIndex(int i) { return !isSecondaryIndex(i) ? ~i : i; }
|
||||
|
||||
// secondary entries hold invokedynamic call site bindings
|
||||
public ConstantPoolCacheEntry getSecondaryEntryAt(int i) {
|
||||
int rawIndex = i;
|
||||
if (isSecondaryIndex(i)) {
|
||||
rawIndex = decodeSecondaryIndex(i);
|
||||
}
|
||||
ConstantPoolCacheEntry e = getEntryAt(rawIndex);
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(e.isSecondaryEntry(), "must be a secondary entry:" + rawIndex);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
public ConstantPoolCacheEntry getMainEntryAt(int i) {
|
||||
int primaryIndex = i;
|
||||
if (isSecondaryIndex(i)) {
|
||||
// run through an extra level of indirection:
|
||||
int rawIndex = decodeSecondaryIndex(i);
|
||||
primaryIndex = getEntryAt(rawIndex).getMainEntryIndex();
|
||||
}
|
||||
ConstantPoolCacheEntry e = getEntryAt(primaryIndex);
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(!e.isSecondaryEntry(), "must not be a secondary entry:" + primaryIndex);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
public int getIntAt(int entry, int fld) {
|
||||
//alignObjectSize ?
|
||||
long offset = baseOffset + /*alignObjectSize*/entry * elementSize + fld* getHeap().getIntSize();
|
||||
return (int) getHandle().getCIntegerAt(offset, getHeap().getIntSize(), true );
|
||||
long offset = baseOffset + /*alignObjectSize*/entry * elementSize + fld * intSize;
|
||||
return (int) getAddress().getCIntegerAt(offset, intSize, true );
|
||||
}
|
||||
|
||||
|
||||
@ -119,17 +90,15 @@ public class ConstantPoolCache extends Oop {
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return (int) length.getValue(this);
|
||||
return (int) length.getValue(getAddress());
|
||||
}
|
||||
|
||||
public void iterateFields(OopVisitor visitor, boolean doVMFields) {
|
||||
super.iterateFields(visitor, doVMFields);
|
||||
if (doVMFields) {
|
||||
visitor.doOop(constants, true);
|
||||
public void iterateFields(MetadataVisitor visitor) {
|
||||
super.iterateFields(visitor);
|
||||
visitor.doMetadata(constants, true);
|
||||
for (int i = 0; i < getLength(); i++) {
|
||||
ConstantPoolCacheEntry entry = getEntryAt(i);
|
||||
entry.iterateFields(visitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 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
|
||||
@ -34,7 +34,7 @@ public class ConstantPoolCacheEntry {
|
||||
private static long size;
|
||||
private static long baseOffset;
|
||||
private static CIntegerField indices;
|
||||
private static sun.jvm.hotspot.types.OopField f1;
|
||||
private static AddressField f1;
|
||||
private static CIntegerField f2;
|
||||
private static CIntegerField flags;
|
||||
|
||||
@ -54,11 +54,11 @@ public class ConstantPoolCacheEntry {
|
||||
size = type.getSize();
|
||||
|
||||
indices = type.getCIntegerField("_indices");
|
||||
f1 = type.getOopField ("_f1");
|
||||
f1 = type.getAddressField ("_f1");
|
||||
f2 = type.getCIntegerField("_f2");
|
||||
flags = type.getCIntegerField("_flags");
|
||||
|
||||
type = db.lookupType("constantPoolCacheOopDesc");
|
||||
type = db.lookupType("ConstantPoolCache");
|
||||
baseOffset = type.getSize();
|
||||
}
|
||||
|
||||
@ -69,43 +69,32 @@ public class ConstantPoolCacheEntry {
|
||||
|
||||
public int getConstantPoolIndex() {
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(!isSecondaryEntry(), "must not be a secondary CP entry");
|
||||
Assert.that((getIndices() & 0xFFFF) != 0, "must be main entry");
|
||||
}
|
||||
return (int) (getIndices() & 0xFFFF);
|
||||
}
|
||||
|
||||
public boolean isSecondaryEntry() {
|
||||
return (getIndices() & 0xFFFF) == 0;
|
||||
}
|
||||
|
||||
public int getMainEntryIndex() {
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(isSecondaryEntry(), "must be a secondary CP entry");
|
||||
}
|
||||
return (int) (getIndices() >>> 16);
|
||||
}
|
||||
|
||||
private long getIndices() {
|
||||
return cp.getHandle().getCIntegerAt(indices.getOffset() + offset, indices.getSize(), indices.isUnsigned());
|
||||
return cp.getAddress().getCIntegerAt(indices.getOffset() + offset, indices.getSize(), indices.isUnsigned());
|
||||
}
|
||||
|
||||
public Oop getF1() {
|
||||
return cp.getHeap().newOop(cp.getHandle().getOopHandleAt(f1.getOffset() + offset));
|
||||
public Metadata getF1() {
|
||||
return Metadata.instantiateWrapperFor(cp.getAddress().getAddressAt(f1.getOffset() + offset));
|
||||
}
|
||||
|
||||
public int getF2() {
|
||||
return cp.getHandle().getJIntAt(f1.getOffset() + offset);
|
||||
return cp.getAddress().getJIntAt(f1.getOffset() + offset);
|
||||
}
|
||||
|
||||
public int getFlags() {
|
||||
return cp.getHandle().getJIntAt(flags.getOffset() + offset);
|
||||
return cp.getAddress().getJIntAt(flags.getOffset() + offset);
|
||||
}
|
||||
|
||||
static NamedFieldIdentifier f1FieldName = new NamedFieldIdentifier("_f1");
|
||||
static NamedFieldIdentifier f2FieldName = new NamedFieldIdentifier("_f2");
|
||||
static NamedFieldIdentifier flagsFieldName = new NamedFieldIdentifier("_flags");
|
||||
|
||||
public void iterateFields(OopVisitor visitor) {
|
||||
public void iterateFields(MetadataVisitor visitor) {
|
||||
visitor.doOop(new OopField(f1FieldName, f1.getOffset() + offset, true), true);
|
||||
visitor.doInt(new IntField(f2FieldName, f2.getOffset() + offset, true), true);
|
||||
visitor.doInt(new IntField(flagsFieldName, flags.getOffset() + offset, true), true);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -64,7 +64,7 @@ public class DataLayout {
|
||||
private boolean handlized;
|
||||
|
||||
public DataLayout(MethodData d, int o) {
|
||||
data = d.getHandle();
|
||||
data = d.getAddress();
|
||||
offset = o;
|
||||
}
|
||||
|
||||
@ -89,15 +89,6 @@ public class DataLayout {
|
||||
return (int)data.getCIntegerAt(offset + cellOffset(index), MethodData.cellSize, false);
|
||||
}
|
||||
|
||||
Oop oopAt(int index) {
|
||||
OopHandle handle;
|
||||
if (handlized) {
|
||||
throw new InternalError("unsupported");
|
||||
}
|
||||
handle = data.getOopHandleAt(offset + cellOffset(index));
|
||||
return VM.getVM().getObjectHeap().newOop(handle);
|
||||
}
|
||||
|
||||
public Address addressAt(int index) {
|
||||
OopHandle handle;
|
||||
if (handlized) {
|
||||
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 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 sun.jvm.hotspot.debugger.Address;
|
||||
|
||||
/** A DefaultMetadataVisitor implements basic no-op MetadataVisitor
|
||||
functionality except that the setObj() and getObj() methods are
|
||||
implemented properly. */
|
||||
abstract public class DefaultMetadataVisitor implements MetadataVisitor {
|
||||
private Metadata obj;
|
||||
|
||||
public void prologue() {}
|
||||
|
||||
// Called after visiting an object
|
||||
public void epilogue() {}
|
||||
|
||||
public void setObj(Metadata obj) {
|
||||
this.obj = obj;
|
||||
}
|
||||
|
||||
public Metadata getObj() {
|
||||
return obj;
|
||||
}
|
||||
|
||||
// Callback methods for each field type in an object
|
||||
abstract public void doMetadata(MetadataField field, boolean isVMField);
|
||||
public void doOop(OopField field, boolean isVMField) {}
|
||||
public void doOop(NarrowOopField field, boolean isVMField) {}
|
||||
public void doByte(ByteField field, boolean isVMField) {}
|
||||
public void doChar(CharField field, boolean isVMField) {}
|
||||
public void doBoolean(BooleanField field, boolean isVMField) {}
|
||||
public void doShort(ShortField field, boolean isVMField) {}
|
||||
public void doInt(IntField field, boolean isVMField) {}
|
||||
public void doLong(LongField field, boolean isVMField) {}
|
||||
public void doFloat(FloatField field, boolean isVMField) {}
|
||||
public void doDouble(DoubleField field, boolean isVMField) {}
|
||||
public void doCInt(CIntField field, boolean isVMField) {}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -45,6 +45,7 @@ public class DefaultOopVisitor implements OopVisitor {
|
||||
}
|
||||
|
||||
// Callback methods for each field type in an object
|
||||
public void doMetadata(MetadataField field, boolean isVMField) {}
|
||||
public void doOop(OopField field, boolean isVMField) {}
|
||||
public void doOop(NarrowOopField field, boolean isVMField) {}
|
||||
public void doByte(ByteField field, boolean isVMField) {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -25,6 +25,7 @@
|
||||
package sun.jvm.hotspot.oops;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.VMObject;
|
||||
|
||||
// The class for a double field simply provides access to the value.
|
||||
public class DoubleField extends Field {
|
||||
@ -41,6 +42,7 @@ public class DoubleField extends Field {
|
||||
}
|
||||
|
||||
public double getValue(Oop obj) { return obj.getHandle().getJDoubleAt(getOffset()); }
|
||||
public double getValue(VMObject obj) { return obj.getAddress().getJDoubleAt(getOffset()); }
|
||||
public void setValue(Oop obj, double value) throws MutationException {
|
||||
// Fix this: setJDoubleAt is missing in Address
|
||||
}
|
||||
|
@ -54,10 +54,10 @@ public class ExceptionTableElement {
|
||||
private static long offsetOfHandlerPC;
|
||||
private static long offsetOfCatchTypeIndex;
|
||||
|
||||
private OopHandle handle;
|
||||
private Address handle;
|
||||
private long offset;
|
||||
|
||||
public ExceptionTableElement(OopHandle handle, long offset) {
|
||||
public ExceptionTableElement(Address handle, long offset) {
|
||||
this.handle = handle;
|
||||
this.offset = offset;
|
||||
}
|
||||
@ -78,4 +78,3 @@ public class ExceptionTableElement {
|
||||
return (int) handle.getCIntegerAt(offset + offsetOfCatchTypeIndex, 2, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -27,6 +27,7 @@ package sun.jvm.hotspot.oops;
|
||||
import java.io.*;
|
||||
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.utilities.*;
|
||||
|
||||
// Super class for all fields in an object
|
||||
public class Field {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -24,35 +24,21 @@
|
||||
|
||||
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.*;
|
||||
// An OopVisitor can be used to inspect all fields within an object.
|
||||
// Fields include vm fields, java fields, indexable fields.
|
||||
|
||||
public class TypeArrayKlassKlass extends ArrayKlassKlass {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
initialize(VM.getVM().getTypeDataBase());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("typeArrayKlassKlass");
|
||||
headerSize = type.getSize() + Oop.getHeaderSize();
|
||||
}
|
||||
|
||||
public TypeArrayKlassKlass(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
}
|
||||
|
||||
private static long headerSize;
|
||||
|
||||
public long getObjectSize() { return alignObjectSize(headerSize); }
|
||||
|
||||
public void printValueOn(PrintStream tty) {
|
||||
tty.print("TypeArrayKlassKlass");
|
||||
}
|
||||
public interface FieldVisitor {
|
||||
// Callback methods for each field type in an object
|
||||
public void doMetadata(MetadataField field, boolean isVMField);
|
||||
public void doOop(OopField field, boolean isVMField);
|
||||
public void doOop(NarrowOopField field, boolean isVMField);
|
||||
public void doByte(ByteField field, boolean isVMField);
|
||||
public void doChar(CharField field, boolean isVMField);
|
||||
public void doBoolean(BooleanField field, boolean isVMField);
|
||||
public void doShort(ShortField field, boolean isVMField);
|
||||
public void doInt(IntField field, boolean isVMField);
|
||||
public void doLong(LongField field, boolean isVMField);
|
||||
public void doFloat(FloatField field, boolean isVMField);
|
||||
public void doDouble(DoubleField field, boolean isVMField);
|
||||
public void doCInt(CIntField field, boolean isVMField);
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -25,6 +25,7 @@
|
||||
package sun.jvm.hotspot.oops;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.VMObject;
|
||||
|
||||
// The class for a float field simply provides access to the value.
|
||||
public class FloatField extends Field {
|
||||
@ -41,6 +42,7 @@ public class FloatField extends Field {
|
||||
}
|
||||
|
||||
public float getValue(Oop obj) { return obj.getHandle().getJFloatAt(getOffset()); }
|
||||
public float getValue(VMObject obj) { return obj.getAddress().getJFloatAt(getOffset()); }
|
||||
public void setValue(Oop obj, float value) throws MutationException {
|
||||
// Fix this: setJFloatAt is missing in Address
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ public class GenerateOopMap {
|
||||
tty.print(" idx " + idx);
|
||||
/*
|
||||
int idx = currentBC.getIndexU2();
|
||||
constantPoolOop cp = method().constants();
|
||||
ConstantPool* cp = method().constants();
|
||||
int nameAndTypeIdx = cp.name_and_type_ref_index_at(idx);
|
||||
int signatureIdx = cp.signature_ref_index_at(nameAndTypeIdx);
|
||||
Symbol* signature = cp.symbol_at(signatureIdx);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -53,7 +53,7 @@ public class Instance extends Oop {
|
||||
|
||||
// Returns header size in bytes.
|
||||
public static long getHeaderSize() {
|
||||
if (VM.getVM().isCompressedOopsEnabled()) {
|
||||
if (VM.getVM().isCompressedHeadersEnabled()) {
|
||||
return typeSize - VM.getVM().getIntSize();
|
||||
} else {
|
||||
return typeSize;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 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
|
||||
@ -27,10 +27,14 @@ package sun.jvm.hotspot.oops;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.memory.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
import sun.jvm.hotspot.utilities.*;
|
||||
|
||||
public class ArrayKlassKlass extends KlassKlass {
|
||||
// An InstanceKlass is the VM level representation of a Java class.
|
||||
|
||||
public class InstanceClassLoaderKlass extends InstanceKlass {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
@ -40,19 +44,11 @@ public class ArrayKlassKlass extends KlassKlass {
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("arrayKlassKlass");
|
||||
headerSize = type.getSize() + Oop.getHeaderSize();
|
||||
// Just make sure it's there for now
|
||||
Type type = db.lookupType("InstanceClassLoaderKlass");
|
||||
}
|
||||
|
||||
ArrayKlassKlass(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
}
|
||||
|
||||
private static long headerSize;
|
||||
|
||||
public long getObjectSize() { return alignObjectSize(headerSize); }
|
||||
|
||||
public void printValueOn(PrintStream tty) {
|
||||
tty.print("ArrayKlassKlass");
|
||||
public InstanceClassLoaderKlass(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
}
|
@ -26,6 +26,7 @@ package sun.jvm.hotspot.oops;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import sun.jvm.hotspot.classfile.ClassLoaderData;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.memory.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
@ -53,7 +54,6 @@ public class InstanceKlass extends Klass {
|
||||
private static int FIELD_SLOTS;
|
||||
|
||||
// ClassState constants
|
||||
private static int CLASS_STATE_UNPARSABLE_BY_GC;
|
||||
private static int CLASS_STATE_ALLOCATED;
|
||||
private static int CLASS_STATE_LOADED;
|
||||
private static int CLASS_STATE_LINKED;
|
||||
@ -62,34 +62,34 @@ public class InstanceKlass extends Klass {
|
||||
private static int CLASS_STATE_INITIALIZATION_ERROR;
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("instanceKlass");
|
||||
arrayKlasses = new OopField(type.getOopField("_array_klasses"), Oop.getHeaderSize());
|
||||
methods = new OopField(type.getOopField("_methods"), Oop.getHeaderSize());
|
||||
methodOrdering = new OopField(type.getOopField("_method_ordering"), Oop.getHeaderSize());
|
||||
localInterfaces = new OopField(type.getOopField("_local_interfaces"), Oop.getHeaderSize());
|
||||
transitiveInterfaces = new OopField(type.getOopField("_transitive_interfaces"), Oop.getHeaderSize());
|
||||
fields = new OopField(type.getOopField("_fields"), Oop.getHeaderSize());
|
||||
javaFieldsCount = new CIntField(type.getCIntegerField("_java_fields_count"), Oop.getHeaderSize());
|
||||
constants = new OopField(type.getOopField("_constants"), Oop.getHeaderSize());
|
||||
classLoader = new OopField(type.getOopField("_class_loader"), Oop.getHeaderSize());
|
||||
protectionDomain = new OopField(type.getOopField("_protection_domain"), Oop.getHeaderSize());
|
||||
signers = new OopField(type.getOopField("_signers"), Oop.getHeaderSize());
|
||||
Type type = db.lookupType("InstanceKlass");
|
||||
arrayKlasses = new MetadataField(type.getAddressField("_array_klasses"), 0);
|
||||
methods = type.getAddressField("_methods");
|
||||
methodOrdering = type.getAddressField("_method_ordering");
|
||||
localInterfaces = type.getAddressField("_local_interfaces");
|
||||
transitiveInterfaces = type.getAddressField("_transitive_interfaces");
|
||||
fields = type.getAddressField("_fields");
|
||||
javaFieldsCount = new CIntField(type.getCIntegerField("_java_fields_count"), 0);
|
||||
constants = new MetadataField(type.getAddressField("_constants"), 0);
|
||||
classLoaderData = type.getAddressField("_class_loader_data");
|
||||
protectionDomain = new OopField(type.getOopField("_protection_domain"), 0);
|
||||
signers = new OopField(type.getOopField("_signers"), 0);
|
||||
sourceFileName = type.getAddressField("_source_file_name");
|
||||
sourceDebugExtension = type.getAddressField("_source_debug_extension");
|
||||
innerClasses = new OopField(type.getOopField("_inner_classes"), Oop.getHeaderSize());
|
||||
nonstaticFieldSize = new CIntField(type.getCIntegerField("_nonstatic_field_size"), Oop.getHeaderSize());
|
||||
staticFieldSize = new CIntField(type.getCIntegerField("_static_field_size"), Oop.getHeaderSize());
|
||||
staticOopFieldCount = new CIntField(type.getCIntegerField("_static_oop_field_count"), Oop.getHeaderSize());
|
||||
nonstaticOopMapSize = new CIntField(type.getCIntegerField("_nonstatic_oop_map_size"), Oop.getHeaderSize());
|
||||
isMarkedDependent = new CIntField(type.getCIntegerField("_is_marked_dependent"), Oop.getHeaderSize());
|
||||
initState = new CIntField(type.getCIntegerField("_init_state"), Oop.getHeaderSize());
|
||||
vtableLen = new CIntField(type.getCIntegerField("_vtable_len"), Oop.getHeaderSize());
|
||||
itableLen = new CIntField(type.getCIntegerField("_itable_len"), Oop.getHeaderSize());
|
||||
innerClasses = type.getAddressField("_inner_classes");
|
||||
nonstaticFieldSize = new CIntField(type.getCIntegerField("_nonstatic_field_size"), 0);
|
||||
staticFieldSize = new CIntField(type.getCIntegerField("_static_field_size"), 0);
|
||||
staticOopFieldCount = new CIntField(type.getCIntegerField("_static_oop_field_count"), 0);
|
||||
nonstaticOopMapSize = new CIntField(type.getCIntegerField("_nonstatic_oop_map_size"), 0);
|
||||
isMarkedDependent = new CIntField(type.getCIntegerField("_is_marked_dependent"), 0);
|
||||
initState = new CIntField(type.getCIntegerField("_init_state"), 0);
|
||||
vtableLen = new CIntField(type.getCIntegerField("_vtable_len"), 0);
|
||||
itableLen = new CIntField(type.getCIntegerField("_itable_len"), 0);
|
||||
breakpoints = type.getAddressField("_breakpoints");
|
||||
genericSignature = type.getAddressField("_generic_signature");
|
||||
majorVersion = new CIntField(type.getCIntegerField("_major_version"), Oop.getHeaderSize());
|
||||
minorVersion = new CIntField(type.getCIntegerField("_minor_version"), Oop.getHeaderSize());
|
||||
headerSize = alignObjectOffset(Oop.getHeaderSize() + type.getSize());
|
||||
majorVersion = new CIntField(type.getCIntegerField("_major_version"), 0);
|
||||
minorVersion = new CIntField(type.getCIntegerField("_minor_version"), 0);
|
||||
headerSize = Oop.alignObjectOffset(type.getSize());
|
||||
|
||||
// read field offset constants
|
||||
ACCESS_FLAGS_OFFSET = db.lookupIntConstant("FieldInfo::access_flags_offset").intValue();
|
||||
@ -100,18 +100,17 @@ public class InstanceKlass extends Klass {
|
||||
HIGH_OFFSET = db.lookupIntConstant("FieldInfo::high_offset").intValue();
|
||||
FIELD_SLOTS = db.lookupIntConstant("FieldInfo::field_slots").intValue();
|
||||
// read ClassState constants
|
||||
CLASS_STATE_UNPARSABLE_BY_GC = db.lookupIntConstant("instanceKlass::unparsable_by_gc").intValue();
|
||||
CLASS_STATE_ALLOCATED = db.lookupIntConstant("instanceKlass::allocated").intValue();
|
||||
CLASS_STATE_LOADED = db.lookupIntConstant("instanceKlass::loaded").intValue();
|
||||
CLASS_STATE_LINKED = db.lookupIntConstant("instanceKlass::linked").intValue();
|
||||
CLASS_STATE_BEING_INITIALIZED = db.lookupIntConstant("instanceKlass::being_initialized").intValue();
|
||||
CLASS_STATE_FULLY_INITIALIZED = db.lookupIntConstant("instanceKlass::fully_initialized").intValue();
|
||||
CLASS_STATE_INITIALIZATION_ERROR = db.lookupIntConstant("instanceKlass::initialization_error").intValue();
|
||||
CLASS_STATE_ALLOCATED = db.lookupIntConstant("InstanceKlass::allocated").intValue();
|
||||
CLASS_STATE_LOADED = db.lookupIntConstant("InstanceKlass::loaded").intValue();
|
||||
CLASS_STATE_LINKED = db.lookupIntConstant("InstanceKlass::linked").intValue();
|
||||
CLASS_STATE_BEING_INITIALIZED = db.lookupIntConstant("InstanceKlass::being_initialized").intValue();
|
||||
CLASS_STATE_FULLY_INITIALIZED = db.lookupIntConstant("InstanceKlass::fully_initialized").intValue();
|
||||
CLASS_STATE_INITIALIZATION_ERROR = db.lookupIntConstant("InstanceKlass::initialization_error").intValue();
|
||||
|
||||
}
|
||||
|
||||
InstanceKlass(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
public InstanceKlass(Address addr) {
|
||||
super(addr);
|
||||
if (getJavaFieldsCount() != getAllFieldsCount()) {
|
||||
// Exercise the injected field logic
|
||||
for (int i = getJavaFieldsCount(); i < getAllFieldsCount(); i++) {
|
||||
@ -121,20 +120,20 @@ public class InstanceKlass extends Klass {
|
||||
}
|
||||
}
|
||||
|
||||
private static OopField arrayKlasses;
|
||||
private static OopField methods;
|
||||
private static OopField methodOrdering;
|
||||
private static OopField localInterfaces;
|
||||
private static OopField transitiveInterfaces;
|
||||
private static OopField fields;
|
||||
private static MetadataField arrayKlasses;
|
||||
private static AddressField methods;
|
||||
private static AddressField methodOrdering;
|
||||
private static AddressField localInterfaces;
|
||||
private static AddressField transitiveInterfaces;
|
||||
private static AddressField fields;
|
||||
private static CIntField javaFieldsCount;
|
||||
private static OopField constants;
|
||||
private static OopField classLoader;
|
||||
private static MetadataField constants;
|
||||
private static AddressField classLoaderData;
|
||||
private static OopField protectionDomain;
|
||||
private static OopField signers;
|
||||
private static AddressField sourceFileName;
|
||||
private static AddressField sourceDebugExtension;
|
||||
private static OopField innerClasses;
|
||||
private static AddressField innerClasses;
|
||||
private static CIntField nonstaticFieldSize;
|
||||
private static CIntField staticFieldSize;
|
||||
private static CIntField staticOopFieldCount;
|
||||
@ -150,7 +149,6 @@ public class InstanceKlass extends Klass {
|
||||
|
||||
// type safe enum for ClassState from instanceKlass.hpp
|
||||
public static class ClassState {
|
||||
public static final ClassState UNPARSABLE_BY_GC = new ClassState("unparsable_by_gc");
|
||||
public static final ClassState ALLOCATED = new ClassState("allocated");
|
||||
public static final ClassState LOADED = new ClassState("loaded");
|
||||
public static final ClassState LINKED = new ClassState("linked");
|
||||
@ -172,9 +170,7 @@ public class InstanceKlass extends Klass {
|
||||
public int getInitStateAsInt() { return (int) initState.getValue(this); }
|
||||
public ClassState getInitState() {
|
||||
int state = getInitStateAsInt();
|
||||
if (state == CLASS_STATE_UNPARSABLE_BY_GC) {
|
||||
return ClassState.UNPARSABLE_BY_GC;
|
||||
} else if (state == CLASS_STATE_ALLOCATED) {
|
||||
if (state == CLASS_STATE_ALLOCATED) {
|
||||
return ClassState.ALLOCATED;
|
||||
} else if (state == CLASS_STATE_LOADED) {
|
||||
return ClassState.LOADED;
|
||||
@ -242,19 +238,24 @@ public class InstanceKlass extends Klass {
|
||||
return getSizeHelper() * VM.getVM().getAddressSize();
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return Oop.alignObjectSize(getHeaderSize() + Oop.alignObjectOffset(getVtableLen()) +
|
||||
Oop.alignObjectOffset(getItableLen()) + Oop.alignObjectOffset(getNonstaticOopMapSize()));
|
||||
}
|
||||
|
||||
public static long getHeaderSize() { return headerSize; }
|
||||
|
||||
public short getFieldAccessFlags(int index) {
|
||||
return getFields().getShortAt(index * FIELD_SLOTS + ACCESS_FLAGS_OFFSET);
|
||||
return getFields().at(index * FIELD_SLOTS + ACCESS_FLAGS_OFFSET);
|
||||
}
|
||||
|
||||
public short getFieldNameIndex(int index) {
|
||||
if (index >= getJavaFieldsCount()) throw new IndexOutOfBoundsException("not a Java field;");
|
||||
return getFields().getShortAt(index * FIELD_SLOTS + NAME_INDEX_OFFSET);
|
||||
return getFields().at(index * FIELD_SLOTS + NAME_INDEX_OFFSET);
|
||||
}
|
||||
|
||||
public Symbol getFieldName(int index) {
|
||||
int nameIndex = getFields().getShortAt(index * FIELD_SLOTS + NAME_INDEX_OFFSET);
|
||||
int nameIndex = getFields().at(index * FIELD_SLOTS + NAME_INDEX_OFFSET);
|
||||
if (index < getJavaFieldsCount()) {
|
||||
return getConstants().getSymbolAt(nameIndex);
|
||||
} else {
|
||||
@ -264,11 +265,11 @@ public class InstanceKlass extends Klass {
|
||||
|
||||
public short getFieldSignatureIndex(int index) {
|
||||
if (index >= getJavaFieldsCount()) throw new IndexOutOfBoundsException("not a Java field;");
|
||||
return getFields().getShortAt(index * FIELD_SLOTS + SIGNATURE_INDEX_OFFSET);
|
||||
return getFields().at(index * FIELD_SLOTS + SIGNATURE_INDEX_OFFSET);
|
||||
}
|
||||
|
||||
public Symbol getFieldSignature(int index) {
|
||||
int signatureIndex = getFields().getShortAt(index * FIELD_SLOTS + SIGNATURE_INDEX_OFFSET);
|
||||
int signatureIndex = getFields().at(index * FIELD_SLOTS + SIGNATURE_INDEX_OFFSET);
|
||||
if (index < getJavaFieldsCount()) {
|
||||
return getConstants().getSymbolAt(signatureIndex);
|
||||
} else {
|
||||
@ -277,7 +278,7 @@ public class InstanceKlass extends Klass {
|
||||
}
|
||||
|
||||
public short getFieldGenericSignatureIndex(int index) {
|
||||
int len = (int)getFields().getLength();
|
||||
int len = getFields().length();
|
||||
int allFieldsCount = getAllFieldsCount();
|
||||
int generic_signature_slot = allFieldsCount * FIELD_SLOTS;
|
||||
for (int i = 0; i < allFieldsCount; i++) {
|
||||
@ -285,7 +286,7 @@ public class InstanceKlass extends Klass {
|
||||
AccessFlags access = new AccessFlags(flags);
|
||||
if (i == index) {
|
||||
if (access.fieldHasGenericSignature()) {
|
||||
return getFields().getShortAt(generic_signature_slot);
|
||||
return getFields().at(generic_signature_slot);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@ -308,25 +309,23 @@ public class InstanceKlass extends Klass {
|
||||
|
||||
public short getFieldInitialValueIndex(int index) {
|
||||
if (index >= getJavaFieldsCount()) throw new IndexOutOfBoundsException("not a Java field;");
|
||||
return getFields().getShortAt(index * FIELD_SLOTS + INITVAL_INDEX_OFFSET);
|
||||
return getFields().at(index * FIELD_SLOTS + INITVAL_INDEX_OFFSET);
|
||||
}
|
||||
|
||||
public int getFieldOffset(int index) {
|
||||
TypeArray fields = getFields();
|
||||
return VM.getVM().buildIntFromShorts(fields.getShortAt(index * FIELD_SLOTS + LOW_OFFSET),
|
||||
fields.getShortAt(index * FIELD_SLOTS + HIGH_OFFSET));
|
||||
U2Array fields = getFields();
|
||||
return VM.getVM().buildIntFromShorts(fields.at(index * FIELD_SLOTS + LOW_OFFSET),
|
||||
fields.at(index * FIELD_SLOTS + HIGH_OFFSET));
|
||||
}
|
||||
|
||||
// Accessors for declared fields
|
||||
public Klass getArrayKlasses() { return (Klass) arrayKlasses.getValue(this); }
|
||||
public ObjArray getMethods() { return (ObjArray) methods.getValue(this); }
|
||||
public TypeArray getMethodOrdering() { return (TypeArray) methodOrdering.getValue(this); }
|
||||
public ObjArray getLocalInterfaces() { return (ObjArray) localInterfaces.getValue(this); }
|
||||
public ObjArray getTransitiveInterfaces() { return (ObjArray) transitiveInterfaces.getValue(this); }
|
||||
public TypeArray getFields() { return (TypeArray) fields.getValue(this); }
|
||||
public MethodArray getMethods() { return new MethodArray(methods.getValue(getAddress())); }
|
||||
public KlassArray getLocalInterfaces() { return new KlassArray(localInterfaces.getValue(getAddress())); }
|
||||
public KlassArray getTransitiveInterfaces() { return new KlassArray(transitiveInterfaces.getValue(getAddress())); }
|
||||
public int getJavaFieldsCount() { return (int) javaFieldsCount.getValue(this); }
|
||||
public int getAllFieldsCount() {
|
||||
int len = (int)getFields().getLength();
|
||||
int len = getFields().length();
|
||||
int allFieldsCount = 0;
|
||||
for (; allFieldsCount*FIELD_SLOTS < len; allFieldsCount++) {
|
||||
short flags = getFieldAccessFlags(allFieldsCount);
|
||||
@ -338,12 +337,12 @@ public class InstanceKlass extends Klass {
|
||||
return allFieldsCount;
|
||||
}
|
||||
public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); }
|
||||
public Oop getClassLoader() { return classLoader.getValue(this); }
|
||||
public ClassLoaderData getClassLoaderData() { return ClassLoaderData.instantiateWrapperFor(classLoaderData.getValue(getAddress())); }
|
||||
public Oop getClassLoader() { return getClassLoaderData().getClassLoader(); }
|
||||
public Oop getProtectionDomain() { return protectionDomain.getValue(this); }
|
||||
public ObjArray getSigners() { return (ObjArray) signers.getValue(this); }
|
||||
public Symbol getSourceFileName() { return getSymbol(sourceFileName); }
|
||||
public String getSourceDebugExtension(){ return CStringUtilities.getString(sourceDebugExtension.getValue(getHandle())); }
|
||||
public TypeArray getInnerClasses() { return (TypeArray) innerClasses.getValue(this); }
|
||||
public String getSourceDebugExtension(){ return CStringUtilities.getString(sourceDebugExtension.getValue(getAddress())); }
|
||||
public long getNonstaticFieldSize() { return nonstaticFieldSize.getValue(this); }
|
||||
public long getStaticOopFieldCount() { return staticOopFieldCount.getValue(this); }
|
||||
public long getNonstaticOopMapSize() { return nonstaticOopMapSize.getValue(this); }
|
||||
@ -383,8 +382,8 @@ public class InstanceKlass extends Klass {
|
||||
public long computeModifierFlags() {
|
||||
long access = getAccessFlags();
|
||||
// But check if it happens to be member class.
|
||||
TypeArray innerClassList = getInnerClasses();
|
||||
int length = ( innerClassList == null)? 0 : (int) innerClassList.getLength();
|
||||
U2Array innerClassList = getInnerClasses();
|
||||
int length = (innerClassList == null)? 0 : (int) innerClassList.length();
|
||||
if (length > 0) {
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(length % InnerClassAttributeOffset.innerClassNextOffset == 0 ||
|
||||
@ -395,7 +394,7 @@ public class InstanceKlass extends Klass {
|
||||
if (i == length - EnclosingMethodAttributeOffset.enclosing_method_attribute_size) {
|
||||
break;
|
||||
}
|
||||
int ioff = innerClassList.getShortAt(i +
|
||||
int ioff = innerClassList.at(i +
|
||||
InnerClassAttributeOffset.innerClassInnerClassInfoOffset);
|
||||
// 'ioff' can be zero.
|
||||
// refer to JVM spec. section 4.7.5.
|
||||
@ -404,9 +403,9 @@ public class InstanceKlass extends Klass {
|
||||
// since we are looking for the flags for our self.
|
||||
ConstantPool.CPSlot classInfo = getConstants().getSlotAt(ioff);
|
||||
Symbol name = null;
|
||||
if (classInfo.isOop()) {
|
||||
name = ((Klass) classInfo.getOop()).getName();
|
||||
} else if (classInfo.isMetaData()) {
|
||||
if (classInfo.isResolved()) {
|
||||
name = classInfo.getKlass().getName();
|
||||
} else if (classInfo.isUnresolved()) {
|
||||
name = classInfo.getSymbol();
|
||||
} else {
|
||||
throw new RuntimeException("should not reach here");
|
||||
@ -414,7 +413,7 @@ public class InstanceKlass extends Klass {
|
||||
|
||||
if (name.equals(getName())) {
|
||||
// This is really a member class
|
||||
access = innerClassList.getShortAt(i +
|
||||
access = innerClassList.at(i +
|
||||
InnerClassAttributeOffset.innerClassAccessFlagsOffset);
|
||||
break;
|
||||
}
|
||||
@ -440,8 +439,8 @@ public class InstanceKlass extends Klass {
|
||||
}
|
||||
|
||||
private boolean isInInnerClasses(Symbol sym, boolean includeLocals) {
|
||||
TypeArray innerClassList = getInnerClasses();
|
||||
int length = ( innerClassList == null)? 0 : (int) innerClassList.getLength();
|
||||
U2Array innerClassList = getInnerClasses();
|
||||
int length = ( innerClassList == null)? 0 : (int) innerClassList.length();
|
||||
if (length > 0) {
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(length % InnerClassAttributeOffset.innerClassNextOffset == 0 ||
|
||||
@ -452,27 +451,19 @@ public class InstanceKlass extends Klass {
|
||||
if (i == length - EnclosingMethodAttributeOffset.enclosing_method_attribute_size) {
|
||||
break;
|
||||
}
|
||||
int ioff = innerClassList.getShortAt(i +
|
||||
int ioff = innerClassList.at(i +
|
||||
InnerClassAttributeOffset.innerClassInnerClassInfoOffset);
|
||||
// 'ioff' can be zero.
|
||||
// refer to JVM spec. section 4.7.5.
|
||||
if (ioff != 0) {
|
||||
ConstantPool.CPSlot iclassInfo = getConstants().getSlotAt(ioff);
|
||||
Symbol innerName = null;
|
||||
if (iclassInfo.isOop()) {
|
||||
innerName = ((Klass) iclassInfo.getOop()).getName();
|
||||
} else if (iclassInfo.isMetaData()) {
|
||||
innerName = iclassInfo.getSymbol();
|
||||
} else {
|
||||
throw new RuntimeException("should not reach here");
|
||||
}
|
||||
|
||||
Symbol innerName = getConstants().getKlassNameAt(ioff);
|
||||
Symbol myname = getName();
|
||||
int ooff = innerClassList.getShortAt(i +
|
||||
int ooff = innerClassList.at(i +
|
||||
InnerClassAttributeOffset.innerClassOuterClassInfoOffset);
|
||||
// for anonymous classes inner_name_index of InnerClasses
|
||||
// attribute is zero.
|
||||
int innerNameIndex = innerClassList.getShortAt(i +
|
||||
int innerNameIndex = innerClassList.at(i +
|
||||
InnerClassAttributeOffset.innerClassInnerNameOffset);
|
||||
// if this is not a member (anonymous, local etc.), 'ooff' will be zero
|
||||
// refer to JVM spec. section 4.7.5.
|
||||
@ -488,9 +479,9 @@ public class InstanceKlass extends Klass {
|
||||
} else {
|
||||
ConstantPool.CPSlot oclassInfo = getConstants().getSlotAt(ooff);
|
||||
Symbol outerName = null;
|
||||
if (oclassInfo.isOop()) {
|
||||
outerName = ((Klass) oclassInfo.getOop()).getName();
|
||||
} else if (oclassInfo.isMetaData()) {
|
||||
if (oclassInfo.isResolved()) {
|
||||
outerName = oclassInfo.getKlass().getName();
|
||||
} else if (oclassInfo.isUnresolved()) {
|
||||
outerName = oclassInfo.getSymbol();
|
||||
} else {
|
||||
throw new RuntimeException("should not reach here");
|
||||
@ -513,10 +504,10 @@ public class InstanceKlass extends Klass {
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(k.isInterface(), "should not reach here");
|
||||
}
|
||||
ObjArray interfaces = getTransitiveInterfaces();
|
||||
final int len = (int) interfaces.getLength();
|
||||
KlassArray interfaces = getTransitiveInterfaces();
|
||||
final int len = interfaces.length();
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (interfaces.getObjAt(i).equals(k)) return true;
|
||||
if (interfaces.getAt(i).equals(k)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -533,20 +524,14 @@ public class InstanceKlass extends Klass {
|
||||
tty.print("InstanceKlass for " + getName().asString());
|
||||
}
|
||||
|
||||
public void iterateFields(OopVisitor visitor, boolean doVMFields) {
|
||||
super.iterateFields(visitor, doVMFields);
|
||||
if (doVMFields) {
|
||||
visitor.doOop(arrayKlasses, true);
|
||||
visitor.doOop(methods, true);
|
||||
visitor.doOop(methodOrdering, true);
|
||||
visitor.doOop(localInterfaces, true);
|
||||
visitor.doOop(transitiveInterfaces, true);
|
||||
visitor.doOop(fields, true);
|
||||
visitor.doOop(constants, true);
|
||||
visitor.doOop(classLoader, true);
|
||||
public void iterateFields(MetadataVisitor visitor) {
|
||||
super.iterateFields(visitor);
|
||||
visitor.doMetadata(arrayKlasses, true);
|
||||
// visitor.doOop(methods, true);
|
||||
// visitor.doOop(localInterfaces, true);
|
||||
// visitor.doOop(transitiveInterfaces, true);
|
||||
visitor.doOop(protectionDomain, true);
|
||||
visitor.doOop(signers, true);
|
||||
visitor.doOop(innerClasses, true);
|
||||
visitor.doCInt(nonstaticFieldSize, true);
|
||||
visitor.doCInt(staticFieldSize, true);
|
||||
visitor.doCInt(staticOopFieldCount, true);
|
||||
@ -556,7 +541,6 @@ public class InstanceKlass extends Klass {
|
||||
visitor.doCInt(vtableLen, true);
|
||||
visitor.doCInt(itableLen, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Visit the static fields of this InstanceKlass with the obj of
|
||||
@ -628,10 +612,10 @@ public class InstanceKlass extends Klass {
|
||||
|
||||
/** Find field in direct superinterfaces. */
|
||||
public Field findInterfaceField(Symbol name, Symbol sig) {
|
||||
ObjArray interfaces = getLocalInterfaces();
|
||||
int n = (int) interfaces.getLength();
|
||||
KlassArray interfaces = getLocalInterfaces();
|
||||
int n = interfaces.length();
|
||||
for (int i = 0; i < n; i++) {
|
||||
InstanceKlass intf1 = (InstanceKlass) interfaces.getObjAt(i);
|
||||
InstanceKlass intf1 = (InstanceKlass) interfaces.getAt(i);
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(intf1.isInterface(), "just checking type");
|
||||
}
|
||||
@ -727,10 +711,10 @@ public class InstanceKlass extends Klass {
|
||||
// transitiveInterfaces contains all interfaces implemented
|
||||
// by this class and its superclass chain with no duplicates.
|
||||
|
||||
ObjArray interfaces = getTransitiveInterfaces();
|
||||
int n = (int) interfaces.getLength();
|
||||
KlassArray interfaces = getTransitiveInterfaces();
|
||||
int n = interfaces.length();
|
||||
for (int i = 0; i < n; i++) {
|
||||
InstanceKlass intf1 = (InstanceKlass) interfaces.getObjAt(i);
|
||||
InstanceKlass intf1 = (InstanceKlass) interfaces.getAt(i);
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(intf1.isInterface(), "just checking type");
|
||||
}
|
||||
@ -759,20 +743,20 @@ public class InstanceKlass extends Klass {
|
||||
// Contains a Method for each method declared in this class/interface
|
||||
// not including inherited methods.
|
||||
|
||||
ObjArray methods = getMethods();
|
||||
int length = (int)methods.getLength();
|
||||
MethodArray methods = getMethods();
|
||||
int length = methods.length();
|
||||
Object[] tmp = new Object[length];
|
||||
|
||||
TypeArray methodOrdering = getMethodOrdering();
|
||||
if (methodOrdering.getLength() != length) {
|
||||
IntArray methodOrdering = getMethodOrdering();
|
||||
if (methodOrdering.length() != length) {
|
||||
// no ordering info present
|
||||
for (int index = 0; index < length; index++) {
|
||||
tmp[index] = methods.getObjAt(index);
|
||||
tmp[index] = methods.at(index);
|
||||
}
|
||||
} else {
|
||||
for (int index = 0; index < length; index++) {
|
||||
int originalIndex = getMethodOrdering().getIntAt(index);
|
||||
tmp[originalIndex] = methods.getObjAt(index);
|
||||
int originalIndex = methodOrdering.at(index);
|
||||
tmp[originalIndex] = methods.at(index);
|
||||
}
|
||||
}
|
||||
|
||||
@ -786,25 +770,17 @@ public class InstanceKlass extends Klass {
|
||||
// Contains an InstanceKlass for each interface in this classes
|
||||
// 'implements' clause.
|
||||
|
||||
ObjArray interfaces = getLocalInterfaces();
|
||||
int length = (int) interfaces.getLength();
|
||||
KlassArray interfaces = getLocalInterfaces();
|
||||
int length = interfaces.length();
|
||||
List directImplementedInterfaces = new ArrayList(length);
|
||||
|
||||
for (int index = 0; index < length; index ++) {
|
||||
directImplementedInterfaces.add(interfaces.getObjAt(index));
|
||||
directImplementedInterfaces.add(interfaces.getAt(index));
|
||||
}
|
||||
|
||||
return directImplementedInterfaces;
|
||||
}
|
||||
|
||||
|
||||
public long getObjectSize() {
|
||||
long bodySize = alignObjectOffset(getVtableLen() * getHeap().getOopSize())
|
||||
+ alignObjectOffset(getItableLen() * getHeap().getOopSize())
|
||||
+ (getNonstaticOopMapSize()) * getHeap().getOopSize();
|
||||
return alignObjectSize(headerSize + bodySize);
|
||||
}
|
||||
|
||||
public Klass arrayKlassImpl(boolean orNull, int n) {
|
||||
// FIXME: in reflective system this would need to change to
|
||||
// actually allocate
|
||||
@ -841,12 +817,28 @@ public class InstanceKlass extends Klass {
|
||||
return findMethod(getMethods(), name, sig);
|
||||
}
|
||||
|
||||
/** Breakpoint support (see methods on methodOop for details) */
|
||||
/** Breakpoint support (see methods on Method* for details) */
|
||||
public BreakpointInfo getBreakpoints() {
|
||||
Address addr = getHandle().getAddressAt(Oop.getHeaderSize() + breakpoints.getOffset());
|
||||
Address addr = getAddress().getAddressAt(breakpoints.getOffset());
|
||||
return (BreakpointInfo) VMObjectFactory.newObject(BreakpointInfo.class, addr);
|
||||
}
|
||||
|
||||
public IntArray getMethodOrdering() {
|
||||
Address addr = getAddress().getAddressAt(methodOrdering.getOffset());
|
||||
return (IntArray) VMObjectFactory.newObject(IntArray.class, addr);
|
||||
}
|
||||
|
||||
public U2Array getFields() {
|
||||
Address addr = getAddress().getAddressAt(fields.getOffset());
|
||||
return (U2Array) VMObjectFactory.newObject(U2Array.class, addr);
|
||||
}
|
||||
|
||||
public U2Array getInnerClasses() {
|
||||
Address addr = getAddress().getAddressAt(innerClasses.getOffset());
|
||||
return (U2Array) VMObjectFactory.newObject(U2Array.class, addr);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Internals only below this point
|
||||
//
|
||||
@ -928,14 +920,14 @@ public class InstanceKlass extends Klass {
|
||||
throw new RuntimeException("Illegal field type at index " + index);
|
||||
}
|
||||
|
||||
private static Method findMethod(ObjArray methods, Symbol name, Symbol signature) {
|
||||
int len = (int) methods.getLength();
|
||||
private static Method findMethod(MethodArray methods, Symbol name, Symbol signature) {
|
||||
int len = methods.length();
|
||||
// methods are sorted, so do binary search
|
||||
int l = 0;
|
||||
int h = len - 1;
|
||||
while (l <= h) {
|
||||
int mid = (l + h) >> 1;
|
||||
Method m = (Method) methods.getObjAt(mid);
|
||||
Method m = methods.at(mid);
|
||||
int res = m.getName().fastCompare(name);
|
||||
if (res == 0) {
|
||||
// found matching name; do linear search to find matching signature
|
||||
@ -944,13 +936,13 @@ public class InstanceKlass extends Klass {
|
||||
// search downwards through overloaded methods
|
||||
int i;
|
||||
for (i = mid - 1; i >= l; i--) {
|
||||
Method m1 = (Method) methods.getObjAt(i);
|
||||
Method m1 = methods.at(i);
|
||||
if (!m1.getName().equals(name)) break;
|
||||
if (m1.getSignature().equals(signature)) return m1;
|
||||
}
|
||||
// search upwards
|
||||
for (i = mid + 1; i <= h; i++) {
|
||||
Method m1 = (Method) methods.getObjAt(i);
|
||||
Method m1 = methods.at(i);
|
||||
if (!m1.getName().equals(name)) break;
|
||||
if (m1.getSignature().equals(signature)) return m1;
|
||||
}
|
||||
@ -977,10 +969,10 @@ public class InstanceKlass extends Klass {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static int linearSearch(ObjArray methods, Symbol name, Symbol signature) {
|
||||
int len = (int) methods.getLength();
|
||||
private static int linearSearch(MethodArray methods, Symbol name, Symbol signature) {
|
||||
int len = (int) methods.length();
|
||||
for (int index = 0; index < len; index++) {
|
||||
Method m = (Method) methods.getObjAt(index);
|
||||
Method m = methods.at(index);
|
||||
if (m.getSignature().equals(signature) && m.getName().equals(name)) {
|
||||
return index;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -45,11 +45,11 @@ public class InstanceMirrorKlass extends InstanceKlass {
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
// Just make sure it's there for now
|
||||
Type type = db.lookupType("instanceMirrorKlass");
|
||||
Type type = db.lookupType("InstanceMirrorKlass");
|
||||
}
|
||||
|
||||
InstanceMirrorKlass(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
public InstanceMirrorKlass(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public long getObjectSize(Oop o) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 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
|
||||
@ -27,10 +27,14 @@ package sun.jvm.hotspot.oops;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.memory.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
import sun.jvm.hotspot.utilities.*;
|
||||
|
||||
public class CompiledICHolderKlass extends Klass {
|
||||
// An InstanceKlass is the VM level representation of a Java class.
|
||||
|
||||
public class InstanceRefKlass extends InstanceKlass {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
@ -40,19 +44,11 @@ public class CompiledICHolderKlass extends Klass {
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("compiledICHolderKlass");
|
||||
headerSize = type.getSize() + Oop.getHeaderSize();
|
||||
// Just make sure it's there for now
|
||||
Type type = db.lookupType("InstanceRefKlass");
|
||||
}
|
||||
|
||||
CompiledICHolderKlass(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
}
|
||||
|
||||
private static long headerSize;
|
||||
|
||||
public long getObjectSize() { return alignObjectSize(headerSize); }
|
||||
|
||||
public void printValueOn(PrintStream tty) {
|
||||
tty.print("CompilerICHolderKlass");
|
||||
public InstanceRefKlass(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -25,6 +25,7 @@
|
||||
package sun.jvm.hotspot.oops;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.VMObject;
|
||||
|
||||
// The class for an int field simply provides access to the value.
|
||||
public class IntField extends Field {
|
||||
@ -46,6 +47,9 @@ public class IntField extends Field {
|
||||
}
|
||||
return obj.getHandle().getJIntAt(getOffset());
|
||||
}
|
||||
public int getValue(VMObject obj) {
|
||||
return obj.getAddress().getJIntAt(getOffset());
|
||||
}
|
||||
public void setValue(Oop obj, int value) throws MutationException {
|
||||
// Fix this: setJIntAt is missing in Address
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -30,7 +30,7 @@ import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
public class Klass extends Oop implements ClassConstants {
|
||||
public class Klass extends Metadata implements ClassConstants {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
@ -50,14 +50,14 @@ public class Klass extends Oop implements ClassConstants {
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("Klass");
|
||||
javaMirror = new OopField(type.getOopField("_java_mirror"), Oop.getHeaderSize());
|
||||
superField = new OopField(type.getOopField("_super"), Oop.getHeaderSize());
|
||||
layoutHelper = new IntField(type.getJIntField("_layout_helper"), Oop.getHeaderSize());
|
||||
javaMirror = new OopField(type.getOopField("_java_mirror"), 0);
|
||||
superField = new MetadataField(type.getAddressField("_super"), 0);
|
||||
layoutHelper = new IntField(type.getJIntField("_layout_helper"), 0);
|
||||
name = type.getAddressField("_name");
|
||||
accessFlags = new CIntField(type.getCIntegerField("_access_flags"), Oop.getHeaderSize());
|
||||
subklass = new OopField(type.getOopField("_subklass"), Oop.getHeaderSize());
|
||||
nextSibling = new OopField(type.getOopField("_next_sibling"), Oop.getHeaderSize());
|
||||
allocCount = new CIntField(type.getCIntegerField("_alloc_count"), Oop.getHeaderSize());
|
||||
accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0);
|
||||
subklass = new MetadataField(type.getAddressField("_subklass"), 0);
|
||||
nextSibling = new MetadataField(type.getAddressField("_next_sibling"), 0);
|
||||
allocCount = new CIntField(type.getCIntegerField("_alloc_count"), 0);
|
||||
|
||||
LH_INSTANCE_SLOW_PATH_BIT = db.lookupIntConstant("Klass::_lh_instance_slow_path_bit").intValue();
|
||||
LH_LOG2_ELEMENT_SIZE_SHIFT = db.lookupIntConstant("Klass::_lh_log2_element_size_shift").intValue();
|
||||
@ -68,8 +68,8 @@ public class Klass extends Oop implements ClassConstants {
|
||||
LH_ARRAY_TAG_OBJ_VALUE = db.lookupIntConstant("Klass::_lh_array_tag_obj_value").intValue();
|
||||
}
|
||||
|
||||
Klass(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
public Klass(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
// jvmdi support - see also class_status in VM code
|
||||
@ -81,20 +81,20 @@ public class Klass extends Oop implements ClassConstants {
|
||||
|
||||
// Fields
|
||||
private static OopField javaMirror;
|
||||
private static OopField superField;
|
||||
private static MetadataField superField;
|
||||
private static IntField layoutHelper;
|
||||
private static AddressField name;
|
||||
private static CIntField accessFlags;
|
||||
private static OopField subklass;
|
||||
private static OopField nextSibling;
|
||||
private static MetadataField subklass;
|
||||
private static MetadataField nextSibling;
|
||||
private static CIntField allocCount;
|
||||
|
||||
private Address getValue(AddressField field) {
|
||||
return getHandle().getAddressAt(field.getOffset() + Oop.getHeaderSize());
|
||||
return addr.getAddressAt(field.getOffset());
|
||||
}
|
||||
|
||||
protected Symbol getSymbol(AddressField field) {
|
||||
return Symbol.create(getHandle().getAddressAt(field.getOffset() + Oop.getHeaderSize()));
|
||||
return Symbol.create(addr.getAddressAt(field.getOffset()));
|
||||
}
|
||||
|
||||
// Accessors for declared fields
|
||||
@ -164,19 +164,16 @@ public class Klass extends Oop implements ClassConstants {
|
||||
tty.print("Klass");
|
||||
}
|
||||
|
||||
public void iterateFields(OopVisitor visitor, boolean doVMFields) {
|
||||
super.iterateFields(visitor, doVMFields);
|
||||
if (doVMFields) {
|
||||
public void iterateFields(MetadataVisitor visitor) {
|
||||
visitor.doOop(javaMirror, true);
|
||||
visitor.doOop(superField, true);
|
||||
visitor.doMetadata(superField, true);
|
||||
visitor.doInt(layoutHelper, true);
|
||||
// visitor.doOop(name, true);
|
||||
visitor.doCInt(accessFlags, true);
|
||||
visitor.doOop(subklass, true);
|
||||
visitor.doOop(nextSibling, true);
|
||||
visitor.doMetadata(subklass, true);
|
||||
visitor.doMetadata(nextSibling, true);
|
||||
visitor.doCInt(allocCount, true);
|
||||
}
|
||||
}
|
||||
|
||||
public long getObjectSize() {
|
||||
throw new RuntimeException("should not reach here");
|
||||
@ -191,11 +188,11 @@ public class Klass extends Oop implements ClassConstants {
|
||||
public Klass arrayKlassOrNull() { return arrayKlassImpl(true); }
|
||||
|
||||
public Klass arrayKlassImpl(boolean orNull, int rank) {
|
||||
throw new RuntimeException("array_klass should be dispatched to instanceKlass, objArrayKlass or typeArrayKlass");
|
||||
throw new RuntimeException("array_klass should be dispatched to InstanceKlass, objArrayKlass or typeArrayKlass");
|
||||
}
|
||||
|
||||
public Klass arrayKlassImpl(boolean orNull) {
|
||||
throw new RuntimeException("array_klass should be dispatched to instanceKlass, objArrayKlass or typeArrayKlass");
|
||||
throw new RuntimeException("array_klass should be dispatched to InstanceKlass, objArrayKlass or typeArrayKlass");
|
||||
}
|
||||
|
||||
// This returns the name in the form java/lang/String which isn't really a signature
|
||||
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2001, 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.*;
|
||||
|
||||
// A KlassKlass serves as the fix point of the klass chain.
|
||||
// The klass of KlassKlass is itself.
|
||||
|
||||
public class KlassKlass extends Klass {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
initialize(VM.getVM().getTypeDataBase());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("klassKlass");
|
||||
headerSize = type.getSize() + Oop.getHeaderSize();
|
||||
}
|
||||
|
||||
KlassKlass(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
}
|
||||
|
||||
private static long headerSize;
|
||||
|
||||
public long getObjectSize() { return alignObjectSize(headerSize); }
|
||||
|
||||
public void printValueOn(PrintStream tty) {
|
||||
tty.print("KlassKlass");
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 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
|
||||
@ -58,10 +58,10 @@ public class LocalVariableTableElement {
|
||||
private static long offsetOfSignatureCPIndex;
|
||||
private static long offsetOfSlot;
|
||||
|
||||
private OopHandle handle;
|
||||
private Address handle;
|
||||
private long offset;
|
||||
|
||||
public LocalVariableTableElement(OopHandle handle, long offset) {
|
||||
public LocalVariableTableElement(Address handle, long offset) {
|
||||
this.handle = handle;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -25,6 +25,7 @@
|
||||
package sun.jvm.hotspot.oops;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.VMObject;
|
||||
|
||||
// The class for a long field simply provides access to the value.
|
||||
public class LongField extends Field {
|
||||
@ -41,6 +42,7 @@ public class LongField extends Field {
|
||||
}
|
||||
|
||||
public long getValue(Oop obj) { return obj.getHandle().getJLongAt(getOffset()); }
|
||||
public long getValue(VMObject obj) { return obj.getAddress().getJLongAt(getOffset()); }
|
||||
public void setValue(Oop obj, long value) {
|
||||
// Fix this: setJLongAt is missing in Address
|
||||
}
|
||||
|
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) 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.utilities.*;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
|
||||
abstract public class Metadata extends VMObject {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
initialize(VM.getVM().getTypeDataBase());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Metadata(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
private static VirtualBaseConstructor<Metadata> metadataConstructor;
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
metadataConstructor = new VirtualBaseConstructor<Metadata>(db, db.lookupType("Metadata"), null, null);
|
||||
// Define an explicit mapping since the C++ and Java type names don't match.
|
||||
metadataConstructor.addMapping("Metadata", Metadata.class);
|
||||
metadataConstructor.addMapping("Klass", Klass.class);
|
||||
metadataConstructor.addMapping("InstanceKlass", InstanceKlass.class);
|
||||
metadataConstructor.addMapping("InstanceMirrorKlass", InstanceMirrorKlass.class);
|
||||
metadataConstructor.addMapping("InstanceRefKlass", InstanceRefKlass.class);
|
||||
metadataConstructor.addMapping("InstanceClassLoaderKlass", InstanceClassLoaderKlass.class);
|
||||
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);
|
||||
}
|
||||
|
||||
public static Metadata instantiateWrapperFor(Address addr) {
|
||||
return metadataConstructor.instantiateWrapperFor(addr);
|
||||
}
|
||||
|
||||
public void iterate(MetadataVisitor visitor) {
|
||||
visitor.setObj(this);
|
||||
visitor.prologue();
|
||||
iterateFields(visitor);
|
||||
visitor.epilogue();
|
||||
}
|
||||
|
||||
void iterateFields(MetadataVisitor visitor) {
|
||||
}
|
||||
|
||||
abstract public void printValueOn(PrintStream tty);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 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
|
||||
@ -22,21 +22,28 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.memory;
|
||||
package sun.jvm.hotspot.oops;
|
||||
|
||||
import sun.jvm.hotspot.runtime.VMObject;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
|
||||
/** All heaps contains a "permanent generation," containing permanent
|
||||
(reflective) objects. This is like a regular generation in some
|
||||
ways, but unlike one in others, and so is split apart. (FIXME:
|
||||
this distinction is confusing and seems unnecessary.) */
|
||||
// The class for an C int field simply provides access to the value.
|
||||
public class MetadataField extends Field {
|
||||
|
||||
public abstract class PermGen extends VMObject {
|
||||
// NEEDS_CLEANUP
|
||||
public PermGen(Address addr) {
|
||||
super(addr);
|
||||
public MetadataField(sun.jvm.hotspot.types.AddressField vmField, long startOffset) {
|
||||
super(new NamedFieldIdentifier(vmField.getName()), vmField.getOffset() + startOffset, true);
|
||||
}
|
||||
|
||||
public abstract Generation asGen();
|
||||
public Metadata getValue(Oop obj) {
|
||||
return getValue(obj.getHandle());
|
||||
}
|
||||
public Metadata getValue(VMObject obj) {
|
||||
return getValue(obj.getAddress());
|
||||
}
|
||||
public Metadata getValue(Address addr) {
|
||||
return Metadata.instantiateWrapperFor(addr.getAddressAt(getOffset()));
|
||||
}
|
||||
public void setValue(Oop obj, long value) throws MutationException {
|
||||
// Fix this: set* missing in Address
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -22,19 +22,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "ci/ciMethodKlass.hpp"
|
||||
#include "ci/ciUtilities.hpp"
|
||||
package sun.jvm.hotspot.oops;
|
||||
|
||||
// ciMethodKlass
|
||||
//
|
||||
// This class represents a klassOop in the HotSpot virtual machine
|
||||
// whose Klass part is a methodKlass.
|
||||
// A MetadataVisitor can be used to inspect all fields within an object.
|
||||
// Fields include vm fields, java fields, indexable fields.
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciMethodKlass::instance
|
||||
//
|
||||
// Return the distinguished instance of this class
|
||||
ciMethodKlass* ciMethodKlass::make() {
|
||||
return CURRENT_ENV->_method_klass_instance;
|
||||
}
|
||||
public interface MetadataVisitor extends FieldVisitor {
|
||||
// Called before visiting an object
|
||||
public void prologue();
|
||||
|
||||
// Called after visiting an object
|
||||
public void epilogue();
|
||||
|
||||
public void setObj(Metadata obj);
|
||||
|
||||
// Returns the object being visited
|
||||
public Metadata getObj();
|
||||
};
|
@ -36,7 +36,7 @@ import sun.jvm.hotspot.utilities.*;
|
||||
|
||||
// A Method represents a Java method
|
||||
|
||||
public class Method extends Oop {
|
||||
public class Method extends Metadata {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
@ -46,9 +46,9 @@ public class Method extends Oop {
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("methodOopDesc");
|
||||
constMethod = new OopField(type.getOopField("_constMethod"), 0);
|
||||
methodData = new OopField(type.getOopField("_method_data"), 0);
|
||||
Type type = db.lookupType("Method");
|
||||
constMethod = type.getAddressField("_constMethod");
|
||||
methodData = type.getAddressField("_method_data");
|
||||
methodSize = new CIntField(type.getCIntegerField("_method_size"), 0);
|
||||
maxStack = new CIntField(type.getCIntegerField("_max_stack"), 0);
|
||||
maxLocals = new CIntField(type.getCIntegerField("_max_locals"), 0);
|
||||
@ -74,15 +74,15 @@ public class Method extends Oop {
|
||||
classInitializerName = null;
|
||||
}
|
||||
|
||||
Method(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
public Method(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public boolean isMethod() { return true; }
|
||||
|
||||
// Fields
|
||||
private static OopField constMethod;
|
||||
private static OopField methodData;
|
||||
private static AddressField constMethod;
|
||||
private static AddressField methodData;
|
||||
private static CIntField methodSize;
|
||||
private static CIntField maxStack;
|
||||
private static CIntField maxLocals;
|
||||
@ -122,11 +122,17 @@ public class Method extends Oop {
|
||||
*/
|
||||
|
||||
// Accessors for declared fields
|
||||
public ConstMethod getConstMethod() { return (ConstMethod) constMethod.getValue(this); }
|
||||
public ConstMethod getConstMethod() {
|
||||
Address addr = constMethod.getValue(getAddress());
|
||||
return (ConstMethod) VMObjectFactory.newObject(ConstMethod.class, addr);
|
||||
}
|
||||
public ConstantPool getConstants() {
|
||||
return getConstMethod().getConstants();
|
||||
}
|
||||
public MethodData getMethodData() { return (MethodData) methodData.getValue(this); }
|
||||
public MethodData getMethodData() {
|
||||
Address addr = methodData.getValue(getAddress());
|
||||
return (MethodData) VMObjectFactory.newObject(MethodData.class, addr);
|
||||
}
|
||||
/** WARNING: this is in words, not useful in this system; use getObjectSize() instead */
|
||||
public long getMethodSize() { return methodSize.getValue(this); }
|
||||
public long getMaxStack() { return maxStack.getValue(this); }
|
||||
@ -153,7 +159,7 @@ public class Method extends Oop {
|
||||
|
||||
// get associated compiled native method, if available, else return null.
|
||||
public NMethod getNativeMethod() {
|
||||
Address addr = code.getValue(getHandle());
|
||||
Address addr = code.getValue(getAddress());
|
||||
return (NMethod) VMObjectFactory.newObject(NMethod.class, addr);
|
||||
}
|
||||
|
||||
@ -268,25 +274,21 @@ public class Method extends Oop {
|
||||
return entry;
|
||||
}
|
||||
|
||||
public long getObjectSize() {
|
||||
return getMethodSize() * getHeap().getOopSize();
|
||||
public long getSize() {
|
||||
return getMethodSize();
|
||||
}
|
||||
|
||||
public void printValueOn(PrintStream tty) {
|
||||
tty.print("Method " + getName().asString() + getSignature().asString() + "@" + getHandle());
|
||||
tty.print("Method " + getName().asString() + getSignature().asString() + "@" + getAddress());
|
||||
}
|
||||
|
||||
public void iterateFields(OopVisitor visitor, boolean doVMFields) {
|
||||
super.iterateFields(visitor, doVMFields);
|
||||
if (doVMFields) {
|
||||
visitor.doOop(constMethod, true);
|
||||
public void iterateFields(MetadataVisitor visitor) {
|
||||
visitor.doCInt(methodSize, true);
|
||||
visitor.doCInt(maxStack, true);
|
||||
visitor.doCInt(maxLocals, true);
|
||||
visitor.doCInt(sizeOfParameters, true);
|
||||
visitor.doCInt(accessFlags, true);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasLineNumberTable() {
|
||||
return getConstMethod().hasLineNumberTable();
|
||||
@ -357,10 +359,10 @@ public class Method extends Oop {
|
||||
return buf.toString().replace('/', '.');
|
||||
}
|
||||
public int interpreterThrowoutCount() {
|
||||
return (int) interpreterThrowoutCountField.getValue(getHandle());
|
||||
return (int) interpreterThrowoutCountField.getValue(this);
|
||||
}
|
||||
|
||||
public int interpreterInvocationCount() {
|
||||
return (int) interpreterInvocationCountField.getValue(getHandle());
|
||||
return (int) interpreterInvocationCountField.getValue(this);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -33,7 +33,7 @@ import sun.jvm.hotspot.utilities.*;
|
||||
|
||||
// A MethodData provides interpreter profiling information
|
||||
|
||||
public class MethodData extends Oop {
|
||||
public class MethodData extends Metadata {
|
||||
static int TypeProfileWidth = 2;
|
||||
static int BciProfileWidth = 2;
|
||||
static int CompileThreshold;
|
||||
@ -129,11 +129,11 @@ public class MethodData extends Oop {
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("methodDataOopDesc");
|
||||
Type type = db.lookupType("MethodData");
|
||||
baseOffset = type.getSize();
|
||||
|
||||
size = new CIntField(type.getCIntegerField("_size"), 0);
|
||||
method = new OopField(type.getOopField("_method"), 0);
|
||||
method = new MetadataField(type.getAddressField("_method"), 0);
|
||||
|
||||
VM.Flag[] flags = VM.getVM().getCommandLineFlags();
|
||||
for (int f = 0; f < flags.length; f++) {
|
||||
@ -188,25 +188,21 @@ public class MethodData extends Oop {
|
||||
}
|
||||
}
|
||||
|
||||
MethodData(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
public MethodData(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public boolean isMethodData() { return true; }
|
||||
|
||||
private static long baseOffset;
|
||||
private static CIntField size;
|
||||
private static OopField method;
|
||||
private static MetadataField method;
|
||||
private static CIntField dataSize;
|
||||
private static AddressField data;
|
||||
|
||||
public static int sizeofMethodDataOopDesc;
|
||||
public static int cellSize;
|
||||
|
||||
public long getObjectSize() {
|
||||
return alignObjectSize(size.getValue(this));
|
||||
}
|
||||
|
||||
public Method getMethod() {
|
||||
return (Method) method.getValue(this);
|
||||
}
|
||||
@ -216,19 +212,17 @@ public class MethodData extends Oop {
|
||||
tty.print("MethodData for " + m.getName().asString() + m.getSignature().asString());
|
||||
}
|
||||
|
||||
public void iterateFields(OopVisitor visitor, boolean doVMFields) {
|
||||
super.iterateFields(visitor, doVMFields);
|
||||
if (doVMFields) {
|
||||
visitor.doOop(method, true);
|
||||
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(this);
|
||||
return (int)dataSize.getValue(getAddress());
|
||||
}
|
||||
}
|
||||
|
||||
@ -298,13 +292,13 @@ public class MethodData extends Oop {
|
||||
}
|
||||
|
||||
public byte[] orig() {
|
||||
// fetch the orig methodDataOopDesc data between header and dataSize
|
||||
return fetchDataAt(this.getHandle(), 0, sizeofMethodDataOopDesc);
|
||||
// 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
|
||||
OopHandle base = getHandle();
|
||||
Address base = getAddress();
|
||||
long offset = data.getOffset();
|
||||
int elements = dataSize() / cellSize;
|
||||
long[] result = new long[elements];
|
||||
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2001, 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.*;
|
||||
|
||||
// The MethodDataKlass is the klass of a MethodData oop
|
||||
|
||||
public class MethodDataKlass extends Klass {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
initialize(VM.getVM().getTypeDataBase());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("methodDataKlass");
|
||||
headerSize = type.getSize() + Oop.getHeaderSize();
|
||||
}
|
||||
|
||||
MethodDataKlass(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
}
|
||||
|
||||
private static long headerSize;
|
||||
|
||||
public long getObjectSize() { return alignObjectSize(headerSize); }
|
||||
|
||||
public void printValueOn(PrintStream tty) {
|
||||
tty.print("MethodDataKlass");
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2001, 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.*;
|
||||
|
||||
// The MethodKlass is the klass of a Method
|
||||
|
||||
public class MethodKlass extends Klass {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
initialize(VM.getVM().getTypeDataBase());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("methodKlass");
|
||||
headerSize = type.getSize() + Oop.getHeaderSize();
|
||||
}
|
||||
|
||||
MethodKlass(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
}
|
||||
|
||||
private static long headerSize;
|
||||
|
||||
public long getObjectSize() { return alignObjectSize(headerSize); }
|
||||
|
||||
public void printValueOn(PrintStream tty) {
|
||||
tty.print("MethodKlass");
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -44,16 +44,16 @@ public class ObjArrayKlass extends ArrayKlass {
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("objArrayKlass");
|
||||
elementKlass = new OopField(type.getOopField("_element_klass"), Oop.getHeaderSize());
|
||||
bottomKlass = new OopField(type.getOopField("_bottom_klass"), Oop.getHeaderSize());
|
||||
elementKlass = new MetadataField(type.getAddressField("_element_klass"), 0);
|
||||
bottomKlass = new MetadataField(type.getAddressField("_bottom_klass"), 0);
|
||||
}
|
||||
|
||||
ObjArrayKlass(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
public ObjArrayKlass(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
private static OopField elementKlass;
|
||||
private static OopField bottomKlass;
|
||||
private static MetadataField elementKlass;
|
||||
private static MetadataField bottomKlass;
|
||||
|
||||
public Klass getElementKlass() { return (Klass) elementKlass.getValue(this); }
|
||||
public Klass getBottomKlass() { return (Klass) bottomKlass.getValue(this); }
|
||||
@ -71,12 +71,10 @@ public class ObjArrayKlass extends ArrayKlass {
|
||||
return arrayFlags;
|
||||
}
|
||||
|
||||
public void iterateFields(OopVisitor visitor, boolean doVMFields) {
|
||||
super.iterateFields(visitor, doVMFields);
|
||||
if (doVMFields) {
|
||||
visitor.doOop(elementKlass, true);
|
||||
visitor.doOop(bottomKlass, true);
|
||||
}
|
||||
public void iterateFields(MetadataVisitor visitor) {
|
||||
super.iterateFields(visitor);
|
||||
visitor.doMetadata(elementKlass, true);
|
||||
visitor.doMetadata(bottomKlass, true);
|
||||
}
|
||||
|
||||
public Klass arrayKlassImpl(boolean orNull, int n) {
|
||||
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2001, 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.*;
|
||||
|
||||
// An ObjArrayKlassKlass is klass for ObjArrayKlass'
|
||||
// We only have one
|
||||
|
||||
public class ObjArrayKlassKlass extends ArrayKlassKlass {
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
initialize(VM.getVM().getTypeDataBase());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("objArrayKlassKlass");
|
||||
headerSize = type.getSize() + Oop.getHeaderSize();
|
||||
}
|
||||
|
||||
ObjArrayKlassKlass(OopHandle handle, ObjectHeap heap) {
|
||||
super(handle, heap);
|
||||
}
|
||||
|
||||
private static long headerSize;
|
||||
|
||||
public long getObjectSize() { return alignObjectSize(headerSize); }
|
||||
|
||||
public void printValueOn(PrintStream tty) {
|
||||
tty.print("ObjArrayKlassKlass");
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -48,35 +48,15 @@ public class ObjectHeap {
|
||||
DEBUG = System.getProperty("sun.jvm.hotspot.oops.ObjectHeap.DEBUG") != null;
|
||||
}
|
||||
|
||||
private OopHandle methodKlassHandle;
|
||||
private OopHandle constMethodKlassHandle;
|
||||
private OopHandle methodDataKlassHandle;
|
||||
private OopHandle constantPoolKlassHandle;
|
||||
private OopHandle constantPoolCacheKlassHandle;
|
||||
private OopHandle klassKlassHandle;
|
||||
private OopHandle instanceKlassKlassHandle;
|
||||
private OopHandle typeArrayKlassKlassHandle;
|
||||
private OopHandle objArrayKlassKlassHandle;
|
||||
private OopHandle boolArrayKlassHandle;
|
||||
private OopHandle byteArrayKlassHandle;
|
||||
private OopHandle charArrayKlassHandle;
|
||||
private OopHandle intArrayKlassHandle;
|
||||
private OopHandle shortArrayKlassHandle;
|
||||
private OopHandle longArrayKlassHandle;
|
||||
private OopHandle singleArrayKlassHandle;
|
||||
private OopHandle doubleArrayKlassHandle;
|
||||
private OopHandle arrayKlassKlassHandle;
|
||||
private OopHandle compiledICHolderKlassHandle;
|
||||
private Address boolArrayKlassHandle;
|
||||
private Address byteArrayKlassHandle;
|
||||
private Address charArrayKlassHandle;
|
||||
private Address intArrayKlassHandle;
|
||||
private Address shortArrayKlassHandle;
|
||||
private Address longArrayKlassHandle;
|
||||
private Address singleArrayKlassHandle;
|
||||
private Address doubleArrayKlassHandle;
|
||||
|
||||
private MethodKlass methodKlassObj;
|
||||
private ConstMethodKlass constMethodKlassObj;
|
||||
private MethodDataKlass methodDataKlassObj;
|
||||
private ConstantPoolKlass constantPoolKlassObj;
|
||||
private ConstantPoolCacheKlass constantPoolCacheKlassObj;
|
||||
private KlassKlass klassKlassObj;
|
||||
private InstanceKlassKlass instanceKlassKlassObj;
|
||||
private TypeArrayKlassKlass typeArrayKlassKlassObj;
|
||||
private ObjArrayKlassKlass objArrayKlassKlassObj;
|
||||
private TypeArrayKlass boolArrayKlassObj;
|
||||
private TypeArrayKlass byteArrayKlassObj;
|
||||
private TypeArrayKlass charArrayKlassObj;
|
||||
@ -85,71 +65,34 @@ public class ObjectHeap {
|
||||
private TypeArrayKlass longArrayKlassObj;
|
||||
private TypeArrayKlass singleArrayKlassObj;
|
||||
private TypeArrayKlass doubleArrayKlassObj;
|
||||
private ArrayKlassKlass arrayKlassKlassObj;
|
||||
private CompiledICHolderKlass compiledICHolderKlassObj;
|
||||
|
||||
public void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
// Lookup the roots in the object hierarchy.
|
||||
Type universeType = db.lookupType("Universe");
|
||||
|
||||
methodKlassHandle = universeType.getOopField("_methodKlassObj").getValue();
|
||||
methodKlassObj = new MethodKlass(methodKlassHandle, this);
|
||||
boolArrayKlassHandle = universeType.getAddressField("_boolArrayKlassObj").getValue();
|
||||
boolArrayKlassObj = new TypeArrayKlass(boolArrayKlassHandle);
|
||||
|
||||
constMethodKlassHandle = universeType.getOopField("_constMethodKlassObj").getValue();
|
||||
constMethodKlassObj = new ConstMethodKlass(constMethodKlassHandle, this);
|
||||
byteArrayKlassHandle = universeType.getAddressField("_byteArrayKlassObj").getValue();
|
||||
byteArrayKlassObj = new TypeArrayKlass(byteArrayKlassHandle);
|
||||
|
||||
constantPoolKlassHandle = universeType.getOopField("_constantPoolKlassObj").getValue();
|
||||
constantPoolKlassObj = new ConstantPoolKlass(constantPoolKlassHandle, this);
|
||||
charArrayKlassHandle = universeType.getAddressField("_charArrayKlassObj").getValue();
|
||||
charArrayKlassObj = new TypeArrayKlass(charArrayKlassHandle);
|
||||
|
||||
constantPoolCacheKlassHandle = universeType.getOopField("_constantPoolCacheKlassObj").getValue();
|
||||
constantPoolCacheKlassObj = new ConstantPoolCacheKlass(constantPoolCacheKlassHandle, this);
|
||||
intArrayKlassHandle = universeType.getAddressField("_intArrayKlassObj").getValue();
|
||||
intArrayKlassObj = new TypeArrayKlass(intArrayKlassHandle);
|
||||
|
||||
klassKlassHandle = universeType.getOopField("_klassKlassObj").getValue();
|
||||
klassKlassObj = new KlassKlass(klassKlassHandle, this);
|
||||
shortArrayKlassHandle = universeType.getAddressField("_shortArrayKlassObj").getValue();
|
||||
shortArrayKlassObj = new TypeArrayKlass(shortArrayKlassHandle);
|
||||
|
||||
arrayKlassKlassHandle = universeType.getOopField("_arrayKlassKlassObj").getValue();
|
||||
arrayKlassKlassObj = new ArrayKlassKlass(arrayKlassKlassHandle, this);
|
||||
longArrayKlassHandle = universeType.getAddressField("_longArrayKlassObj").getValue();
|
||||
longArrayKlassObj = new TypeArrayKlass(longArrayKlassHandle);
|
||||
|
||||
instanceKlassKlassHandle = universeType.getOopField("_instanceKlassKlassObj").getValue();
|
||||
instanceKlassKlassObj = new InstanceKlassKlass(instanceKlassKlassHandle, this);
|
||||
singleArrayKlassHandle = universeType.getAddressField("_singleArrayKlassObj").getValue();
|
||||
singleArrayKlassObj = new TypeArrayKlass(singleArrayKlassHandle);
|
||||
|
||||
typeArrayKlassKlassHandle = universeType.getOopField("_typeArrayKlassKlassObj").getValue();
|
||||
typeArrayKlassKlassObj = new TypeArrayKlassKlass(typeArrayKlassKlassHandle, this);
|
||||
|
||||
objArrayKlassKlassHandle = universeType.getOopField("_objArrayKlassKlassObj").getValue();
|
||||
objArrayKlassKlassObj = new ObjArrayKlassKlass(objArrayKlassKlassHandle, this);
|
||||
|
||||
boolArrayKlassHandle = universeType.getOopField("_boolArrayKlassObj").getValue();
|
||||
boolArrayKlassObj = new TypeArrayKlass(boolArrayKlassHandle, this);
|
||||
|
||||
byteArrayKlassHandle = universeType.getOopField("_byteArrayKlassObj").getValue();
|
||||
byteArrayKlassObj = new TypeArrayKlass(byteArrayKlassHandle, this);
|
||||
|
||||
charArrayKlassHandle = universeType.getOopField("_charArrayKlassObj").getValue();
|
||||
charArrayKlassObj = new TypeArrayKlass(charArrayKlassHandle, this);
|
||||
|
||||
intArrayKlassHandle = universeType.getOopField("_intArrayKlassObj").getValue();
|
||||
intArrayKlassObj = new TypeArrayKlass(intArrayKlassHandle, this);
|
||||
|
||||
shortArrayKlassHandle = universeType.getOopField("_shortArrayKlassObj").getValue();
|
||||
shortArrayKlassObj = new TypeArrayKlass(shortArrayKlassHandle, this);
|
||||
|
||||
longArrayKlassHandle = universeType.getOopField("_longArrayKlassObj").getValue();
|
||||
longArrayKlassObj = new TypeArrayKlass(longArrayKlassHandle, this);
|
||||
|
||||
singleArrayKlassHandle = universeType.getOopField("_singleArrayKlassObj").getValue();
|
||||
singleArrayKlassObj = new TypeArrayKlass(singleArrayKlassHandle, this);
|
||||
|
||||
doubleArrayKlassHandle = universeType.getOopField("_doubleArrayKlassObj").getValue();
|
||||
doubleArrayKlassObj = new TypeArrayKlass(doubleArrayKlassHandle, this);
|
||||
|
||||
if (!VM.getVM().isCore()) {
|
||||
methodDataKlassHandle = universeType.getOopField("_methodDataKlassObj").getValue();
|
||||
methodDataKlassObj = new MethodDataKlass(methodDataKlassHandle, this);
|
||||
|
||||
compiledICHolderKlassHandle = universeType.getOopField("_compiledICHolderKlassObj").getValue();
|
||||
compiledICHolderKlassObj= new CompiledICHolderKlass(compiledICHolderKlassHandle ,this);
|
||||
}
|
||||
doubleArrayKlassHandle = universeType.getAddressField("_doubleArrayKlassObj").getValue();
|
||||
doubleArrayKlassObj = new TypeArrayKlass(doubleArrayKlassHandle);
|
||||
}
|
||||
|
||||
public ObjectHeap(TypeDataBase db) throws WrongTypeException {
|
||||
@ -195,16 +138,6 @@ public class ObjectHeap {
|
||||
public long getDoubleSize() { return doubleSize; }
|
||||
|
||||
// Accessors for well-known system classes (from Universe)
|
||||
public MethodKlass getMethodKlassObj() { return methodKlassObj; }
|
||||
public ConstMethodKlass getConstMethodKlassObj() { return constMethodKlassObj; }
|
||||
public MethodDataKlass getMethodDataKlassObj() { return methodDataKlassObj; }
|
||||
public ConstantPoolKlass getConstantPoolKlassObj() { return constantPoolKlassObj; }
|
||||
public ConstantPoolCacheKlass getConstantPoolCacheKlassObj() { return constantPoolCacheKlassObj; }
|
||||
public KlassKlass getKlassKlassObj() { return klassKlassObj; }
|
||||
public ArrayKlassKlass getArrayKlassKlassObj() { return arrayKlassKlassObj; }
|
||||
public InstanceKlassKlass getInstanceKlassKlassObj() { return instanceKlassKlassObj; }
|
||||
public ObjArrayKlassKlass getObjArrayKlassKlassObj() { return objArrayKlassKlassObj; }
|
||||
public TypeArrayKlassKlass getTypeArrayKlassKlassObj() { return typeArrayKlassKlassObj; }
|
||||
public TypeArrayKlass getBoolArrayKlassObj() { return boolArrayKlassObj; }
|
||||
public TypeArrayKlass getByteArrayKlassObj() { return byteArrayKlassObj; }
|
||||
public TypeArrayKlass getCharArrayKlassObj() { return charArrayKlassObj; }
|
||||
@ -213,12 +146,6 @@ public class ObjectHeap {
|
||||
public TypeArrayKlass getLongArrayKlassObj() { return longArrayKlassObj; }
|
||||
public TypeArrayKlass getSingleArrayKlassObj() { return singleArrayKlassObj; }
|
||||
public TypeArrayKlass getDoubleArrayKlassObj() { return doubleArrayKlassObj; }
|
||||
public CompiledICHolderKlass getCompiledICHolderKlassObj() {
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(!VM.getVM().isCore(), "must not be called for core build");
|
||||
}
|
||||
return compiledICHolderKlassObj;
|
||||
}
|
||||
|
||||
/** Takes a BasicType and returns the corresponding primitive array
|
||||
klass */
|
||||
@ -301,22 +228,13 @@ public class ObjectHeap {
|
||||
visitor.epilogue();
|
||||
}
|
||||
|
||||
// Iterates through only the perm generation for the purpose of
|
||||
// finding static fields for liveness analysis
|
||||
public void iteratePerm(HeapVisitor visitor) {
|
||||
CollectedHeap heap = VM.getVM().getUniverse().heap();
|
||||
List liveRegions = new ArrayList();
|
||||
addPermGenLiveRegions(liveRegions, heap);
|
||||
sortLiveRegions(liveRegions);
|
||||
iterateLiveRegions(liveRegions, visitor, null);
|
||||
}
|
||||
|
||||
public boolean isValidMethod(OopHandle handle) {
|
||||
OopHandle klass = Oop.getKlassForOopHandle(handle);
|
||||
if (klass != null && klass.equals(methodKlassHandle)) {
|
||||
public boolean isValidMethod(Address handle) {
|
||||
try {
|
||||
Method m = (Method)Metadata.instantiateWrapperFor(handle);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Creates an instance from the Oop hierarchy based based on the handle
|
||||
@ -329,60 +247,12 @@ public class ObjectHeap {
|
||||
// Handle the null reference
|
||||
if (handle == null) return null;
|
||||
|
||||
// First check if handle is one of the root objects
|
||||
if (handle.equals(methodKlassHandle)) return getMethodKlassObj();
|
||||
if (handle.equals(constMethodKlassHandle)) return getConstMethodKlassObj();
|
||||
if (handle.equals(constantPoolKlassHandle)) return getConstantPoolKlassObj();
|
||||
if (handle.equals(constantPoolCacheKlassHandle)) return getConstantPoolCacheKlassObj();
|
||||
if (handle.equals(instanceKlassKlassHandle)) return getInstanceKlassKlassObj();
|
||||
if (handle.equals(objArrayKlassKlassHandle)) return getObjArrayKlassKlassObj();
|
||||
if (handle.equals(klassKlassHandle)) return getKlassKlassObj();
|
||||
if (handle.equals(arrayKlassKlassHandle)) return getArrayKlassKlassObj();
|
||||
if (handle.equals(typeArrayKlassKlassHandle)) return getTypeArrayKlassKlassObj();
|
||||
if (handle.equals(boolArrayKlassHandle)) return getBoolArrayKlassObj();
|
||||
if (handle.equals(byteArrayKlassHandle)) return getByteArrayKlassObj();
|
||||
if (handle.equals(charArrayKlassHandle)) return getCharArrayKlassObj();
|
||||
if (handle.equals(intArrayKlassHandle)) return getIntArrayKlassObj();
|
||||
if (handle.equals(shortArrayKlassHandle)) return getShortArrayKlassObj();
|
||||
if (handle.equals(longArrayKlassHandle)) return getLongArrayKlassObj();
|
||||
if (handle.equals(singleArrayKlassHandle)) return getSingleArrayKlassObj();
|
||||
if (handle.equals(doubleArrayKlassHandle)) return getDoubleArrayKlassObj();
|
||||
if (!VM.getVM().isCore()) {
|
||||
if (handle.equals(compiledICHolderKlassHandle)) return getCompiledICHolderKlassObj();
|
||||
if (handle.equals(methodDataKlassHandle)) return getMethodDataKlassObj();
|
||||
}
|
||||
|
||||
// Then check if obj.klass() is one of the root objects
|
||||
OopHandle klass = Oop.getKlassForOopHandle(handle);
|
||||
Klass klass = Oop.getKlassForOopHandle(handle);
|
||||
if (klass != null) {
|
||||
if (klass.equals(methodKlassHandle)) return new Method(handle, this);
|
||||
if (klass.equals(constMethodKlassHandle)) return new ConstMethod(handle, this);
|
||||
if (klass.equals(constantPoolKlassHandle)) return new ConstantPool(handle, this);
|
||||
if (klass.equals(constantPoolCacheKlassHandle)) return new ConstantPoolCache(handle, this);
|
||||
if (!VM.getVM().isCore()) {
|
||||
if (klass.equals(compiledICHolderKlassHandle)) return new CompiledICHolder(handle, this);
|
||||
if (klass.equals(methodDataKlassHandle)) return new MethodData(handle, this);
|
||||
}
|
||||
if (klass.equals(instanceKlassKlassHandle)) {
|
||||
InstanceKlass ik = new InstanceKlass(handle, this);
|
||||
if (ik.getName().asString().equals("java/lang/Class")) {
|
||||
// We would normally do this using the vtable style
|
||||
// lookup but since it's not used for these currently
|
||||
// it's simpler to just check for the name.
|
||||
return new InstanceMirrorKlass(handle, this);
|
||||
}
|
||||
return ik;
|
||||
}
|
||||
if (klass.equals(objArrayKlassKlassHandle)) return new ObjArrayKlass(handle, this);
|
||||
if (klass.equals(typeArrayKlassKlassHandle)) return new TypeArrayKlass(handle, this);
|
||||
|
||||
// Lastly check if obj.klass().klass() is on of the root objects
|
||||
OopHandle klassKlass = Oop.getKlassForOopHandle(klass);
|
||||
if (klassKlass != null) {
|
||||
if (klassKlass.equals(instanceKlassKlassHandle)) return new Instance(handle, this);
|
||||
if (klassKlass.equals(objArrayKlassKlassHandle)) return new ObjArray(handle, this);
|
||||
if (klassKlass.equals(typeArrayKlassKlassHandle)) return new TypeArray(handle, this);
|
||||
}
|
||||
if (klass instanceof TypeArrayKlass) return new TypeArray(handle, this);
|
||||
if (klass instanceof ObjArrayKlass) return new ObjArray(handle, this);
|
||||
if (klass instanceof InstanceKlass) return new Instance(handle, this);
|
||||
}
|
||||
|
||||
if (DEBUG) {
|
||||
@ -434,21 +304,15 @@ public class ObjectHeap {
|
||||
visitor.prologue(totalSize);
|
||||
|
||||
CompactibleFreeListSpace cmsSpaceOld = null;
|
||||
CompactibleFreeListSpace cmsSpacePerm = null;
|
||||
CollectedHeap heap = VM.getVM().getUniverse().heap();
|
||||
|
||||
if (heap instanceof GenCollectedHeap) {
|
||||
GenCollectedHeap genHeap = (GenCollectedHeap) heap;
|
||||
Generation genOld = genHeap.getGen(1);
|
||||
Generation genPerm = genHeap.permGen();
|
||||
if (genOld instanceof ConcurrentMarkSweepGeneration) {
|
||||
ConcurrentMarkSweepGeneration concGen = (ConcurrentMarkSweepGeneration)genOld;
|
||||
cmsSpaceOld = concGen.cmsSpace();
|
||||
}
|
||||
if (genPerm instanceof ConcurrentMarkSweepGeneration) {
|
||||
ConcurrentMarkSweepGeneration concGen = (ConcurrentMarkSweepGeneration)genPerm;
|
||||
cmsSpacePerm = concGen.cmsSpace();
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < liveRegions.size(); i += 2) {
|
||||
@ -476,8 +340,6 @@ public class ObjectHeap {
|
||||
|
||||
if ( (cmsSpaceOld != null) && cmsSpaceOld.contains(handle) ){
|
||||
size = cmsSpaceOld.collector().blockSizeUsingPrintezisBits(handle);
|
||||
} else if ((cmsSpacePerm != null) && cmsSpacePerm.contains(handle) ){
|
||||
size = cmsSpacePerm.collector().blockSizeUsingPrintezisBits(handle);
|
||||
}
|
||||
|
||||
if (size <= 0) {
|
||||
@ -494,8 +356,7 @@ public class ObjectHeap {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( (cmsSpaceOld != null) && cmsSpaceOld.contains(handle) ||
|
||||
(cmsSpacePerm != null) && cmsSpacePerm.contains(handle) ) {
|
||||
if ( (cmsSpaceOld != null) && cmsSpaceOld.contains(handle)) {
|
||||
handle = handle.addOffsetToAsOopHandle(CompactibleFreeListSpace.adjustObjectSizeInBytes(obj.getObjectSize()) );
|
||||
} else {
|
||||
handle = handle.addOffsetToAsOopHandle(obj.getObjectSize());
|
||||
@ -513,32 +374,6 @@ public class ObjectHeap {
|
||||
visitor.epilogue();
|
||||
}
|
||||
|
||||
private void addPermGenLiveRegions(List output, CollectedHeap heap) {
|
||||
LiveRegionsCollector lrc = new LiveRegionsCollector(output);
|
||||
if (heap instanceof SharedHeap) {
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(heap instanceof GenCollectedHeap ||
|
||||
heap instanceof G1CollectedHeap,
|
||||
"Expecting GenCollectedHeap or G1CollectedHeap, " +
|
||||
"but got " + heap.getClass().getName());
|
||||
}
|
||||
// Handles both GenCollectedHeap and G1CollectedHeap
|
||||
SharedHeap sharedHeap = (SharedHeap) heap;
|
||||
Generation gen = sharedHeap.permGen();
|
||||
gen.spaceIterate(lrc, true);
|
||||
} else if (heap instanceof ParallelScavengeHeap) {
|
||||
ParallelScavengeHeap psh = (ParallelScavengeHeap) heap;
|
||||
PSPermGen permGen = psh.permGen();
|
||||
addLiveRegions(permGen.objectSpace().getLiveRegions(), output);
|
||||
} else {
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
Assert.that(false,
|
||||
"Expecting SharedHeap or ParallelScavengeHeap, " +
|
||||
"but got " + heap.getClass().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addLiveRegions(List input, List output) {
|
||||
for (Iterator itr = input.iterator(); itr.hasNext();) {
|
||||
MemRegion reg = (MemRegion) itr.next();
|
||||
@ -608,9 +443,6 @@ public class ObjectHeap {
|
||||
}
|
||||
}
|
||||
|
||||
// handle perm generation
|
||||
addPermGenLiveRegions(liveRegions, heap);
|
||||
|
||||
// If UseTLAB is enabled, snip out regions associated with TLABs'
|
||||
// dead regions. Note that TLABs can be present in any generation.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -84,10 +84,6 @@ public class ObjectHistogramElement {
|
||||
return tak.getElementTypeName() + "[]";
|
||||
} else if (k instanceof ObjArrayKlass) {
|
||||
ObjArrayKlass oak = (ObjArrayKlass) ak;
|
||||
// See whether it's a "system objArray"
|
||||
if (oak.equals(VM.getVM().getUniverse().systemObjArrayKlassObj())) {
|
||||
return "* System ObjArray";
|
||||
}
|
||||
Klass bottom = oak.getBottomKlass();
|
||||
int dim = (int) oak.getDimension();
|
||||
StringBuffer buf = new StringBuffer();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -30,7 +30,6 @@ import sun.jvm.hotspot.utilities.*;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
import sun.jvm.hotspot.memory.CompactingPermGenGen;
|
||||
|
||||
// Oop represents the superclass for all types of
|
||||
// objects in the HotSpot object heap.
|
||||
@ -47,8 +46,11 @@ public class Oop {
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("oopDesc");
|
||||
mark = new CIntField(type.getCIntegerField("_mark"), 0);
|
||||
klass = new OopField(type.getOopField("_metadata._klass"), 0);
|
||||
compressedKlass = new NarrowOopField(type.getOopField("_metadata._compressed_klass"), 0);
|
||||
klass = new MetadataField(type.getAddressField("_metadata._klass"), 0);
|
||||
if (VM.getVM().isCompressedHeadersEnabled()) {
|
||||
// compressedKlass = new CIntField(type.getCIntegerField("_metadata._compressed_klass"), 0);
|
||||
throw new InternalError("unimplemented");
|
||||
}
|
||||
headerSize = type.getSize();
|
||||
}
|
||||
|
||||
@ -71,28 +73,16 @@ public class Oop {
|
||||
public static long getHeaderSize() { return headerSize; } // Header size in bytes.
|
||||
|
||||
private static CIntField mark;
|
||||
private static OopField klass;
|
||||
private static NarrowOopField compressedKlass;
|
||||
|
||||
public boolean isShared() {
|
||||
return CompactingPermGenGen.isShared(handle);
|
||||
}
|
||||
|
||||
public boolean isSharedReadOnly() {
|
||||
return CompactingPermGenGen.isSharedReadOnly(handle);
|
||||
}
|
||||
|
||||
public boolean isSharedReadWrite() {
|
||||
return CompactingPermGenGen.isSharedReadWrite(handle);
|
||||
}
|
||||
private static MetadataField klass;
|
||||
private static CIntField compressedKlass;
|
||||
|
||||
// Accessors for declared fields
|
||||
public Mark getMark() { return new Mark(getHandle()); }
|
||||
public Klass getKlass() {
|
||||
if (VM.getVM().isCompressedOopsEnabled()) {
|
||||
return (Klass) compressedKlass.getValue(this);
|
||||
if (VM.getVM().isCompressedHeadersEnabled()) {
|
||||
throw new InternalError("unimplemented");
|
||||
} else {
|
||||
return (Klass) klass.getValue(this);
|
||||
return (Klass)klass.getValue(getHandle());
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,14 +103,7 @@ public class Oop {
|
||||
public boolean isArray() { return false; }
|
||||
public boolean isObjArray() { return false; }
|
||||
public boolean isTypeArray() { return false; }
|
||||
public boolean isSymbol() { return false; }
|
||||
public boolean isKlass() { return false; }
|
||||
public boolean isThread() { return false; }
|
||||
public boolean isMethod() { return false; }
|
||||
public boolean isMethodData() { return false; }
|
||||
public boolean isConstantPool() { return false; }
|
||||
public boolean isConstantPoolCache() { return false; }
|
||||
public boolean isCompiledICHolder() { return false; }
|
||||
|
||||
// Align the object size.
|
||||
public static long alignObjectSize(long size) {
|
||||
@ -167,10 +150,10 @@ public class Oop {
|
||||
void iterateFields(OopVisitor visitor, boolean doVMFields) {
|
||||
if (doVMFields) {
|
||||
visitor.doCInt(mark, true);
|
||||
if (VM.getVM().isCompressedOopsEnabled()) {
|
||||
visitor.doOop(compressedKlass, true);
|
||||
if (VM.getVM().isCompressedHeadersEnabled()) {
|
||||
throw new InternalError("unimplemented");
|
||||
} else {
|
||||
visitor.doOop(klass, true);
|
||||
visitor.doMetadata(klass, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -223,14 +206,14 @@ public class Oop {
|
||||
public boolean verify() { return true;}
|
||||
|
||||
// Package-private routine to speed up ObjectHeap.newOop
|
||||
static OopHandle getKlassForOopHandle(OopHandle handle) {
|
||||
static Klass getKlassForOopHandle(OopHandle handle) {
|
||||
if (handle == null) {
|
||||
return null;
|
||||
}
|
||||
if (VM.getVM().isCompressedOopsEnabled()) {
|
||||
return handle.getCompOopHandleAt(compressedKlass.getOffset());
|
||||
if (VM.getVM().isCompressedHeadersEnabled()) {
|
||||
throw new InternalError("Unimplemented");
|
||||
} else {
|
||||
return handle.getOopHandleAt(klass.getOffset());
|
||||
return (Klass)Metadata.instantiateWrapperFor(handle.getAddressAt(klass.getOffset()));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -25,6 +25,8 @@
|
||||
package sun.jvm.hotspot.oops;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.VM;
|
||||
import sun.jvm.hotspot.runtime.VMObject;
|
||||
|
||||
// The class for an oop field simply provides access to the value.
|
||||
public class OopField extends Field {
|
||||
@ -55,6 +57,15 @@ public class OopField extends Field {
|
||||
return obj.getHandle().getOopHandleAt(getOffset());
|
||||
}
|
||||
|
||||
public Oop getValue(VMObject obj) {
|
||||
return VM.getVM().getObjectHeap().newOop(getValueAsOopHandle(obj));
|
||||
}
|
||||
|
||||
/** Debugging support */
|
||||
public OopHandle getValueAsOopHandle(VMObject obj) {
|
||||
return obj.getAddress().getOopHandleAt(getOffset());
|
||||
}
|
||||
|
||||
public void setValue(Oop obj) throws MutationException {
|
||||
// Fix this: setOopAt is missing in Address
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -52,6 +52,12 @@ public class OopPrinter implements OopVisitor {
|
||||
field.printOn(tty);
|
||||
}
|
||||
|
||||
public void doMetadata(MetadataField field, boolean isVMField) {
|
||||
printField(field);
|
||||
field.getValue(getObj()).printValueOn(tty);
|
||||
tty.println();
|
||||
}
|
||||
|
||||
public void doOop(OopField field, boolean isVMField) {
|
||||
printField(field);
|
||||
Oop.printOopValueOn(field.getValue(getObj()), tty);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -27,7 +27,7 @@ package sun.jvm.hotspot.oops;
|
||||
// An OopVisitor can be used to inspect all fields within an object.
|
||||
// Fields include vm fields, java fields, indexable fields.
|
||||
|
||||
public interface OopVisitor {
|
||||
public interface OopVisitor extends FieldVisitor {
|
||||
// Called before visiting an object
|
||||
public void prologue();
|
||||
|
||||
@ -38,17 +38,4 @@ public interface OopVisitor {
|
||||
|
||||
// Returns the object being visited
|
||||
public Oop getObj();
|
||||
|
||||
// Callback methods for each field type in an object
|
||||
public void doOop(OopField field, boolean isVMField);
|
||||
public void doOop(NarrowOopField field, boolean isVMField);
|
||||
public void doByte(ByteField field, boolean isVMField);
|
||||
public void doChar(CharField field, boolean isVMField);
|
||||
public void doBoolean(BooleanField field, boolean isVMField);
|
||||
public void doShort(ShortField field, boolean isVMField);
|
||||
public void doInt(IntField field, boolean isVMField);
|
||||
public void doLong(LongField field, boolean isVMField);
|
||||
public void doFloat(FloatField field, boolean isVMField);
|
||||
public void doDouble(DoubleField field, boolean isVMField);
|
||||
public void doCInt(CIntField field, boolean isVMField);
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -61,10 +61,6 @@ public abstract class ProfileData {
|
||||
int uintAt(int index) {
|
||||
return (int)intptrAt(index);
|
||||
}
|
||||
Oop oopAt(int index) {
|
||||
return data().oopAt(index);
|
||||
}
|
||||
|
||||
public Address addressAt(int index) {
|
||||
return data().addressAt(index);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user