From 148bd0d53599dfafeae3d2b84bc30699f3dfd57f Mon Sep 17 00:00:00 2001 From: jzhou Date: Mon, 24 Jan 2011 22:14:25 +0000 Subject: [PATCH] Some changes to enable SPECjbb for MGC version. Enable the compilation for 1. class type, 2. try-catch-finally, 3. transient modifier, 4. array-create-init statement. Now the compiler can parse code with these features but does not process them. Also add some interfaces for String, FileOutputStream classes. --- Robust/src/ClassLibrary/FileOutputStream.java | 6 + Robust/src/ClassLibrary/String.java | 36 +++++ Robust/src/IR/Tree/BuildIR.java | 24 +++- Robust/src/IR/Tree/ClassTypeNode.java | 31 +++++ Robust/src/IR/Tree/Kind.java | 1 + Robust/src/IR/Tree/Modifiers.java | 8 +- Robust/src/Parse/java14.cup | 128 ++++++++++++------ 7 files changed, 194 insertions(+), 40 deletions(-) create mode 100644 Robust/src/IR/Tree/ClassTypeNode.java diff --git a/Robust/src/ClassLibrary/FileOutputStream.java b/Robust/src/ClassLibrary/FileOutputStream.java index 297cd482..07658f10 100644 --- a/Robust/src/ClassLibrary/FileOutputStream.java +++ b/Robust/src/ClassLibrary/FileOutputStream.java @@ -1,3 +1,5 @@ +import java.io.FileDescriptor; + public class FileOutputStream extends OutputStream { private int fd; @@ -26,6 +28,10 @@ public class FileOutputStream extends OutputStream { public FileOutputStreamOpen(String pathname) { fd = nativeOpen(pathname.getBytes()); } + + public FileOutputStream(FileDescriptor fdObj) { + fd = nativeOpen(fdObj.channel.getBytes()); + } private static native int nativeOpen(byte[] filename); private static native int nativeAppend(byte[] filename); diff --git a/Robust/src/ClassLibrary/String.java b/Robust/src/ClassLibrary/String.java index 52147045..e306e742 100644 --- a/Robust/src/ClassLibrary/String.java +++ b/Robust/src/ClassLibrary/String.java @@ -41,6 +41,29 @@ public class String { this.count=length; this.offset=0; } + + public String(byte str[], String encoding) { + int length = this.count; + if (length>(str.length)) + length=str.length; + char charstr[]=new char[length]; + for(int i=0; i(str.length-offset)) + length=str.length-offset; + char charstr[]=new char[length]; + for(int i=0; i count) || (srcBegin > srcEnd)) { + // FIXME + System.printString("Index error: "+srcBegin+" "+srcEnd+" "+count+"\n"+this); + System.exit(-1); + } + int len = srcEnd - srcBegin; + int j = dstBegin; + for(int i=srcBegin; i