mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
add VMClass changes
This commit is contained in:
parent
9b36dca846
commit
194e3b2701
@ -16,6 +16,7 @@ public class VMClass {
|
|||||||
public short fixedSize;
|
public short fixedSize;
|
||||||
public byte arrayElementSize;
|
public byte arrayElementSize;
|
||||||
public byte arrayDimensions;
|
public byte arrayDimensions;
|
||||||
|
public VMClass arrayElementClass;
|
||||||
public int runtimeDataIndex;
|
public int runtimeDataIndex;
|
||||||
public int[] objectMask;
|
public int[] objectMask;
|
||||||
public byte[] name;
|
public byte[] name;
|
||||||
@ -35,7 +36,7 @@ public class VMClass {
|
|||||||
*/
|
*/
|
||||||
public VMMethod[] methodTable;
|
public VMMethod[] methodTable;
|
||||||
public ClassAddendum addendum;
|
public ClassAddendum addendum;
|
||||||
public Object staticTable;
|
public Singleton staticTable;
|
||||||
public ClassLoader loader;
|
public ClassLoader loader;
|
||||||
public byte[] source;
|
public byte[] source;
|
||||||
}
|
}
|
||||||
|
@ -171,8 +171,8 @@ public final class Class <T> implements Type, AnnotatedElement {
|
|||||||
return SystemClassLoader.getClass(Classes.primitiveClass('D'));
|
return SystemClassLoader.getClass(Classes.primitiveClass('D'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vmClass.staticTable == null) throw new AssertionError();
|
if (vmClass.arrayElementClass == null) throw new AssertionError();
|
||||||
return SystemClassLoader.getClass((VMClass) vmClass.staticTable);
|
return SystemClassLoader.getClass((VMClass) vmClass.arrayElementClass);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ class GcByteArray;
|
|||||||
class GcCode;
|
class GcCode;
|
||||||
class GcClass;
|
class GcClass;
|
||||||
class GcMethod;
|
class GcMethod;
|
||||||
|
class GcClassAddendum;
|
||||||
|
|
||||||
class Processor {
|
class Processor {
|
||||||
public:
|
public:
|
||||||
@ -88,6 +89,7 @@ class Processor {
|
|||||||
uint16_t fixedSize,
|
uint16_t fixedSize,
|
||||||
uint8_t arrayElementSize,
|
uint8_t arrayElementSize,
|
||||||
uint8_t arrayDimensions,
|
uint8_t arrayDimensions,
|
||||||
|
GcClass* arrayElementClass,
|
||||||
object objectMask,
|
object objectMask,
|
||||||
object name,
|
object name,
|
||||||
object sourceFile,
|
object sourceFile,
|
||||||
@ -96,7 +98,7 @@ class Processor {
|
|||||||
object virtualTable,
|
object virtualTable,
|
||||||
object fieldTable,
|
object fieldTable,
|
||||||
object methodTable,
|
object methodTable,
|
||||||
object addendum,
|
GcClassAddendum* addendum,
|
||||||
object staticTable,
|
object staticTable,
|
||||||
object loader,
|
object loader,
|
||||||
unsigned vtableLength) = 0;
|
unsigned vtableLength) = 0;
|
||||||
|
@ -116,7 +116,7 @@ typedef int64_t target_intptr_t;
|
|||||||
|
|
||||||
const unsigned TargetClassFixedSize = 12;
|
const unsigned TargetClassFixedSize = 12;
|
||||||
const unsigned TargetClassArrayElementSize = 14;
|
const unsigned TargetClassArrayElementSize = 14;
|
||||||
const unsigned TargetClassVtable = 128;
|
const unsigned TargetClassVtable = 136;
|
||||||
|
|
||||||
const unsigned TargetFieldOffset = 12;
|
const unsigned TargetFieldOffset = 12;
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ typedef int32_t target_intptr_t;
|
|||||||
|
|
||||||
const unsigned TargetClassFixedSize = 8;
|
const unsigned TargetClassFixedSize = 8;
|
||||||
const unsigned TargetClassArrayElementSize = 10;
|
const unsigned TargetClassArrayElementSize = 10;
|
||||||
const unsigned TargetClassVtable = 68;
|
const unsigned TargetClassVtable = 72;
|
||||||
|
|
||||||
const unsigned TargetFieldOffset = 8;
|
const unsigned TargetFieldOffset = 8;
|
||||||
|
|
||||||
|
@ -1206,7 +1206,7 @@ Avian_java_lang_Class_getComponentType
|
|||||||
(getJClass(t, primitiveClass(t, n)));
|
(getJClass(t, primitiveClass(t, n)));
|
||||||
} else {
|
} else {
|
||||||
return reinterpret_cast<uintptr_t>
|
return reinterpret_cast<uintptr_t>
|
||||||
(getJClass(t, cast<GcClass>(t, classStaticTable(t, c->vmClass()))));
|
(getJClass(t, cast<GcClass>(t, classArrayElementClass(t, c->vmClass()))));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -4154,7 +4154,7 @@ jvmGetComponentType(Thread* t, uintptr_t* arguments)
|
|||||||
} else {
|
} else {
|
||||||
return reinterpret_cast<uintptr_t>
|
return reinterpret_cast<uintptr_t>
|
||||||
(makeLocalReference
|
(makeLocalReference
|
||||||
(t, reinterpret_cast<object>(getJClass(t, cast<GcClass>(t, classStaticTable(t, jclassVmClass(t, *c)))))));
|
(t, reinterpret_cast<object>(getJClass(t, cast<GcClass>(t, classArrayElementClass(t, jclassVmClass(t, *c)))))));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -8420,6 +8420,10 @@ class MyProcessor: public Processor {
|
|||||||
abort(t);
|
abort(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expect(t, TargetClassArrayElementSize == ClassArrayElementSize);
|
||||||
|
expect(t, TargetClassFixedSize == ClassFixedSize);
|
||||||
|
expect(t, TargetClassVtable == ClassVtable);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
t->init();
|
t->init();
|
||||||
@ -8468,6 +8472,7 @@ class MyProcessor: public Processor {
|
|||||||
uint16_t fixedSize,
|
uint16_t fixedSize,
|
||||||
uint8_t arrayElementSize,
|
uint8_t arrayElementSize,
|
||||||
uint8_t arrayDimensions,
|
uint8_t arrayDimensions,
|
||||||
|
GcClass* arrayElementClass,
|
||||||
object objectMask,
|
object objectMask,
|
||||||
object name,
|
object name,
|
||||||
object sourceFile,
|
object sourceFile,
|
||||||
@ -8476,8 +8481,8 @@ class MyProcessor: public Processor {
|
|||||||
object virtualTable,
|
object virtualTable,
|
||||||
object fieldTable,
|
object fieldTable,
|
||||||
object methodTable,
|
object methodTable,
|
||||||
|
GcClassAddendum* addendum,
|
||||||
object staticTable,
|
object staticTable,
|
||||||
object addendum,
|
|
||||||
object loader,
|
object loader,
|
||||||
unsigned vtableLength)
|
unsigned vtableLength)
|
||||||
{
|
{
|
||||||
@ -8487,6 +8492,7 @@ class MyProcessor: public Processor {
|
|||||||
fixedSize,
|
fixedSize,
|
||||||
arrayElementSize,
|
arrayElementSize,
|
||||||
arrayDimensions,
|
arrayDimensions,
|
||||||
|
arrayElementClass,
|
||||||
0,
|
0,
|
||||||
cast<GcIntArray>(t, objectMask),
|
cast<GcIntArray>(t, objectMask),
|
||||||
cast<GcByteArray>(t, name),
|
cast<GcByteArray>(t, name),
|
||||||
@ -8496,8 +8502,8 @@ class MyProcessor: public Processor {
|
|||||||
virtualTable,
|
virtualTable,
|
||||||
fieldTable,
|
fieldTable,
|
||||||
methodTable,
|
methodTable,
|
||||||
reinterpret_cast<GcClassAddendum*>(staticTable), // DANGER DANGER DANGER!!!!!!!!!
|
|
||||||
addendum,
|
addendum,
|
||||||
|
staticTable,
|
||||||
cast<GcClassLoader>(t, loader),
|
cast<GcClassLoader>(t, loader),
|
||||||
0,
|
0,
|
||||||
vtableLength);
|
vtableLength);
|
||||||
|
@ -559,7 +559,7 @@ invokeNativeSlow(Thread* t, GcMethod* method, void* function)
|
|||||||
RUNTIME_ARRAY_BODY(args)[argOffset++] = reinterpret_cast<uintptr_t>(t);
|
RUNTIME_ARRAY_BODY(args)[argOffset++] = reinterpret_cast<uintptr_t>(t);
|
||||||
RUNTIME_ARRAY_BODY(types)[typeOffset++] = POINTER_TYPE;
|
RUNTIME_ARRAY_BODY(types)[typeOffset++] = POINTER_TYPE;
|
||||||
|
|
||||||
object jclass = 0;
|
GcJclass* jclass = 0;
|
||||||
PROTECT(t, jclass);
|
PROTECT(t, jclass);
|
||||||
|
|
||||||
unsigned sp;
|
unsigned sp;
|
||||||
@ -2114,9 +2114,9 @@ interpret3(Thread* t, const int base)
|
|||||||
GcClass* class_ = resolveClassInPool
|
GcClass* class_ = resolveClassInPool
|
||||||
(t, frameMethod(t, frame), index - 1);
|
(t, frameMethod(t, frame), index - 1);
|
||||||
|
|
||||||
pushObject(t, getJClass(t, class_));
|
pushObject(t, reinterpret_cast<object>(getJClass(t, class_)));
|
||||||
} else if (objectClass(t, v) == type(t, GcClass::Type)) {
|
} else if (objectClass(t, v) == type(t, GcClass::Type)) {
|
||||||
pushObject(t, getJClass(t, cast<GcClass>(t, v)));
|
pushObject(t, reinterpret_cast<object>(getJClass(t, cast<GcClass>(t, v))));
|
||||||
} else {
|
} else {
|
||||||
pushObject(t, v);
|
pushObject(t, v);
|
||||||
}
|
}
|
||||||
@ -3010,6 +3010,7 @@ class MyProcessor: public Processor {
|
|||||||
uint16_t fixedSize,
|
uint16_t fixedSize,
|
||||||
uint8_t arrayElementSize,
|
uint8_t arrayElementSize,
|
||||||
uint8_t arrayDimensions,
|
uint8_t arrayDimensions,
|
||||||
|
GcClass* arrayElementClass,
|
||||||
object objectMask,
|
object objectMask,
|
||||||
object name,
|
object name,
|
||||||
object sourceFile,
|
object sourceFile,
|
||||||
@ -3018,7 +3019,7 @@ class MyProcessor: public Processor {
|
|||||||
object virtualTable,
|
object virtualTable,
|
||||||
object fieldTable,
|
object fieldTable,
|
||||||
object methodTable,
|
object methodTable,
|
||||||
object addendum,
|
GcClassAddendum* addendum,
|
||||||
object staticTable,
|
object staticTable,
|
||||||
object loader,
|
object loader,
|
||||||
unsigned vtableLength UNUSED)
|
unsigned vtableLength UNUSED)
|
||||||
@ -3029,6 +3030,7 @@ class MyProcessor: public Processor {
|
|||||||
fixedSize,
|
fixedSize,
|
||||||
arrayElementSize,
|
arrayElementSize,
|
||||||
arrayDimensions,
|
arrayDimensions,
|
||||||
|
arrayElementClass,
|
||||||
0,
|
0,
|
||||||
cast<GcIntArray>(t, objectMask),
|
cast<GcIntArray>(t, objectMask),
|
||||||
cast<GcByteArray>(t, name),
|
cast<GcByteArray>(t, name),
|
||||||
@ -3038,7 +3040,7 @@ class MyProcessor: public Processor {
|
|||||||
virtualTable,
|
virtualTable,
|
||||||
fieldTable,
|
fieldTable,
|
||||||
methodTable,
|
methodTable,
|
||||||
cast<GcClassAddendum>(t, addendum),
|
addendum,
|
||||||
staticTable,
|
staticTable,
|
||||||
cast<GcClassLoader>(t, loader),
|
cast<GcClassLoader>(t, loader),
|
||||||
0,
|
0,
|
||||||
|
@ -2510,6 +2510,7 @@ updateBootstrapClass(Thread* t, GcClass* bootstrapClass, GcClass* class_)
|
|||||||
bootstrapClass->vmFlags() |= class_->vmFlags();
|
bootstrapClass->vmFlags() |= class_->vmFlags();
|
||||||
bootstrapClass->flags() |= class_->flags();
|
bootstrapClass->flags() |= class_->flags();
|
||||||
|
|
||||||
|
set(t, reinterpret_cast<object>(bootstrapClass), ClassArrayElementClass, reinterpret_cast<object>(class_->arrayElementClass()));
|
||||||
set(t, reinterpret_cast<object>(bootstrapClass), ClassSuper, reinterpret_cast<object>(class_->super()));
|
set(t, reinterpret_cast<object>(bootstrapClass), ClassSuper, reinterpret_cast<object>(class_->super()));
|
||||||
set(t, reinterpret_cast<object>(bootstrapClass), ClassInterfaceTable, reinterpret_cast<object>(class_->interfaceTable()));
|
set(t, reinterpret_cast<object>(bootstrapClass), ClassInterfaceTable, reinterpret_cast<object>(class_->interfaceTable()));
|
||||||
set(t, reinterpret_cast<object>(bootstrapClass), ClassVirtualTable, reinterpret_cast<object>(class_->virtualTable()));
|
set(t, reinterpret_cast<object>(bootstrapClass), ClassVirtualTable, reinterpret_cast<object>(class_->virtualTable()));
|
||||||
@ -2548,6 +2549,7 @@ makeArrayClass(Thread* t, object loader, unsigned dimensions, object spec,
|
|||||||
2 * BytesPerWord,
|
2 * BytesPerWord,
|
||||||
BytesPerWord,
|
BytesPerWord,
|
||||||
dimensions,
|
dimensions,
|
||||||
|
cast<GcClass>(t, elementClass),
|
||||||
reinterpret_cast<object>(type(t, GcArray::Type)->objectMask()),
|
reinterpret_cast<object>(type(t, GcArray::Type)->objectMask()),
|
||||||
spec,
|
spec,
|
||||||
0,
|
0,
|
||||||
@ -2557,7 +2559,7 @@ makeArrayClass(Thread* t, object loader, unsigned dimensions, object spec,
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
elementClass,
|
0,
|
||||||
loader,
|
loader,
|
||||||
arrayLength(t, vtable));
|
arrayLength(t, vtable));
|
||||||
|
|
||||||
@ -2742,7 +2744,7 @@ bootClass(Thread* t, Gc::Type type, int superType, uint32_t objectMask,
|
|||||||
|
|
||||||
GcClass* class_ = t->m->processor->makeClass
|
GcClass* class_ = t->m->processor->makeClass
|
||||||
(t, 0, BootstrapFlag, fixedSize, arrayElementSize,
|
(t, 0, BootstrapFlag, fixedSize, arrayElementSize,
|
||||||
arrayElementSize ? 1 : 0, mask, 0, 0, reinterpret_cast<object>(super), 0, 0, 0, 0, 0, 0,
|
arrayElementSize ? 1 : 0, 0, mask, 0, 0, reinterpret_cast<object>(super), 0, 0, 0, 0, 0, 0,
|
||||||
root(t, Machine::BootLoader), vtableLength);
|
root(t, Machine::BootLoader), vtableLength);
|
||||||
|
|
||||||
setType(t, type, class_);
|
setType(t, type, class_);
|
||||||
@ -2876,21 +2878,21 @@ boot(Thread* t)
|
|||||||
type(t, GcJvoid::Type)->vmFlags()
|
type(t, GcJvoid::Type)->vmFlags()
|
||||||
|= PrimitiveFlag;
|
|= PrimitiveFlag;
|
||||||
|
|
||||||
set(t, reinterpret_cast<object>(type(t, GcBooleanArray::Type)), ClassStaticTable,
|
set(t, reinterpret_cast<object>(type(t, GcBooleanArray::Type)), ClassArrayElementClass,
|
||||||
reinterpret_cast<object>(type(t, GcJboolean::Type)));
|
reinterpret_cast<object>(type(t, GcJboolean::Type)));
|
||||||
set(t, reinterpret_cast<object>(type(t, GcByteArray::Type)), ClassStaticTable,
|
set(t, reinterpret_cast<object>(type(t, GcByteArray::Type)), ClassArrayElementClass,
|
||||||
reinterpret_cast<object>(type(t, GcJbyte::Type)));
|
reinterpret_cast<object>(type(t, GcJbyte::Type)));
|
||||||
set(t, reinterpret_cast<object>(type(t, GcCharArray::Type)), ClassStaticTable,
|
set(t, reinterpret_cast<object>(type(t, GcCharArray::Type)), ClassArrayElementClass,
|
||||||
reinterpret_cast<object>(type(t, GcJchar::Type)));
|
reinterpret_cast<object>(type(t, GcJchar::Type)));
|
||||||
set(t, reinterpret_cast<object>(type(t, GcShortArray::Type)), ClassStaticTable,
|
set(t, reinterpret_cast<object>(type(t, GcShortArray::Type)), ClassArrayElementClass,
|
||||||
reinterpret_cast<object>(type(t, GcJshort::Type)));
|
reinterpret_cast<object>(type(t, GcJshort::Type)));
|
||||||
set(t, reinterpret_cast<object>(type(t, GcIntArray::Type)), ClassStaticTable,
|
set(t, reinterpret_cast<object>(type(t, GcIntArray::Type)), ClassArrayElementClass,
|
||||||
reinterpret_cast<object>(type(t, GcJint::Type)));
|
reinterpret_cast<object>(type(t, GcJint::Type)));
|
||||||
set(t, reinterpret_cast<object>(type(t, GcLongArray::Type)), ClassStaticTable,
|
set(t, reinterpret_cast<object>(type(t, GcLongArray::Type)), ClassArrayElementClass,
|
||||||
reinterpret_cast<object>(type(t, GcJlong::Type)));
|
reinterpret_cast<object>(type(t, GcJlong::Type)));
|
||||||
set(t, reinterpret_cast<object>(type(t, GcFloatArray::Type)), ClassStaticTable,
|
set(t, reinterpret_cast<object>(type(t, GcFloatArray::Type)), ClassArrayElementClass,
|
||||||
reinterpret_cast<object>(type(t, GcJfloat::Type)));
|
reinterpret_cast<object>(type(t, GcJfloat::Type)));
|
||||||
set(t, reinterpret_cast<object>(type(t, GcDoubleArray::Type)), ClassStaticTable,
|
set(t, reinterpret_cast<object>(type(t, GcDoubleArray::Type)), ClassArrayElementClass,
|
||||||
reinterpret_cast<object>(type(t, GcJdouble::Type)));
|
reinterpret_cast<object>(type(t, GcJdouble::Type)));
|
||||||
|
|
||||||
{ GcHashMap* map = makeHashMap(t, 0, 0);
|
{ GcHashMap* map = makeHashMap(t, 0, 0);
|
||||||
@ -4114,7 +4116,7 @@ isAssignableFrom(Thread* t, GcClass* a, GcClass* b)
|
|||||||
} else if (a->arrayDimensions()) {
|
} else if (a->arrayDimensions()) {
|
||||||
if (b->arrayDimensions()) {
|
if (b->arrayDimensions()) {
|
||||||
return isAssignableFrom
|
return isAssignableFrom
|
||||||
(t, cast<GcClass>(t, a->staticTable()), cast<GcClass>(t, b->staticTable()));
|
(t, a->arrayElementClass(), b->arrayElementClass());
|
||||||
}
|
}
|
||||||
} else if ((a->vmFlags() & PrimitiveFlag)
|
} else if ((a->vmFlags() & PrimitiveFlag)
|
||||||
== (b->vmFlags() & PrimitiveFlag))
|
== (b->vmFlags() & PrimitiveFlag))
|
||||||
@ -4275,6 +4277,7 @@ parseClass(Thread* t, object loader, const uint8_t* data, unsigned size,
|
|||||||
0, // fixed size
|
0, // fixed size
|
||||||
0, // array size
|
0, // array size
|
||||||
0, // array dimensions
|
0, // array dimensions
|
||||||
|
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))),
|
cast<GcByteArray>(t, referenceName(t, singletonObject(t, pool, name - 1))),
|
||||||
@ -4327,6 +4330,7 @@ parseClass(Thread* t, object loader, const uint8_t* data, unsigned size,
|
|||||||
class_->fixedSize(),
|
class_->fixedSize(),
|
||||||
class_->arrayElementSize(),
|
class_->arrayElementSize(),
|
||||||
class_->arrayDimensions(),
|
class_->arrayDimensions(),
|
||||||
|
class_->arrayElementClass(),
|
||||||
reinterpret_cast<object>(class_->objectMask()),
|
reinterpret_cast<object>(class_->objectMask()),
|
||||||
reinterpret_cast<object>(class_->name()),
|
reinterpret_cast<object>(class_->name()),
|
||||||
reinterpret_cast<object>(class_->sourceFile()),
|
reinterpret_cast<object>(class_->sourceFile()),
|
||||||
@ -4335,7 +4339,7 @@ parseClass(Thread* t, object loader, const uint8_t* data, unsigned size,
|
|||||||
reinterpret_cast<object>(class_->virtualTable()),
|
reinterpret_cast<object>(class_->virtualTable()),
|
||||||
reinterpret_cast<object>(class_->fieldTable()),
|
reinterpret_cast<object>(class_->fieldTable()),
|
||||||
reinterpret_cast<object>(class_->methodTable()),
|
reinterpret_cast<object>(class_->methodTable()),
|
||||||
reinterpret_cast<object>(class_->addendum()),
|
class_->addendum(),
|
||||||
reinterpret_cast<object>(class_->staticTable()),
|
reinterpret_cast<object>(class_->staticTable()),
|
||||||
reinterpret_cast<object>(class_->loader()),
|
reinterpret_cast<object>(class_->loader()),
|
||||||
vtableLength);
|
vtableLength);
|
||||||
|
Loading…
Reference in New Issue
Block a user