comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/NodeFactory.java @ 9258:07f8d136a05e

Truffle API changes for the Frame API. Introduction of Assumptions class.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 23 Apr 2013 15:34:06 +0200
parents aa9ffb3a715e
children 8cf939b349dd
comparison
equal deleted inserted replaced
9257:542712a4732a 9258:07f8d136a05e
49 public FunctionDefinitionNode findFunction(String name) { 49 public FunctionDefinitionNode findFunction(String name) {
50 return functions.get(name); 50 return functions.get(name);
51 } 51 }
52 52
53 public void startFunction() { 53 public void startFunction() {
54 frameDescriptor = new FrameDescriptor(SLTypesGen.SLTYPES); 54 frameDescriptor = new FrameDescriptor();
55 } 55 }
56 56
57 public void createFunction(StatementNode body, String name) { 57 public void createFunction(StatementNode body, String name) {
58 functions.put(name, new FunctionDefinitionNode(body, frameDescriptor, name, returnValue)); 58 functions.put(name, new FunctionDefinitionNode(body, frameDescriptor, name, returnValue));
59 } 59 }
60 60
61 public TypedNode createLocal(String name) { 61 public TypedNode createLocal(String name) {
62 return ReadLocalNodeFactory.create(frameDescriptor.findOrAddFrameSlot(name)); 62 return ReadLocalNodeFactory.create(frameDescriptor.findOrAddFrameSlot(name, Integer.class));
63 } 63 }
64 64
65 public TypedNode createStringLiteral(String value) { 65 public TypedNode createStringLiteral(String value) {
66 return StringLiteralNodeFactory.create(value); 66 return StringLiteralNodeFactory.create(value);
67 } 67 }
68 68
69 public StatementNode createAssignment(String name, TypedNode right) { 69 public StatementNode createAssignment(String name, TypedNode right) {
70 return WriteLocalNodeFactory.create(frameDescriptor.findOrAddFrameSlot(name), right); 70 return WriteLocalNodeFactory.create(frameDescriptor.findOrAddFrameSlot(name, Integer.class), right);
71 } 71 }
72 72
73 public StatementNode createPrint(List<TypedNode> expressions) { 73 public StatementNode createPrint(List<TypedNode> expressions) {
74 if (expressions.size() >= 1) { 74 if (expressions.size() >= 1) {
75 StatementNode[] nodes = new StatementNode[expressions.size() + 1]; 75 StatementNode[] nodes = new StatementNode[expressions.size() + 1];
121 public TypedNode createTime() { 121 public TypedNode createTime() {
122 return TimeNodeFactory.create(); 122 return TimeNodeFactory.create();
123 } 123 }
124 124
125 public StatementNode createReturn(TypedNode value) { 125 public StatementNode createReturn(TypedNode value) {
126 FrameSlot slot = frameDescriptor.findOrAddFrameSlot("<retval>"); 126 FrameSlot slot = frameDescriptor.findOrAddFrameSlot("<retval>", Integer.class);
127 if (returnValue == null) { 127 if (returnValue == null) {
128 returnValue = ReadLocalNodeFactory.create(slot); 128 returnValue = ReadLocalNodeFactory.create(slot);
129 } 129 }
130 StatementNode write = WriteLocalNodeFactory.create(slot, value); 130 StatementNode write = WriteLocalNodeFactory.create(slot, value);
131 return new ReturnNode(write); 131 return new ReturnNode(write);