[llvm-commits] CVS: llvm-java/docs/object-layout.txt

Alkis Evlogimenos alkis at cs.uiuc.edu
Wed Sep 8 13:10:20 PDT 2004



Changes in directory llvm-java/docs:

object-layout.txt updated: 1.2 -> 1.3
---
Log message:

Fixup code and struct declarations.


---
Diffs of the changes:  (+18 -17)

Index: llvm-java/docs/object-layout.txt
diff -u llvm-java/docs/object-layout.txt:1.2 llvm-java/docs/object-layout.txt:1.3
--- llvm-java/docs/object-layout.txt:1.2	Wed Sep  8 14:26:13 2004
+++ llvm-java/docs/object-layout.txt	Wed Sep  8 15:10:09 2004
@@ -4,9 +4,9 @@
 Each Java object will have the following basic layout:
 
 struct llvm_java_object_base {
-  llvm_java_object_header header;
-  llvm_java_object_vtable* vtable;
-}
+  struct llvm_java_object_header header;
+  struct llvm_java_object_vtable* vtable;
+};
 
 Additional fields go to the end of the struct.
 
@@ -16,7 +16,7 @@
 
 struct llvm_java_object_header {
   // gc info, hash info, locking
-}
+};
 
 
 
@@ -26,8 +26,8 @@
 at runtime.
 
 struct llvm_java_object_vtable {
-  java_object_typeinfo typeinfo;
-}
+  struct java_object_typeinfo typeinfo;
+};
 
 
 
@@ -47,24 +47,25 @@
 
 struct llvm_java_object_typeinfo {
   uint depth;
-  llvm_java_object_vtable* vtables;
+  struct llvm_java_object_vtable* vtables;
   uint lastIface;
-  llvm_java_object_vtable* interfaces;
-}
+  struct llvm_java_object_vtable* interfaces;
+};
 
 The structure of llvm_java_object_typeinfo allows constant time
 dynamic type checks:
 
-bool isInstanceOf(llvm_java_object_base* obj, llvm_java_object_vtable* clazz) {
-  llvm_java_object_vtable* objClazz = obj->vtable;
+int isInstanceOf(struct llvm_java_object_base* obj,
+                 struct llvm_java_object_vtable* clazz) {
+  struct llvm_java_object_vtable* objClazz = obj->vtable;
   if (objClazz == clazz)
-    return true;
+    return 1;
   // we are checking against a class' typeinfo
-  if (clazz->interfaces != -1)
-    return objClazz->depth > clazz->depth &&
-           objClazz->vtables[clazz->depth] == clazz;
+  if (clazz->typeinfo.interfaces != (struct llvm_java_object_vtable*)-1)
+    return objClazz->typeinfo.depth > clazz->typeinfo.depth &&
+           &objClazz->typeinfo.vtables[clazz->typeinfo.depth] == clazz;
   // otherwise we are checking against an interface's typeinfo
   else
-    return objClazz->lastIface >= clazz->lastIface &&
-           objClazz->interfaces[class->lastIface];
+    return objClazz->typeinfo.lastIface >= clazz->typeinfo.lastIface &&
+           &objClazz->typeinfo.interfaces[clazz->typeinfo.lastIface];
 }






More information about the llvm-commits mailing list