Mercurial > hg > truffle
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/TypeSystemData.java @ 16817:0370880ac9ce
Truffle-DSL: better caching for type checks.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 13 Aug 2014 18:06:26 +0200 |
parents | 8169deda04bb |
children | 58eb9bbb60c4 |
comparison
equal
deleted
inserted
replaced
16816:8d374faacb7e | 16817:0370880ac9ce |
---|---|
58 if (types != null) { | 58 if (types != null) { |
59 for (TypeData typeData : types) { | 59 for (TypeData typeData : types) { |
60 primitiveTypeMirrors.add(typeData.getPrimitiveType()); | 60 primitiveTypeMirrors.add(typeData.getPrimitiveType()); |
61 boxedTypeMirrors.add(typeData.getBoxedType()); | 61 boxedTypeMirrors.add(typeData.getBoxedType()); |
62 cachedTypes.put(ElementUtils.getUniqueIdentifier(typeData.getPrimitiveType()), typeData); | 62 cachedTypes.put(ElementUtils.getUniqueIdentifier(typeData.getPrimitiveType()), typeData); |
63 cachedTypes.put(ElementUtils.getUniqueIdentifier(typeData.getBoxedType()), typeData); | |
63 } | 64 } |
64 } | 65 } |
65 } | 66 } |
66 | 67 |
67 public void setImplicitCasts(List<ImplicitCastData> implicitCasts) { | 68 public void setImplicitCasts(List<ImplicitCastData> implicitCasts) { |
116 | 117 |
117 public List<TypeMirror> getPrimitiveTypeMirrors() { | 118 public List<TypeMirror> getPrimitiveTypeMirrors() { |
118 return primitiveTypeMirrors; | 119 return primitiveTypeMirrors; |
119 } | 120 } |
120 | 121 |
122 public Set<String> getTypeIdentifiers() { | |
123 return cachedTypes.keySet(); | |
124 } | |
125 | |
121 public List<TypeData> getTypes() { | 126 public List<TypeData> getTypes() { |
122 return types; | 127 return types; |
123 } | 128 } |
124 | 129 |
125 public TypeMirror getGenericType() { | 130 public TypeMirror getGenericType() { |
126 return genericType; | 131 return genericType; |
127 } | 132 } |
128 | 133 |
129 public TypeData getGenericTypeData() { | 134 public TypeData getGenericTypeData() { |
130 TypeData result = types.get(types.size() - 1); | 135 TypeData result = types.get(types.size() - 2); |
131 assert result.getBoxedType() == genericType; | 136 assert result.getBoxedType() == genericType; |
132 return result; | 137 return result; |
133 } | 138 } |
134 | 139 |
135 public TypeData findType(String simpleName) { | 140 public TypeData findType(String simpleName) { |