This commit is contained in:
Joel Dice 2007-09-12 21:15:16 -06:00
parent 7cb3a30a91
commit 542888a1d3
5 changed files with 64 additions and 27 deletions

View File

@ -14,7 +14,7 @@ const unsigned Top = ~static_cast<unsigned>(0);
const unsigned InitialGen2CapacityInBytes = 4 * 1024 * 1024;
const bool Verbose = true;
const bool Verbose = false;
const bool Verbose2 = false;
const bool Debug = false;

View File

@ -235,7 +235,8 @@ CallBooleanMethodV(Thread* t, jobject o, jmethodID m, va_list a)
{
ENTER(t, Thread::ActiveState);
return booleanValue(t, run(t, getMethod(t, *o, m), *o, true, a));
object r = run(t, getMethod(t, *o, m), *o, true, a);
return (t->exception ? 0 : booleanValue(t, r));
}
jboolean JNICALL
@ -256,7 +257,8 @@ CallByteMethodV(Thread* t, jobject o, jmethodID m, va_list a)
{
ENTER(t, Thread::ActiveState);
return byteValue(t, run(t, getMethod(t, *o, m), *o, true, a));
object r = run(t, getMethod(t, *o, m), *o, true, a);
return (t->exception ? 0 : byteValue(t, r));
}
jbyte JNICALL
@ -277,7 +279,8 @@ CallCharMethodV(Thread* t, jobject o, jmethodID m, va_list a)
{
ENTER(t, Thread::ActiveState);
return charValue(t, run(t, getMethod(t, *o, m), *o, true, a));
object r = run(t, getMethod(t, *o, m), *o, true, a);
return (t->exception ? 0 : charValue(t, r));
}
jchar JNICALL
@ -298,7 +301,8 @@ CallShortMethodV(Thread* t, jobject o, jmethodID m, va_list a)
{
ENTER(t, Thread::ActiveState);
return shortValue(t, run(t, getMethod(t, *o, m), *o, true, a));
object r = run(t, getMethod(t, *o, m), *o, true, a);
return (t->exception ? 0 : shortValue(t, r));
}
jshort JNICALL
@ -319,7 +323,8 @@ CallIntMethodV(Thread* t, jobject o, jmethodID m, va_list a)
{
ENTER(t, Thread::ActiveState);
return intValue(t, run(t, getMethod(t, *o, m), *o, true, a));
object r = run(t, getMethod(t, *o, m), *o, true, a);
return (t->exception ? 0 : intValue(t, r));
}
jint JNICALL
@ -340,7 +345,8 @@ CallLongMethodV(Thread* t, jobject o, jmethodID m, va_list a)
{
ENTER(t, Thread::ActiveState);
return longValue(t, run(t, getMethod(t, *o, m), *o, true, a));
object r = run(t, getMethod(t, *o, m), *o, true, a);
return (t->exception ? 0 : longValue(t, r));
}
jlong JNICALL
@ -361,7 +367,10 @@ CallFloatMethodV(Thread* t, jobject o, jmethodID m, va_list a)
{
ENTER(t, Thread::ActiveState);
return floatValue(t, run(t, getMethod(t, *o, m), *o, true, a));
object r = run(t, getMethod(t, *o, m), *o, true, a);
jint i = (t->exception ? 0 : floatValue(t, r));
jfloat f; memcpy(&f, &i, 4);
return f;
}
jfloat JNICALL
@ -382,7 +391,10 @@ CallDoubleMethodV(Thread* t, jobject o, jmethodID m, va_list a)
{
ENTER(t, Thread::ActiveState);
return doubleValue(t, run(t, getMethod(t, *o, m), *o, true, a));
object r = run(t, getMethod(t, *o, m), *o, true, a);
jlong i = (t->exception ? 0 : doubleValue(t, r));
jdouble f; memcpy(&f, &i, 4);
return f;
}
jdouble JNICALL
@ -420,7 +432,7 @@ CallVoidMethod(Thread* t, jobject o, jmethodID m, ...)
inline object
getStaticMethod(Thread* t, object class_, jmethodID m)
{
return arrayBody(t, classMethodTable(t, class_), m);
return arrayBody(t, classMethodTable(t, class_), m - 1);
}
jobject JNICALL
@ -449,7 +461,8 @@ CallStaticBooleanMethodV(Thread* t, jclass c, jmethodID m, va_list a)
{
ENTER(t, Thread::ActiveState);
return booleanValue(t, run(t, getStaticMethod(t, *c, m), 0, true, a));
object r = run(t, getStaticMethod(t, *c, m), 0, true, a);
return (t->exception ? 0 : booleanValue(t, r));
}
jboolean JNICALL
@ -470,7 +483,8 @@ CallStaticByteMethodV(Thread* t, jclass c, jmethodID m, va_list a)
{
ENTER(t, Thread::ActiveState);
return byteValue(t, run(t, getStaticMethod(t, *c, m), 0, true, a));
object r = run(t, getStaticMethod(t, *c, m), 0, true, a);
return (t->exception ? 0 : byteValue(t, r));
}
jbyte JNICALL
@ -491,7 +505,8 @@ CallStaticCharMethodV(Thread* t, jclass c, jmethodID m, va_list a)
{
ENTER(t, Thread::ActiveState);
return charValue(t, run(t, getStaticMethod(t, *c, m), 0, true, a));
object r = run(t, getStaticMethod(t, *c, m), 0, true, a);
return (t->exception ? 0 : charValue(t, r));
}
jchar JNICALL
@ -512,7 +527,8 @@ CallStaticShortMethodV(Thread* t, jclass c, jmethodID m, va_list a)
{
ENTER(t, Thread::ActiveState);
return shortValue(t, run(t, getStaticMethod(t, *c, m), 0, true, a));
object r = run(t, getStaticMethod(t, *c, m), 0, true, a);
return (t->exception ? 0 : shortValue(t, r));
}
jshort JNICALL
@ -533,7 +549,8 @@ CallStaticIntMethodV(Thread* t, jclass c, jmethodID m, va_list a)
{
ENTER(t, Thread::ActiveState);
return intValue(t, run(t, getStaticMethod(t, *c, m), 0, true, a));
object r = run(t, getStaticMethod(t, *c, m), 0, true, a);
return (t->exception ? 0 : intValue(t, r));
}
jint JNICALL
@ -554,7 +571,8 @@ CallStaticLongMethodV(Thread* t, jclass c, jmethodID m, va_list a)
{
ENTER(t, Thread::ActiveState);
return longValue(t, run(t, getStaticMethod(t, *c, m), 0, true, a));
object r = run(t, getStaticMethod(t, *c, m), 0, true, a);
return (t->exception ? 0 : longValue(t, r));
}
jlong JNICALL
@ -575,7 +593,10 @@ CallStaticFloatMethodV(Thread* t, jclass c, jmethodID m, va_list a)
{
ENTER(t, Thread::ActiveState);
return floatValue(t, run(t, getStaticMethod(t, *c, m), 0, true, a));
object r = run(t, getStaticMethod(t, *c, m), 0, true, a);
jint i = (t->exception ? 0 : floatValue(t, r));
jfloat f; memcpy(&f, &i, 4);
return f;
}
jfloat JNICALL
@ -596,7 +617,10 @@ CallStaticDoubleMethodV(Thread* t, jclass c, jmethodID m, va_list a)
{
ENTER(t, Thread::ActiveState);
return doubleValue(t, run(t, getStaticMethod(t, *c, m), 0, true, a));
object r = run(t, getStaticMethod(t, *c, m), 0, true, a);
jlong i = (t->exception ? 0 : doubleValue(t, r));
jdouble f; memcpy(&f, &i, 4);
return f;
}
jdouble JNICALL

