diff --git a/classpath/avian/Addendum.java b/classpath/avian/Addendum.java index 0335d41e8a..1615904439 100644 --- a/classpath/avian/Addendum.java +++ b/classpath/avian/Addendum.java @@ -11,7 +11,7 @@ package avian; public class Addendum { - public Object pool; + public Singleton pool; public Object annotationTable; public Object signature; } diff --git a/classpath/avian/Code.java b/classpath/avian/Code.java index 01b8df7272..957099107d 100644 --- a/classpath/avian/Code.java +++ b/classpath/avian/Code.java @@ -1,5 +1,5 @@ package avian; -class Code { +abstract class Code { // VM-visible fields in types.def } diff --git a/classpath/avian/Singleton.java b/classpath/avian/Singleton.java index 0c8a3db52f..ebb55f12dd 100644 --- a/classpath/avian/Singleton.java +++ b/classpath/avian/Singleton.java @@ -14,4 +14,6 @@ public abstract class Singleton { public static native int getInt(Object singleton, int offset); public static native long getLong(Object singleton, int offset); public static native Object getObject(Object singleton, int offset); + + // Fields in types.def } diff --git a/src/avian/processor.h b/src/avian/processor.h index ccbbf3b740..8d2e773b8c 100644 --- a/src/avian/processor.h +++ b/src/avian/processor.h @@ -37,6 +37,7 @@ class GcCode; class GcClass; class GcMethod; class GcClassAddendum; +class GcSingleton; class Processor { public: @@ -99,7 +100,7 @@ class Processor { object fieldTable, object methodTable, GcClassAddendum* addendum, - object staticTable, + GcSingleton* staticTable, object loader, unsigned vtableLength) = 0; diff --git a/src/classpath-openjdk.cpp b/src/classpath-openjdk.cpp index bb46c155e5..9f2ddf34be 100644 --- a/src/classpath-openjdk.cpp +++ b/src/classpath-openjdk.cpp @@ -754,7 +754,7 @@ class MyClasspath : public Classpath { object sclSet = resolveField (t, type(t, GcClassLoader::Type), "sclSet", "Z"); - set(t, type(t, GcClassLoader::Type)->staticTable(), + set(t, reinterpret_cast(type(t, GcClassLoader::Type)->staticTable()), fieldOffset(t, scl), root(t, Machine::AppLoader)); fieldAtOffset(type(t, GcClassLoader::Type)->staticTable(), diff --git a/src/compile.cpp b/src/compile.cpp index 97494edbd2..86b193cb80 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -8418,7 +8418,7 @@ class MyProcessor: public Processor { object fieldTable, object methodTable, GcClassAddendum* addendum, - object staticTable, + GcSingleton* staticTable, object loader, unsigned vtableLength) { diff --git a/src/interpret.cpp b/src/interpret.cpp index ca715c30e3..c59b79a1f5 100644 --- a/src/interpret.cpp +++ b/src/interpret.cpp @@ -3020,7 +3020,7 @@ class MyProcessor: public Processor { object fieldTable, object methodTable, GcClassAddendum* addendum, - object staticTable, + GcSingleton* staticTable, object loader, unsigned vtableLength UNUSED) { diff --git a/src/machine.cpp b/src/machine.cpp index 26f842a9ef..6855ad22e4 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -1213,7 +1213,7 @@ getClassAddendum(Thread* t, GcClass* class_, GcSingleton* pool) if (addendum == 0) { PROTECT(t, class_); - addendum = makeClassAddendum(t, reinterpret_cast(pool), 0, 0, 0, 0, -1, 0, 0); + addendum = makeClassAddendum(t, pool, 0, 0, 0, 0, -1, 0, 0); set(t, reinterpret_cast(class_), ClassAddendum, @@ -1350,7 +1350,7 @@ parseFieldTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) { if (addendum == 0) { addendum = reinterpret_cast( - makeFieldAddendum(t, reinterpret_cast(pool), 0, 0)); + makeFieldAddendum(t, pool, 0, 0)); } set(t, addendum, AddendumSignature, @@ -1361,7 +1361,7 @@ parseFieldTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) { if (addendum == 0) { addendum = reinterpret_cast( - makeFieldAddendum(t, reinterpret_cast(pool), 0, 0)); + makeFieldAddendum(t, pool, 0, 0)); } object body = reinterpret_cast(makeByteArray(t, length)); @@ -2104,7 +2104,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) &byteArrayBody(t, attributeName, 0)) == 0) { if (addendum == 0) { - addendum = reinterpret_cast(makeMethodAddendum(t, reinterpret_cast(pool), 0, 0, 0, 0, 0)); + addendum = reinterpret_cast(makeMethodAddendum(t, pool, 0, 0, 0, 0, 0)); } unsigned exceptionCount = s.read2(); object body = reinterpret_cast(makeShortArray(t, exceptionCount)); @@ -2117,7 +2117,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) &byteArrayBody(t, attributeName, 0)) == 0) { if (addendum == 0) { - addendum = reinterpret_cast(makeMethodAddendum(t, reinterpret_cast(pool), 0, 0, 0, 0, 0)); + addendum = reinterpret_cast(makeMethodAddendum(t, pool, 0, 0, 0, 0, 0)); } object body = reinterpret_cast(makeByteArray(t, length)); @@ -2129,7 +2129,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) &byteArrayBody(t, attributeName, 0)) == 0) { if (addendum == 0) { - addendum = reinterpret_cast(makeMethodAddendum(t, reinterpret_cast(pool), 0, 0, 0, 0, 0)); + addendum = reinterpret_cast(makeMethodAddendum(t, pool, 0, 0, 0, 0, 0)); } set(t, addendum, AddendumSignature, @@ -2139,7 +2139,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) &byteArrayBody(t, attributeName, 0)) == 0) { if (addendum == 0) { - addendum = reinterpret_cast(makeMethodAddendum(t, reinterpret_cast(pool), 0, 0, 0, 0, 0)); + addendum = reinterpret_cast(makeMethodAddendum(t, pool, 0, 0, 0, 0, 0)); } object body = reinterpret_cast(makeByteArray(t, length)); @@ -2152,7 +2152,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool) &byteArrayBody(t, attributeName, 0)) == 0) { if (addendum == 0) { - addendum = reinterpret_cast(makeMethodAddendum(t, reinterpret_cast(pool), 0, 0, 0, 0, 0)); + addendum = reinterpret_cast(makeMethodAddendum(t, pool, 0, 0, 0, 0, 0)); } object body = reinterpret_cast(makeByteArray(t, length)); @@ -2465,7 +2465,7 @@ updateClassTables(Thread* t, GcClass* newClass, GcClass* oldClass) } } - object staticTable = newClass->staticTable(); + object staticTable = reinterpret_cast(newClass->staticTable()); if (staticTable) { set(t, staticTable, SingletonBody, reinterpret_cast(newClass)); } @@ -4340,7 +4340,7 @@ parseClass(Thread* t, object loader, const uint8_t* data, unsigned size, reinterpret_cast(class_->fieldTable()), reinterpret_cast(class_->methodTable()), class_->addendum(), - reinterpret_cast(class_->staticTable()), + class_->staticTable(), reinterpret_cast(class_->loader()), vtableLength); diff --git a/src/tools/bootimage-generator/main.cpp b/src/tools/bootimage-generator/main.cpp index 326922b625..302edd7ccc 100644 --- a/src/tools/bootimage-generator/main.cpp +++ b/src/tools/bootimage-generator/main.cpp @@ -651,13 +651,13 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code, (t, addendum->exceptionTable(), i) - 1; object o = singletonObject - (t, cast(t, addendum->pool()), index); + (t, addendum->pool(), index); if (objectClass(t, o) == type(t, GcReference::Type)) { o = reinterpret_cast(resolveClass (t, root(t, Machine::BootLoader), referenceName(t, o))); - set(t, addendum->pool(), + set(t, reinterpret_cast(addendum->pool()), SingletonBody + (index * BytesPerWord), o); } } diff --git a/src/types.def b/src/types.def index 40b2f34791..46136ea2d5 100644 --- a/src/types.def +++ b/src/types.def @@ -22,7 +22,7 @@ (type cloneable java/lang/Cloneable) -(type singleton +(type singleton avian/Singleton (array uintptr_t body)) (type classLoader java/lang/ClassLoader