src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EffectList.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EffectList.java	Fri Jul  7 09:31:52 2017
--- new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EffectList.java	Fri Jul  7 09:31:52 2017

*** 25,35 **** --- 25,35 ---- import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; ! import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.debug.GraalError; import org.graalvm.compiler.graph.Node; import org.graalvm.compiler.nodes.StructuredGraph; /**
*** 60,81 **** --- 60,86 ---- } private static final Effect[] EMPTY_ARRAY = new Effect[0]; private static final String[] EMPTY_STRING_ARRAY = new String[0]; + private final DebugContext debug; private Effect[] effects = EMPTY_ARRAY; private String[] names = EMPTY_STRING_ARRAY; private int size; + public EffectList(DebugContext debug) { + this.debug = debug; + } + private void enlarge(int elements) { int length = effects.length; if (size + elements > length) { while (size + elements > length) { length = Math.max(length * 2, 4); } effects = Arrays.copyOf(effects, length); ! if (Debug.isEnabled()) { ! if (debug.isLogEnabled()) { names = Arrays.copyOf(names, length); } } }
*** 84,114 **** --- 89,119 ---- } public void add(String name, Effect effect) { assert effect != null; enlarge(1); ! if (Debug.isEnabled()) { ! if (debug.isLogEnabled()) { names[size] = name; } effects[size++] = effect; } public void addAll(EffectList list) { enlarge(list.size); System.arraycopy(list.effects, 0, effects, size, list.size); ! if (Debug.isEnabled()) { ! if (debug.isLogEnabled()) { System.arraycopy(list.names, 0, names, size, list.size); } size += list.size; } public void insertAll(EffectList list, int position) { assert position >= 0 && position <= size; enlarge(list.size); System.arraycopy(effects, position, effects, position + list.size, size - position); System.arraycopy(list.effects, 0, effects, position, list.size); ! if (Debug.isEnabled()) { ! if (debug.isLogEnabled()) { System.arraycopy(names, position, names, position + list.size, size - position); System.arraycopy(list.names, 0, names, position, list.size); } size += list.size; }
*** 174,187 **** --- 179,192 ---- } catch (Throwable t) { StringBuilder str = new StringBuilder(); toString(str, i); throw new GraalError(t).addContext("effect", str); } ! if (effect.isVisible() && Debug.isLogEnabled()) { ! if (effect.isVisible() && debug.isLogEnabled()) { StringBuilder str = new StringBuilder(); toString(str, i); ! Debug.log(" %s", str); ! debug.log(" %s", str); } } } }
*** 225,235 **** --- 230,240 ---- } return str.toString(); } private String getName(int i) { ! if (Debug.isEnabled()) { ! if (debug.isLogEnabled()) { return names[i]; } else { return ""; } }

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EffectList.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File