add stronger typing to code.singleton

This commit is contained in:
Joshua Warner 2014-06-27 21:51:07 -06:00 committed by Joshua Warner
parent 4754a92b75
commit 9248f8f8ad
5 changed files with 21 additions and 21 deletions

View File

@ -3627,7 +3627,7 @@ inline GcClass*
resolveClassInPool(Thread* t, object loader, GcMethod* method, unsigned index, resolveClassInPool(Thread* t, object loader, GcMethod* method, unsigned index,
bool throw_ = true) bool throw_ = true)
{ {
object o = singletonObject(t, cast<GcSingleton>(t, codePool(t, method->code())), index); object o = singletonObject(t, codePool(t, method->code()), index);
loadMemoryBarrier(); loadMemoryBarrier();
@ -3639,7 +3639,7 @@ resolveClassInPool(Thread* t, object loader, GcMethod* method, unsigned index,
if (c) { if (c) {
storeStoreMemoryBarrier(); storeStoreMemoryBarrier();
set(t, codePool(t, method->code()), set(t, reinterpret_cast<object>(codePool(t, method->code())),
SingletonBody + (index * BytesPerWord), reinterpret_cast<object>(c)); SingletonBody + (index * BytesPerWord), reinterpret_cast<object>(c));
} }
return c; return c;
@ -3660,7 +3660,7 @@ resolve(Thread* t, object loader, GcMethod* method, unsigned index,
object (*find)(vm::Thread*, GcClass*, object, object), object (*find)(vm::Thread*, GcClass*, object, object),
Gc::Type errorType, bool throw_ = true) Gc::Type errorType, bool throw_ = true)
{ {
object o = singletonObject(t, cast<GcSingleton>(t, codePool(t, method->code())), index); object o = singletonObject(t, codePool(t, method->code()), index);
loadMemoryBarrier(); loadMemoryBarrier();
@ -3680,7 +3680,7 @@ resolve(Thread* t, object loader, GcMethod* method, unsigned index,
if (o) { if (o) {
storeStoreMemoryBarrier(); storeStoreMemoryBarrier();
set(t, codePool(t, method->code()), set(t, reinterpret_cast<object>(codePool(t, method->code())),
SingletonBody + (index * BytesPerWord), o); SingletonBody + (index * BytesPerWord), o);
} }
} else { } else {

View File

@ -4105,7 +4105,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
uint16_t index = codeReadInt16(t, code, ip); uint16_t index = codeReadInt16(t, code, ip);
object reference = singletonObject object reference = singletonObject
(t, cast<GcSingleton>(t, codePool(t, context->method->code())), index - 1); (t, codePool(t, context->method->code()), index - 1);
PROTECT(t, reference); PROTECT(t, reference);
@ -4191,7 +4191,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
uint16_t index = codeReadInt16(t, code, ip); uint16_t index = codeReadInt16(t, code, ip);
object reference = singletonObject object reference = singletonObject
(t, cast<GcSingleton>(t, codePool(t, context->method->code())), index - 1); (t, codePool(t, context->method->code()), index - 1);
PROTECT(t, reference); PROTECT(t, reference);
@ -4422,7 +4422,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
uint16_t index = codeReadInt16(t, code, ip); uint16_t index = codeReadInt16(t, code, ip);
object reference = singletonObject object reference = singletonObject
(t, cast<GcSingleton>(t, codePool(t, context->method->code())), index - 1); (t, codePool(t, context->method->code()), index - 1);
PROTECT(t, reference); PROTECT(t, reference);
@ -4869,7 +4869,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
uint16_t index = codeReadInt16(t, code, ip); uint16_t index = codeReadInt16(t, code, ip);
object reference = singletonObject object reference = singletonObject
(t, cast<GcSingleton>(t, codePool(t, context->method->code())), index - 1); (t, codePool(t, context->method->code()), index - 1);
PROTECT(t, reference); PROTECT(t, reference);
@ -4905,7 +4905,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
ip += 2; ip += 2;
object reference = singletonObject object reference = singletonObject
(t, cast<GcSingleton>(t, codePool(t, context->method->code())), index - 1); (t, codePool(t, context->method->code()), index - 1);
PROTECT(t, reference); PROTECT(t, reference);
@ -4963,7 +4963,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
uint16_t index = codeReadInt16(t, code, ip); uint16_t index = codeReadInt16(t, code, ip);
object reference = singletonObject object reference = singletonObject
(t, cast<GcSingleton>(t, codePool(t, context->method->code())), index - 1); (t, codePool(t, context->method->code()), index - 1);
PROTECT(t, reference); PROTECT(t, reference);
@ -4998,7 +4998,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
uint16_t index = codeReadInt16(t, code, ip); uint16_t index = codeReadInt16(t, code, ip);
object reference = singletonObject object reference = singletonObject
(t, cast<GcSingleton>(t, codePool(t, context->method->code())), index - 1); (t, codePool(t, context->method->code()), index - 1);
PROTECT(t, reference); PROTECT(t, reference);
@ -5024,7 +5024,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
uint16_t index = codeReadInt16(t, code, ip); uint16_t index = codeReadInt16(t, code, ip);
object reference = singletonObject object reference = singletonObject
(t, cast<GcSingleton>(t, codePool(t, context->method->code())), index - 1); (t, codePool(t, context->method->code()), index - 1);
PROTECT(t, reference); PROTECT(t, reference);
@ -5238,7 +5238,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
index = codeReadInt16(t, code, ip); index = codeReadInt16(t, code, ip);
} }
GcSingleton* pool = cast<GcSingleton>(t, codePool(t, code)); GcSingleton* pool = codePool(t, code);
if (singletonIsObject(t, pool, index - 1)) { if (singletonIsObject(t, pool, index - 1)) {
object v = singletonObject(t, pool, index - 1); object v = singletonObject(t, pool, index - 1);
@ -5293,7 +5293,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
case ldc2_w: { case ldc2_w: {
uint16_t index = codeReadInt16(t, code, ip); uint16_t index = codeReadInt16(t, code, ip);
GcSingleton* pool = cast<GcSingleton>(t, codePool(t, code)); GcSingleton* pool = codePool(t, code);
uint64_t v; uint64_t v;
memcpy(&v, &singletonValue(t, pool, index - 1), 8); memcpy(&v, &singletonValue(t, pool, index - 1), 8);
@ -5522,7 +5522,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
uint8_t dimensions = codeBody(t, code, ip++); uint8_t dimensions = codeBody(t, code, ip++);
object reference = singletonObject object reference = singletonObject
(t, cast<GcSingleton>(t, codePool(t, context->method->code())), index - 1); (t, codePool(t, context->method->code()), index - 1);
PROTECT(t, reference); PROTECT(t, reference);
@ -5562,7 +5562,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
uint16_t index = codeReadInt16(t, code, ip); uint16_t index = codeReadInt16(t, code, ip);
object reference = singletonObject object reference = singletonObject
(t, cast<GcSingleton>(t, codePool(t, context->method->code())), index - 1); (t, codePool(t, context->method->code()), index - 1);
PROTECT(t, reference); PROTECT(t, reference);
@ -5624,7 +5624,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
uint16_t index = codeReadInt16(t, code, ip); uint16_t index = codeReadInt16(t, code, ip);
object reference = singletonObject object reference = singletonObject
(t, cast<GcSingleton>(t, codePool(t, context->method->code())), index - 1); (t, codePool(t, context->method->code()), index - 1);
PROTECT(t, reference); PROTECT(t, reference);

View File

@ -2106,7 +2106,7 @@ interpret3(Thread* t, const int base)
index = codeReadInt16(t, code, ip); index = codeReadInt16(t, code, ip);
} }
GcSingleton* pool = cast<GcSingleton>(t, codePool(t, code)); GcSingleton* pool = codePool(t, code);
if (singletonIsObject(t, pool, index - 1)) { if (singletonIsObject(t, pool, index - 1)) {
object v = singletonObject(t, pool, index - 1); object v = singletonObject(t, pool, index - 1);
@ -2128,7 +2128,7 @@ interpret3(Thread* t, const int base)
case ldc2_w: { case ldc2_w: {
uint16_t index = codeReadInt16(t, code, ip); uint16_t index = codeReadInt16(t, code, ip);
GcSingleton* pool = cast<GcSingleton>(t, codePool(t, code)); GcSingleton* pool = codePool(t, code);
uint64_t v; uint64_t v;
memcpy(&v, &singletonValue(t, pool, index - 1), 8); memcpy(&v, &singletonValue(t, pool, index - 1), 8);

View File

@ -1914,7 +1914,7 @@ parseCode(Thread* t, Stream& s, GcSingleton* pool)
fprintf(stderr, " code: maxStack %d maxLocals %d length %d\n", maxStack, maxLocals, length); fprintf(stderr, " code: maxStack %d maxLocals %d length %d\n", maxStack, maxLocals, length);
} }
object code = reinterpret_cast<object>(makeCode(t, reinterpret_cast<object>(pool), 0, 0, 0, 0, 0, maxStack, maxLocals, length)); object code = reinterpret_cast<object>(makeCode(t, pool, 0, 0, 0, 0, 0, maxStack, maxLocals, length));
s.read(&codeBody(t, code, 0), length); s.read(&codeBody(t, code, 0), length);
PROTECT(t, code); PROTECT(t, code);

View File

@ -327,7 +327,7 @@
(array int32_t body)) (array int32_t body))
(type code avian/Code (type code avian/Code
(object pool) (singleton pool)
(intArray stackMap) (intArray stackMap)
(object exceptionHandlerTable) (object exceptionHandlerTable)
(lineNumberTable lineNumberTable) (lineNumberTable lineNumberTable)