src/hotspot/share/classfile/javaClasses.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File open Sdiff src/hotspot/share/classfile

src/hotspot/share/classfile/javaClasses.cpp

Print this page




2616         java_lang_Class::set_source_file(java_class(), source_file);
2617       }
2618     } else {
2619       // Class was redefined. Dump the cache if it was set.
2620       if (source_file != NULL) {
2621         source_file = NULL;
2622         java_lang_Class::set_source_file(java_class(), source_file);
2623       }
2624       if (ShowHiddenFrames) {
2625         source = vmSymbols::unknown_class_name();
2626         source_file = StringTable::intern(source, CHECK);
2627       }
2628     }
2629     java_lang_StackTraceElement::set_fileName(element(), source_file);
2630 
2631     int line_number = Backtrace::get_line_number(method, bci);
2632     java_lang_StackTraceElement::set_lineNumber(element(), line_number);
2633   }
2634 }
2635 

2636 void java_lang_StackTraceElement::decode(Handle mirror, methodHandle method, int bci, Symbol*& methodname, Symbol*& filename, int& line_number) {
2637   int method_id = method->orig_method_idnum();
2638   int cpref = method->name_index();
2639   decode(mirror, method_id, method->constants()->version(), bci, cpref, methodname, filename, line_number);
2640 }
2641 
2642 void java_lang_StackTraceElement::decode(Handle mirror, int method_id, int version, int bci, int cpref, Symbol*& methodname, Symbol*& filename, int& line_number) {
2643   // Fill in class name
2644   InstanceKlass* holder = InstanceKlass::cast(java_lang_Class::as_Klass(mirror()));
2645   Method* method = holder->method_with_orig_idnum(method_id, version);
2646 
2647   // The method can be NULL if the requested class version is gone
2648   Symbol* sym = (method != NULL) ? method->name() : holder->constants()->symbol_at(cpref);
2649 
2650   // Fill in method name
2651   methodname = sym;
2652 
2653   if (!version_matches(method, version)) {
2654     // If the method was redefined, accurate line number information isn't available
2655     filename = NULL;
2656     line_number = -1;
2657   } else {
2658     // Fill in source file name and line number.
2659     // Use a specific ik version as a holder since the mirror might
2660     // refer to a version that is now obsolete and no longer accessible
2661     // via the previous versions list.
2662     holder = holder->get_klass_version(version);
2663     assert(holder != NULL, "sanity check");
2664     Symbol* source = holder->source_file_name();
2665     if (ShowHiddenFrames && source == NULL) {
2666       source = vmSymbols::unknown_class_name();
2667     }
2668     filename = source;
2669     line_number = Backtrace::get_line_number(method, bci);
2670   }
2671 }

