mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
staticly type GcReference
This commit is contained in:
parent
bb331e9414
commit
b8ddc779a2
@ -489,7 +489,7 @@ resolveExceptionJTypes(Thread* t, GcClassLoader* loader, GcMethodAddendum* adden
|
|||||||
object o = singletonObject(t, addendum->pool()->as<GcSingleton>(t), index);
|
object o = singletonObject(t, addendum->pool()->as<GcSingleton>(t), index);
|
||||||
|
|
||||||
if (objectClass(t, o) == type(t, GcReference::Type)) {
|
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),
|
set(t, reinterpret_cast<object>(addendum->pool()), SingletonBody + (index * BytesPerWord),
|
||||||
o);
|
o);
|
||||||
|
@ -3667,7 +3667,7 @@ resolveClassInPool(Thread* t, GcClassLoader* loader, GcMethod* method, unsigned
|
|||||||
if (objectClass(t, o) == type(t, GcReference::Type)) {
|
if (objectClass(t, o) == type(t, GcReference::Type)) {
|
||||||
PROTECT(t, method);
|
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) {
|
if (c) {
|
||||||
storeStoreMemoryBarrier();
|
storeStoreMemoryBarrier();
|
||||||
@ -3707,7 +3707,7 @@ resolve(Thread* t, GcClassLoader* loader, GcMethod* method, unsigned index,
|
|||||||
|
|
||||||
if (class_) {
|
if (class_) {
|
||||||
o = findInHierarchy
|
o = findInHierarchy
|
||||||
(t, class_, cast<GcByteArray>(t, reference->name()), cast<GcByteArray>(t, reference->spec()),
|
(t, class_, reference->name(), reference->spec(),
|
||||||
find, errorType, throw_);
|
find, errorType, throw_);
|
||||||
|
|
||||||
if (o) {
|
if (o) {
|
||||||
|
@ -1321,7 +1321,7 @@ unsigned methodReferenceParameterFootprint(Thread* t,
|
|||||||
return parameterFootprint(
|
return parameterFootprint(
|
||||||
t,
|
t,
|
||||||
reinterpret_cast<const char*>(
|
reinterpret_cast<const char*>(
|
||||||
&byteArrayBody(t, referenceSpec(t, reference), 0)),
|
referenceSpec(t, reference)->body().begin()),
|
||||||
isStatic);
|
isStatic);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1332,7 +1332,7 @@ int methodReferenceReturnCode(Thread* t, object reference)
|
|||||||
unsigned returnCode;
|
unsigned returnCode;
|
||||||
scanMethodSpec(t,
|
scanMethodSpec(t,
|
||||||
reinterpret_cast<const char*>(
|
reinterpret_cast<const char*>(
|
||||||
&byteArrayBody(t, referenceSpec(t, reference), 0)),
|
referenceSpec(t, reference)->body().begin()),
|
||||||
true,
|
true,
|
||||||
¶meterCount,
|
¶meterCount,
|
||||||
¶meterFootprint,
|
¶meterFootprint,
|
||||||
@ -2285,7 +2285,7 @@ resolveMethod(Thread* t, object pair)
|
|||||||
ReferenceClass);
|
ReferenceClass);
|
||||||
|
|
||||||
return cast<GcMethod>(t, findInHierarchy
|
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));
|
findMethodInClass, GcNoSuchMethodError::Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2420,7 +2420,7 @@ getJClassFromReference(MyThread* t, object pair)
|
|||||||
t,
|
t,
|
||||||
resolveClass(t,
|
resolveClass(t,
|
||||||
cast<GcMethod>(t, cast<GcPair>(t, pair)->first())->class_()->loader(),
|
cast<GcMethod>(t, cast<GcPair>(t, pair)->first())->class_()->loader(),
|
||||||
cast<GcByteArray>(t, referenceName(t, pairSecond(t, pair))))));
|
referenceName(t, pairSecond(t, pair)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
@ -2513,7 +2513,7 @@ makeBlankObjectArrayFromReference(MyThread* t, object pair,
|
|||||||
t,
|
t,
|
||||||
resolveClass(t,
|
resolveClass(t,
|
||||||
cast<GcMethod>(t, cast<GcPair>(t, pair)->first())->class_()->loader(),
|
cast<GcMethod>(t, cast<GcPair>(t, pair)->first())->class_()->loader(),
|
||||||
cast<GcByteArray>(t, referenceName(t, pairSecond(t, pair)))),
|
referenceName(t, pairSecond(t, pair))),
|
||||||
length);
|
length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2652,7 +2652,7 @@ makeMultidimensionalArrayFromReference(MyThread* t, object pair,
|
|||||||
return makeMultidimensionalArray
|
return makeMultidimensionalArray
|
||||||
(t, resolveClass
|
(t, resolveClass
|
||||||
(t, cast<GcMethod>(t, cast<GcPair>(t, pair)->first())->class_()->loader(),
|
(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
|
void NO_RETURN
|
||||||
@ -2711,7 +2711,7 @@ checkCastFromReference(MyThread* t, object pair, object o)
|
|||||||
|
|
||||||
GcClass* c = resolveClass
|
GcClass* c = resolveClass
|
||||||
(t, cast<GcMethod>(t, cast<GcPair>(t, pair)->first())->class_()->loader(),
|
(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);
|
checkCast(t, c, o);
|
||||||
}
|
}
|
||||||
@ -2727,7 +2727,7 @@ resolveField(Thread* t, object pair)
|
|||||||
ReferenceClass);
|
ReferenceClass);
|
||||||
|
|
||||||
return findInHierarchy
|
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);
|
findFieldInClass, GcNoSuchFieldError::Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2907,7 +2907,7 @@ instanceOfFromReference(Thread* t, object pair, object o)
|
|||||||
|
|
||||||
GcClass* c = resolveClass
|
GcClass* c = resolveClass
|
||||||
(t, cast<GcMethod>(t, cast<GcPair>(t, pair)->first())->class_()->loader(),
|
(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);
|
return instanceOf64(t, c, o);
|
||||||
}
|
}
|
||||||
@ -2937,7 +2937,7 @@ makeNewFromReference(Thread* t, object pair)
|
|||||||
{
|
{
|
||||||
GcClass* class_ = resolveClass
|
GcClass* class_ = resolveClass
|
||||||
(t, cast<GcMethod>(t, cast<GcPair>(t, pair)->first())->class_()->loader(),
|
(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_);
|
PROTECT(t, class_);
|
||||||
|
|
||||||
@ -3362,14 +3362,9 @@ bool
|
|||||||
isReferenceTailCall(MyThread* t, object code, unsigned ip, GcMethod* caller,
|
isReferenceTailCall(MyThread* t, object code, unsigned ip, GcMethod* caller,
|
||||||
object calleeReference)
|
object calleeReference)
|
||||||
{
|
{
|
||||||
object c = referenceClass(t, calleeReference);
|
|
||||||
if (objectClass(t, c) == type(t, GcClass::Type)) {
|
|
||||||
c = className(t, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
return isTailCall
|
return isTailCall
|
||||||
(t, code, ip, caller, methodReferenceReturnCode(t, calleeReference),
|
(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) {
|
lir::TernaryOperation toCompilerJumpOp(MyThread* t, unsigned instruction) {
|
||||||
@ -4572,7 +4567,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int fieldCode = vm::fieldCode
|
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));
|
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 {
|
} else {
|
||||||
int fieldCode = vm::fieldCode
|
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::Value* value = popField(t, frame, fieldCode);
|
||||||
ir::Type rType = operandTypeForFieldCode(t, fieldCode);
|
ir::Type rType = operandTypeForFieldCode(t, fieldCode);
|
||||||
|
@ -948,7 +948,7 @@ parsePoolEntry(Thread* t, Stream& s, uint32_t* index, GcSingleton* pool, unsigne
|
|||||||
unsigned si = s.read2() - 1;
|
unsigned si = s.read2() - 1;
|
||||||
parsePoolEntry(t, s, index, pool, si);
|
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);
|
set(t, reinterpret_cast<object>(pool), SingletonBody + (i * BytesPerWord), value);
|
||||||
|
|
||||||
if(DebugClassReader) {
|
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, ci);
|
||||||
parsePoolEntry(t, s, index, pool, nti);
|
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 nameAndType = singletonObject(t, pool, nti);
|
||||||
|
|
||||||
object value = reinterpret_cast<object>(makeReference
|
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);
|
set(t, reinterpret_cast<object>(pool), SingletonBody + (i * BytesPerWord), value);
|
||||||
|
|
||||||
if(DebugClassReader) {
|
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;
|
} return 1;
|
||||||
@ -1027,9 +1027,9 @@ parsePoolEntry(Thread* t, Stream& s, uint32_t* index, GcSingleton* pool, unsigne
|
|||||||
|
|
||||||
if (DebugClassReader) {
|
if (DebugClassReader) {
|
||||||
fprintf(stderr, " consts[%d] = method handle %d %s.%s%s\n", i, kind,
|
fprintf(stderr, " consts[%d] = method handle %d %s.%s%s\n", i, kind,
|
||||||
&byteArrayBody(t, referenceClass(t, value), 0),
|
referenceClass(t, value)->body().begin(),
|
||||||
&byteArrayBody(t, referenceName(t, value), 0),
|
referenceName(t, value)->body().begin(),
|
||||||
&byteArrayBody(t, referenceSpec(t, value), 0));
|
referenceSpec(t, value)->body().begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
value = reinterpret_cast<object>(makeReference
|
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) {
|
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);
|
PROTECT(t, name);
|
||||||
|
|
||||||
GcClass* interface = resolveClass
|
GcClass* interface = resolveClass
|
||||||
@ -2415,8 +2415,8 @@ parseAttributeTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
|
|||||||
|
|
||||||
object reference = reinterpret_cast<object>(makeInnerClassReference
|
object reference = reinterpret_cast<object>(makeInnerClassReference
|
||||||
(t,
|
(t,
|
||||||
cast<GcByteArray>(t, inner ? referenceName(t, singletonObject(t, pool, inner - 1)) : 0),
|
inner ? referenceName(t, singletonObject(t, pool, inner - 1)) : 0,
|
||||||
cast<GcByteArray>(t, outer ? referenceName(t, singletonObject(t, pool, outer - 1)) : 0),
|
outer ? referenceName(t, singletonObject(t, pool, outer - 1)) : 0,
|
||||||
cast<GcByteArray>(t, name ? singletonObject(t, pool, name - 1) : 0),
|
cast<GcByteArray>(t, name ? singletonObject(t, pool, name - 1) : 0),
|
||||||
flags));
|
flags));
|
||||||
|
|
||||||
@ -2444,7 +2444,7 @@ parseAttributeTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
|
|||||||
|
|
||||||
GcClassAddendum* addendum = getClassAddendum(t, class_, 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)));
|
referenceName(t, singletonObject(t, pool, enclosingClass - 1)));
|
||||||
|
|
||||||
set(t, reinterpret_cast<object>(addendum), ClassAddendumEnclosingMethod, enclosingMethod
|
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, // array element class
|
||||||
0, // runtime data index
|
0, // runtime data index
|
||||||
0, // object mask
|
0, // object mask
|
||||||
cast<GcByteArray>(t, referenceName(t, singletonObject(t, pool, name - 1))),
|
referenceName(t, singletonObject(t, pool, name - 1)),
|
||||||
0, // source file
|
0, // source file
|
||||||
0, // super
|
0, // super
|
||||||
0, // interfaces
|
0, // interfaces
|
||||||
@ -4297,7 +4297,7 @@ parseClass(Thread* t, GcClassLoader* loader, const uint8_t* data, unsigned size,
|
|||||||
unsigned super = s.read2();
|
unsigned super = s.read2();
|
||||||
if (super) {
|
if (super) {
|
||||||
GcClass* sc = resolveClass
|
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);
|
true, throwType);
|
||||||
|
|
||||||
set(t, reinterpret_cast<object>(class_), ClassSuper, reinterpret_cast<object>(sc));
|
set(t, reinterpret_cast<object>(class_), ClassSuper, reinterpret_cast<object>(sc));
|
||||||
|
@ -73,13 +73,6 @@
|
|||||||
(type lineNumberTable
|
(type lineNumberTable
|
||||||
(array uint64_t body))
|
(array uint64_t body))
|
||||||
|
|
||||||
|
|
||||||
(type reference
|
|
||||||
(uint8_t kind)
|
|
||||||
(object class)
|
|
||||||
(object name)
|
|
||||||
(object spec))
|
|
||||||
|
|
||||||
(type invocation
|
(type invocation
|
||||||
(uint16_t bootstrap)
|
(uint16_t bootstrap)
|
||||||
(int32_t index)
|
(int32_t index)
|
||||||
@ -307,6 +300,12 @@
|
|||||||
(extends jobject)
|
(extends jobject)
|
||||||
(array int8_t body))
|
(array int8_t body))
|
||||||
|
|
||||||
|
(type reference
|
||||||
|
(uint8_t kind)
|
||||||
|
(byteArray class)
|
||||||
|
(byteArray name)
|
||||||
|
(byteArray spec))
|
||||||
|
|
||||||
(type finder
|
(type finder
|
||||||
(void* finder)
|
(void* finder)
|
||||||
(byteArray name)
|
(byteArray name)
|
||||||
|
Loading…
Reference in New Issue
Block a user