From a6ce1a68c0ecd4ba01222d88756c1f9d39bcc34d Mon Sep 17 00:00:00 2001 From: jzhou Date: Wed, 4 Jan 2012 01:25:14 +0000 Subject: [PATCH] remove the '$' in the C code as tilera does not allow it --- Robust/src/IR/Tree/BuildIR.java | 6 +++--- Robust/src/IR/Tree/SemanticCheck.java | 20 ++++++++++---------- Robust/src/IR/TypeDescriptor.java | 2 ++ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Robust/src/IR/Tree/BuildIR.java b/Robust/src/IR/Tree/BuildIR.java index ca56794d..c8efb8e7 100644 --- a/Robust/src/IR/Tree/BuildIR.java +++ b/Robust/src/IR/Tree/BuildIR.java @@ -662,8 +662,8 @@ private void addOuterClassParam( ClassDescriptor cn, ClassDescriptor ocn, int de for(Iterator method_it=icd.getMethods(); method_it.hasNext(); ) { MethodDescriptor md=(MethodDescriptor)method_it.next(); if( md.isConstructor() ){ - md.addParameter( theTypeDesc, "surrounding$" + String.valueOf(depth) ); - initializeOuterMember( md, "this$" + String.valueOf( depth ), "surrounding$" + String.valueOf(depth) ); + md.addParameter( theTypeDesc, "surrounding___DOLLAR___" + String.valueOf(depth) ); + initializeOuterMember( md, "this___DOLLAR___" + String.valueOf( depth ), "surrounding___DOLLAR___" + String.valueOf(depth) ); //System.out.println( "The added param is " + md.toString() + "\n" ); } } @@ -691,7 +691,7 @@ private void addOuterClassReferences( ClassDescriptor cn, ClassDescriptor ocn, i tempChildNode.addChild("identifier").addChild ( tempCopy ); theNode.addChild("type").addChild( theTypeNode ); ParseNode variableDeclaratorID = new ParseNode("single"); - String theStr = "this$" + String.valueOf( depth ); + String theStr = "this___DOLLAR___" + String.valueOf( depth ); variableDeclaratorID.addChild( theStr ); ParseNode variableDeclarator = new ParseNode( "variable_declarator" ); variableDeclarator.addChild( variableDeclaratorID ); diff --git a/Robust/src/IR/Tree/SemanticCheck.java b/Robust/src/IR/Tree/SemanticCheck.java index 7851ae38..4ec6c4ba 100644 --- a/Robust/src/IR/Tree/SemanticCheck.java +++ b/Robust/src/IR/Tree/SemanticCheck.java @@ -702,8 +702,8 @@ public class SemanticCheck { if(icd.getSurroundingDesc()==ltd.getClassDesc()) { // this is a surrounding class access inside an inner class fan.setExpression(nn); - fan.setFieldName("this$0"); - fd = (FieldDescriptor)icd.getFieldTable().get("this$0"); + fan.setFieldName("this___DOLLAR___0"); + fd = (FieldDescriptor)icd.getFieldTable().get("this___DOLLAR___0"); } else if(icd==ltd.getClassDesc()) { // this is an inner class this operation fd = new FieldDescriptor(new Modifiers(),new TypeDescriptor(icd),"this",null,false); @@ -908,7 +908,7 @@ public class SemanticCheck { String composed = "this"; NameDescriptor runningDesc = new NameDescriptor( "this" );; - composed = "this$" + String.valueOf(startingDepth-depth-1); + composed = "this___DOLLAR___" + String.valueOf(startingDepth-depth-1); runningDesc = new NameDescriptor(runningDesc, composed); NameDescriptor idDesc = new NameDescriptor( runningDesc, varname ); @@ -1242,8 +1242,8 @@ public class SemanticCheck { int index = 0; while(it_fields.hasNext()) { FieldDescriptor fd = (FieldDescriptor)(it_fields.next()); - if(fd.getSymbol().startsWith("this$")) { - con.addArgument(new NameNode(new NameDescriptor("this$"+index))); + if(fd.getSymbol().startsWith("this___DOLLAR___")) { + con.addArgument(new NameNode(new NameDescriptor("this___DOLLAR___"+index))); index++; } } @@ -1316,7 +1316,7 @@ public class SemanticCheck { if(cd.getSuperDesc().isInnerClass()&&!cd.getSuperDesc().isStatic()&&!cd.getSuperDesc().getInStaticContext()) { // for a super class that is also an inner class with surrounding reference, add the surrounding // instance of the child instance as the parent instance's surrounding instance - min.addArgument(new NameNode(new NameDescriptor("surrounding$0"))); + min.addArgument(new NameNode(new NameDescriptor("surrounding___DOLLAR___0"))); } } for(int i = 0 ; i < tdarray.length; i++) { @@ -1531,11 +1531,11 @@ NextMethod: for (Iterator methodit = methoddescriptorset.iterator(); methodit.ha NameDescriptor runningDesc = new NameDescriptor( "this" );; for ( int index = startingDepth; index > depth; --index ) { - composed = "this$" + String.valueOf( index - 1 ); + composed = "this___DOLLAR___" + String.valueOf( index - 1 ); runningDesc = new NameDescriptor( runningDesc, composed ); } if( false == cd.isInnerClass() ) - runningDesc = new NameDescriptor( runningDesc, "this$" + String.valueOf(0) ); //all the way up. + runningDesc = new NameDescriptor( runningDesc, "this___DOLLAR___" + String.valueOf(0) ); //all the way up. return new NameNode(runningDesc); } @@ -1606,9 +1606,9 @@ NextMethod: for (Iterator methodit = methoddescriptorset.iterator(); methodit.ha // for a super class that is also an inner class with surrounding reference, add the surrounding // instance of the child instance as the parent instance's surrounding instance if(((MethodDescriptor)md).isConstructor()) { - min.addArgument(new NameNode(new NameDescriptor("surrounding$0"))); + min.addArgument(new NameNode(new NameDescriptor("surrounding___DOLLAR___0"))); } else if(((MethodDescriptor)md).getClassDesc().isInnerClass()&&!((MethodDescriptor)md).getClassDesc().isStatic()&&!((MethodDescriptor)md).getClassDesc().getInStaticContext()) { - min.addArgument(new NameNode(new NameDescriptor("this$0"))); + min.addArgument(new NameNode(new NameDescriptor("this___DOLLAR___0"))); } } tdarray=new TypeDescriptor[min.numArgs()]; diff --git a/Robust/src/IR/TypeDescriptor.java b/Robust/src/IR/TypeDescriptor.java index dfaf3550..431d964d 100644 --- a/Robust/src/IR/TypeDescriptor.java +++ b/Robust/src/IR/TypeDescriptor.java @@ -150,6 +150,8 @@ public class TypeDescriptor extends Descriptor { return "float"; else if (isOffset()) return "short"; + else if (isNull()) + return "null"; else throw new Error("Error Type: "+type); } -- 2.34.1