1337 oop java_lang_Class::module(oop java_class) {
1338 assert(_module_offset != 0, "must be set");
1339 return java_class->obj_field(_module_offset);
1340 }
1341
1342 void java_lang_Class::set_module(oop java_class, oop module) {
1343 assert(_module_offset != 0, "must be set");
1344 java_class->obj_field_put(_module_offset, module);
1345 }
1346
1347 oop java_lang_Class::name(Handle java_class, TRAPS) {
1348 assert(_name_offset != 0, "must be set");
1349 oop o = java_class->obj_field(_name_offset);
1350 if (o == NULL) {
1351 o = StringTable::intern(java_lang_Class::as_external_name(java_class()), THREAD);
1352 java_class->obj_field_put(_name_offset, o);
1353 }
1354 return o;
1355 }
1356
1357 oop java_lang_Class::create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS) {
1358 // This should be improved by adding a field at the Java level or by
1359 // introducing a new VM klass (see comment in ClassFileParser)
1360 oop java_class = InstanceMirrorKlass::cast(SystemDictionary::Class_klass())->allocate_instance(NULL, CHECK_0);
1361 if (type != T_VOID) {
1362 Klass* aklass = Universe::typeArrayKlassObj(type);
1363 assert(aklass != NULL, "correct bootstrap");
1364 release_set_array_klass(java_class, aklass);
1365 }
1366 #ifdef ASSERT
1367 InstanceMirrorKlass* mk = InstanceMirrorKlass::cast(SystemDictionary::Class_klass());
1368 assert(java_lang_Class::static_oop_field_count(java_class) == 0, "should have been zeroed by allocation");
1369 #endif
1370 return java_class;
1371 }
1372
1373
1374 Klass* java_lang_Class::as_Klass(oop java_class) {
1375 //%note memory_2
1376 assert(java_lang_Class::is_instance(java_class), "must be a Class object");
2585 ModuleEntry* module = holder->module();
2586 if (module->is_named()) {
2587 oop module_name = StringTable::intern(module->name(), CHECK);
2588 java_lang_StackTraceElement::set_moduleName(element(), module_name);
2589 oop module_version;
2590 if (module->version() != NULL) {
2591 module_version = StringTable::intern(module->version(), CHECK);
2592 } else {
2593 module_version = NULL;
2594 }
2595 java_lang_StackTraceElement::set_moduleVersion(element(), module_version);
2596 }
2597
2598 if (method() == NULL || !version_matches(method(), version)) {
2599 // The method was redefined, accurate line number information isn't available
2600 java_lang_StackTraceElement::set_fileName(element(), NULL);
2601 java_lang_StackTraceElement::set_lineNumber(element(), -1);
2602 } else {
2603 // Fill in source file name and line number.
2604 Symbol* source = Backtrace::get_source_file_name(holder, version);
2605 if (ShowHiddenFrames && source == NULL)
2606 source = vmSymbols::unknown_class_name();
2607 oop filename = StringTable::intern(source, CHECK);
2608 java_lang_StackTraceElement::set_fileName(element(), filename);
2609
2610 int line_number = Backtrace::get_line_number(method, bci);
2611 java_lang_StackTraceElement::set_lineNumber(element(), line_number);
2612 }
2613 }
2614
2615 Method* java_lang_StackFrameInfo::get_method(Handle stackFrame, InstanceKlass* holder, TRAPS) {
2616 HandleMark hm(THREAD);
2617 Handle mname(THREAD, stackFrame->obj_field(_memberName_offset));
2618 Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mname());
2619 // we should expand MemberName::name when Throwable uses StackTrace
2620 // MethodHandles::expand_MemberName(mname, MethodHandles::_suppress_defc|MethodHandles::_suppress_type, CHECK_NULL);
2621 return method;
2622 }
2623
2624 void java_lang_StackFrameInfo::set_method_and_bci(Handle stackFrame, const methodHandle& method, int bci, TRAPS) {
2625 // set Method* or mid/cpref
2626 HandleMark hm(THREAD);
2627 Handle mname(Thread::current(), stackFrame->obj_field(_memberName_offset));
2628 InstanceKlass* ik = method->method_holder();
3963 void java_lang_System::serialize_offsets(SerializeClosure* f) {
3964 SYSTEM_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
3965 }
3966 #endif
3967
3968 int java_lang_System::in_offset_in_bytes() { return static_in_offset; }
3969 int java_lang_System::out_offset_in_bytes() { return static_out_offset; }
3970 int java_lang_System::err_offset_in_bytes() { return static_err_offset; }
3971
3972 int java_lang_Class::_klass_offset;
3973 int java_lang_Class::_array_klass_offset;
3974 int java_lang_Class::_oop_size_offset;
3975 int java_lang_Class::_static_oop_field_count_offset;
3976 int java_lang_Class::_class_loader_offset;
3977 int java_lang_Class::_module_offset;
3978 int java_lang_Class::_protection_domain_offset;
3979 int java_lang_Class::_component_mirror_offset;
3980 int java_lang_Class::_init_lock_offset;
3981 int java_lang_Class::_signers_offset;
3982 int java_lang_Class::_name_offset;
3983 GrowableArray<Klass*>* java_lang_Class::_fixup_mirror_list = NULL;
3984 GrowableArray<Klass*>* java_lang_Class::_fixup_module_field_list = NULL;
3985 int java_lang_Throwable::backtrace_offset;
3986 int java_lang_Throwable::detailMessage_offset;
3987 int java_lang_Throwable::stackTrace_offset;
3988 int java_lang_Throwable::depth_offset;
3989 int java_lang_Throwable::static_unassigned_stacktrace_offset;
3990 int java_lang_reflect_AccessibleObject::override_offset;
3991 int java_lang_reflect_Method::clazz_offset;
3992 int java_lang_reflect_Method::name_offset;
3993 int java_lang_reflect_Method::returnType_offset;
3994 int java_lang_reflect_Method::parameterTypes_offset;
3995 int java_lang_reflect_Method::exceptionTypes_offset;
3996 int java_lang_reflect_Method::slot_offset;
3997 int java_lang_reflect_Method::modifiers_offset;
3998 int java_lang_reflect_Method::signature_offset;
3999 int java_lang_reflect_Method::annotations_offset;
4000 int java_lang_reflect_Method::parameter_annotations_offset;
4001 int java_lang_reflect_Method::annotation_default_offset;
4002 int java_lang_reflect_Constructor::clazz_offset;
|
1337 oop java_lang_Class::module(oop java_class) {
1338 assert(_module_offset != 0, "must be set");
1339 return java_class->obj_field(_module_offset);
1340 }
1341
1342 void java_lang_Class::set_module(oop java_class, oop module) {
1343 assert(_module_offset != 0, "must be set");
1344 java_class->obj_field_put(_module_offset, module);
1345 }
1346
1347 oop java_lang_Class::name(Handle java_class, TRAPS) {
1348 assert(_name_offset != 0, "must be set");
1349 oop o = java_class->obj_field(_name_offset);
1350 if (o == NULL) {
1351 o = StringTable::intern(java_lang_Class::as_external_name(java_class()), THREAD);
1352 java_class->obj_field_put(_name_offset, o);
1353 }
1354 return o;
1355 }
1356
1357 oop java_lang_Class::source_file(oop java_class) {
1358 assert(_source_file_offset != 0, "must be set");
1359 return java_class->obj_field(_source_file_offset);
1360 }
1361
1362 void java_lang_Class::set_source_file(oop java_class, oop source_file) {
1363 assert(_source_file_offset != 0, "must be set");
1364 java_class->obj_field_put(_source_file_offset, source_file);
1365 }
1366
1367 oop java_lang_Class::create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS) {
1368 // This should be improved by adding a field at the Java level or by
1369 // introducing a new VM klass (see comment in ClassFileParser)
1370 oop java_class = InstanceMirrorKlass::cast(SystemDictionary::Class_klass())->allocate_instance(NULL, CHECK_0);
1371 if (type != T_VOID) {
1372 Klass* aklass = Universe::typeArrayKlassObj(type);
1373 assert(aklass != NULL, "correct bootstrap");
1374 release_set_array_klass(java_class, aklass);
1375 }
1376 #ifdef ASSERT
1377 InstanceMirrorKlass* mk = InstanceMirrorKlass::cast(SystemDictionary::Class_klass());
1378 assert(java_lang_Class::static_oop_field_count(java_class) == 0, "should have been zeroed by allocation");
1379 #endif
1380 return java_class;
1381 }
1382
1383
1384 Klass* java_lang_Class::as_Klass(oop java_class) {
1385 //%note memory_2
1386 assert(java_lang_Class::is_instance(java_class), "must be a Class object");
2595 ModuleEntry* module = holder->module();
2596 if (module->is_named()) {
2597 oop module_name = StringTable::intern(module->name(), CHECK);
2598 java_lang_StackTraceElement::set_moduleName(element(), module_name);
2599 oop module_version;
2600 if (module->version() != NULL) {
2601 module_version = StringTable::intern(module->version(), CHECK);
2602 } else {
2603 module_version = NULL;
2604 }
2605 java_lang_StackTraceElement::set_moduleVersion(element(), module_version);
2606 }
2607
2608 if (method() == NULL || !version_matches(method(), version)) {
2609 // The method was redefined, accurate line number information isn't available
2610 java_lang_StackTraceElement::set_fileName(element(), NULL);
2611 java_lang_StackTraceElement::set_lineNumber(element(), -1);
2612 } else {
2613 // Fill in source file name and line number.
2614 Symbol* source = Backtrace::get_source_file_name(holder, version);
2615 oop source_file = java_lang_Class::source_file(java_class());
2616 if (source != NULL) {
2617 // Class was not redefined. We can trust its cache if set,
2618 // else we have to initialize it.
2619 if (source_file == NULL) {
2620 source_file = StringTable::intern(source, CHECK);
2621 java_lang_Class::set_source_file(java_class(), source_file);
2622 }
2623 } else {
2624 // Class was redefined. Dump the cache if it was set.
2625 if (source_file != NULL) {
2626 source_file = NULL;
2627 java_lang_Class::set_source_file(java_class(), source_file);
2628 }
2629 if (ShowHiddenFrames) {
2630 source = vmSymbols::unknown_class_name();
2631 source_file = StringTable::intern(source, CHECK);
2632 }
2633 }
2634 java_lang_StackTraceElement::set_fileName(element(), source_file);
2635
2636 int line_number = Backtrace::get_line_number(method, bci);
2637 java_lang_StackTraceElement::set_lineNumber(element(), line_number);
2638 }
2639 }
2640
2641 Method* java_lang_StackFrameInfo::get_method(Handle stackFrame, InstanceKlass* holder, TRAPS) {
2642 HandleMark hm(THREAD);
2643 Handle mname(THREAD, stackFrame->obj_field(_memberName_offset));
2644 Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mname());
2645 // we should expand MemberName::name when Throwable uses StackTrace
2646 // MethodHandles::expand_MemberName(mname, MethodHandles::_suppress_defc|MethodHandles::_suppress_type, CHECK_NULL);
2647 return method;
2648 }
2649
2650 void java_lang_StackFrameInfo::set_method_and_bci(Handle stackFrame, const methodHandle& method, int bci, TRAPS) {
2651 // set Method* or mid/cpref
2652 HandleMark hm(THREAD);
2653 Handle mname(Thread::current(), stackFrame->obj_field(_memberName_offset));
2654 InstanceKlass* ik = method->method_holder();
3989 void java_lang_System::serialize_offsets(SerializeClosure* f) {
3990 SYSTEM_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
3991 }
3992 #endif
3993
3994 int java_lang_System::in_offset_in_bytes() { return static_in_offset; }
3995 int java_lang_System::out_offset_in_bytes() { return static_out_offset; }
3996 int java_lang_System::err_offset_in_bytes() { return static_err_offset; }
3997
3998 int java_lang_Class::_klass_offset;
3999 int java_lang_Class::_array_klass_offset;
4000 int java_lang_Class::_oop_size_offset;
4001 int java_lang_Class::_static_oop_field_count_offset;
4002 int java_lang_Class::_class_loader_offset;
4003 int java_lang_Class::_module_offset;
4004 int java_lang_Class::_protection_domain_offset;
4005 int java_lang_Class::_component_mirror_offset;
4006 int java_lang_Class::_init_lock_offset;
4007 int java_lang_Class::_signers_offset;
4008 int java_lang_Class::_name_offset;
4009 int java_lang_Class::_source_file_offset;
4010 GrowableArray<Klass*>* java_lang_Class::_fixup_mirror_list = NULL;
4011 GrowableArray<Klass*>* java_lang_Class::_fixup_module_field_list = NULL;
4012 int java_lang_Throwable::backtrace_offset;
4013 int java_lang_Throwable::detailMessage_offset;
4014 int java_lang_Throwable::stackTrace_offset;
4015 int java_lang_Throwable::depth_offset;
4016 int java_lang_Throwable::static_unassigned_stacktrace_offset;
4017 int java_lang_reflect_AccessibleObject::override_offset;
4018 int java_lang_reflect_Method::clazz_offset;
4019 int java_lang_reflect_Method::name_offset;
4020 int java_lang_reflect_Method::returnType_offset;
4021 int java_lang_reflect_Method::parameterTypes_offset;
4022 int java_lang_reflect_Method::exceptionTypes_offset;
4023 int java_lang_reflect_Method::slot_offset;
4024 int java_lang_reflect_Method::modifiers_offset;
4025 int java_lang_reflect_Method::signature_offset;
4026 int java_lang_reflect_Method::annotations_offset;
4027 int java_lang_reflect_Method::parameter_annotations_offset;
4028 int java_lang_reflect_Method::annotation_default_offset;
4029 int java_lang_reflect_Constructor::clazz_offset;
|