Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/NodeParser.java @ 20942:a2e295c6cf7c
Truffle-DSL: fixed frame might be added twice for polymorphic signatures.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 14 Apr 2015 19:23:32 +0200 |
parents | 4f45e4d3361c |
children | a778fbcb8d8e |
comparison
equal
deleted
inserted
replaced
20941:4f45e4d3361c | 20942:a2e295c6cf7c |
---|---|
1343 if (frameTypes.size() == 1) { | 1343 if (frameTypes.size() == 1) { |
1344 frameType = frameTypes.iterator().next(); | 1344 frameType = frameTypes.iterator().next(); |
1345 } else { | 1345 } else { |
1346 frameType = context.getType(Frame.class); | 1346 frameType = context.getType(Frame.class); |
1347 } | 1347 } |
1348 types.add(new CodeVariableElement(frameType, "frameValue")); | 1348 types.add(new CodeVariableElement(frameType, TemplateMethod.FRAME_NAME)); |
1349 } | 1349 } |
1350 | 1350 |
1351 TypeMirror returnType = null; | 1351 TypeMirror returnType = null; |
1352 int index = 0; | 1352 int index = 0; |
1353 for (Parameter genericParameter : generic.getReturnTypeAndParameters()) { | 1353 for (Parameter genericParameter : generic.getReturnTypeAndParameters()) { |
1354 TypeMirror polymorphicType; | 1354 TypeMirror polymorphicType; |
1355 if (genericParameter.getLocalName().equals(TemplateMethod.FRAME_NAME)) { | |
1356 continue; | |
1357 } | |
1355 if (!genericParameter.getSpecification().isSignature()) { | 1358 if (!genericParameter.getSpecification().isSignature()) { |
1356 polymorphicType = genericParameter.getType(); | 1359 polymorphicType = genericParameter.getType(); |
1357 } else { | 1360 } else { |
1358 Set<TypeMirror> usedTypes = new HashSet<>(); | 1361 Set<TypeMirror> usedTypes = new HashSet<>(); |
1359 for (SpecializationData specialization : node.getSpecializations()) { | 1362 for (SpecializationData specialization : node.getSpecializations()) { |
1375 | 1378 |
1376 if (node.getTypeSystem().hasImplicitSourceTypes(polymorphicType)) { | 1379 if (node.getTypeSystem().hasImplicitSourceTypes(polymorphicType)) { |
1377 polymorphicType = context.getType(Object.class); | 1380 polymorphicType = context.getType(Object.class); |
1378 } | 1381 } |
1379 } else { | 1382 } else { |
1380 polymorphicType = context.getType(Object.class); | 1383 if (generic.getFrame() == genericParameter) { |
1384 polymorphicType = context.getType(Frame.class); | |
1385 } else { | |
1386 polymorphicType = context.getType(Object.class); | |
1387 } | |
1381 } | 1388 } |
1382 } | 1389 } |
1383 if (genericParameter == generic.getReturnType()) { | 1390 if (genericParameter == generic.getReturnType()) { |
1384 returnType = polymorphicType; | 1391 returnType = polymorphicType; |
1385 } else { | 1392 } else { |