< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/CompiledVFrame.java

Print this page

128 
129   public List<MonitorInfo> getMonitors() {
130     if (getScope() == null) {
131       return new ArrayList<>();
132     }
133     List<MonitorValue> monitors = getScope().getMonitors();
134     if (monitors == null) {
135       return new ArrayList<>();
136     }
137     List<MonitorInfo> result = new ArrayList<>(monitors.size());
138     for (int i = 0; i < monitors.size(); i++) {
139       MonitorValue mv = monitors.get(i);
140       ScopeValue ov = mv.owner();
141       StackValue ownerSV = createStackValue(ov); // it is an oop
142       if (ov.isObject()) { // The owner object was scalar replaced
143         Assert.that(mv.eliminated() && ownerSV.objIsScalarReplaced(), "monitor should be eliminated for scalar replaced object");
144         // Put klass for scalar replaced object.
145         ScopeValue kv = ((ObjectValue)ov).getKlass();
146         Assert.that(kv.isConstantOop(), "klass should be oop constant for scalar replaced object");
147         OopHandle k = ((ConstantOopReadValue)kv).getValue();
148         result.add(new MonitorInfo(k, resolveMonitorLock(mv.basicLock()), mv.eliminated(), true));
149       } else {
150         result.add(new MonitorInfo(ownerSV.getObject(), resolveMonitorLock(mv.basicLock()), mv.eliminated(), false));
151       }
152     }
153     return result;
154   }
155 
156   public int getBCI() {
157     int raw = getRawBCI();
158     return ((raw == DebugInformationRecorder.SYNCHRONIZATION_ENTRY_BCI) ? 0 : raw);
159   }
160 
161   /** Returns SynchronizationEntryBCI or bci() (used for synchronization) */
162   public int getRawBCI() {
163     if (VM.getVM().isDebugging() && getScope() == null) {
164       return 0; // No debugging information!
165     }
166     return getScope().getBCI();
167   }
168 
169   /** Returns the sender vframe */
170   public VFrame sender() {

293       return new StackValue(((ConstantIntValue) sv).getValue() & 0xFFFFFFFF);
294     } else if (sv.isConstantOop()) {
295       // constant oop
296       return new StackValue(((ConstantOopReadValue) sv).getValue(), 0);
297     } else if (sv.isConstantDouble()) {
298       // Constant double in a single stack slot
299       double d = ((ConstantDoubleValue) sv).getValue();
300       return new StackValue(Double.doubleToLongBits(d) & 0xFFFFFFFF);
301     } else if (VM.getVM().isLP64() && sv.isConstantLong()) {
302       // Constant long in a single stack slot
303       return new StackValue(((ConstantLongValue) sv).getValue() & 0xFFFFFFFF);
304     } else if (sv.isObject()) {
305       // Scalar replaced object in compiled frame
306       return new StackValue(((ObjectValue)sv).getValue(), 1);
307     }
308 
309     // Unknown ScopeValue type
310     Assert.that(false, "Should not reach here");
311     return new StackValue(0);   // dummy
312   }
313 
314   private BasicLock resolveMonitorLock(Location location) {
315     if (Assert.ASSERTS_ENABLED) {
316       Assert.that(location.isStack(), "for now we only look at the stack");
317     }
318     int byteOffset = location.getStackOffset();
319     // (stack picture)
320     // high: [     ]  byte_offset + wordSize
321     // low   [     ]  byte_offset
322     //
323     // sp->  [     ]  0
324     // the byte_offset is the distance from the stack pointer to the lowest address
325     // The frame's original stack pointer, before any extension by its callee
326     // (due to Compiler1 linkage on SPARC), must be used.
327     return new BasicLock(getFrame().getUnextendedSP().addOffsetTo(byteOffset));
328   }
329 }

128 
129   public List<MonitorInfo> getMonitors() {
130     if (getScope() == null) {
131       return new ArrayList<>();
132     }
133     List<MonitorValue> monitors = getScope().getMonitors();
134     if (monitors == null) {
135       return new ArrayList<>();
136     }
137     List<MonitorInfo> result = new ArrayList<>(monitors.size());
138     for (int i = 0; i < monitors.size(); i++) {
139       MonitorValue mv = monitors.get(i);
140       ScopeValue ov = mv.owner();
141       StackValue ownerSV = createStackValue(ov); // it is an oop
142       if (ov.isObject()) { // The owner object was scalar replaced
143         Assert.that(mv.eliminated() && ownerSV.objIsScalarReplaced(), "monitor should be eliminated for scalar replaced object");
144         // Put klass for scalar replaced object.
145         ScopeValue kv = ((ObjectValue)ov).getKlass();
146         Assert.that(kv.isConstantOop(), "klass should be oop constant for scalar replaced object");
147         OopHandle k = ((ConstantOopReadValue)kv).getValue();
148         result.add(new MonitorInfo(k, mv.eliminated(), true));
149       } else {
150         result.add(new MonitorInfo(ownerSV.getObject(), mv.eliminated(), false));
151       }
152     }
153     return result;
154   }
155 
156   public int getBCI() {
157     int raw = getRawBCI();
158     return ((raw == DebugInformationRecorder.SYNCHRONIZATION_ENTRY_BCI) ? 0 : raw);
159   }
160 
161   /** Returns SynchronizationEntryBCI or bci() (used for synchronization) */
162   public int getRawBCI() {
163     if (VM.getVM().isDebugging() && getScope() == null) {
164       return 0; // No debugging information!
165     }
166     return getScope().getBCI();
167   }
168 
169   /** Returns the sender vframe */
170   public VFrame sender() {

293       return new StackValue(((ConstantIntValue) sv).getValue() & 0xFFFFFFFF);
294     } else if (sv.isConstantOop()) {
295       // constant oop
296       return new StackValue(((ConstantOopReadValue) sv).getValue(), 0);
297     } else if (sv.isConstantDouble()) {
298       // Constant double in a single stack slot
299       double d = ((ConstantDoubleValue) sv).getValue();
300       return new StackValue(Double.doubleToLongBits(d) & 0xFFFFFFFF);
301     } else if (VM.getVM().isLP64() && sv.isConstantLong()) {
302       // Constant long in a single stack slot
303       return new StackValue(((ConstantLongValue) sv).getValue() & 0xFFFFFFFF);
304     } else if (sv.isObject()) {
305       // Scalar replaced object in compiled frame
306       return new StackValue(((ObjectValue)sv).getValue(), 1);
307     }
308 
309     // Unknown ScopeValue type
310     Assert.that(false, "Should not reach here");
311     return new StackValue(0);   // dummy
312   }
















313 }
< prev index next >