Path: blob/master/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/ScopeValue.java
41161 views
/*1* Copyright (c) 2000, 2009, 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.code;2526import java.io.*;2728import sun.jvm.hotspot.utilities.*;2930/** <P> Classes used for serializing debugging information. These31abstractions are introducted to provide symmetric read and write32operations. </P>3334<P>35<UL>36<LI> ScopeValue: describes the value of a variable/expression in a scope37<UL>38<LI> LocationValue: describes a value in a given location (in frame or register)39<LI> ConstantValue: describes a constant40</UL>41</UL>42</P> */4344public abstract class ScopeValue {45// Package private enumeration values (FIXME: read from target VM)46static final int LOCATION_CODE = 0;47static final int CONSTANT_INT_CODE = 1;48static final int CONSTANT_OOP_CODE = 2;49static final int CONSTANT_LONG_CODE = 3;50static final int CONSTANT_DOUBLE_CODE = 4;51static final int CONSTANT_OBJECT_CODE = 5;52static final int CONSTANT_OBJECT_ID_CODE = 6;5354public boolean isLocation() { return false; }55public boolean isConstantInt() { return false; }56public boolean isConstantDouble() { return false; }57public boolean isConstantLong() { return false; }58public boolean isConstantOop() { return false; }59public boolean isObject() { return false; }6061public static ScopeValue readFrom(DebugInfoReadStream stream) {62switch (stream.readInt()) {63case LOCATION_CODE:64return new LocationValue(stream);65case CONSTANT_INT_CODE:66return new ConstantIntValue(stream);67case CONSTANT_OOP_CODE:68return new ConstantOopReadValue(stream);69case CONSTANT_LONG_CODE:70return new ConstantLongValue(stream);71case CONSTANT_DOUBLE_CODE:72return new ConstantDoubleValue(stream);73case CONSTANT_OBJECT_CODE:74return stream.readObjectValue();75case CONSTANT_OBJECT_ID_CODE:76return stream.getCachedObject();77default:78Assert.that(false, "should not reach here");79return null;80}81}8283public abstract void printOn(PrintStream tty);84}858687