comparison src/share/vm/c1x/c1x_TargetMethod.hpp @ 1428:695451afc619

refactoring classes into separate files
author Lukas Stadler <lukas.stadler@oracle.com>
date Thu, 19 Aug 2010 14:34:52 -0700
parents
children abc670a709dc
comparison
equal deleted inserted replaced
1427:149b1d2316de 1428:695451afc619
1 /*
2 * Copyright 2000-2010 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 void c1x_compute_offsets();
26
27 // defines the structure of the CiTargetMethod - classes
28 // this will generate classes with accessors similar to javaClasses.hpp
29
30 #define COMPILER_CLASSES_DO(start_class, end_class, char_field, int_field, long_field, oop_field, static_oop_field) \
31 start_class(HotSpotTypeResolved) \
32 long_field(HotSpotTypeResolved, vmId) \
33 end_class \
34 start_class(HotSpotMethod) \
35 long_field(HotSpotMethod, vmId) \
36 end_class \
37 start_class(HotSpotTargetMethod) \
38 oop_field(HotSpotTargetMethod, targetMethod, "Lcom/sun/cri/ci/CiTargetMethod;") \
39 oop_field(HotSpotTargetMethod, method, "Lcom/sun/hotspot/c1x/HotSpotMethod;") \
40 oop_field(HotSpotTargetMethod, name, "Ljava/lang/String;") \
41 oop_field(HotSpotTargetMethod, sites, "[Lcom/sun/cri/ci/CiTargetMethod$Site;") \
42 end_class \
43 start_class(CiTargetMethod) \
44 int_field(CiTargetMethod, frameSize) \
45 oop_field(CiTargetMethod, targetCode, "[B") \
46 int_field(CiTargetMethod, targetCodeSize) \
47 int_field(CiTargetMethod, referenceRegisterCount) \
48 end_class \
49 start_class(CiTargetMethod_Site) \
50 int_field(CiTargetMethod_Site, pcOffset) \
51 end_class \
52 start_class(CiTargetMethod_Call) \
53 oop_field(CiTargetMethod_Call, runtimeCall, "Lcom/sun/cri/ci/CiRuntimeCall;") \
54 oop_field(CiTargetMethod_Call, method, "Lcom/sun/cri/ri/RiMethod;") \
55 oop_field(CiTargetMethod_Call, symbol, "Ljava/lang/String;") \
56 oop_field(CiTargetMethod_Call, globalStubID, "Ljava/lang/Object;") \
57 oop_field(CiTargetMethod_Call, debugInfo, "Lcom/sun/cri/ci/CiDebugInfo;") \
58 oop_field(CiTargetMethod_Call, stackMap, "[B") \
59 oop_field(CiTargetMethod_Call, registerMap, "[B") \
60 end_class \
61 start_class(CiTargetMethod_DataPatch) \
62 oop_field(CiTargetMethod_DataPatch, constant, "Lcom/sun/cri/ci/CiConstant;") \
63 end_class \
64 start_class(CiTargetMethod_Safepoint) \
65 oop_field(CiTargetMethod_Safepoint, debugInfo, "Lcom/sun/cri/ci/CiDebugInfo;") \
66 end_class \
67 start_class(CiTargetMethod_ExceptionHandler) \
68 int_field(CiTargetMethod_ExceptionHandler, handlerPos) \
69 oop_field(CiTargetMethod_ExceptionHandler, exceptionType, "Lcom/sun/cri/ri/RiType;")\
70 end_class \
71 start_class(CiTargetMethod_Mark) \
72 oop_field(CiTargetMethod_Mark, id, "Ljava/lang/Object;") \
73 oop_field(CiTargetMethod_Mark, references, "[Lcom/sun/cri/ci/CiTargetMethod$Mark;") \
74 end_class \
75 start_class(CiDebugInfo) \
76 oop_field(CiDebugInfo, codePos, "Lcom/sun/cri/ci/CiCodePos;") \
77 oop_field(CiDebugInfo, frame, "Lcom/sun/cri/ci/CiDebugInfo$Frame;") \
78 oop_field(CiDebugInfo, registerRefMap, "[B") \
79 oop_field(CiDebugInfo, frameRefMap, "[B") \
80 end_class \
81 start_class(CiDebugInfo_Frame) \
82 oop_field(CiDebugInfo_Frame, caller, "Lcom/sun/cri/ci/CiDebugInfo$Frame;") \
83 oop_field(CiDebugInfo_Frame, codePos, "Lcom/sun/cri/ci/CiCodePos;") \
84 oop_field(CiDebugInfo_Frame, values, "[Lcom/sun/cri/ci/CiValue;") \
85 int_field(CiDebugInfo_Frame, numLocals) \
86 int_field(CiDebugInfo_Frame, numStack) \
87 int_field(CiDebugInfo_Frame, numLocks) \
88 end_class \
89 start_class(CiCodePos) \
90 oop_field(CiCodePos, caller, "Lcom/sun/cri/ci/CiCodePos;") \
91 oop_field(CiCodePos, method, "Lcom/sun/cri/ri/RiMethod;") \
92 int_field(CiCodePos, bci) \
93 end_class \
94 start_class(CiConstant) \
95 oop_field(CiConstant, kind, "Lcom/sun/cri/ci/CiKind;") \
96 oop_field(CiConstant, object, "Ljava/lang/Object;") \
97 long_field(CiConstant, primitive) \
98 end_class \
99 start_class(CiKind) \
100 char_field(CiKind, typeChar) \
101 end_class \
102 start_class(CiRuntimeCall) \
103 static_oop_field(CiRuntimeCall, Debug, "Lcom/sun/cri/ci/CiRuntimeCall;"); \
104 end_class \
105 start_class(RiMethod) \
106 end_class \
107 start_class(CiRegisterValue) \
108 end_class \
109 start_class(CiStackSlot) \
110 end_class \
111 /* end*/
112
113 #define START_CLASS(name) \
114 class name : AllStatic { \
115 private: \
116 friend class C1XCompiler; \
117 static void check(oop obj) { assert(obj != NULL, "NULL field access"); assert(obj->is_a(SystemDictionary::name##_klass()), "wrong class, " #name " expected"); } \
118 static void compute_offsets(); \
119 public: \
120 static klassOop klass() { return SystemDictionary::name##_klass(); }
121
122 #define END_CLASS };
123
124 #define FIELD(name, type, accessor) \
125 static int _##name##_offset; \
126 static type name(oop obj) { check(obj); return obj->accessor(_##name##_offset); } \
127 static type name(jobject obj) { check(JNIHandles::resolve(obj)); return JNIHandles::resolve(obj)->accessor(_##name##_offset); } \
128 static void set_##name(oop obj, type x) { check(obj); obj->accessor##_put(_##name##_offset, x); } \
129 static void set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj)); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); }
130
131 #define CHAR_FIELD(klass, name) FIELD(name, jchar, char_field)
132 #define INT_FIELD(klass, name) FIELD(name, jint, int_field)
133 #define LONG_FIELD(klass, name) FIELD(name, jlong, long_field)
134 #define OOP_FIELD(klass, name, signature) FIELD(name, oop, obj_field)
135 #define STATIC_OOP_FIELD(klassName, name, signature) \
136 static int _##name##_offset; \
137 static oop name() { return klassName::klass()->obj_field(_##name##_offset); } \
138 static void set_##name(oop x) { klassName::klass()->obj_field_put(_##name##_offset, x); }
139
140 COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, LONG_FIELD, OOP_FIELD, STATIC_OOP_FIELD)
141 #undef START_CLASS
142 #undef END_CLASS
143 #undef FIELD
144 #undef CHAR_FIELD
145 #undef INT_FIELD
146 #undef LONG_FIELD
147 #undef OOP_FIELD
148 #undef STATIC_OOP_FIELD
149
150