equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
202 // Conversion |
202 // Conversion |
203 static Symbol* as_symbol(Handle java_string, TRAPS); |
203 static Symbol* as_symbol(Handle java_string, TRAPS); |
204 static Symbol* as_symbol_or_null(oop java_string); |
204 static Symbol* as_symbol_or_null(oop java_string); |
205 |
205 |
206 // Testers |
206 // Testers |
207 static bool is_instance(oop obj) { |
207 static bool is_instance(oop obj); |
208 return obj != NULL && obj->klass() == SystemDictionary::String_klass(); |
208 static bool is_instance_inlined(oop obj); |
209 } |
|
210 |
209 |
211 // Debugging |
210 // Debugging |
212 static void print(oop java_string, outputStream* st); |
211 static void print(oop java_string, outputStream* st); |
213 friend class JavaClasses; |
212 friend class JavaClasses; |
214 }; |
213 }; |
271 return result; |
270 return result; |
272 } |
271 } |
273 static Symbol* as_signature(oop java_class, bool intern_if_not_found, TRAPS); |
272 static Symbol* as_signature(oop java_class, bool intern_if_not_found, TRAPS); |
274 static void print_signature(oop java_class, outputStream *st); |
273 static void print_signature(oop java_class, outputStream *st); |
275 // Testing |
274 // Testing |
276 static bool is_instance(oop obj) { |
275 static bool is_instance(oop obj); |
277 return obj != NULL && obj->klass() == SystemDictionary::Class_klass(); |
276 |
278 } |
|
279 static bool is_primitive(oop java_class); |
277 static bool is_primitive(oop java_class); |
280 static BasicType primitive_type(oop java_class); |
278 static BasicType primitive_type(oop java_class); |
281 static oop primitive_mirror(BasicType t); |
279 static oop primitive_mirror(BasicType t); |
282 // JVM_NewArray support |
280 // JVM_NewArray support |
283 static Klass* array_klass(oop java_class); |
281 static Klass* array_klass(oop java_class); |
987 |
985 |
988 // Testers |
986 // Testers |
989 static bool is_subclass(Klass* klass) { |
987 static bool is_subclass(Klass* klass) { |
990 return klass->is_subclass_of(SystemDictionary::MethodHandle_klass()); |
988 return klass->is_subclass_of(SystemDictionary::MethodHandle_klass()); |
991 } |
989 } |
992 static bool is_instance(oop obj) { |
990 static bool is_instance(oop obj); |
993 return obj != NULL && is_subclass(obj->klass()); |
|
994 } |
|
995 |
991 |
996 // Accessors for code generation: |
992 // Accessors for code generation: |
997 static int type_offset_in_bytes() { return _type_offset; } |
993 static int type_offset_in_bytes() { return _type_offset; } |
998 static int form_offset_in_bytes() { return _form_offset; } |
994 static int form_offset_in_bytes() { return _form_offset; } |
999 }; |
995 }; |
1014 |
1010 |
1015 // Testers |
1011 // Testers |
1016 static bool is_subclass(Klass* klass) { |
1012 static bool is_subclass(Klass* klass) { |
1017 return klass->is_subclass_of(SystemDictionary::DirectMethodHandle_klass()); |
1013 return klass->is_subclass_of(SystemDictionary::DirectMethodHandle_klass()); |
1018 } |
1014 } |
1019 static bool is_instance(oop obj) { |
1015 static bool is_instance(oop obj); |
1020 return obj != NULL && is_subclass(obj->klass()); |
|
1021 } |
|
1022 |
1016 |
1023 // Accessors for code generation: |
1017 // Accessors for code generation: |
1024 static int member_offset_in_bytes() { return _member_offset; } |
1018 static int member_offset_in_bytes() { return _member_offset; } |
1025 }; |
1019 }; |
1026 |
1020 |
1043 // Testers |
1037 // Testers |
1044 static bool is_subclass(Klass* klass) { |
1038 static bool is_subclass(Klass* klass) { |
1045 return SystemDictionary::LambdaForm_klass() != NULL && |
1039 return SystemDictionary::LambdaForm_klass() != NULL && |
1046 klass->is_subclass_of(SystemDictionary::LambdaForm_klass()); |
1040 klass->is_subclass_of(SystemDictionary::LambdaForm_klass()); |
1047 } |
1041 } |
1048 static bool is_instance(oop obj) { |
1042 static bool is_instance(oop obj); |
1049 return obj != NULL && is_subclass(obj->klass()); |
|
1050 } |
|
1051 |
1043 |
1052 // Accessors for code generation: |
1044 // Accessors for code generation: |
1053 static int vmentry_offset_in_bytes() { return _vmentry_offset; } |
1045 static int vmentry_offset_in_bytes() { return _vmentry_offset; } |
1054 }; |
1046 }; |
1055 |
1047 |
1109 |
1101 |
1110 // Testers |
1102 // Testers |
1111 static bool is_subclass(Klass* klass) { |
1103 static bool is_subclass(Klass* klass) { |
1112 return klass->is_subclass_of(SystemDictionary::MemberName_klass()); |
1104 return klass->is_subclass_of(SystemDictionary::MemberName_klass()); |
1113 } |
1105 } |
1114 static bool is_instance(oop obj) { |
1106 static bool is_instance(oop obj); |
1115 return obj != NULL && is_subclass(obj->klass()); |
|
1116 } |
|
1117 |
1107 |
1118 static bool is_method(oop obj); |
1108 static bool is_method(oop obj); |
1119 |
1109 |
1120 // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants): |
1110 // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants): |
1121 enum { |
1111 enum { |
1164 static int rtype_slot_count(oop mt); // extra counts for long/double |
1154 static int rtype_slot_count(oop mt); // extra counts for long/double |
1165 |
1155 |
1166 static Symbol* as_signature(oop mt, bool intern_if_not_found, TRAPS); |
1156 static Symbol* as_signature(oop mt, bool intern_if_not_found, TRAPS); |
1167 static void print_signature(oop mt, outputStream* st); |
1157 static void print_signature(oop mt, outputStream* st); |
1168 |
1158 |
1169 static bool is_instance(oop obj) { |
1159 static bool is_instance(oop obj); |
1170 return obj != NULL && obj->klass() == SystemDictionary::MethodType_klass(); |
|
1171 } |
|
1172 |
1160 |
1173 static bool equals(oop mt1, oop mt2); |
1161 static bool equals(oop mt1, oop mt2); |
1174 |
1162 |
1175 // Accessors for code generation: |
1163 // Accessors for code generation: |
1176 static int rtype_offset_in_bytes() { return _rtype_offset; } |
1164 static int rtype_offset_in_bytes() { return _rtype_offset; } |
1188 |
1176 |
1189 static void compute_offsets(); |
1177 static void compute_offsets(); |
1190 |
1178 |
1191 public: |
1179 public: |
1192 // Accessors |
1180 // Accessors |
1193 static oop target( oop site) { return site->obj_field( _target_offset); } |
1181 static oop target( oop site); |
1194 static void set_target( oop site, oop target) { site->obj_field_put( _target_offset, target); } |
1182 static void set_target( oop site, oop target); |
1195 |
1183 |
1196 static volatile oop target_volatile(oop site) { return oop((oopDesc *)(site->obj_field_volatile(_target_offset))); } |
1184 static volatile oop target_volatile(oop site); |
1197 static void set_target_volatile(oop site, oop target) { site->obj_field_put_volatile(_target_offset, target); } |
1185 static void set_target_volatile(oop site, oop target); |
1198 |
1186 |
1199 // Testers |
1187 // Testers |
1200 static bool is_subclass(Klass* klass) { |
1188 static bool is_subclass(Klass* klass) { |
1201 return klass->is_subclass_of(SystemDictionary::CallSite_klass()); |
1189 return klass->is_subclass_of(SystemDictionary::CallSite_klass()); |
1202 } |
1190 } |
1203 static bool is_instance(oop obj) { |
1191 static bool is_instance(oop obj); |
1204 return obj != NULL && is_subclass(obj->klass()); |
|
1205 } |
|
1206 |
1192 |
1207 // Accessors for code generation: |
1193 // Accessors for code generation: |
1208 static int target_offset_in_bytes() { return _target_offset; } |
1194 static int target_offset_in_bytes() { return _target_offset; } |
1209 }; |
1195 }; |
1210 |
1196 |
1266 |
1252 |
1267 // Testers |
1253 // Testers |
1268 static bool is_subclass(Klass* klass) { |
1254 static bool is_subclass(Klass* klass) { |
1269 return klass->is_subclass_of(SystemDictionary::ClassLoader_klass()); |
1255 return klass->is_subclass_of(SystemDictionary::ClassLoader_klass()); |
1270 } |
1256 } |
1271 static bool is_instance(oop obj) { |
1257 static bool is_instance(oop obj); |
1272 return obj != NULL && is_subclass(obj->klass()); |
|
1273 } |
|
1274 |
1258 |
1275 // Debugging |
1259 // Debugging |
1276 friend class JavaClasses; |
1260 friend class JavaClasses; |
1277 friend class ClassFileParser; // access to number_of_fake_fields |
1261 friend class ClassFileParser; // access to number_of_fake_fields |
1278 }; |
1262 }; |