Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/examples/MathPow.java @ 21492:9e5947d24e63
Truffle-DSL: pow example should not use @ExplodeLoop.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 26 May 2015 20:02:07 +0200 |
parents | a79a3e467245 |
children |
comparison
equal
deleted
inserted
replaced
21491:28a137691ff2 | 21492:9e5947d24e63 |
---|---|
103 protected static double cachePow(double base, int exponent) { | 103 protected static double cachePow(double base, int exponent) { |
104 return Math.pow(base, exponent); | 104 return Math.pow(base, exponent); |
105 } | 105 } |
106 | 106 |
107 @Specialization(contains = "doPowCached", guards = {"exponent == cachedExponent", "cachedExponent <= 10"}) | 107 @Specialization(contains = "doPowCached", guards = {"exponent == cachedExponent", "cachedExponent <= 10"}) |
108 @ExplodeLoop | |
109 double doPowCachedExponent(double base, int exponent, @Cached("exponent") int cachedExponent) { | 108 double doPowCachedExponent(double base, int exponent, @Cached("exponent") int cachedExponent) { |
110 doPowCachedExponent++; | 109 doPowCachedExponent++; |
111 double result = 1.0; | 110 double result = 1.0; |
112 for (int i = 0; i < cachedExponent; i++) { | 111 for (int i = 0; i < cachedExponent; i++) { |
113 result *= base; | 112 result *= base; |