0
|
1 /*
|
|
2 * Copyright 2000-2001 Sun Microsystems, Inc. All Rights Reserved.
|
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 *
|
|
5 * This code is free software; you can redistribute it and/or modify it
|
|
6 * under the terms of the GNU General Public License version 2 only, as
|
|
7 * published by the Free Software Foundation.
|
|
8 *
|
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 * version 2 for more details (a copy is included in the LICENSE file that
|
|
13 * accompanied this code).
|
|
14 *
|
|
15 * You should have received a copy of the GNU General Public License version
|
|
16 * 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 *
|
|
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 * have any questions.
|
|
22 *
|
|
23 */
|
|
24
|
|
25 package sun.jvm.hotspot.code;
|
|
26
|
|
27 import java.io.*;
|
|
28
|
|
29 import sun.jvm.hotspot.utilities.*;
|
|
30
|
|
31 /** <P> Classes used for serializing debugging information. These
|
|
32 abstractions are introducted to provide symmetric read and write
|
|
33 operations. </P>
|
|
34
|
|
35 <P>
|
|
36 <UL>
|
|
37 <LI> ScopeValue: describes the value of a variable/expression in a scope
|
|
38 <UL>
|
|
39 <LI> LocationValue: describes a value in a given location (in frame or register)
|
|
40 <LI> ConstantValue: describes a constant
|
|
41 </UL>
|
|
42 </UL>
|
|
43 </P> */
|
|
44
|
|
45 public abstract class ScopeValue {
|
|
46 // Package private enumeration values (FIXME: read from target VM)
|
|
47 static final int LOCATION_CODE = 0;
|
|
48 static final int CONSTANT_INT_CODE = 1;
|
|
49 static final int CONSTANT_OOP_CODE = 2;
|
|
50 static final int CONSTANT_LONG_CODE = 3;
|
|
51 static final int CONSTANT_DOUBLE_CODE = 4;
|
|
52
|
|
53 public boolean isLocation() { return false; }
|
|
54 public boolean isConstantInt() { return false; }
|
|
55 public boolean isConstantDouble() { return false; }
|
|
56 public boolean isConstantLong() { return false; }
|
|
57 public boolean isConstantOop() { return false; }
|
|
58
|
|
59 public static ScopeValue readFrom(DebugInfoReadStream stream) {
|
|
60 switch (stream.readInt()) {
|
|
61 case LOCATION_CODE:
|
|
62 return new LocationValue(stream);
|
|
63 case CONSTANT_INT_CODE:
|
|
64 return new ConstantIntValue(stream);
|
|
65 case CONSTANT_OOP_CODE:
|
|
66 return new ConstantOopReadValue(stream);
|
|
67 case CONSTANT_LONG_CODE:
|
|
68 return new ConstantLongValue(stream);
|
|
69 case CONSTANT_DOUBLE_CODE:
|
|
70 return new ConstantDoubleValue(stream);
|
|
71 default:
|
|
72 Assert.that(false, "should not reach here");
|
|
73 return null;
|
|
74 }
|
|
75 }
|
|
76
|
|
77 public abstract void printOn(PrintStream tty);
|
|
78 }
|