comparison src/share/vm/jvmci/jvmciJavaAccess.cpp @ 22454:76af33d4d504

Make jvmci redefinition safe
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Fri, 21 Aug 2015 11:57:29 -0700
parents 0e095e2c24e2
children
comparison
equal deleted inserted replaced
22453:d6bbd5d8d81e 22454:76af33d4d504
44 ResourceMark rm; 44 ResourceMark rm;
45 fatal(err_msg("Invalid layout of %s at %s", name_symbol->as_C_string(), ik->external_name())); 45 fatal(err_msg("Invalid layout of %s at %s", name_symbol->as_C_string(), ik->external_name()));
46 } 46 }
47 guarantee(fd.is_static() == static_field, "static/instance mismatch"); 47 guarantee(fd.is_static() == static_field, "static/instance mismatch");
48 dest_offset = fd.offset(); 48 dest_offset = fd.offset();
49 assert(dest_offset != 0, "must be valid offset");
49 } 50 }
50 51
51 // This piece of macro magic creates the contents of the jvmci_compute_offsets method that initializes the field indices of all the access classes. 52 // This piece of macro magic creates the contents of the jvmci_compute_offsets method that initializes the field indices of all the access classes.
52 53
53 #define START_CLASS(name) { Klass* k = SystemDictionary::name##_klass(); assert(k != NULL, "Could not find class " #name ""); 54 #define START_CLASS(name) { Klass* k = SystemDictionary::name##_klass(); assert(k != NULL, "Could not find class " #name "");
65 #define STATIC_INT_FIELD(klass, name) FIELD(klass, name, "I", true) 66 #define STATIC_INT_FIELD(klass, name) FIELD(klass, name, "I", true)
66 #define STATIC_BOOLEAN_FIELD(klass, name) FIELD(klass, name, "Z", true) 67 #define STATIC_BOOLEAN_FIELD(klass, name) FIELD(klass, name, "Z", true)
67 68
68 69
69 void jvmci_compute_offsets() { 70 void jvmci_compute_offsets() {
70 COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, FLOAT_FIELD, OOP_FIELD, OOP_FIELD, OOP_FIELD, STATIC_OOP_FIELD, STATIC_INT_FIELD, STATIC_BOOLEAN_FIELD) 71 COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, FLOAT_FIELD, OOP_FIELD, OOP_FIELD, OOP_FIELD, STATIC_OOP_FIELD, STATIC_OOP_FIELD, STATIC_INT_FIELD, STATIC_BOOLEAN_FIELD)
71 guarantee(InstalledCode::_address_offset == sizeof(oopDesc), "codeBlob must be first field!"); 72 guarantee(InstalledCode::_address_offset == sizeof(oopDesc), "codeBlob must be first field!");
72 } 73 }
73 74
74 #define EMPTY0 75 #define EMPTY0
75 #define EMPTY1(x) 76 #define EMPTY1(x)
76 #define EMPTY2(x,y) 77 #define EMPTY2(x,y)
77 #define FIELD2(klass, name) int klass::_##name##_offset = 0; 78 #define FIELD2(klass, name) int klass::_##name##_offset = 0;
78 #define FIELD3(klass, name, sig) FIELD2(klass, name) 79 #define FIELD3(klass, name, sig) FIELD2(klass, name)
79 80
80 COMPILER_CLASSES_DO(EMPTY1, EMPTY0, FIELD2, FIELD2, FIELD2, FIELD2, FIELD2, FIELD3, FIELD3, FIELD3, FIELD3, FIELD2, FIELD2) 81 COMPILER_CLASSES_DO(EMPTY1, EMPTY0, FIELD2, FIELD2, FIELD2, FIELD2, FIELD2, FIELD3, FIELD3, FIELD3, FIELD3, FIELD3, FIELD2, FIELD2)
81 82
82 83
83 84
84 85
85 86