staticly type GcReference

This commit is contained in:
Joshua Warner 2014-06-28 21:18:22 -06:00 committed by Joshua Warner
parent bb331e9414
commit b8ddc779a2
5 changed files with 35 additions and 41 deletions

View File

@ -489,7 +489,7 @@ resolveExceptionJTypes(Thread* t, GcClassLoader* loader, GcMethodAddendum* adden
object o = singletonObject(t, addendum->pool()->as<GcSingleton>(t), index);
if (objectClass(t, o) == type(t, GcReference::Type)) {
o = reinterpret_cast<object>(resolveClass(t, loader, cast<GcByteArray>(t, cast<GcReference>(t, o)->name())));
o = reinterpret_cast<object>(resolveClass(t, loader, cast<GcReference>(t, o)->name()));
set(t, reinterpret_cast<object>(addendum->pool()), SingletonBody + (index * BytesPerWord),
o);

View File

@ -3667,7 +3667,7 @@ resolveClassInPool(Thread* t, GcClassLoader* loader, GcMethod* method, unsigned
if (objectClass(t, o) == type(t, GcReference::Type)) {
PROTECT(t, method);
GcClass* c = resolveClass(t, loader, cast<GcByteArray>(t, cast<GcReference>(t, o)->name()), throw_);
GcClass* c = resolveClass(t, loader, cast<GcReference>(t, o)->name(), throw_);
if (c) {
storeStoreMemoryBarrier();
@ -3707,7 +3707,7 @@ resolve(Thread* t, GcClassLoader* loader, GcMethod* method, unsigned index,
if (class_) {
o = findInHierarchy
(t, class_, cast<GcByteArray>(t, reference->name()), cast<GcByteArray>(t, reference->spec()),
(t, class_, reference->name(), reference->spec(),
find, errorType, throw_);
if (o) {

View File

@ -1321,7 +1321,7 @@ unsigned methodReferenceParameterFootprint(Thread* t,
return parameterFootprint(
t,
reinterpret_cast<const char*>(
&byteArrayBody(t, referenceSpec(t, reference), 0)),
referenceSpec(t, reference)->body().begin()),
isStatic);
}
@ -1332,7 +1332,7 @@ int methodReferenceReturnCode(Thread* t, object reference)
unsigned returnCode;
scanMethodSpec(t,
reinterpret_cast<const char*>(
&byteArrayBody(t, referenceSpec(t, reference), 0)),
referenceSpec(t, reference)->body().begin()),
true,
&parameterCount,
&parameterFootprint,
@ -2285,7 +2285,7 @@ resolveMethod(Thread* t, object pair)
ReferenceClass);
return cast<GcMethod>(t, findInHierarchy
(t, class_, cast<GcByteArray>(t, referenceName(t, reference)), cast<GcByteArray>(t, referenceSpec(t, reference)),
(t, class_, referenceName(t, reference), referenceSpec(t, reference),
findMethodInClass, GcNoSuchMethodError::Type));
}
@ -2420,7 +2420,7 @@ getJClassFromReference(MyThread* t, object pair)
t,
resolveClass(t,
cast<GcMethod>(t, cast<GcPair>(t, pair)->first())->class_()->loader(),
cast<GcByteArray>(t, referenceName(t, pairSecond(t, pair))))));
referenceName(t, pairSecond(t, pair)))));
}
unsigned
@ -2513,7 +2513,7 @@ makeBlankObjectArrayFromReference(MyThread* t, object pair,
t,
resolveClass(t,
cast<GcMethod>(t, cast<GcPair>(t, pair)->first())->class_()->loader(),
cast<GcByteArray>(t, referenceName(t, pairSecond(t, pair)))),
referenceName(t, pairSecond(t, pair))),
length);
}
@ -2652,7 +2652,7 @@ makeMultidimensionalArrayFromReference(MyThread* t, object pair,
return makeMultidimensionalArray
(t, resolveClass
(t, cast<GcMethod>(t, cast<GcPair>(t, pair)->first())->class_()->loader(),
cast<GcByteArray>(t, referenceName(t, pairSecond(t, pair)))), dimensions, offset);
referenceName(t, pairSecond(t, pair))), dimensions, offset);
}
void NO_RETURN
@ -2711,7 +2711,7 @@ checkCastFromReference(MyThread* t, object pair, object o)
GcClass* c = resolveClass
(t, cast<GcMethod>(t, cast<GcPair>(t, pair)->first())->class_()->loader(),
cast<GcByteArray>(t, referenceName(t, pairSecond(t, pair))));
referenceName(t, pairSecond(t, pair)));
checkCast(t, c, o);
}
@ -2727,7 +2727,7 @@ resolveField(Thread* t, object pair)
ReferenceClass);
return findInHierarchy
(t, class_, cast<GcByteArray>(t, referenceName(t, reference)), cast<GcByteArray>(t, referenceSpec(t, reference)),
(t, class_, referenceName(t, reference), referenceSpec(t, reference),
findFieldInClass, GcNoSuchFieldError::Type);
}
@ -2907,7 +2907,7 @@ instanceOfFromReference(Thread* t, object pair, object o)
GcClass* c = resolveClass
(t, cast<GcMethod>(t, cast<GcPair>(t, pair)->first())->class_()->loader(),
cast<GcByteArray>(t, referenceName(t, pairSecond(t, pair))));
referenceName(t, pairSecond(t, pair)));
return instanceOf64(t, c, o);
}
@ -2937,7 +2937,7 @@ makeNewFromReference(Thread* t, object pair)
{
GcClass* class_ = resolveClass
(t, cast<GcMethod>(t, cast<GcPair>(t, pair)->first())->class_()->loader(),
cast<GcByteArray>(t, referenceName(t, pairSecond(t, pair))));
referenceName(t, pairSecond(t, pair)));
PROTECT(t, class_);
@ -3362,14 +3362,9 @@ bool
isReferenceTailCall(MyThread* t, object code, unsigned ip, GcMethod* caller,
object calleeReference)
{
object c = referenceClass(t, calleeReference);
if (objectClass(t, c) == type(t, GcClass::Type)) {
c = className(t, c);
}
return isTailCall
(t, code, ip, caller, methodReferenceReturnCode(t, calleeReference),
cast<GcByteArray>(t, c), cast<GcByteArray>(t, referenceName(t, calleeReference)), cast<GcByteArray>(t, referenceSpec(t, calleeReference)));
referenceClass(t, calleeReference), referenceName(t, calleeReference), referenceSpec(t, calleeReference));
}
lir::TernaryOperation toCompilerJumpOp(MyThread* t, unsigned instruction) {
@ -4572,7 +4567,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
}
} else {
int fieldCode = vm::fieldCode
(t, byteArrayBody(t, referenceSpec(t, reference), 0));
(t, referenceSpec(t, reference)->body()[0]);
object pair = reinterpret_cast<object>(makePair(t, reinterpret_cast<object>(context->method), reference));
@ -5784,7 +5779,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
}
} else {
int fieldCode = vm::fieldCode
(t, byteArrayBody(t, referenceSpec(t, reference), 0));
(t, referenceSpec(t, reference)->body()[0]);
ir::Value* value = popField(t, frame, fieldCode);
ir::Type rType = operandTypeForFieldCode(t, fieldCode);

View File

@ -948,7 +948,7 @@ parsePoolEntry(Thread* t, Stream& s, uint32_t* index, GcSingleton* pool, unsigne
unsigned si = s.read2() - 1;
parsePoolEntry(t, s, index, pool, si);
object value = reinterpret_cast<object>(makeReference(t, 0, 0, singletonObject(t, pool, si), 0));
object value = reinterpret_cast<object>(makeReference(t, 0, 0, cast<GcByteArray>(t, singletonObject(t, pool, si)), 0));
set(t, reinterpret_cast<object>(pool), SingletonBody + (i * BytesPerWord), value);
if(DebugClassReader) {
@ -1003,15 +1003,15 @@ parsePoolEntry(Thread* t, Stream& s, uint32_t* index, GcSingleton* pool, unsigne
parsePoolEntry(t, s, index, pool, ci);
parsePoolEntry(t, s, index, pool, nti);
object className = referenceName(t, singletonObject(t, pool, ci));
GcByteArray* className = referenceName(t, singletonObject(t, pool, ci));
object nameAndType = singletonObject(t, pool, nti);
object value = reinterpret_cast<object>(makeReference
(t, 0, className, pairFirst(t, nameAndType), pairSecond(t, nameAndType)));
(t, 0, className, cast<GcByteArray>(t, pairFirst(t, nameAndType)), cast<GcByteArray>(t, pairSecond(t, nameAndType))));
set(t, reinterpret_cast<object>(pool), SingletonBody + (i * BytesPerWord), value);
if(DebugClassReader) {
fprintf(stderr, " consts[%d] = method %s.%s%s\n", i, &byteArrayBody(t, className, 0), &byteArrayBody(t, pairFirst(t, nameAndType), 0), &byteArrayBody(t, pairSecond(t, nameAndType), 0));
fprintf(stderr, " consts[%d] = method %s.%s%s\n", i, className->body().begin(), &byteArrayBody(t, pairFirst(t, nameAndType), 0), &byteArrayBody(t, pairSecond(t, nameAndType), 0));
}
}
} return 1;
@ -1027,9 +1027,9 @@ parsePoolEntry(Thread* t, Stream& s, uint32_t* index, GcSingleton* pool, unsigne
if (DebugClassReader) {
fprintf(stderr, " consts[%d] = method handle %d %s.%s%s\n", i, kind,
&byteArrayBody(t, referenceClass(t, value), 0),
&byteArrayBody(t, referenceName(t, value), 0),
&byteArrayBody(t, referenceSpec(t, value), 0));
referenceClass(t, value)->body().begin(),
referenceName(t, value)->body().begin(),
referenceSpec(t, value)->body().begin());
}
value = reinterpret_cast<object>(makeReference
@ -1249,7 +1249,7 @@ parseInterfaceTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool,
}
for (unsigned i = 0; i < count; ++i) {
GcByteArray* name = cast<GcByteArray>(t, referenceName(t, singletonObject(t, pool, s.read2() - 1)));
GcByteArray* name = referenceName(t, singletonObject(t, pool, s.read2() - 1));
PROTECT(t, name);
GcClass* interface = resolveClass
@ -2415,8 +2415,8 @@ parseAttributeTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
object reference = reinterpret_cast<object>(makeInnerClassReference
(t,
cast<GcByteArray>(t, inner ? referenceName(t, singletonObject(t, pool, inner - 1)) : 0),
cast<GcByteArray>(t, outer ? referenceName(t, singletonObject(t, pool, outer - 1)) : 0),
inner ? referenceName(t, singletonObject(t, pool, inner - 1)) : 0,
outer ? referenceName(t, singletonObject(t, pool, outer - 1)) : 0,
cast<GcByteArray>(t, name ? singletonObject(t, pool, name - 1) : 0),
flags));
@ -2444,7 +2444,7 @@ parseAttributeTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
GcClassAddendum* addendum = getClassAddendum(t, class_, pool);
set(t, reinterpret_cast<object>(addendum), ClassAddendumEnclosingClass,
set(t, addendum, ClassAddendumEnclosingClass,
referenceName(t, singletonObject(t, pool, enclosingClass - 1)));
set(t, reinterpret_cast<object>(addendum), ClassAddendumEnclosingMethod, enclosingMethod
@ -4280,7 +4280,7 @@ parseClass(Thread* t, GcClassLoader* loader, const uint8_t* data, unsigned size,
0, // array element class
0, // runtime data index
0, // object mask
cast<GcByteArray>(t, referenceName(t, singletonObject(t, pool, name - 1))),
referenceName(t, singletonObject(t, pool, name - 1)),
0, // source file
0, // super
0, // interfaces
@ -4297,7 +4297,7 @@ parseClass(Thread* t, GcClassLoader* loader, const uint8_t* data, unsigned size,
unsigned super = s.read2();
if (super) {
GcClass* sc = resolveClass
(t, loader, cast<GcByteArray>(t, referenceName(t, singletonObject(t, pool, super - 1))),
(t, loader, referenceName(t, singletonObject(t, pool, super - 1)),
true, throwType);
set(t, reinterpret_cast<object>(class_), ClassSuper, reinterpret_cast<object>(sc));

View File

@ -73,13 +73,6 @@
(type lineNumberTable
(array uint64_t body))
(type reference
(uint8_t kind)
(object class)
(object name)
(object spec))
(type invocation
(uint16_t bootstrap)
(int32_t index)
@ -307,6 +300,12 @@
(extends jobject)
(array int8_t body))
(type reference
(uint8_t kind)
(byteArray class)
(byteArray name)
(byteArray spec))
(type finder
(void* finder)
(byteArray name)