comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/GuardData.java @ 16755:bd28da642eea

Truffle-DSL: Several new features implemented: Implementation of a new code generation layout which shares code between generated nodes. Declaration order of specializations is now used as specialization order. Specializations do no longer perform fallthrough on respecialization, they now always respecialize from the first specialization. Implemented support for contains relations between specializations. Improved reachability error messages. Preliminary support for @Implies.
author Christian Humer <christian.humer@gmail.com>
date Mon, 11 Aug 2014 15:53:05 +0200
parents f33beed55ddc
children
comparison
equal deleted inserted replaced
16754:55fd5be68a52 16755:bd28da642eea
20 * or visit www.oracle.com if you need additional information or have any 20 * or visit www.oracle.com if you need additional information or have any
21 * questions. 21 * questions.
22 */ 22 */
23 package com.oracle.truffle.dsl.processor.typesystem; 23 package com.oracle.truffle.dsl.processor.typesystem;
24 24
25 import com.oracle.truffle.dsl.processor.node.*; 25 import java.util.*;
26
26 import com.oracle.truffle.dsl.processor.template.*; 27 import com.oracle.truffle.dsl.processor.template.*;
27 28
28 public class GuardData extends TemplateMethod { 29 public class GuardData extends TemplateMethod {
29 30
30 private final SpecializationData specialization; 31 private List<GuardExpression> impliesExpressions;
31 private final boolean negated;
32 32
33 public GuardData(TemplateMethod method, SpecializationData specialization, boolean negated) { 33 public GuardData(TemplateMethod method, List<GuardExpression> impliesExpressions) {
34 super(method); 34 super(method);
35 this.negated = negated; 35 this.impliesExpressions = impliesExpressions;
36 this.specialization = specialization;
37 } 36 }
38 37
39 public boolean isNegated() { 38 public List<GuardExpression> getImpliesExpressions() {
40 return negated; 39 return impliesExpressions;
41 } 40 }
42 41
43 @Override 42 @Override
44 public boolean equals(Object obj) { 43 public boolean equals(Object obj) {
45 if (obj instanceof GuardData) { 44 if (obj instanceof GuardData) {
46 GuardData other = (GuardData) obj; 45 GuardData other = (GuardData) obj;
47 return getMethod().equals(other.getMethod()) && negated == other.negated; 46 return getMethod().equals(other.getMethod());
48 } 47 }
49 return false; 48 return false;
50 } 49 }
51 50
52 @Override 51 @Override
53 public int hashCode() { 52 public int hashCode() {
54 return getMethod().hashCode(); 53 return getMethod().hashCode();
55 } 54 }
56 55
57 public SpecializationData getSpecialization() {
58 return specialization;
59 }
60
61 @Override
62 public String toString() {
63 return (negated ? "!" : "") + getMethodName() + getParameters().toString();
64 }
65
66 } 56 }