2672 
2673 Method* java_lang_StackFrameInfo::get_method(Handle stackFrame, InstanceKlass* holder, TRAPS) {
2674   HandleMark hm(THREAD);
2675   Handle mname(THREAD, stackFrame->obj_field(_memberName_offset));
2676   Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mname());
2677   // we should expand MemberName::name when Throwable uses StackTrace
2678   // MethodHandles::expand_MemberName(mname, MethodHandles::_suppress_defc|MethodHandles::_suppress_type, CHECK_NULL);
2679   return method;
2680 }
2681 
2682 void java_lang_StackFrameInfo::set_method_and_bci(Handle stackFrame, const methodHandle& method, int bci, TRAPS) {
2683   // set Method* or mid/cpref
2684   HandleMark hm(THREAD);
2685   Handle mname(Thread::current(), stackFrame->obj_field(_memberName_offset));
2686   InstanceKlass* ik = method->method_holder();
2687   CallInfo info(method(), ik, CHECK);
2688   MethodHandles::init_method_MemberName(mname, info);
2689   // set bci
2690   java_lang_StackFrameInfo::set_bci(stackFrame(), bci);
2691   // method may be redefined; store the version




2616         java_lang_Class::set_source_file(java_class(), source_file);
2617       }
2618     } else {
2619       // Class was redefined. Dump the cache if it was set.
2620       if (source_file != NULL) {
2621         source_file = NULL;
2622         java_lang_Class::set_source_file(java_class(), source_file);
2623       }
2624       if (ShowHiddenFrames) {
2625         source = vmSymbols::unknown_class_name();
2626         source_file = StringTable::intern(source, CHECK);
2627       }
2628     }
2629     java_lang_StackTraceElement::set_fileName(element(), source_file);
2630 
2631     int line_number = Backtrace::get_line_number(method, bci);
2632     java_lang_StackTraceElement::set_lineNumber(element(), line_number);
2633   }
2634 }
2635 
2636 #if INCLUDE_JVMCI
2637 void java_lang_StackTraceElement::decode(Handle mirror, methodHandle method, int bci, Symbol*& methodname, Symbol*& filename, int& line_number) {
2638   int method_id = method->orig_method_idnum();
2639   int cpref = method->name_index();
2640   decode(mirror, method_id, method->constants()->version(), bci, cpref, methodname, filename, line_number);
2641 }
2642 
2643 void java_lang_StackTraceElement::decode(Handle mirror, int method_id, int version, int bci, int cpref, Symbol*& methodname, Symbol*& filename, int& line_number) {
2644   // Fill in class name
2645   InstanceKlass* holder = InstanceKlass::cast(java_lang_Class::as_Klass(mirror()));
2646   Method* method = holder->method_with_orig_idnum(method_id, version);
2647 
2648   // The method can be NULL if the requested class version is gone
2649   Symbol* sym = (method != NULL) ? method->name() : holder->constants()->symbol_at(cpref);
2650 
2651   // Fill in method name
2652   methodname = sym;
2653 
2654   if (!version_matches(method, version)) {
2655     // If the method was redefined, accurate line number information isn't available
2656     filename = NULL;
2657     line_number = -1;
2658   } else {
2659     // Fill in source file name and line number.
2660     // Use a specific ik version as a holder since the mirror might
2661     // refer to a version that is now obsolete and no longer accessible
2662     // via the previous versions list.
2663     holder = holder->get_klass_version(version);
2664     assert(holder != NULL, "sanity check");
2665     Symbol* source = holder->source_file_name();
2666     if (ShowHiddenFrames && source == NULL) {
2667       source = vmSymbols::unknown_class_name();
2668     }
2669     filename = source;
2670     line_number = Backtrace::get_line_number(method, bci);
2671   }
2672 }
2673 #endif // INCLUDE_JVMCI
2674 
2675 Method* java_lang_StackFrameInfo::get_method(Handle stackFrame, InstanceKlass* holder, TRAPS) {
2676   HandleMark hm(THREAD);
2677   Handle mname(THREAD, stackFrame->obj_field(_memberName_offset));
2678   Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mname());
2679   // we should expand MemberName::name when Throwable uses StackTrace
2680   // MethodHandles::expand_MemberName(mname, MethodHandles::_suppress_defc|MethodHandles::_suppress_type, CHECK_NULL);
2681   return method;
2682 }
2683 
2684 void java_lang_StackFrameInfo::set_method_and_bci(Handle stackFrame, const methodHandle& method, int bci, TRAPS) {
2685   // set Method* or mid/cpref
2686   HandleMark hm(THREAD);
2687   Handle mname(Thread::current(), stackFrame->obj_field(_memberName_offset));
2688   InstanceKlass* ik = method->method_holder();
2689   CallInfo info(method(), ik, CHECK);
2690   MethodHandles::init_method_MemberName(mname, info);
2691   // set bci
2692   java_lang_StackFrameInfo::set_bci(stackFrame(), bci);
2693   // method may be redefined; store the version


src/hotspot/share/classfile/javaClasses.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File