diff --git a/src/machine.cpp b/src/machine.cpp index 94916963aa..4c03e74658 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -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); } diff --git a/test/Misc.java b/test/Misc.java index 620897332f..669e7bf691 100644 --- a/test/Misc.java +++ b/test/Misc.java @@ -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); } }