src/hotspot/share/classfile/javaClasses.cpp
changeset 59056 15936b142f86
parent 58956 9a0a5e70eeb2
child 59070 22ee476cc664
equal deleted inserted replaced
59055:57ad70bcf06c 59056:15936b142f86
    40 #include "memory/heapShared.inline.hpp"
    40 #include "memory/heapShared.inline.hpp"
    41 #include "memory/metaspaceShared.hpp"
    41 #include "memory/metaspaceShared.hpp"
    42 #include "memory/oopFactory.hpp"
    42 #include "memory/oopFactory.hpp"
    43 #include "memory/resourceArea.hpp"
    43 #include "memory/resourceArea.hpp"
    44 #include "memory/universe.hpp"
    44 #include "memory/universe.hpp"
    45 #include "oops/fieldStreams.hpp"
    45 #include "oops/fieldStreams.inline.hpp"
    46 #include "oops/instanceKlass.hpp"
    46 #include "oops/instanceKlass.hpp"
    47 #include "oops/instanceMirrorKlass.hpp"
    47 #include "oops/instanceMirrorKlass.hpp"
    48 #include "oops/klass.hpp"
    48 #include "oops/klass.hpp"
    49 #include "oops/method.inline.hpp"
    49 #include "oops/method.inline.hpp"
    50 #include "oops/objArrayOop.inline.hpp"
    50 #include "oops/objArrayOop.inline.hpp"
  2268   }
  2268   }
  2269 
  2269 
  2270   st->print_cr("%s", buf);
  2270   st->print_cr("%s", buf);
  2271 }
  2271 }
  2272 
  2272 
  2273 void java_lang_Throwable::print_stack_element(outputStream *st, const methodHandle& method, int bci) {
  2273 void java_lang_Throwable::print_stack_element(outputStream *st, Method* method, int bci) {
  2274   Handle mirror (Thread::current(),  method->method_holder()->java_mirror());
  2274   Handle mirror (Thread::current(),  method->method_holder()->java_mirror());
  2275   int method_id = method->orig_method_idnum();
  2275   int method_id = method->orig_method_idnum();
  2276   int version = method->constants()->version();
  2276   int version = method->constants()->version();
  2277   print_stack_element_to_stream(st, mirror, method_id, version, bci, method->name());
  2277   print_stack_element_to_stream(st, mirror, method_id, version, bci, method->name());
  2278 }
  2278 }
  2374   // See bug 6333838 for  more details.
  2374   // See bug 6333838 for  more details.
  2375   // The "ASSERT" here is to verify this method generates the exactly same stack
  2375   // The "ASSERT" here is to verify this method generates the exactly same stack
  2376   // trace as utilizing vframe.
  2376   // trace as utilizing vframe.
  2377 #ifdef ASSERT
  2377 #ifdef ASSERT
  2378   vframeStream st(thread);
  2378   vframeStream st(thread);
  2379   methodHandle st_method(THREAD, st.method());
       
  2380 #endif
  2379 #endif
  2381   int total_count = 0;
  2380   int total_count = 0;
  2382   RegisterMap map(thread, false);
  2381   RegisterMap map(thread, false);
  2383   int decode_offset = 0;
  2382   int decode_offset = 0;
  2384   CompiledMethod* nm = NULL;
  2383   CompiledMethod* nm = NULL;
  2424           continue;
  2423           continue;
  2425         }
  2424         }
  2426       }
  2425       }
  2427     }
  2426     }
  2428 #ifdef ASSERT
  2427 #ifdef ASSERT
  2429     assert(st_method() == method && st.bci() == bci,
  2428     assert(st.method() == method && st.bci() == bci,
  2430            "Wrong stack trace");
  2429            "Wrong stack trace");
  2431     st.next();
  2430     st.next();
  2432     // vframeStream::method isn't GC-safe so store off a copy
       
  2433     // of the Method* in case we GC.
       
  2434     if (!st.at_end()) {
       
  2435       st_method = st.method();
       
  2436     }
       
  2437 #endif
  2431 #endif
  2438 
  2432 
  2439     // the format of the stacktrace will be:
  2433     // the format of the stacktrace will be:
  2440     // - 1 or more fillInStackTrace frames for the exception class (skipped)
  2434     // - 1 or more fillInStackTrace frames for the exception class (skipped)
  2441     // - 0 or more <init> methods for the exception class (skipped)
  2435     // - 0 or more <init> methods for the exception class (skipped)
  2694         java_lang_Class::set_source_file(java_class(), source_file);
  2688         java_lang_Class::set_source_file(java_class(), source_file);
  2695       }
  2689       }
  2696     }
  2690     }
  2697     java_lang_StackTraceElement::set_fileName(element(), source_file);
  2691     java_lang_StackTraceElement::set_fileName(element(), source_file);
  2698 
  2692 
  2699     int line_number = Backtrace::get_line_number(method, bci);
  2693     int line_number = Backtrace::get_line_number(method(), bci);
  2700     java_lang_StackTraceElement::set_lineNumber(element(), line_number);
  2694     java_lang_StackTraceElement::set_lineNumber(element(), line_number);
  2701   }
  2695   }
  2702 }
  2696 }
  2703 
  2697 
  2704 #if INCLUDE_JVMCI
  2698 #if INCLUDE_JVMCI
  2769   Method* method = java_lang_StackFrameInfo::get_method(stackFrame, holder, CHECK);
  2763   Method* method = java_lang_StackFrameInfo::get_method(stackFrame, holder, CHECK);
  2770 
  2764 
  2771   short version = stackFrame->short_field(_version_offset);
  2765   short version = stackFrame->short_field(_version_offset);
  2772   int bci = stackFrame->int_field(_bci_offset);
  2766   int bci = stackFrame->int_field(_bci_offset);
  2773   Symbol* name = method->name();
  2767   Symbol* name = method->name();
  2774   java_lang_StackTraceElement::fill_in(stack_trace_element, holder, method, version, bci, name, CHECK);
  2768   java_lang_StackTraceElement::fill_in(stack_trace_element, holder, methodHandle(THREAD, method),
       
  2769                                        version, bci, name, CHECK);
  2775 }
  2770 }
  2776 
  2771 
  2777 #define STACKFRAMEINFO_FIELDS_DO(macro) \
  2772 #define STACKFRAMEINFO_FIELDS_DO(macro) \
  2778   macro(_memberName_offset,     k, "memberName",  object_signature, false); \
  2773   macro(_memberName_offset,     k, "memberName",  object_signature, false); \
  2779   macro(_bci_offset,            k, "bci",         int_signature,    false)
  2774   macro(_bci_offset,            k, "bci",         int_signature,    false)