From: jzhou Date: Thu, 4 Feb 2010 18:39:24 +0000 (+0000) Subject: add instanceof into multicore version runtime X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=27a8c0b0e4bf2a05d8fe3a6d1482668a374ecb9f;p=IRC.git add instanceof into multicore version runtime --- 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() { }