Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeParser.java @ 11193:6879565ee10b
Truffle-DSL: Fixed the second specialization is unreachable if two specializations have the exactly same signature (also guards) and are ordered next to each other.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Thu, 01 Aug 2013 20:52:03 +0200 |
parents | 7a8835ec5e7d |
children | 4830676526e3 |
comparison
equal
deleted
inserted
replaced
11192:0460c44aef60 | 11193:6879565ee10b |
---|---|
663 needsId.get(i).setId(ids.get(i)); | 663 needsId.get(i).setId(ids.get(i)); |
664 } | 664 } |
665 } | 665 } |
666 | 666 |
667 // calculate reachability | 667 // calculate reachability |
668 SpecializationData prev = null; | |
668 int specializationCount = 0; | 669 int specializationCount = 0; |
669 boolean reachable = true; | 670 boolean reachable = true; |
670 for (SpecializationData specialization : specializations) { | 671 for (SpecializationData specialization : specializations) { |
671 if (specialization.isUninitialized()) { | 672 if (specialization.isUninitialized()) { |
672 specialization.setReachable(true); | 673 specialization.setReachable(true); |
673 continue; | 674 continue; |
674 } | 675 } |
675 if (!reachable && specialization.getMethod() != null) { | 676 if (prev != null && prev.equalsGuards(specialization) && prev.getExceptions().isEmpty()) { |
677 specialization.addError("%s is not reachable.", specialization.isGeneric() ? "Generic" : "Specialization"); | |
678 } else if (!reachable && specialization.getMethod() != null) { | |
676 specialization.addError("%s is not reachable.", specialization.isGeneric() ? "Generic" : "Specialization"); | 679 specialization.addError("%s is not reachable.", specialization.isGeneric() ? "Generic" : "Specialization"); |
677 } | 680 } |
678 specialization.setReachable(reachable); | 681 specialization.setReachable(reachable); |
679 if (!specialization.hasRewrite(context)) { | 682 if (!specialization.hasRewrite(context)) { |
680 reachable = false; | 683 reachable = false; |
681 } | 684 } |
682 if (!specialization.isGeneric()) { | 685 if (!specialization.isGeneric()) { |
683 specializationCount++; | 686 specializationCount++; |
684 } | 687 } |
688 prev = specialization; | |
685 } | 689 } |
686 | 690 |
687 // initialize polymorphic depth | 691 // initialize polymorphic depth |
688 if (node.getPolymorphicDepth() < 0) { | 692 if (node.getPolymorphicDepth() < 0) { |
689 node.setPolymorphicDepth(specializationCount - 1); | 693 node.setPolymorphicDepth(specializationCount - 1); |