[llvm-commits] CVS: llvm-java/docs/object-layout.txt
Alkis Evlogimenos
alkis at cs.uiuc.edu
Tue Oct 26 11:56:36 PDT 2004
Changes in directory llvm-java/docs:
object-layout.txt updated: 1.5 -> 1.6
---
Log message:
Add docs for java layout for java arrays.
---
Diffs of the changes: (+29 -0)
Index: llvm-java/docs/object-layout.txt
diff -u llvm-java/docs/object-layout.txt:1.5 llvm-java/docs/object-layout.txt:1.6
--- llvm-java/docs/object-layout.txt:1.5 Fri Sep 10 15:21:16 2004
+++ llvm-java/docs/object-layout.txt Tue Oct 26 13:56:26 2004
@@ -74,3 +74,32 @@
return objClazz->typeinfo.lastIface >= clazz->typeinfo.lastIface &&
objClazz->typeinfo.interfaces[clazz->typeinfo.lastIface];
}
+
+Object Layout for Java Arrays
+-----------------------------
+
+Java primitive arrays inherit from java.lang.Object so they will at
+minimum have a nested java.lang.Object struct as their first element.
+
+struct javaIntArray {
+ struct java_lang_Object;
+ unsigned length;
+ int array[0];
+};
+
+The typeinfo struct inside this class' vtable will be filled in the
+same way as if this was a proper class. This will allow isInstanceOf
+to work transparently for primitive java arrays.
+
+For reference type arrays we use the same struct with a different
+typeinfo:
+
+struct javaObjectArray {
+ struct java_lang_Object;
+ unsigned length;
+ java_lang_Object[0];
+};
+
+The typeinfo struct will reflect a hierarchy of array types as if B[]
+derives from A[] if B derives from A. This will allow isInstanceOf to
+work transparently for object arrays as well.
More information about the llvm-commits
mailing list