< prev index next >
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/classfile/ClassLoaderData.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2012, 2019, 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.
*** 22,32 ****
*
*/
package sun.jvm.hotspot.classfile;
- import java.io.PrintStream;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.oops.*;
import sun.jvm.hotspot.types.*;
--- 22,31 ----
*** 40,57 ****
});
}
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
Type type = db.lookupType("ClassLoaderData");
! classLoaderField = type.getAddressField("_class_loader");
nextField = type.getAddressField("_next");
klassesField = new MetadataField(type.getAddressField("_klasses"), 0);
isUnsafeAnonymousField = new CIntField(type.getCIntegerField("_is_unsafe_anonymous"), 0);
dictionaryField = type.getAddressField("_dictionary");
}
! private static AddressField classLoaderField;
private static AddressField nextField;
private static MetadataField klassesField;
private static CIntField isUnsafeAnonymousField;
private static AddressField dictionaryField;
--- 39,56 ----
});
}
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
Type type = db.lookupType("ClassLoaderData");
! classLoaderFieldOffset = type.getAddressField("_class_loader").getOffset();
nextField = type.getAddressField("_next");
klassesField = new MetadataField(type.getAddressField("_klasses"), 0);
isUnsafeAnonymousField = new CIntField(type.getCIntegerField("_is_unsafe_anonymous"), 0);
dictionaryField = type.getAddressField("_dictionary");
}
! private static long classLoaderFieldOffset;
private static AddressField nextField;
private static MetadataField klassesField;
private static CIntField isUnsafeAnonymousField;
private static AddressField dictionaryField;
*** 70,86 ****
}
return new ClassLoaderData(addr);
}
public Oop getClassLoader() {
! Address handle = classLoaderField.getValue(getAddress());
! if (handle != null) {
! // Load through the handle
! OopHandle refs = handle.getOopHandleAt(0);
! return (Instance)VM.getVM().getObjectHeap().newOop(refs);
! }
! return null;
}
public boolean getisUnsafeAnonymous() {
return isUnsafeAnonymousField.getValue(this) != 0;
}
--- 69,81 ----
}
return new ClassLoaderData(addr);
}
public Oop getClassLoader() {
! Address addr = getAddress().addOffsetTo(classLoaderFieldOffset);
! VMOopHandle vmOopHandle = VMObjectFactory.newObject(VMOopHandle.class, addr);
! return vmOopHandle.resolve();
}
public boolean getisUnsafeAnonymous() {
return isUnsafeAnonymousField.getValue(this) != 0;
}
< prev index next >