mirror of
https://github.com/corda/corda.git
synced 2025-06-13 04:38:19 +00:00
avoid inifinite recursion if java.lang.Object is missing; refactoring
When trying to create an array class, we try to resolve java.lang.Object so we can use its vtable in the array class. However, if Object is missing, we'll try to create and throw a ClassNotFoundException, which requires creating an array to store the stack trace, which requires creating an array class, which requires resolving Object, etc.. This commit short-circuits this process by telling resolveClass not to create and throw an exception if it can't find Object. While doing the above work, I noticed that the implementations of Classpath::makeThrowable in classpath-avian.cpp and classpath-openjdk.cpp were identical, so I made makeThrowable a top-level function. Finally, I discovered that Thread.setDaemon can only be called before the target thread has been started, which allowed me to simplify the code to track daemon threads in the VM.
This commit is contained in:
@ -239,12 +239,12 @@ public class Thread implements Runnable {
|
||||
}
|
||||
|
||||
public synchronized void setDaemon(boolean v) {
|
||||
if (v != daemon) {
|
||||
setDaemon(this, v);
|
||||
if (getState() != State.NEW) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
private static native void setDaemon(Thread t, boolean increment);
|
||||
daemon = v;
|
||||
}
|
||||
|
||||
public static native void yield();
|
||||
|
||||
|
Reference in New Issue
Block a user