Mercurial > hg > truffle
comparison src/share/vm/c1x/c1x_TargetMethod.hpp @ 1429:abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
* -Dc1x.debug=true turns on the logging proxies and lots of log output on the java side
* provide more information about types to the compiler (type hierarchy, etc)
* provide exception handler tables to the compiler
* add exception handlers to the nmethod
* correct implementation of ExceptionObject
* exception handling/unwinding entry points
* modified versions of handle/unwind exception stubs using standard calling conventions
* exception throwing
* implicit null pointer exception, implicit div by 0 exception
* arraystore/classcast/arrayindex exceptions
* checkcast implementation
* newarray, anewarray, multinewarray implementation
* correct new instance initialization
* access to java class mirrors (for ldc)
* unresolved methods
* class resolving - class patching (asssembly prototype copying)
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Tue, 31 Aug 2010 22:13:30 -0700 |
parents | 695451afc619 |
children | efba53f86c4f |
comparison
equal
deleted
inserted
replaced
1428:695451afc619 | 1429:abc670a709dc |
---|---|
25 void c1x_compute_offsets(); | 25 void c1x_compute_offsets(); |
26 | 26 |
27 // defines the structure of the CiTargetMethod - classes | 27 // defines the structure of the CiTargetMethod - classes |
28 // this will generate classes with accessors similar to javaClasses.hpp | 28 // this will generate classes with accessors similar to javaClasses.hpp |
29 | 29 |
30 #define COMPILER_CLASSES_DO(start_class, end_class, char_field, int_field, long_field, oop_field, static_oop_field) \ | 30 #define COMPILER_CLASSES_DO(start_class, end_class, char_field, int_field, boolean_field, long_field, oop_field, static_oop_field) \ |
31 start_class(HotSpotTypeResolved) \ | 31 start_class(HotSpotTypeResolved) \ |
32 long_field(HotSpotTypeResolved, vmId) \ | 32 long_field(HotSpotTypeResolved, vmId) \ |
33 long_field(HotSpotTypeResolved, javaMirrorVmId) \ | |
34 oop_field(HotSpotTypeResolved, name, "Ljava/lang/String;") \ | |
35 int_field(HotSpotTypeResolved, accessFlags) \ | |
36 boolean_field(HotSpotTypeResolved, hasFinalizer) \ | |
37 boolean_field(HotSpotTypeResolved, hasSubclass) \ | |
38 boolean_field(HotSpotTypeResolved, hasFinalizableSubclass) \ | |
39 boolean_field(HotSpotTypeResolved, isInitialized) \ | |
40 boolean_field(HotSpotTypeResolved, isArrayClass) \ | |
41 boolean_field(HotSpotTypeResolved, isInstanceClass) \ | |
42 boolean_field(HotSpotTypeResolved, isInterface) \ | |
43 int_field(HotSpotTypeResolved, instanceSize) \ | |
33 end_class \ | 44 end_class \ |
34 start_class(HotSpotMethod) \ | 45 start_class(HotSpotMethodResolved) \ |
35 long_field(HotSpotMethod, vmId) \ | 46 long_field(HotSpotMethodResolved, vmId) \ |
36 end_class \ | 47 end_class \ |
37 start_class(HotSpotTargetMethod) \ | 48 start_class(HotSpotTargetMethod) \ |
38 oop_field(HotSpotTargetMethod, targetMethod, "Lcom/sun/cri/ci/CiTargetMethod;") \ | 49 oop_field(HotSpotTargetMethod, targetMethod, "Lcom/sun/cri/ci/CiTargetMethod;") \ |
39 oop_field(HotSpotTargetMethod, method, "Lcom/sun/hotspot/c1x/HotSpotMethod;") \ | 50 oop_field(HotSpotTargetMethod, method, "Lcom/sun/hotspot/c1x/HotSpotMethodResolved;")\ |
40 oop_field(HotSpotTargetMethod, name, "Ljava/lang/String;") \ | 51 oop_field(HotSpotTargetMethod, name, "Ljava/lang/String;") \ |
41 oop_field(HotSpotTargetMethod, sites, "[Lcom/sun/cri/ci/CiTargetMethod$Site;") \ | 52 oop_field(HotSpotTargetMethod, sites, "[Lcom/sun/cri/ci/CiTargetMethod$Site;") \ |
53 oop_field(HotSpotTargetMethod, exceptionHandlers, "[Lcom/sun/cri/ci/CiTargetMethod$ExceptionHandler;") \ | |
54 end_class \ | |
55 start_class(HotSpotExceptionHandler) \ | |
56 int_field(HotSpotExceptionHandler, startBci) \ | |
57 int_field(HotSpotExceptionHandler, endBci) \ | |
58 int_field(HotSpotExceptionHandler, handlerBci) \ | |
59 int_field(HotSpotExceptionHandler, catchClassIndex) \ | |
60 oop_field(HotSpotExceptionHandler, catchClass, "Lcom/sun/cri/ri/RiType;") \ | |
42 end_class \ | 61 end_class \ |
43 start_class(CiTargetMethod) \ | 62 start_class(CiTargetMethod) \ |
44 int_field(CiTargetMethod, frameSize) \ | 63 int_field(CiTargetMethod, frameSize) \ |
45 oop_field(CiTargetMethod, targetCode, "[B") \ | 64 oop_field(CiTargetMethod, targetCode, "[B") \ |
46 int_field(CiTargetMethod, targetCodeSize) \ | 65 int_field(CiTargetMethod, targetCodeSize) \ |
64 start_class(CiTargetMethod_Safepoint) \ | 83 start_class(CiTargetMethod_Safepoint) \ |
65 oop_field(CiTargetMethod_Safepoint, debugInfo, "Lcom/sun/cri/ci/CiDebugInfo;") \ | 84 oop_field(CiTargetMethod_Safepoint, debugInfo, "Lcom/sun/cri/ci/CiDebugInfo;") \ |
66 end_class \ | 85 end_class \ |
67 start_class(CiTargetMethod_ExceptionHandler) \ | 86 start_class(CiTargetMethod_ExceptionHandler) \ |
68 int_field(CiTargetMethod_ExceptionHandler, handlerPos) \ | 87 int_field(CiTargetMethod_ExceptionHandler, handlerPos) \ |
88 int_field(CiTargetMethod_ExceptionHandler, handlerBci) \ | |
89 int_field(CiTargetMethod_ExceptionHandler, bci) \ | |
90 int_field(CiTargetMethod_ExceptionHandler, scopeLevel) \ | |
69 oop_field(CiTargetMethod_ExceptionHandler, exceptionType, "Lcom/sun/cri/ri/RiType;")\ | 91 oop_field(CiTargetMethod_ExceptionHandler, exceptionType, "Lcom/sun/cri/ri/RiType;")\ |
70 end_class \ | 92 end_class \ |
71 start_class(CiTargetMethod_Mark) \ | 93 start_class(CiTargetMethod_Mark) \ |
72 oop_field(CiTargetMethod_Mark, id, "Ljava/lang/Object;") \ | 94 oop_field(CiTargetMethod_Mark, id, "Ljava/lang/Object;") \ |
73 oop_field(CiTargetMethod_Mark, references, "[Lcom/sun/cri/ci/CiTargetMethod$Mark;") \ | 95 oop_field(CiTargetMethod_Mark, references, "[Lcom/sun/cri/ci/CiTargetMethod$Mark;") \ |
98 end_class \ | 120 end_class \ |
99 start_class(CiKind) \ | 121 start_class(CiKind) \ |
100 char_field(CiKind, typeChar) \ | 122 char_field(CiKind, typeChar) \ |
101 end_class \ | 123 end_class \ |
102 start_class(CiRuntimeCall) \ | 124 start_class(CiRuntimeCall) \ |
125 static_oop_field(CiRuntimeCall, UnwindException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
126 static_oop_field(CiRuntimeCall, RegisterFinalizer, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
127 static_oop_field(CiRuntimeCall, HandleException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
128 static_oop_field(CiRuntimeCall, OSRMigrationEnd, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
129 static_oop_field(CiRuntimeCall, JavaTimeMillis, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
130 static_oop_field(CiRuntimeCall, JavaTimeNanos, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
103 static_oop_field(CiRuntimeCall, Debug, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | 131 static_oop_field(CiRuntimeCall, Debug, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ |
132 static_oop_field(CiRuntimeCall, ArithmethicLrem, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
133 static_oop_field(CiRuntimeCall, ArithmeticLdiv, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
134 static_oop_field(CiRuntimeCall, ArithmeticFrem, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
135 static_oop_field(CiRuntimeCall, ArithmeticDrem, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
136 static_oop_field(CiRuntimeCall, ArithmeticCos, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
137 static_oop_field(CiRuntimeCall, ArithmeticTan, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
138 static_oop_field(CiRuntimeCall, ArithmeticLog, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
139 static_oop_field(CiRuntimeCall, ArithmeticLog10, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
140 static_oop_field(CiRuntimeCall, ArithmeticSin, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
104 end_class \ | 141 end_class \ |
105 start_class(RiMethod) \ | 142 start_class(RiMethod) \ |
106 end_class \ | 143 end_class \ |
107 start_class(CiRegisterValue) \ | 144 start_class(CiRegisterValue) \ |
108 end_class \ | 145 end_class \ |
109 start_class(CiStackSlot) \ | 146 start_class(CiStackSlot) \ |
110 end_class \ | 147 end_class \ |
111 /* end*/ | 148 /* end*/ |
149 | |
150 | |
151 | |
112 | 152 |
113 #define START_CLASS(name) \ | 153 #define START_CLASS(name) \ |
114 class name : AllStatic { \ | 154 class name : AllStatic { \ |
115 private: \ | 155 private: \ |
116 friend class C1XCompiler; \ | 156 friend class C1XCompiler; \ |
122 #define END_CLASS }; | 162 #define END_CLASS }; |
123 | 163 |
124 #define FIELD(name, type, accessor) \ | 164 #define FIELD(name, type, accessor) \ |
125 static int _##name##_offset; \ | 165 static int _##name##_offset; \ |
126 static type name(oop obj) { check(obj); return obj->accessor(_##name##_offset); } \ | 166 static type name(oop obj) { check(obj); return obj->accessor(_##name##_offset); } \ |
167 static type name(Handle 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); } \ | 168 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); } \ | 169 static void set_##name(oop obj, type x) { check(obj); obj->accessor##_put(_##name##_offset, x); } \ |
170 static void set_##name(Handle 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); } | 171 static void set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj)); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); } |
130 | 172 |
131 #define CHAR_FIELD(klass, name) FIELD(name, jchar, char_field) | 173 #define CHAR_FIELD(klass, name) FIELD(name, jchar, char_field) |
132 #define INT_FIELD(klass, name) FIELD(name, jint, int_field) | 174 #define INT_FIELD(klass, name) FIELD(name, jint, int_field) |
175 #define BOOLEAN_FIELD(klass, name) FIELD(name, jboolean, bool_field) | |
133 #define LONG_FIELD(klass, name) FIELD(name, jlong, long_field) | 176 #define LONG_FIELD(klass, name) FIELD(name, jlong, long_field) |
134 #define OOP_FIELD(klass, name, signature) FIELD(name, oop, obj_field) | 177 #define OOP_FIELD(klass, name, signature) FIELD(name, oop, obj_field) |
135 #define STATIC_OOP_FIELD(klassName, name, signature) \ | 178 #define STATIC_OOP_FIELD(klassName, name, signature) \ |
136 static int _##name##_offset; \ | 179 static int _##name##_offset; \ |
137 static oop name() { return klassName::klass()->obj_field(_##name##_offset); } \ | 180 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); } | 181 static void set_##name(oop x) { klassName::klass()->obj_field_put(_##name##_offset, x); } |
139 | 182 |
140 COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, LONG_FIELD, OOP_FIELD, STATIC_OOP_FIELD) | 183 COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, OOP_FIELD, STATIC_OOP_FIELD) |
141 #undef START_CLASS | 184 #undef START_CLASS |
142 #undef END_CLASS | 185 #undef END_CLASS |
143 #undef FIELD | 186 #undef FIELD |
144 #undef CHAR_FIELD | 187 #undef CHAR_FIELD |
145 #undef INT_FIELD | 188 #undef INT_FIELD |
189 #undef BOOLEAN_FIELD | |
146 #undef LONG_FIELD | 190 #undef LONG_FIELD |
147 #undef OOP_FIELD | 191 #undef OOP_FIELD |
148 #undef STATIC_OOP_FIELD | 192 #undef STATIC_OOP_FIELD |
149 | 193 |
150 | 194 |