1514 |
1514 |
1515 bool java_lang_Class::offsets_computed = false; |
1515 bool java_lang_Class::offsets_computed = false; |
1516 int java_lang_Class::classRedefinedCount_offset = -1; |
1516 int java_lang_Class::classRedefinedCount_offset = -1; |
1517 |
1517 |
1518 #define CLASS_FIELDS_DO(macro) \ |
1518 #define CLASS_FIELDS_DO(macro) \ |
1519 macro(classRedefinedCount_offset, k, "classRedefinedCount", int_signature, false) ; \ |
1519 macro(classRedefinedCount_offset, k, "classRedefinedCount", int_signature, false); \ |
1520 macro(_class_loader_offset, k, "classLoader", classloader_signature, false); \ |
1520 macro(_class_loader_offset, k, "classLoader", classloader_signature, false); \ |
1521 macro(_component_mirror_offset, k, "componentType", class_signature, false); \ |
1521 macro(_component_mirror_offset, k, "componentType", class_signature, false); \ |
1522 macro(_module_offset, k, "module", module_signature, false); \ |
1522 macro(_module_offset, k, "module", module_signature, false); \ |
1523 macro(_name_offset, k, "name", string_signature, false); \ |
1523 macro(_name_offset, k, "name", string_signature, false); \ |
1524 |
1524 |
1959 static inline bool version_matches(Method* method, int version) { |
1959 static inline bool version_matches(Method* method, int version) { |
1960 assert(version < MAX_VERSION, "version is too big"); |
1960 assert(version < MAX_VERSION, "version is too big"); |
1961 return method != NULL && (method->constants()->version() == version); |
1961 return method != NULL && (method->constants()->version() == version); |
1962 } |
1962 } |
1963 |
1963 |
|
1964 bool java_lang_Throwable::get_method_and_bci(oop throwable, Method** method, int* bci) { |
|
1965 objArrayOop bt = (objArrayOop)backtrace(throwable); |
|
1966 |
|
1967 if (bt == NULL) { |
|
1968 return false; |
|
1969 } |
|
1970 |
|
1971 oop ms = bt->obj_at(trace_methods_offset); |
|
1972 typeArrayOop methods = typeArrayOop(ms); |
|
1973 typeArrayOop bcis = (typeArrayOop)bt->obj_at(trace_bcis_offset); |
|
1974 objArrayOop mirrors = (objArrayOop)bt->obj_at(trace_mirrors_offset); |
|
1975 if ((methods == NULL) || (bcis == NULL) || (mirrors == NULL)) { |
|
1976 return false; |
|
1977 } |
|
1978 |
|
1979 oop m = mirrors->obj_at(0); |
|
1980 if (m == NULL) { |
|
1981 return false; |
|
1982 } |
|
1983 |
|
1984 InstanceKlass* holder = InstanceKlass::cast(java_lang_Class::as_Klass(m)); |
|
1985 int method_id = methods->short_at(0); |
|
1986 Method* act_method = holder->method_with_idnum(method_id); |
|
1987 if (act_method == NULL) { |
|
1988 return false; |
|
1989 } |
|
1990 |
|
1991 int act_bci = Backtrace::bci_at(bcis->int_at(0)); |
|
1992 *method = act_method; |
|
1993 *bci = act_bci; |
|
1994 return true; |
|
1995 } |
1964 |
1996 |
1965 // This class provides a simple wrapper over the internal structure of |
1997 // This class provides a simple wrapper over the internal structure of |
1966 // exception backtrace to insulate users of the backtrace from needing |
1998 // exception backtrace to insulate users of the backtrace from needing |
1967 // to know what it looks like. |
1999 // to know what it looks like. |
1968 class BacktraceBuilder: public StackObj { |
2000 class BacktraceBuilder: public StackObj { |