From 5850a15dcdc6aec01a410a42aa01c058e963b2fe Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 15 Aug 2006 17:37:27 +0000 Subject: [PATCH] check in changes --- Robust/src/IR/Flat/BuildCode.java | 5 ++++ Robust/src/IR/Flat/FlatFlagActionNode.java | 10 +++++++ Robust/src/Runtime/runtime.c | 31 ++++++++++++++++++---- Robust/src/Runtime/runtime.h | 2 +- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 77a1e093..380b2a81 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -79,6 +79,10 @@ public class BuildCode { outmethodheader.println("#include \"structdefs.h\""); /* Output types for short array and string */ + outstructs.println("#define STRINGARRAYTYPE "+ + (state.getArrayNumber( + (new TypeDescriptor(typeutil.getClass(TypeUtil.StringClass))).makeArray(state))+state.numClasses())); + outstructs.println("#define STRINGTYPE "+typeutil.getClass(TypeUtil.StringClass).getId()); outstructs.println("#define CHARARRAYTYPE "+ (state.getArrayNumber((new TypeDescriptor(TypeDescriptor.CHAR)).makeArray(state))+state.numClasses())); @@ -1049,5 +1053,6 @@ public class BuildCode { public void generateFlatFlagActionNode(FlatMethod fm, FlatFlagActionNode ffann, PrintWriter output) { output.print("/* FlatFlagActionNode will go here */"); + } } diff --git a/Robust/src/IR/Flat/FlatFlagActionNode.java b/Robust/src/IR/Flat/FlatFlagActionNode.java index a6bff51f..41b93f40 100644 --- a/Robust/src/IR/Flat/FlatFlagActionNode.java +++ b/Robust/src/IR/Flat/FlatFlagActionNode.java @@ -24,6 +24,16 @@ public class FlatFlagActionNode extends FlatNode { public int kind() { return FKind.FlatFlagActionNode; } + + /** This method returns an iterator over the Temp/Flag pairs. */ + + public Iterator getTempFlagPairs() { + return tempflagpairs.keySet().iterator(); + } + + public boolean getFlagChange(TempFlagPair tfp) { + return ((Boolean)tempflagpairs.get(tfp)).booleanValue(); + } public TempDescriptor [] readsTemps() { if (tempflagpairs.size()==0) diff --git a/Robust/src/Runtime/runtime.c b/Robust/src/Runtime/runtime.c index 084469da..c91890a9 100644 --- a/Robust/src/Runtime/runtime.c +++ b/Robust/src/Runtime/runtime.c @@ -1,5 +1,7 @@ #include "runtime.h" #include "structdefs.h" +#include + extern int classsize[]; #ifdef BOEHM_GC #include "gc.h" @@ -8,6 +10,26 @@ extern int classsize[]; #define FREEMALLOC(x) calloc(1,x) #endif +#ifdef TASK +int main(int argc, char **argv) { + int i; + /* Allocate startup object */ + struct ___StartupObject___ *startupobject=(struct ___StartupObject___*) allocate_new(STARTUPTYPE); + + /* Build array of strings */ + struct ArrayObject * stringarray=allocate_newarray(STRINGARRAYTYPE, argc); + startupobject->___parameters___=stringarray; + + for(i=0;i___length___)+sizeof(int)))[i]=newstring; + } + + +} +#endif + int ___Object______hashcode____(struct ___Object___ * ___this___) { return (int) ___this___; } @@ -21,17 +43,16 @@ void ___System______printString____L___String___(struct ___String___ * s) { } } - void * allocate_new(int type) { void * v=FREEMALLOC(classsize[type]); *((int *)v)=type; return v; } -void * allocate_newarray(int type, int length) { - void * v=FREEMALLOC(sizeof(struct ArrayObject)+length*classsize[type]); - *((int *)v)=type; - ((struct ArrayObject *)v)->___length___=length; +struct ArrayObject * allocate_newarray(int type, int length) { + struct ArrayObject * v=FREEMALLOC(sizeof(struct ArrayObject)+length*classsize[type]); + v->type=type; + v->___length___=length; return v; } diff --git a/Robust/src/Runtime/runtime.h b/Robust/src/Runtime/runtime.h index b84919e7..eb020ef2 100644 --- a/Robust/src/Runtime/runtime.h +++ b/Robust/src/Runtime/runtime.h @@ -5,7 +5,7 @@ void * allocate_new(int type); -void * allocate_newarray(int type, int length); +struct ArrayObject * allocate_newarray(int type, int length); struct ___String___ * NewString(char *str,int length); void failedboundschk(); -- 2.34.1