Permalink
Browse files

ensure that array classes implement Cloneable and Serializable in boo…

…timage build
  • Loading branch information...
1 parent 96a4b6e commit 3309a9f4ad5e021fa84d1a09c56e451a0373b83d @dicej dicej committed Mar 15, 2013
Showing with 22 additions and 9 deletions.
  1. +16 −9 src/machine.cpp
  2. +6 −0 test/Misc.java
View
@@ -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
@@ -250,5 +250,11 @@ public static void main(String[] args) {
μ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);
}
}

0 comments on commit 3309a9f

Please sign in to comment.