diff --git a/src/machine.cpp b/src/machine.cpp index dbbcde9880..fd52aa486b 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -2872,6 +2872,17 @@ makeTrace(Thread* t, Thread* target) return v.trace ? v.trace : makeArray(t, 0, true); } +void +runJavaThread(Thread* t) +{ + object method = resolveMethod(t, "java/lang/Thread", "run", "()V"); + if (t->exception == 0) { + t->m->processor->invoke + (t, findMethod(t, method, objectClass(t, t->javaThread)), + t->javaThread); + } +} + void noop() { } diff --git a/src/machine.h b/src/machine.h index 81a6617956..b976ec26d7 100644 --- a/src/machine.h +++ b/src/machine.h @@ -1190,6 +1190,9 @@ inline void stress(Thread* t); #endif // not VM_STRESS +void +runJavaThread(Thread* t); + class Thread { public: enum State { @@ -1242,8 +1245,7 @@ class Thread { t->m->localThread->set(t); - t->m->processor->invoke - (t, "java/lang/Thread", "run", "()V", t->javaThread); + runJavaThread(t); if (t->exception) { printTrace(t, t->exception); @@ -2023,6 +2025,13 @@ findMethod(Thread* t, object class_, object name, object spec) (t, class_, name, spec, findMethodInClass, makeNoSuchMethodError); } +inline object +findMethod(Thread* t, object method, object class_) +{ + return arrayBody(t, classVirtualTable(t, class_), + methodOffset(t, method)); +} + inline unsigned objectArrayLength(Thread* t UNUSED, object array) { diff --git a/src/process.h b/src/process.h index 64654c48fc..78c231b307 100644 --- a/src/process.h +++ b/src/process.h @@ -125,13 +125,6 @@ isSpecialMethod(Thread* t, object method, object class_) and isSuperclass(t, methodClass(t, method), class_); } -inline object -findMethod(Thread* t, object method, object class_) -{ - return arrayBody(t, classVirtualTable(t, class_), - methodOffset(t, method)); -} - void* resolveNativeMethod2(Thread* t, object method);