Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationData.java @ 8252:0905d796944a
Refactored codegen error model to make error redirection a lot easier.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 13 Mar 2013 19:58:28 +0100 |
parents | cb70ed101b5f |
children | 4dc7034317ec |
comparison
equal
deleted
inserted
replaced
8251:cb70ed101b5f | 8252:0905d796944a |
---|---|
32 | 32 |
33 private final int order; | 33 private final int order; |
34 private final boolean generic; | 34 private final boolean generic; |
35 private final boolean uninitialized; | 35 private final boolean uninitialized; |
36 private final List<SpecializationThrowsData> exceptions; | 36 private final List<SpecializationThrowsData> exceptions; |
37 private SpecializationGuardData[] guards; | 37 private List<SpecializationGuardData> guards; |
38 private ShortCircuitData[] shortCircuits; | 38 private List<ShortCircuitData> shortCircuits; |
39 private boolean useSpecializationsForGeneric = true; | 39 private boolean useSpecializationsForGeneric = true; |
40 private NodeData node; | 40 private NodeData node; |
41 | 41 |
42 private final boolean synthetic; | 42 private final boolean synthetic; |
43 | 43 |
58 super(template); | 58 super(template); |
59 this.order = Specialization.DEFAULT_ORDER; | 59 this.order = Specialization.DEFAULT_ORDER; |
60 this.generic = generic; | 60 this.generic = generic; |
61 this.uninitialized = uninitialized; | 61 this.uninitialized = uninitialized; |
62 this.exceptions = Collections.emptyList(); | 62 this.exceptions = Collections.emptyList(); |
63 this.guards = new SpecializationGuardData[0]; | 63 this.guards = new ArrayList<>(); |
64 this.synthetic = synthetic; | 64 this.synthetic = synthetic; |
65 } | 65 } |
66 | 66 |
67 @Override | |
68 protected List<MessageContainer> findChildContainers() { | |
69 List<MessageContainer> sinks = new ArrayList<>(); | |
70 if (exceptions != null) { | |
71 sinks.addAll(exceptions); | |
72 } | |
73 if (guards != null) { | |
74 sinks.addAll(guards); | |
75 } | |
76 return sinks; | |
77 } | |
78 | |
67 public boolean hasRewrite(ProcessorContext context) { | 79 public boolean hasRewrite(ProcessorContext context) { |
68 if (getExceptions().size() > 0) { | 80 if (!getExceptions().isEmpty()) { |
69 return true; | 81 return true; |
70 } | 82 } |
71 if (getGuards().length > 0) { | 83 if (!getGuards().isEmpty()) { |
72 return true; | 84 return true; |
73 } | 85 } |
74 for (ActualParameter parameter : getParameters()) { | 86 for (ActualParameter parameter : getParameters()) { |
75 NodeFieldData field = getNode().findField(parameter.getSpecification().getName()); | 87 NodeFieldData field = getNode().findField(parameter.getSpecification().getName()); |
76 if (field == null) { | 88 if (field == null) { |
90 | 102 |
91 public void setNode(NodeData node) { | 103 public void setNode(NodeData node) { |
92 this.node = node; | 104 this.node = node; |
93 } | 105 } |
94 | 106 |
95 public void setGuards(SpecializationGuardData[] guards) { | 107 public void setGuards(List<SpecializationGuardData> guards) { |
96 this.guards = guards; | 108 this.guards = guards; |
97 } | 109 } |
98 | 110 |
99 public boolean isSynthetic() { | 111 public boolean isSynthetic() { |
100 return synthetic; | 112 return synthetic; |
114 | 126 |
115 public List<SpecializationThrowsData> getExceptions() { | 127 public List<SpecializationThrowsData> getExceptions() { |
116 return exceptions; | 128 return exceptions; |
117 } | 129 } |
118 | 130 |
119 public SpecializationGuardData[] getGuards() { | 131 public List<SpecializationGuardData> getGuards() { |
120 return guards; | 132 return guards; |
121 } | 133 } |
122 | 134 |
123 public void setShortCircuits(ShortCircuitData[] shortCircuits) { | 135 public void setShortCircuits(List<ShortCircuitData> shortCircuits) { |
124 this.shortCircuits = shortCircuits; | 136 this.shortCircuits = shortCircuits; |
125 } | 137 } |
126 | 138 |
127 public ShortCircuitData[] getShortCircuits() { | 139 public List<ShortCircuitData> getShortCircuits() { |
128 return shortCircuits; | 140 return shortCircuits; |
129 } | 141 } |
130 | 142 |
131 void setUseSpecializationsForGeneric(boolean useSpecializationsForGeneric) { | 143 void setUseSpecializationsForGeneric(boolean useSpecializationsForGeneric) { |
132 this.useSpecializationsForGeneric = useSpecializationsForGeneric; | 144 this.useSpecializationsForGeneric = useSpecializationsForGeneric; |