Path: blob/master/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/StackValueCollection.java
41161 views
/*1* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324package sun.jvm.hotspot.runtime;2526import java.util.*;2728import sun.jvm.hotspot.debugger.*;29import sun.jvm.hotspot.types.*;3031public class StackValueCollection {32private List<StackValue> list;3334public StackValueCollection() { list = new ArrayList<>(); }35public StackValueCollection(int length) { list = new ArrayList<>(length); }3637public void add(StackValue val) { list.add(val); }38public int size() { return list.size(); }39public boolean isEmpty() { return (size() == 0); }40public StackValue get(int i) { return (StackValue) list.get(i); }4142// Get typed locals/expressions43// FIXME: must figure out whether word swapping is necessary on x8644public boolean booleanAt(int slot) { return (int)get(slot).getInteger() != 0; }45public byte byteAt(int slot) { return (byte) get(slot).getInteger(); }46public char charAt(int slot) { return (char) get(slot).getInteger(); }47public short shortAt(int slot) { return (short) get(slot).getInteger(); }48public int intAt(int slot) { return (int) get(slot).getInteger(); }49public long longAt(int slot) { return VM.getVM().buildLongFromIntsPD((int) get(slot).getInteger(),50(int) get(slot+1).getInteger()); }5152public OopHandle oopHandleAt(int slot) {53StackValue sv = get(slot);54if (sv.getType() == BasicType.getTConflict()) {55throw new WrongTypeException("Conflict type");56}57return sv.getObject();58}5960public float floatAt(int slot) { return Float.intBitsToFloat(intAt(slot)); }61public double doubleAt(int slot) { return Double.longBitsToDouble(longAt(slot)); }62}636465