Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/TypeSystemNodeFactory.java @ 20938:18c0f02fa4d2
Truffle-DSL: make type systems optional.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 14 Apr 2015 15:12:48 +0200 |
parents | c0fb70634640 |
children | 476374f3fe9a |
rev | line source |
---|---|
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 /* |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 * |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 * |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 * accompanied this code). |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 * |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 * |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
21 * questions. |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
22 */ |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
23 package com.oracle.truffle.dsl.processor.generator; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
24 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
25 import static com.oracle.truffle.dsl.processor.java.ElementUtils.*; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
26 import static javax.lang.model.element.Modifier.*; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
27 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
28 import javax.lang.model.element.*; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
29 import javax.lang.model.type.*; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
30 import javax.lang.model.util.*; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
31 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
32 import com.oracle.truffle.api.dsl.internal.*; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
33 import com.oracle.truffle.api.frame.*; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
34 import com.oracle.truffle.api.nodes.*; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
35 import com.oracle.truffle.dsl.processor.*; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
36 import com.oracle.truffle.dsl.processor.java.*; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
37 import com.oracle.truffle.dsl.processor.java.model.*; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
38 import com.oracle.truffle.dsl.processor.model.*; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
39 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
40 public class TypeSystemNodeFactory { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
41 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
42 private final ProcessorContext context; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
43 private final TypeSystemData typeSystem; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
44 private final DSLOptions options; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
45 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
46 public TypeSystemNodeFactory(ProcessorContext context, TypeSystemData typeSystem) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
47 this.context = context; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
48 this.typeSystem = typeSystem; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
49 this.options = typeSystem.getOptions(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
50 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
51 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
52 public static TypeMirror nodeType(TypeSystemData typeSystem) { |
20938
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
53 if (typeSystem.isDefault()) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
54 return typeSystem.getContext().getType(SpecializationNode.class); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
55 } else { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
56 TypeMirror parentType = TypeSystemCodeGenerator.createTypeSystemGen(typeSystem); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
57 return new GeneratedTypeMirror(getQualifiedName(parentType), typeName(typeSystem)); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
58 } |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
59 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
60 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
61 public static String typeName(TypeSystemData typeSystem) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
62 return getTypeId(typeSystem.getTemplateType().asType()) + "Node"; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
63 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
64 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
65 public static String acceptAndExecuteName() { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
66 return "acceptAndExecute"; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
67 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
68 |
20938
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
69 public static String executeName(TypeMirror type) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
70 if (type == null) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
71 return acceptAndExecuteName(); |
20938
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
72 } else if (ElementUtils.isObject(type)) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
73 return "executeGeneric"; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
74 } else { |
20938
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
75 return "execute" + getTypeId(type); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
76 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
77 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
78 |
20938
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
79 public static String voidBoxingExecuteName(TypeMirror type) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
80 return executeName(type) + "Void"; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
81 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
82 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
83 public CodeTypeElement create() { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
84 String typeName = typeName(typeSystem); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
85 TypeMirror baseType = context.getType(SpecializationNode.class); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
86 CodeTypeElement clazz = GeneratorUtils.createClass(typeSystem, null, modifiers(PUBLIC, ABSTRACT, STATIC), typeName, baseType); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
87 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
88 for (ExecutableElement constructor : ElementFilter.constructorsIn(ElementUtils.fromTypeMirror(baseType).getEnclosedElements())) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
89 clazz.add(GeneratorUtils.createSuperConstructor(context, clazz, constructor)); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
90 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
91 |
20938
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
92 for (TypeMirror type : typeSystem.getLegacyTypes()) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
93 clazz.add(createExecuteMethod(type)); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
94 if (GeneratorUtils.isTypeBoxingOptimized(options.voidBoxingOptimization(), type)) { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
95 clazz.add(createVoidBoxingExecuteMethod(type)); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
96 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
97 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
98 return clazz; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
99 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
100 |
20938
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
101 private Element createVoidBoxingExecuteMethod(TypeMirror type) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
102 TypeMirror voidType = context.getType(void.class); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
103 String methodName = voidBoxingExecuteName(type); |
20938
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
104 CodeExecutableElement method = new CodeExecutableElement(modifiers(PROTECTED, FINAL), voidType, methodName); |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18761
diff
changeset
|
105 method.addParameter(new CodeVariableElement(context.getType(Frame.class), "frame")); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
106 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
107 CodeTreeBuilder builder = method.createBuilder(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
108 builder.startTryBlock(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
109 builder.startStatement().startCall(executeName(type)).string("frame").end().end(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
110 builder.end(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
111 builder.startCatchBlock(context.getType(UnexpectedResultException.class), "e"); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
112 builder.end(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
113 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
114 return method; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
115 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
116 |
20938
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
117 private Element createExecuteMethod(TypeMirror type) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
118 TypeMirror genericType = context.getType(Object.class); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
119 String methodName = executeName(type); |
20938
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
120 CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), type, methodName); |
18776
c0fb70634640
Truffle-DSL: support for frame types Frame, MaterializedFrame. Added validation for frame type consistency. Some refactorings along the way.
Christian Humer <christian.humer@gmail.com>
parents:
18761
diff
changeset
|
121 method.addParameter(new CodeVariableElement(context.getType(Frame.class), "frame")); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
122 |
20938
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
123 if (ElementUtils.isObject(type)) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
124 method.getModifiers().add(ABSTRACT); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
125 } else { |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
126 CodeTreeBuilder builder = method.createBuilder(); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
127 CodeTree executeGeneric = builder.create().startCall(executeName(genericType)).string("frame").end().build(); |
20938
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
128 if (!ElementUtils.isVoid(type)) { |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
129 method.getThrownTypes().add(context.getType(UnexpectedResultException.class)); |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
130 } |
20938
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
18776
diff
changeset
|
131 builder.startReturn().tree(TypeSystemCodeGenerator.expect(typeSystem, type, executeGeneric)).end(); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
132 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
133 |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
134 return method; |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
135 } |
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
136 } |