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;
public class Addendum {
public Object pool;
public Singleton pool;
public Object annotationTable;
public Object signature;
}

View File

@ -1,5 +1,5 @@
package avian;
class Code {
abstract class Code {
// 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 long getLong(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 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;

View File

@ -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<object>(type(t, GcClassLoader::Type)->staticTable()),
fieldOffset(t, scl), root(t, Machine::AppLoader));
fieldAtOffset<uint8_t>(type(t, GcClassLoader::Type)->staticTable(),

View File

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

View File

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

View File

@ -1213,7 +1213,7 @@ getClassAddendum(Thread* t, GcClass* class_, GcSingleton* pool)
if (addendum == 0) {
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,
reinterpret_cast<object>(class_),
ClassAddendum,
@ -1350,7 +1350,7 @@ parseFieldTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
{
if (addendum == 0) {
addendum = reinterpret_cast<object>(
makeFieldAddendum(t, reinterpret_cast<object>(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<object>(
makeFieldAddendum(t, reinterpret_cast<object>(pool), 0, 0));
makeFieldAddendum(t, pool, 0, 0));
}
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)
{
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();
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)
{
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));
@ -2129,7 +2129,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
&byteArrayBody(t, attributeName, 0)) == 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,
@ -2139,7 +2139,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
&byteArrayBody(t, attributeName, 0)) == 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));
@ -2152,7 +2152,7 @@ parseMethodTable(Thread* t, Stream& s, GcClass* class_, GcSingleton* pool)
&byteArrayBody(t, attributeName, 0)) == 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));
@ -2465,7 +2465,7 @@ updateClassTables(Thread* t, GcClass* newClass, GcClass* oldClass)
}
}
object staticTable = newClass->staticTable();
object staticTable = reinterpret_cast<object>(newClass->staticTable());
if (staticTable) {
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_->methodTable()),
class_->addendum(),
reinterpret_cast<object>(class_->staticTable()),
class_->staticTable(),
reinterpret_cast<object>(class_->loader()),
vtableLength);

View File

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

View File

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