comparison src/share/vm/graal/graalJavaAccess.cpp @ 6948:e522a00b91aa

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
author Doug Simon <doug.simon@oracle.com>
date Mon, 12 Nov 2012 23:14:12 +0100
parents 511612d1b5c1
children 0266549ff6e0
comparison
equal deleted inserted replaced
6711:ae13cc658b80 6948:e522a00b91aa
26 #include "runtime/jniHandles.hpp" 26 #include "runtime/jniHandles.hpp"
27 #include "classfile/symbolTable.hpp" 27 #include "classfile/symbolTable.hpp"
28 // This function is similar to javaClasses.cpp, it computes the field offset of a (static or instance) field. 28 // This function is similar to javaClasses.cpp, it computes the field offset of a (static or instance) field.
29 // It looks up the name and signature symbols without creating new ones, all the symbols of these classes need to be already loaded. 29 // It looks up the name and signature symbols without creating new ones, all the symbols of these classes need to be already loaded.
30 30
31 void compute_offset(int &dest_offset, klassOop klass_oop, const char* name, const char* signature, bool static_field) { 31 void compute_offset(int &dest_offset, Klass* klass, const char* name, const char* signature, bool static_field) {
32 Symbol* name_symbol = SymbolTable::probe(name, (int)strlen(name)); 32 Symbol* name_symbol = SymbolTable::probe(name, (int)strlen(name));
33 Symbol* signature_symbol = SymbolTable::probe(signature, (int)strlen(signature)); 33 Symbol* signature_symbol = SymbolTable::probe(signature, (int)strlen(signature));
34 #ifndef PRODUCT 34 #ifndef PRODUCT
35 if (name_symbol == NULL) { 35 if (name_symbol == NULL) {
36 tty->print_cr("symbol with name %s was not found in symbol table (klass=%s)", name, klass_oop->klass_part()->name()->as_C_string()); 36 tty->print_cr("symbol with name %s was not found in symbol table (klass=%s)", name, klass->name()->as_C_string());
37 } 37 }
38 #endif 38 #endif
39 if (name_symbol == NULL || signature_symbol == NULL) { 39 if (name_symbol == NULL || signature_symbol == NULL) {
40 guarantee(false, err_msg("symbol not found - class layout of %s changed?", klass_oop->klass_part()->name()->as_C_string())); 40 guarantee(false, err_msg("symbol not found - class layout of %s changed?", klass->name()->as_C_string()));
41 } 41 }
42 42
43 instanceKlass* ik = instanceKlass::cast(klass_oop); 43 InstanceKlass* ik = InstanceKlass::cast(klass);
44 fieldDescriptor fd; 44 fieldDescriptor fd;
45 if (!ik->find_field(name_symbol, signature_symbol, &fd)) { 45 if (!ik->find_field(name_symbol, signature_symbol, &fd)) {
46 ResourceMark rm; 46 ResourceMark rm;
47 tty->print_cr("Invalid layout of %s at %s", name_symbol->as_C_string(), ik->external_name()); 47 tty->print_cr("Invalid layout of %s at %s", name_symbol->as_C_string(), ik->external_name());
48 fatal("Invalid layout of preloaded class"); 48 fatal("Invalid layout of preloaded class");
51 dest_offset = fd.offset(); 51 dest_offset = fd.offset();
52 } 52 }
53 53
54 // This piece of macro magic creates the contents of the graal_compute_offsets method that initializes the field indices of all the access classes. 54 // This piece of macro magic creates the contents of the graal_compute_offsets method that initializes the field indices of all the access classes.
55 55
56 #define START_CLASS(name) { klassOop k = SystemDictionary::name##_klass(); assert(k != NULL, "Could not find class " #name ""); 56 #define START_CLASS(name) { Klass* k = SystemDictionary::name##_klass(); assert(k != NULL, "Could not find class " #name "");
57 57
58 #define END_CLASS } 58 #define END_CLASS }
59 59
60 #define FIELD(klass, name, signature, static_field) compute_offset(klass::_##name##_offset, k, #name, signature, static_field); 60 #define FIELD(klass, name, signature, static_field) compute_offset(klass::_##name##_offset, k, #name, signature, static_field);
61 #define CHAR_FIELD(klass, name) FIELD(klass, name, "C", false) 61 #define CHAR_FIELD(klass, name) FIELD(klass, name, "C", false)