< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/gen/DebugInfoBuilder.java

Print this page




  26 
  27 import java.util.ArrayDeque;
  28 import java.util.Arrays;
  29 import java.util.Queue;
  30 
  31 import jdk.internal.vm.compiler.collections.EconomicMap;
  32 import jdk.internal.vm.compiler.collections.Equivalence;
  33 import org.graalvm.compiler.debug.CounterKey;
  34 import org.graalvm.compiler.debug.DebugContext;
  35 import org.graalvm.compiler.debug.GraalError;
  36 import org.graalvm.compiler.lir.ConstantValue;
  37 import org.graalvm.compiler.lir.LIRFrameState;
  38 import org.graalvm.compiler.lir.LabelRef;
  39 import org.graalvm.compiler.lir.Variable;
  40 import org.graalvm.compiler.nodes.ConstantNode;
  41 import org.graalvm.compiler.nodes.FrameState;
  42 import org.graalvm.compiler.nodes.ValueNode;
  43 import org.graalvm.compiler.nodes.spi.NodeValueMap;
  44 import org.graalvm.compiler.nodes.util.GraphUtil;
  45 import org.graalvm.compiler.nodes.virtual.EscapeObjectState;
  46 import org.graalvm.compiler.nodes.virtual.VirtualBoxingNode;
  47 import org.graalvm.compiler.nodes.virtual.VirtualObjectNode;
  48 import org.graalvm.compiler.serviceprovider.GraalServices;
  49 import org.graalvm.compiler.virtual.nodes.MaterializedObjectState;
  50 import org.graalvm.compiler.virtual.nodes.VirtualObjectState;
  51 
  52 import jdk.vm.ci.code.BytecodeFrame;
  53 import jdk.vm.ci.code.VirtualObject;
  54 import jdk.vm.ci.meta.JavaConstant;
  55 import jdk.vm.ci.meta.JavaKind;
  56 import jdk.vm.ci.meta.JavaType;
  57 import jdk.vm.ci.meta.JavaValue;
  58 import jdk.vm.ci.meta.ResolvedJavaField;
  59 import jdk.vm.ci.meta.ResolvedJavaType;
  60 import jdk.vm.ci.meta.Value;
  61 
  62 /**
  63  * Builds {@link LIRFrameState}s from {@link FrameState}s.
  64  */
  65 public class DebugInfoBuilder {
  66 
  67     protected final NodeValueMap nodeValueMap;
  68     protected final DebugContext debug;


 139                             assert value.getStackKind() == JavaKind.Illegal;
 140                             ValueNode previousValue = currentField.values().get(i - 1);
 141                             assert (previousValue != null && previousValue.getStackKind().needsTwoSlots()) : vobjNode + " " + i +
 142                                             " " + previousValue + " " + currentField.values().snapshot();
 143                             if (previousValue == null || !previousValue.getStackKind().needsTwoSlots()) {
 144                                 // Don't allow the IllegalConstant to leak into the debug info
 145                                 JavaKind entryKind = vobjNode.entryKind(i);
 146                                 values[pos] = JavaConstant.defaultForKind(entryKind.getStackKind());
 147                                 slotKinds[pos] = entryKind.getStackKind();
 148                                 pos++;
 149                             }
 150                         }
 151                     }
 152                     if (pos != entryCount) {
 153                         values = Arrays.copyOf(values, pos);
 154                         slotKinds = Arrays.copyOf(slotKinds, pos);
 155                     }
 156                 }
 157                 assert checkValues(vobjValue.getType(), values, slotKinds);
 158                 vobjValue.setValues(values, slotKinds);
 159 
 160                 if (vobjNode instanceof VirtualBoxingNode) {
 161                     GraalServices.markVirtualObjectAsAutoBox(vobjValue);
 162                 }
 163             }
 164 
 165             virtualObjectsArray = new VirtualObject[virtualObjects.size()];
 166             int index = 0;
 167             for (VirtualObject value : virtualObjects.getValues()) {
 168                 virtualObjectsArray[index++] = value;
 169             }
 170             virtualObjects.clear();
 171         }
 172         objectStates.clear();
 173 
 174         return newLIRFrameState(exceptionEdge, frame, virtualObjectsArray);
 175     }
 176 
 177     private boolean checkValues(ResolvedJavaType type, JavaValue[] values, JavaKind[] slotKinds) {
 178         assert (values == null) == (slotKinds == null);
 179         if (values != null) {
 180             assert values.length == slotKinds.length;
 181             if (!type.isArray()) {
 182                 ResolvedJavaField[] fields = type.getInstanceFields(true);




  26 
  27 import java.util.ArrayDeque;
  28 import java.util.Arrays;
  29 import java.util.Queue;
  30 
  31 import jdk.internal.vm.compiler.collections.EconomicMap;
  32 import jdk.internal.vm.compiler.collections.Equivalence;
  33 import org.graalvm.compiler.debug.CounterKey;
  34 import org.graalvm.compiler.debug.DebugContext;
  35 import org.graalvm.compiler.debug.GraalError;
  36 import org.graalvm.compiler.lir.ConstantValue;
  37 import org.graalvm.compiler.lir.LIRFrameState;
  38 import org.graalvm.compiler.lir.LabelRef;
  39 import org.graalvm.compiler.lir.Variable;
  40 import org.graalvm.compiler.nodes.ConstantNode;
  41 import org.graalvm.compiler.nodes.FrameState;
  42 import org.graalvm.compiler.nodes.ValueNode;
  43 import org.graalvm.compiler.nodes.spi.NodeValueMap;
  44 import org.graalvm.compiler.nodes.util.GraphUtil;
  45 import org.graalvm.compiler.nodes.virtual.EscapeObjectState;

  46 import org.graalvm.compiler.nodes.virtual.VirtualObjectNode;

  47 import org.graalvm.compiler.virtual.nodes.MaterializedObjectState;
  48 import org.graalvm.compiler.virtual.nodes.VirtualObjectState;
  49 
  50 import jdk.vm.ci.code.BytecodeFrame;
  51 import jdk.vm.ci.code.VirtualObject;
  52 import jdk.vm.ci.meta.JavaConstant;
  53 import jdk.vm.ci.meta.JavaKind;
  54 import jdk.vm.ci.meta.JavaType;
  55 import jdk.vm.ci.meta.JavaValue;
  56 import jdk.vm.ci.meta.ResolvedJavaField;
  57 import jdk.vm.ci.meta.ResolvedJavaType;
  58 import jdk.vm.ci.meta.Value;
  59 
  60 /**
  61  * Builds {@link LIRFrameState}s from {@link FrameState}s.
  62  */
  63 public class DebugInfoBuilder {
  64 
  65     protected final NodeValueMap nodeValueMap;
  66     protected final DebugContext debug;


 137                             assert value.getStackKind() == JavaKind.Illegal;
 138                             ValueNode previousValue = currentField.values().get(i - 1);
 139                             assert (previousValue != null && previousValue.getStackKind().needsTwoSlots()) : vobjNode + " " + i +
 140                                             " " + previousValue + " " + currentField.values().snapshot();
 141                             if (previousValue == null || !previousValue.getStackKind().needsTwoSlots()) {
 142                                 // Don't allow the IllegalConstant to leak into the debug info
 143                                 JavaKind entryKind = vobjNode.entryKind(i);
 144                                 values[pos] = JavaConstant.defaultForKind(entryKind.getStackKind());
 145                                 slotKinds[pos] = entryKind.getStackKind();
 146                                 pos++;
 147                             }
 148                         }
 149                     }
 150                     if (pos != entryCount) {
 151                         values = Arrays.copyOf(values, pos);
 152                         slotKinds = Arrays.copyOf(slotKinds, pos);
 153                     }
 154                 }
 155                 assert checkValues(vobjValue.getType(), values, slotKinds);
 156                 vobjValue.setValues(values, slotKinds);




 157             }
 158 
 159             virtualObjectsArray = new VirtualObject[virtualObjects.size()];
 160             int index = 0;
 161             for (VirtualObject value : virtualObjects.getValues()) {
 162                 virtualObjectsArray[index++] = value;
 163             }
 164             virtualObjects.clear();
 165         }
 166         objectStates.clear();
 167 
 168         return newLIRFrameState(exceptionEdge, frame, virtualObjectsArray);
 169     }
 170 
 171     private boolean checkValues(ResolvedJavaType type, JavaValue[] values, JavaKind[] slotKinds) {
 172         assert (values == null) == (slotKinds == null);
 173         if (values != null) {
 174             assert values.length == slotKinds.length;
 175             if (!type.isArray()) {
 176                 ResolvedJavaField[] fields = type.getInstanceFields(true);


< prev index next >