1 /* |
1 /* |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2018, 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. |
442 hc_backtrace_offset = 0, |
442 hc_backtrace_offset = 0, |
443 hc_detailMessage_offset = 1, |
443 hc_detailMessage_offset = 1, |
444 hc_cause_offset = 2, // New since 1.4 |
444 hc_cause_offset = 2, // New since 1.4 |
445 hc_stackTrace_offset = 3 // New since 1.4 |
445 hc_stackTrace_offset = 3 // New since 1.4 |
446 }; |
446 }; |
447 enum { |
|
448 hc_static_unassigned_stacktrace_offset = 0 // New since 1.7 |
|
449 }; |
|
450 // Trace constants |
447 // Trace constants |
451 enum { |
448 enum { |
452 trace_methods_offset = 0, |
449 trace_methods_offset = 0, |
453 trace_bcis_offset = 1, |
450 trace_bcis_offset = 1, |
454 trace_mirrors_offset = 2, |
451 trace_mirrors_offset = 2, |
876 |
873 |
877 static int referent_offset; |
874 static int referent_offset; |
878 static int queue_offset; |
875 static int queue_offset; |
879 static int next_offset; |
876 static int next_offset; |
880 static int discovered_offset; |
877 static int discovered_offset; |
881 static int number_of_fake_oop_fields; |
|
882 |
878 |
883 // Accessors |
879 // Accessors |
884 static inline oop referent(oop ref); |
880 static inline oop referent(oop ref); |
885 static inline void set_referent(oop ref, oop value); |
881 static inline void set_referent(oop ref, oop value); |
886 static inline void set_referent_raw(oop ref, oop value); |
882 static inline void set_referent_raw(oop ref, oop value); |
900 |
896 |
901 // Interface to java.lang.ref.SoftReference objects |
897 // Interface to java.lang.ref.SoftReference objects |
902 |
898 |
903 class java_lang_ref_SoftReference: public java_lang_ref_Reference { |
899 class java_lang_ref_SoftReference: public java_lang_ref_Reference { |
904 public: |
900 public: |
905 enum { |
|
906 // The timestamp is a long field and may need to be adjusted for alignment. |
|
907 hc_timestamp_offset = hc_discovered_offset + 1 |
|
908 }; |
|
909 enum { |
|
910 hc_static_clock_offset = 0 |
|
911 }; |
|
912 |
|
913 static int timestamp_offset; |
901 static int timestamp_offset; |
914 static int static_clock_offset; |
902 static int static_clock_offset; |
915 |
903 |
916 // Accessors |
904 // Accessors |
917 static jlong timestamp(oop ref); |
905 static jlong timestamp(oop ref); |
918 |
906 |
919 // Accessors for statics |
907 // Accessors for statics |
920 static jlong clock(); |
908 static jlong clock(); |
921 static void set_clock(jlong value); |
909 static void set_clock(jlong value); |
|
910 |
|
911 static void compute_offsets(); |
922 }; |
912 }; |
923 |
913 |
924 // Interface to java.lang.invoke.MethodHandle objects |
914 // Interface to java.lang.invoke.MethodHandle objects |
925 |
915 |
926 class MethodHandleEntry; |
916 class MethodHandleEntry; |
1226 #define CLASSLOADER_INJECTED_FIELDS(macro) \ |
1216 #define CLASSLOADER_INJECTED_FIELDS(macro) \ |
1227 macro(java_lang_ClassLoader, loader_data, intptr_signature, false) |
1217 macro(java_lang_ClassLoader, loader_data, intptr_signature, false) |
1228 |
1218 |
1229 class java_lang_ClassLoader : AllStatic { |
1219 class java_lang_ClassLoader : AllStatic { |
1230 private: |
1220 private: |
1231 // The fake offsets are added by the class loader when java.lang.Class is loaded |
|
1232 enum { |
|
1233 hc_parent_offset = 0 |
|
1234 }; |
|
1235 static int _loader_data_offset; |
1221 static int _loader_data_offset; |
1236 static bool offsets_computed; |
1222 static bool offsets_computed; |
1237 static int parent_offset; |
1223 static int parent_offset; |
1238 static int parallelCapable_offset; |
1224 static int parallelCapable_offset; |
1239 static int name_offset; |
1225 static int name_offset; |
1277 |
1263 |
1278 // Interface to java.lang.System objects |
1264 // Interface to java.lang.System objects |
1279 |
1265 |
1280 class java_lang_System : AllStatic { |
1266 class java_lang_System : AllStatic { |
1281 private: |
1267 private: |
1282 enum { |
|
1283 hc_static_in_offset = 0, |
|
1284 hc_static_out_offset = 1, |
|
1285 hc_static_err_offset = 2, |
|
1286 hc_static_security_offset = 3 |
|
1287 }; |
|
1288 |
|
1289 static int static_in_offset; |
1268 static int static_in_offset; |
1290 static int static_out_offset; |
1269 static int static_out_offset; |
1291 static int static_err_offset; |
1270 static int static_err_offset; |
1292 static int static_security_offset; |
1271 static int static_security_offset; |
1293 |
1272 |
1296 static int out_offset_in_bytes(); |
1275 static int out_offset_in_bytes(); |
1297 static int err_offset_in_bytes(); |
1276 static int err_offset_in_bytes(); |
1298 |
1277 |
1299 static bool has_security_manager(); |
1278 static bool has_security_manager(); |
1300 |
1279 |
|
1280 static void compute_offsets(); |
|
1281 |
1301 // Debugging |
1282 // Debugging |
1302 friend class JavaClasses; |
1283 friend class JavaClasses; |
1303 }; |
1284 }; |
1304 |
1285 |
1305 |
1286 |
1306 // Interface to java.lang.StackTraceElement objects |
1287 // Interface to java.lang.StackTraceElement objects |
1307 |
1288 |
1308 class java_lang_StackTraceElement: AllStatic { |
1289 class java_lang_StackTraceElement: AllStatic { |
1309 private: |
1290 private: |
1310 enum { |
|
1311 hc_declaringClassObject_offset = 0, |
|
1312 hc_classLoaderName_offset = 1, |
|
1313 hc_moduleName_offset = 2, |
|
1314 hc_moduleVersion_offset = 3, |
|
1315 hc_declaringClass_offset = 4, |
|
1316 hc_methodName_offset = 5, |
|
1317 hc_fileName_offset = 6, |
|
1318 hc_lineNumber_offset = 7 |
|
1319 }; |
|
1320 |
|
1321 static int declaringClassObject_offset; |
1291 static int declaringClassObject_offset; |
1322 static int classLoaderName_offset; |
1292 static int classLoaderName_offset; |
1323 static int moduleName_offset; |
1293 static int moduleName_offset; |
1324 static int moduleVersion_offset; |
1294 static int moduleVersion_offset; |
1325 static int declaringClass_offset; |
1295 static int declaringClass_offset; |
1342 static oop create(const methodHandle& method, int bci, TRAPS); |
1312 static oop create(const methodHandle& method, int bci, TRAPS); |
1343 |
1313 |
1344 static void fill_in(Handle element, InstanceKlass* holder, const methodHandle& method, |
1314 static void fill_in(Handle element, InstanceKlass* holder, const methodHandle& method, |
1345 int version, int bci, Symbol* name, TRAPS); |
1315 int version, int bci, Symbol* name, TRAPS); |
1346 |
1316 |
|
1317 static void compute_offsets(); |
|
1318 |
1347 // Debugging |
1319 // Debugging |
1348 friend class JavaClasses; |
1320 friend class JavaClasses; |
1349 }; |
1321 }; |
1350 |
1322 |
1351 |
1323 |
1414 |
1386 |
1415 // Interface to java.lang.AssertionStatusDirectives objects |
1387 // Interface to java.lang.AssertionStatusDirectives objects |
1416 |
1388 |
1417 class java_lang_AssertionStatusDirectives: AllStatic { |
1389 class java_lang_AssertionStatusDirectives: AllStatic { |
1418 private: |
1390 private: |
1419 enum { |
|
1420 hc_classes_offset, |
|
1421 hc_classEnabled_offset, |
|
1422 hc_packages_offset, |
|
1423 hc_packageEnabled_offset, |
|
1424 hc_deflt_offset |
|
1425 }; |
|
1426 |
|
1427 static int classes_offset; |
1391 static int classes_offset; |
1428 static int classEnabled_offset; |
1392 static int classEnabled_offset; |
1429 static int packages_offset; |
1393 static int packages_offset; |
1430 static int packageEnabled_offset; |
1394 static int packageEnabled_offset; |
1431 static int deflt_offset; |
1395 static int deflt_offset; |
1435 static void set_classes(oop obj, oop val); |
1399 static void set_classes(oop obj, oop val); |
1436 static void set_classEnabled(oop obj, oop val); |
1400 static void set_classEnabled(oop obj, oop val); |
1437 static void set_packages(oop obj, oop val); |
1401 static void set_packages(oop obj, oop val); |
1438 static void set_packageEnabled(oop obj, oop val); |
1402 static void set_packageEnabled(oop obj, oop val); |
1439 static void set_deflt(oop obj, bool val); |
1403 static void set_deflt(oop obj, bool val); |
|
1404 |
|
1405 static void compute_offsets(); |
|
1406 |
1440 // Debugging |
1407 // Debugging |
1441 friend class JavaClasses; |
1408 friend class JavaClasses; |
1442 }; |
1409 }; |
1443 |
1410 |
1444 |
1411 |
1506 private: |
1473 private: |
1507 |
1474 |
1508 static InjectedField _injected_fields[]; |
1475 static InjectedField _injected_fields[]; |
1509 |
1476 |
1510 static bool check_offset(const char *klass_name, int offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0; |
1477 static bool check_offset(const char *klass_name, int offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0; |
1511 static bool check_static_offset(const char *klass_name, int hardcoded_offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0; |
|
1512 static bool check_constant(const char *klass_name, int constant, const char *field_name, const char* field_sig) PRODUCT_RETURN0; |
|
1513 |
|
1514 public: |
1478 public: |
1515 enum InjectedFieldID { |
1479 enum InjectedFieldID { |
1516 ALL_INJECTED_FIELDS(DECLARE_INJECTED_FIELD_ENUM) |
1480 ALL_INJECTED_FIELDS(DECLARE_INJECTED_FIELD_ENUM) |
1517 MAX_enum |
1481 MAX_enum |
1518 }; |
1482 }; |