Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeData.java @ 10596:f43eb2f1bbbc
Truffle-DSL: code-generation of polymorphic caching
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 01 Jul 2013 20:32:20 +0200 |
parents | 3cc5fb59916e |
children |
comparison
equal
deleted
inserted
replaced
10595:47233c73ca58 | 10596:f43eb2f1bbbc |
---|---|
44 private List<NodeFieldData> fields; | 44 private List<NodeFieldData> fields; |
45 private TypeMirror nodeType; | 45 private TypeMirror nodeType; |
46 private ParameterSpec instanceParameterSpec; | 46 private ParameterSpec instanceParameterSpec; |
47 | 47 |
48 private List<SpecializationData> specializations; | 48 private List<SpecializationData> specializations; |
49 private List<SpecializationData> polymorphicSpecializations; | |
49 private List<SpecializationListenerData> specializationListeners; | 50 private List<SpecializationListenerData> specializationListeners; |
50 private Map<Integer, List<ExecutableTypeData>> executableTypes; | 51 private Map<Integer, List<ExecutableTypeData>> executableTypes; |
51 private List<ShortCircuitData> shortCircuits; | 52 private List<ShortCircuitData> shortCircuits; |
52 private List<String> assumptions; | 53 private List<String> assumptions; |
53 private List<CreateCastData> casts; | 54 private List<CreateCastData> casts; |
54 | 55 |
56 private int polymorphicDepth = -1; | |
55 private String shortName; | 57 private String shortName; |
56 | 58 |
57 public NodeData(TypeElement type, String id) { | 59 public NodeData(TypeElement type, String id) { |
58 super(type, null, null); | 60 super(type, null, null); |
59 this.nodeId = id; | 61 this.nodeId = id; |
73 this.fields = splitSource.fields; | 75 this.fields = splitSource.fields; |
74 this.children = splitSource.children; | 76 this.children = splitSource.children; |
75 this.assumptions = splitSource.assumptions; | 77 this.assumptions = splitSource.assumptions; |
76 } | 78 } |
77 | 79 |
80 public int getPolymorphicDepth() { | |
81 return polymorphicDepth; | |
82 } | |
83 | |
84 void setPolymorphicDepth(int polymorphicDepth) { | |
85 this.polymorphicDepth = polymorphicDepth; | |
86 } | |
87 | |
78 public List<CreateCastData> getCasts() { | 88 public List<CreateCastData> getCasts() { |
79 return casts; | 89 return casts; |
80 } | 90 } |
81 | 91 |
82 void setCasts(List<CreateCastData> casts) { | 92 void setCasts(List<CreateCastData> casts) { |
269 | 279 |
270 for (ExecutableTypeData type : types) { | 280 for (ExecutableTypeData type : types) { |
271 if (!type.getType().isVoid()) { | 281 if (!type.getType().isVoid()) { |
272 return type; | 282 return type; |
273 } | 283 } |
284 } | |
285 | |
286 for (ExecutableTypeData type : types) { | |
287 return type; | |
274 } | 288 } |
275 return null; | 289 return null; |
276 } | 290 } |
277 | 291 |
278 public List<ExecutableTypeData> getExecutableTypes(int evaluatedCount) { | 292 public List<ExecutableTypeData> getExecutableTypes(int evaluatedCount) { |
356 } | 370 } |
357 } | 371 } |
358 return null; | 372 return null; |
359 } | 373 } |
360 | 374 |
375 public SpecializationData getUninitializedSpecialization() { | |
376 for (SpecializationData specialization : specializations) { | |
377 if (specialization.isUninitialized()) { | |
378 return specialization; | |
379 } | |
380 } | |
381 return null; | |
382 } | |
383 | |
361 @Override | 384 @Override |
362 public TypeSystemData getTypeSystem() { | 385 public TypeSystemData getTypeSystem() { |
363 return typeSystem; | 386 return typeSystem; |
364 } | 387 } |
365 | 388 |
379 dumpProperty(builder, indent, "templateClass", Utils.getQualifiedName(getTemplateType())); | 402 dumpProperty(builder, indent, "templateClass", Utils.getQualifiedName(getTemplateType())); |
380 dumpProperty(builder, indent, "typeSystem", getTypeSystem()); | 403 dumpProperty(builder, indent, "typeSystem", getTypeSystem()); |
381 dumpProperty(builder, indent, "fields", getChildren()); | 404 dumpProperty(builder, indent, "fields", getChildren()); |
382 dumpProperty(builder, indent, "executableTypes", getExecutableTypes()); | 405 dumpProperty(builder, indent, "executableTypes", getExecutableTypes()); |
383 dumpProperty(builder, indent, "specializations", getSpecializations()); | 406 dumpProperty(builder, indent, "specializations", getSpecializations()); |
407 dumpProperty(builder, indent, "polymorphicDepth", getPolymorphicDepth()); | |
408 dumpProperty(builder, indent, "polymorphic", getPolymorphicSpecializations()); | |
384 dumpProperty(builder, indent, "assumptions", getAssumptions()); | 409 dumpProperty(builder, indent, "assumptions", getAssumptions()); |
385 dumpProperty(builder, indent, "casts", getCasts()); | 410 dumpProperty(builder, indent, "casts", getCasts()); |
386 dumpProperty(builder, indent, "messages", collectMessages()); | 411 dumpProperty(builder, indent, "messages", collectMessages()); |
387 if (getDeclaredNodes().size() > 0) { | 412 if (getDeclaredNodes().size() > 0) { |
388 builder.append(String.format("\n%s children = [", indent)); | 413 builder.append(String.format("\n%s children = [", indent)); |
486 specialization.setNode(this); | 511 specialization.setNode(this); |
487 } | 512 } |
488 } | 513 } |
489 } | 514 } |
490 | 515 |
516 void setPolymorphicSpecializations(List<SpecializationData> polymorphicSpecializations) { | |
517 this.polymorphicSpecializations = polymorphicSpecializations; | |
518 } | |
519 | |
520 public List<SpecializationData> getPolymorphicSpecializations() { | |
521 return polymorphicSpecializations; | |
522 } | |
523 | |
491 void setSpecializationListeners(List<SpecializationListenerData> specializationListeners) { | 524 void setSpecializationListeners(List<SpecializationListenerData> specializationListeners) { |
492 this.specializationListeners = specializationListeners; | 525 this.specializationListeners = specializationListeners; |
493 } | 526 } |
494 | 527 |
495 void setExecutableTypes(Map<Integer, List<ExecutableTypeData>> executableTypes) { | 528 void setExecutableTypes(Map<Integer, List<ExecutableTypeData>> executableTypes) { |