View File

@ -361,7 +361,7 @@ postCollect(Thread* t)
{
#ifdef VM_STRESS
t->vm->system->free(t->defaultHeap);
t->defaultHeap = static_cast<object*>
t->defaultHeap = static_cast<uintptr_t*>
(t->vm->system->allocate(Thread::HeapSizeInBytes));
#endif
@ -996,6 +996,8 @@ parseMethodTable(Thread* t, Stream& s, object class_, object pool)
PROTECT(t, method);
if (flags & ACC_STATIC) {
methodOffset(t, method) = i;
if (strcmp(reinterpret_cast<const int8_t*>("<clinit>"),
&byteArrayBody(t, methodName(t, method), 0)) == 0)
{
@ -1352,7 +1354,7 @@ Thread::Thread(Machine* m, object javaThread, Thread* parent):
runnable(this)
#ifdef VM_STRESS
, stress(false),
defaultHeap(static_cast<object*>(m->system->allocate(HeapSizeInBytes)))
defaultHeap(static_cast<uintptr_t*>(m->system->allocate(HeapSizeInBytes)))
#endif // VM_STRESS
, heap(defaultHeap)
{

View File

@ -1097,9 +1097,9 @@ class Reference {
class Machine {
public:
enum {
enum Type {
#include "type-enums.cpp"
} Type;
};
Machine(System* system, Heap* heap, Finder* finder);
@ -1246,11 +1246,12 @@ class Thread {
unsigned heapOffset;
Protector* protector;
Runnable runnable;
uintptr_t* heap;
#ifdef VM_STRESS
bool stress;
uintptr_t* defaultHeap;
uintptr_t* heap;
#else // not VM_STRESS
uintptr_t* heap;
uintptr_t defaultHeap[HeapSizeInWords];
#endif // not VM_STRESS
uintptr_t stack[StackSizeInWords];

View File

@ -2450,8 +2450,13 @@ pushArguments(Thread* t, object this_, const char* spec, bool indirectObjects,
case 'L':
while (*s and *s != ';') ++ s;
++ s;
pushObject
(t, (indirectObjects ? va_arg(a, object) : *va_arg(a, object*)));
if (indirectObjects) {
object* v = va_arg(a, object*);
pushObject(t, v ? *v : 0);
} else {
pushObject(t, va_arg(a, object));
}
break;
case '[':
@ -2466,8 +2471,13 @@ pushArguments(Thread* t, object this_, const char* spec, bool indirectObjects,
++ s;
break;
}
pushObject
(t, (indirectObjects ? va_arg(a, object) : *va_arg(a, object*)));
if (indirectObjects) {
object* v = va_arg(a, object*);
pushObject(t, v ? *v : 0);
} else {
pushObject(t, va_arg(a, object));
}
break;
case 'J':