[llvm-commits] CVS: llvm-java/runtime/runtime.c

Alkis Evlogimenos alkis at cs.uiuc.edu
Tue May 10 19:29:30 PDT 2005



Changes in directory llvm-java/runtime:

runtime.c updated: 1.36 -> 1.37
---
Log message:

Reverse the array of superclasses in the type information block. This
makes instanceof a bit faster since we don't need to subtract the two
depths to check if a class is a subclass of another.

This was pointed out by Dinakar at the presentation today. Thanks Dinakar :-)


---
Diffs of the changes:  (+2 -2)

 runtime.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm-java/runtime/runtime.c
diff -u llvm-java/runtime/runtime.c:1.36 llvm-java/runtime/runtime.c:1.37
--- llvm-java/runtime/runtime.c:1.36	Sun Apr  3 18:05:07 2005
+++ llvm-java/runtime/runtime.c	Tue May 10 21:28:59 2005
@@ -32,7 +32,7 @@
   if (llvm_java_is_interface_class(cr) || cr->typeinfo.depth == 0)
     return NULL;
 
-  return cr->typeinfo.superclasses[0];
+  return cr->typeinfo.superclasses[cr->typeinfo.depth - 1];
 }
 
 jboolean llvm_java_is_assignable_from(struct llvm_java_class_record* cr,
@@ -63,7 +63,7 @@
   /* otherwise this is a class, check if from is a superclass of this
    * class */
   if (cr->typeinfo.depth > from->typeinfo.depth) {
-    int index = cr->typeinfo.depth - from->typeinfo.depth - 1;
+    int index = from->typeinfo.depth;
     return cr->typeinfo.superclasses[index] == from;
   }
 






More information about the llvm-commits mailing list