add instanceof into multicore version runtime
authorjzhou <jzhou>
Thu, 4 Feb 2010 18:39:24 +0000 (18:39 +0000)
committerjzhou <jzhou>
Thu, 4 Feb 2010 18:39:24 +0000 (18:39 +0000)
Robust/src/Runtime/multicoreruntime.c

index 2690c1577faed6c92ea1441eeb6d49e626809eb9..9f4a825c3e6af876098e3a5682b678e2658ef249 100644 (file)
@@ -15,6 +15,8 @@
 //#include "option.h"
 
 extern int classsize[];
+extern int typearray[];
+extern int typearray2[];
 #ifndef MULTICORE
 jmp_buf error_handler;
 int instructioncount;
@@ -35,6 +37,24 @@ int instaccum=0;
 
 int debugtask=0;
 
+int instanceof(struct ___Object___ *ptr, int type) {
+  int i=ptr->type;
+  do {
+    if (i==type)
+      return 1;
+    i=typearray[i];
+  } while(i!=-1);
+  i=ptr->type;
+  if (i>NUMCLASSES) {
+    do {
+      if (i==type)
+       return 1;
+      i=typearray2[i-NUMCLASSES];
+    } while(i!=-1);
+  }
+  return 0;
+}
+
 #ifdef MULTICORE
 void initializeexithandler() {
 }