You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2009/08/12 16:59:49 UTC
svn commit: r803546 -
/commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/algorithmic/forward/analysis/MethodDifferentiator.java
Author: luc
Date: Wed Aug 12 14:59:49 2009
New Revision: 803546
URL: http://svn.apache.org/viewvc?rev=803546&view=rev
Log:
try not to build big arrays containing values that are immediately ignored
because they have already been processed
Modified:
commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/algorithmic/forward/analysis/MethodDifferentiator.java
Modified: commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/algorithmic/forward/analysis/MethodDifferentiator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/algorithmic/forward/analysis/MethodDifferentiator.java?rev=803546&r1=803545&r2=803546&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/algorithmic/forward/analysis/MethodDifferentiator.java (original)
+++ commons/sandbox/nabla/trunk/src/main/java/org/apache/commons/nabla/algorithmic/forward/analysis/MethodDifferentiator.java Wed Aug 12 14:59:49 2009
@@ -394,14 +394,7 @@
// an instruction consuming a converted value and producing
// a double must be changed to produce a differential pair,
// get the double values produced and add them to the changed set
- for (TrackingValue produced : getProducedDoubleValues(consumer)) {
-
- // add it to the pending set if it has not already been processed
- if (!converted.contains(produced)) {
- pending.add(produced);
- }
-
- }
+ pending.addAll(getProducedAndNotConvertedDoubleValues(consumer));
// as a consumer of a converted value, the instruction must be changed
changes.add(consumer);
@@ -421,11 +414,11 @@
}
- /** Get the list of double values produced by an instruction.
+ /** Get the list of double values produced by an instruction and not yet converted.
* @param instruction instruction producing the values
* @return list of double values produced
*/
- private List<TrackingValue> getProducedDoubleValues(final AbstractInsnNode instruction) {
+ private List<TrackingValue> getProducedAndNotConvertedDoubleValues(final AbstractInsnNode instruction) {
final List<TrackingValue> values = new ArrayList<TrackingValue>();
@@ -447,7 +440,8 @@
for (int i = 0; i < produced.getStackSize(); ++i) {
final TrackingValue value = (TrackingValue) produced.getStack(i);
if (((i >= beforeStackSize) || (value != before.getStack(i))) &&
- value.getValue().equals(BasicValue.DOUBLE_VALUE)) {
+ value.getValue().equals(BasicValue.DOUBLE_VALUE) &&
+ !converted.contains(value)) {
values.add(value);
}
}
@@ -456,7 +450,8 @@
for (int i = 0; i < locals; ++i) {
final TrackingValue value = (TrackingValue) produced.getLocal(i);
if ((value != before.getLocal(i)) &&
- value.getValue().equals(BasicValue.DOUBLE_VALUE)) {
+ value.getValue().equals(BasicValue.DOUBLE_VALUE) &&
+ !converted.contains(value)) {
values.add(value);
}
}