statically type Addendum.pool better

This commit is contained in:
Joshua Warner 2014-06-28 12:28:44 -06:00 committed by Joshua Warner
parent 9f5912c2b6
commit 0ec87c6aa1
10 changed files with 22 additions and 19 deletions

View File

@ -11,7 +11,7 @@
package avian; package avian;
public class Addendum { public class Addendum {
public Object pool; public Singleton pool;
public Object annotationTable; public Object annotationTable;
public Object signature; public Object signature;
} }

View File

@ -1,5 +1,5 @@
package avian; package avian;
class Code { abstract class Code {
// VM-visible fields in types.def // VM-visible fields in types.def
} }

View File

@ -14,4 +14,6 @@ public abstract class Singleton {
public static native int getInt(Object singleton, int offset); public static native int getInt(Object singleton, int offset);
public static native long getLong(Object singleton, int offset); public static native long getLong(Object singleton, int offset);
public static native Object getObject(Object singleton, int offset); public static native Object getObject(Object singleton, int offset);
// Fields in types.def
} }

View File

@ -37,6 +37,7 @@ class GcCode;
class GcClass; class GcClass;
class GcMethod; class GcMethod;
class GcClassAddendum; class GcClassAddendum;
class GcSingleton;
class Processor { class Processor {
public: public:
@ -99,7 +100,7 @@ class Processor {
object fieldTable, object fieldTable,
object methodTable, object methodTable,
GcClassAddendum* addendum, GcClassAddendum* addendum,
object staticTable, GcSingleton* staticTable,
object loader, object loader,
unsigned vtableLength) = 0; unsigned vtableLength) = 0;

View File

@ -754,7 +754,7 @@ class MyClasspath : public Classpath {
object sclSet = resolveField object sclSet = resolveField
(t, type(t, GcClassLoader::Type), "sclSet", "Z"); (t, type(t, GcClassLoader::Type), "sclSet", "Z");
set(t, type(t, GcClassLoader::Type)->staticTable(), set(t, reinterpret_cast<object>(type(t, GcClassLoader::Type)->staticTable()),
fieldOffset(t, scl), root(t, Machine::AppLoader)); fieldOffset(t, scl), root(t, Machine::AppLoader));
fieldAtOffset<uint8_t>(type(t, GcClassLoader::Type)->staticTable(), fieldAtOffset<uint8_t>(type(t, GcClassLoader::Type)->staticTable(),

View File

@ -8418,7 +8418,7 @@ class MyProcessor: public Processor {
object fieldTable, object fieldTable,
object methodTable, object methodTable,
GcClassAddendum* addendum, GcClassAddendum* addendum,
object staticTable, GcSingleton* staticTable,
object loader, object loader,
unsigned vtableLength) unsigned vtableLength)
{ {

View File

@ -3020,7 +3020,7 @@ class MyProcessor: public Processor {
object fieldTable, object fieldTable,
object methodTable, object methodTable,
GcClassAddendum* addendum, GcClassAddendum* addendum,
object staticTable, GcSingleton* staticTable,
object loader, object loader,
unsigned vtableLength UNUSED) unsigned vtableLength UNUSED)
{ {

View File

@ -1213,7 +1213,7 @@ getClassAddendum(Thread* t, GcClass* class_, GcSingleton* pool)
if (addendum == 0) { if (addendum == 0) {
PROTECT(t, class_); PROTECT(t, class_);
addendum = makeClassAddendum(t, reinterpret_cast<object>(pool), 0, 0, 0, 0, -1, 0, 0); addendum = makeClassAddendum(t, pool, 0, 0, 0, 0, -1, 0, 0);
set(t, set(t,
reinterpret_cast<object>(class_), reinterpret_cast<object>(class_),
ClassAddendum, ClassAddendum,
@ -1350,7 +1350,7 @@ parseFieldTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
{ {
if (addendum == 0) { if (addendum == 0) {
addendum = reinterpret_cast<object>( addendum = reinterpret_cast<object>(
makeFieldAddendum(t, reinterpret_cast<object>(pool), 0, 0)); makeFieldAddendum(t, pool, 0, 0));
} }
set(t, addendum, AddendumSignature, set(t, addendum, AddendumSignature,
@ -1361,7 +1361,7 @@ parseFieldTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
{ {
if (addendum == 0) { if (addendum == 0) {
addendum = reinterpret_cast<object>( addendum = reinterpret_cast<object>(
makeFieldAddendum(t, reinterpret_cast<object>(pool), 0, 0)); makeFieldAddendum(t, pool, 0, 0));
} }
object body = reinterpret_cast<object>(makeByteArray(t, length)); object body = reinterpret_cast<object>(makeByteArray(t, length));
@ -2104,7 +2104,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
&byteArrayBody(t, attributeName, 0)) == 0) &byteArrayBody(t, attributeName, 0)) == 0)
{ {
if (addendum == 0) { if (addendum == 0) {
addendum = reinterpret_cast<object>(makeMethodAddendum(t, reinterpret_cast<object>(pool), 0, 0, 0, 0, 0)); addendum = reinterpret_cast<object>(makeMethodAddendum(t, pool, 0, 0, 0, 0, 0));
} }
unsigned exceptionCount = s.read2(); unsigned exceptionCount = s.read2();
object body = reinterpret_cast<object>(makeShortArray(t, exceptionCount)); object body = reinterpret_cast<object>(makeShortArray(t, exceptionCount));
@ -2117,7 +2117,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
&byteArrayBody(t, attributeName, 0)) == 0) &byteArrayBody(t, attributeName, 0)) == 0)
{ {
if (addendum == 0) { if (addendum == 0) {
addendum = reinterpret_cast<object>(makeMethodAddendum(t, reinterpret_cast<object>(pool), 0, 0, 0, 0, 0)); addendum = reinterpret_cast<object>(makeMethodAddendum(t, pool, 0, 0, 0, 0, 0));
} }
object body = reinterpret_cast<object>(makeByteArray(t, length)); object body = reinterpret_cast<object>(makeByteArray(t, length));
@ -2129,7 +2129,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
&byteArrayBody(t, attributeName, 0)) == 0) &byteArrayBody(t, attributeName, 0)) == 0)
{ {
if (addendum == 0) { if (addendum == 0) {
addendum = reinterpret_cast<object>(makeMethodAddendum(t, reinterpret_cast<object>(pool), 0, 0, 0, 0, 0)); addendum = reinterpret_cast<object>(makeMethodAddendum(t, pool, 0, 0, 0, 0, 0));
} }
set(t, addendum, AddendumSignature, set(t, addendum, AddendumSignature,
@ -2139,7 +2139,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
&byteArrayBody(t, attributeName, 0)) == 0) &byteArrayBody(t, attributeName, 0)) == 0)
{ {
if (addendum == 0) { if (addendum == 0) {
addendum = reinterpret_cast<object>(makeMethodAddendum(t, reinterpret_cast<object>(pool), 0, 0, 0, 0, 0)); addendum = reinterpret_cast<object>(makeMethodAddendum(t, pool, 0, 0, 0, 0, 0));
} }
object body = reinterpret_cast<object>(makeByteArray(t, length)); object body = reinterpret_cast<object>(makeByteArray(t, length));
@ -2152,7 +2152,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
&byteArrayBody(t, attributeName, 0)) == 0) &byteArrayBody(t, attributeName, 0)) == 0)
{ {
if (addendum == 0) { if (addendum == 0) {
addendum = reinterpret_cast<object>(makeMethodAddendum(t, reinterpret_cast<object>(pool), 0, 0, 0, 0, 0)); addendum = reinterpret_cast<object>(makeMethodAddendum(t, pool, 0, 0, 0, 0, 0));
} }
object body = reinterpret_cast<object>(makeByteArray(t, length)); object body = reinterpret_cast<object>(makeByteArray(t, length));
@ -2465,7 +2465,7 @@ updateClassTables(Thread* t, GcClass* newClass, GcClass* oldClass)
} }
} }
object staticTable = newClass->staticTable(); object staticTable = reinterpret_cast<object>(newClass->staticTable());
if (staticTable) { if (staticTable) {
set(t, staticTable, SingletonBody, reinterpret_cast<object>(newClass)); set(t, staticTable, SingletonBody, reinterpret_cast<object>(newClass));
} }
@ -4340,7 +4340,7 @@ parseClass(Thread* t, object loader, const uint8_t* data, unsigned size,
reinterpret_cast<object>(class_->fieldTable()), reinterpret_cast<object>(class_->fieldTable()),
reinterpret_cast<object>(class_->methodTable()), reinterpret_cast<object>(class_->methodTable()),
class_->addendum(), class_->addendum(),
reinterpret_cast<object>(class_->staticTable()), class_->staticTable(),
reinterpret_cast<object>(class_->loader()), reinterpret_cast<object>(class_->loader()),
vtableLength); vtableLength);

View File

@ -651,13 +651,13 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
(t, addendum->exceptionTable(), i) - 1; (t, addendum->exceptionTable(), i) - 1;
object o = singletonObject object o = singletonObject
(t, cast<GcSingleton>(t, addendum->pool()), index); (t, addendum->pool(), index);
if (objectClass(t, o) == type(t, GcReference::Type)) { if (objectClass(t, o) == type(t, GcReference::Type)) {
o = reinterpret_cast<object>(resolveClass o = reinterpret_cast<object>(resolveClass
(t, root(t, Machine::BootLoader), referenceName(t, o))); (t, root(t, Machine::BootLoader), referenceName(t, o)));
set(t, addendum->pool(), set(t, reinterpret_cast<object>(addendum->pool()),
SingletonBody + (index * BytesPerWord), o); SingletonBody + (index * BytesPerWord), o);
} }
} }

View File

@ -22,7 +22,7 @@
(type cloneable java/lang/Cloneable) (type cloneable java/lang/Cloneable)
(type singleton (type singleton avian/Singleton
(array uintptr_t body)) (array uintptr_t body))
(type classLoader java/lang/ClassLoader (type classLoader java/lang/ClassLoader