use of com.ibm.dtfj.image.ImagePointer in project openj9 by eclipse.
the class JavaRuntime method checkDeferredMonitors.
private void checkDeferredMonitors() {
int errs = 0;
for (int i = 0; i < deferMonitors.size(); i++) {
DeferMonitor mon = (DeferMonitor) deferMonitors.get(i);
if (mon.id != 0) {
// At this point we attempt a cover-up operation by building the monitor
ImagePointer ptr = pointerInAddressSpace(mon.id);
JavaMonitor autoMon = new JavaMonitor(this, ptr, "Auto-generated monitor #" + mon.id, null, 0);
// adding this to the runtime automatically resolves any other referencing deferred monitors
addMonitor(autoMon);
errs++;
}
}
deferMonitors.clear();
// if (errs > 0) {
// System.out.println("Some deferred monitors not processed " + errs);
// }
}
use of com.ibm.dtfj.image.ImagePointer in project openj9 by eclipse.
the class JCJavaClassLoader method findClass.
/**
*/
public JavaClass findClass(String className) {
JavaClass foundClass = null;
if (fClassNames.containsKey(className)) {
ImagePointer ip = (ImagePointer) fClassNames.get(className);
if (ip != null) {
// By class ID
long id = ip.getAddress();
foundClass = fRuntime.findJavaClass(id);
} else {
// By class name
foundClass = fRuntime.findJavaClass(className);
}
}
return foundClass;
}
use of com.ibm.dtfj.image.ImagePointer in project openj9 by eclipse.
the class JCJavaRuntime method addJavaClass.
/**
* NON-DTFJ
* <br>
* <b>For internal building purposes only</b>. Do not call outside the DTFJ implementation.
* <br><br>
* Two separate maps are kept for classes. One based on class ID, the other based on class name. Both
* are used for lookups while building the runtime object. When a valid javaclass is added, it gets
* added at least the name-based map, and may be added to the ID-based map if the ID is available. The
* class name of the java class is a requirement, so this field must be set in the java class being passed.
*
* @param javaClass must not be null or exception thrown
* @throws JCRegistrationFailureException if java class is null
*/
public void addJavaClass(JCJavaClass javaClass) throws JCInvalidArgumentsException {
if (javaClass == null) {
throw new JCInvalidArgumentsException("Must pass a valid javaClass");
}
String javaClassName = javaClass.internalGetName();
ImagePointer pointer = javaClass.getID();
if (pointer != null) {
long id = pointer.getAddress();
fJavaClassIDs.put(new LookupKey(id), javaClass);
}
fJavaClasses.put(javaClassName, javaClass);
}
use of com.ibm.dtfj.image.ImagePointer in project openj9 by eclipse.
the class JCJavaRuntime method findJavaThread.
/**
* NON-DTFJ
* <br>
* <b>For internal building purposes only</b>. Do not call outside the DTFJ implementation.
* <br><br>
* In most cases, the threadID is the tid in a javacore, but in some other occasions, the id
* passed could be the system_thread_id or even the native thread. If a java thread is not
* found via tid, see if it can be found indirectly by an image thread that may be associated
* with the java thread (the image thread has a system thread ID as well as a native thread ID).
* @param threadID usually, tid in a javacore, may be id of some other internal vm datastructure.
* @return found java thread or null.
*/
public JCJavaThread findJavaThread(long threadID) {
Object javaThread = null;
fIDLookupKey.setKey(threadID);
if ((javaThread = fJavaThreads.get(fIDLookupKey)) == null) {
Iterator it = fJavaThreads.values().iterator();
while (javaThread == null && it.hasNext()) {
JCJavaThread jThread = (JCJavaThread) it.next();
JCImageThread imageThread = jThread.internalGetImageThread();
if (imageThread != null) {
// lookup via systemthreadID
ImagePointer pointer = imageThread.getSystemThreadID();
long address = (pointer != null) ? pointer.getAddress() : IBuilderData.NOT_AVAILABLE;
if (address != IBuilderData.NOT_AVAILABLE && address == threadID) {
javaThread = jThread;
} else // lookup via nativethreadID. This is always set for any valid image thread.
{
pointer = imageThread.getInternalID();
if (pointer.getAddress() == threadID) {
javaThread = jThread;
}
}
}
}
}
return (JCJavaThread) javaThread;
}
use of com.ibm.dtfj.image.ImagePointer in project openj9 by eclipse.
the class ImageAddressSpaceBuilder method addImageSection.
public ImageSection addImageSection(String name, long base, long size) {
ImagePointer basePointer = fImageAddressSpace.getPointer(base);
ImageSection section = new JCImageSection(name, basePointer, size);
fImageAddressSpace.addImageSection(section);
return section;
}
Aggregations