ensure that array classes implement Cloneable and Serializable in bootimage build

This commit is contained in:
Joel Dice 2013-03-15 13:25:12 -06:00
parent 96a4b6e508
commit 3309a9f4ad
2 changed files with 22 additions and 9 deletions

View File

@ -2650,6 +2650,20 @@ nameClass(Thread* t, Machine::Type type, const char* name)
set(t, arrayBody(t, t->m->types, type), ClassName, n);
}
void
makeArrayInterfaceTable(Thread* t)
{
object interfaceTable = makeArray(t, 4);
set(t, interfaceTable, ArrayBody, type
(t, Machine::SerializableType));
set(t, interfaceTable, ArrayBody + (2 * BytesPerWord),
type(t, Machine::CloneableType));
setRoot(t, Machine::ArrayInterfaceTable, interfaceTable);
}
void
boot(Thread* t)
{
@ -2761,15 +2775,7 @@ boot(Thread* t)
setRoot(t, Machine::StringMap, makeWeakHashMap(t, 0, 0));
{ object interfaceTable = makeArray(t, 4);
set(t, interfaceTable, ArrayBody, type(t, Machine::SerializableType));
set(t, interfaceTable, ArrayBody + (2 * BytesPerWord),
type(t, Machine::CloneableType));
setRoot(t, Machine::ArrayInterfaceTable, interfaceTable);
}
makeArrayInterfaceTable(t);
set(t, type(t, Machine::BooleanArrayType), ClassInterfaceTable,
root(t, Machine::ArrayInterfaceTable));
@ -3228,6 +3234,7 @@ Thread::init()
if (image and code) {
m->processor->boot(this, image, code);
makeArrayInterfaceTable(this);
} else {
boot(this);
}

View File

@ -250,5 +250,11 @@ public class Misc {
μInstance.μMethod(8933);
expect(μInstance.μField == 8933);
}
expect(new int[0] instanceof Cloneable);
expect(new int[0] instanceof java.io.Serializable);
expect(new Object[0] instanceof Cloneable);
expect(new Object[0] instanceof java.io.Serializable);
}
}