01: /*
02: *
03: *
04: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: */
26:
27: package vm;
28:
29: import jcc.Const;
30: import util.DataFormatException;
31: import components.*;
32: import jcc.Util;
33:
34: /*
35: * A primitive class
36: *
37: */
38:
39: public class PrimitiveClassInfo extends ClassInfo {
40:
41: public char signature;
42: public int slotsize;
43: public int elementsize;
44: public int typecode;
45:
46: private PrimitiveClassInfo(String name, char signature,
47: int typecode, int slotsize, int elementsize,
48: boolean verbosity, ConstantPool p) {
49: super (verbosity);
50: UnicodeConstant uc = (UnicodeConstant) p
51: .add(new UnicodeConstant(name));
52: className = name;
53: this Class = new ClassConstant(uc);
54: super ClassInfo = lookupClass("java/lang/Object");
55: super Class = super ClassInfo.this Class;
56: this .signature = signature;
57: this .typecode = typecode;
58: this .slotsize = slotsize;
59: this .elementsize = elementsize;
60: access = Const.ACC_FINAL | Const.ACC_ABSTRACT
61: | Const.ACC_PUBLIC;
62: constants = new ConstantObject[0];
63: methods = new MethodInfo[0];
64: fields = new FieldInfo[0];
65: enterClass(name);
66: }
67:
68: public static void init(boolean v, ConstantPool p) {
69:
70: (new PrimitiveClassInfo("void", Const.SIGC_VOID, Const.T_VOID,
71: 0, 0, v, p)).countReferences(false);
72: (new PrimitiveClassInfo("boolean", Const.SIGC_BOOLEAN,
73: Const.T_BOOLEAN, 4, 1, v, p)).countReferences(false);
74: (new PrimitiveClassInfo("byte", Const.SIGC_BYTE, Const.T_BYTE,
75: 4, 1, v, p)).countReferences(false);
76: (new PrimitiveClassInfo("char", Const.SIGC_CHAR, Const.T_CHAR,
77: 4, 2, v, p)).countReferences(false);
78: (new PrimitiveClassInfo("short", Const.SIGC_SHORT,
79: Const.T_SHORT, 4, 2, v, p)).countReferences(false);
80: (new PrimitiveClassInfo("int", Const.SIGC_INT, Const.T_INT, 4,
81: 4, v, p)).countReferences(false);
82: (new PrimitiveClassInfo("long", Const.SIGC_LONG, Const.T_LONG,
83: 8, 8, v, p)).countReferences(false);
84: (new PrimitiveClassInfo("float", Const.SIGC_FLOAT,
85: Const.T_FLOAT, 4, 4, v, p)).countReferences(false);
86: (new PrimitiveClassInfo("double", Const.SIGC_DOUBLE,
87: Const.T_DOUBLE, 8, 8, v, p)).countReferences(false);
88: };
89:
90: protected String createGenericNativeName() {
91: return /*NOI18N*/"primitiveClass_"
92: + Util.convertToClassName(className);
93: }
94: }
|