From 27a8c0b0e4bf2a05d8fe3a6d1482668a374ecb9f Mon Sep 17 00:00:00 2001 From: jzhou Date: Thu, 4 Feb 2010 18:39:24 +0000 Subject: [PATCH] add instanceof into multicore version runtime --- Robust/src/Runtime/multicoreruntime.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Robust/src/Runtime/multicoreruntime.c b/Robust/src/Runtime/multicoreruntime.c index 2690c157..9f4a825c 100644 --- a/Robust/src/Runtime/multicoreruntime.c +++ b/Robust/src/Runtime/multicoreruntime.c @@ -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() { } -- 2.34.1