hotspot/src/share/vm/classfile/javaClasses.inline.hpp
changeset 34280 72bfaaffee36
parent 34273 8598d07915d9
child 35498 392b50de06c6
equal deleted inserted replaced
34277:d457b9400c99 34280:72bfaaffee36
    71 
    71 
    72 inline bool java_lang_invoke_DirectMethodHandle::is_instance(oop obj) {
    72 inline bool java_lang_invoke_DirectMethodHandle::is_instance(oop obj) {
    73   return obj != NULL && is_subclass(obj->klass());
    73   return obj != NULL && is_subclass(obj->klass());
    74 }
    74 }
    75 
    75 
       
    76 inline int Backtrace::merge_bci_and_version(int bci, int version) {
       
    77   // only store u2 for version, checking for overflow.
       
    78   if (version > USHRT_MAX || version < 0) version = USHRT_MAX;
       
    79   assert((jushort)bci == bci, "bci should be short");
       
    80   return build_int_from_shorts(version, bci);
       
    81 }
       
    82 
       
    83 inline int Backtrace::merge_mid_and_cpref(int mid, int cpref) {
       
    84   // only store u2 for mid and cpref, checking for overflow.
       
    85   assert((jushort)mid == mid, "mid should be short");
       
    86   assert((jushort)cpref == cpref, "cpref should be short");
       
    87   return build_int_from_shorts(cpref, mid);
       
    88 }
       
    89 
       
    90 inline int Backtrace::bci_at(unsigned int merged) {
       
    91   return extract_high_short_from_int(merged);
       
    92 }
       
    93 
       
    94 inline int Backtrace::version_at(unsigned int merged) {
       
    95   return extract_low_short_from_int(merged);
       
    96 }
       
    97 
       
    98 inline int Backtrace::mid_at(unsigned int merged) {
       
    99   return extract_high_short_from_int(merged);
       
   100 }
       
   101 
       
   102 inline int Backtrace::cpref_at(unsigned int merged) {
       
   103   return extract_low_short_from_int(merged);
       
   104 }
       
   105 
       
   106 inline int Backtrace::get_line_number(const methodHandle& method, int bci) {
       
   107   int line_number = 0;
       
   108   if (method->is_native()) {
       
   109     // Negative value different from -1 below, enabling Java code in
       
   110     // class java.lang.StackTraceElement to distinguish "native" from
       
   111     // "no LineNumberTable".  JDK tests for -2.
       
   112     line_number = -2;
       
   113   } else {
       
   114     // Returns -1 if no LineNumberTable, and otherwise actual line number
       
   115     line_number = method->line_number_from_bci(bci);
       
   116     if (line_number == -1 && ShowHiddenFrames) {
       
   117       line_number = bci + 1000000;
       
   118     }
       
   119   }
       
   120   return line_number;
       
   121 }
       
   122 
       
   123 /*
       
   124  * Returns the source file name of a given InstanceKlass and version
       
   125  */
       
   126 inline Symbol* Backtrace::get_source_file_name(InstanceKlass* holder, int version) {
       
   127   // Find the specific ik version that contains this source_file_name_index
       
   128   // via the previous versions list, but use the current version's
       
   129   // constant pool to look it up.  The previous version's index has been
       
   130   // merged for the current constant pool.
       
   131   InstanceKlass* ik = holder->get_klass_version(version);
       
   132   // This version has been cleaned up.
       
   133   if (ik == NULL) return NULL;
       
   134   int source_file_name_index = ik->source_file_name_index();
       
   135   return (source_file_name_index == 0) ?
       
   136       (Symbol*)NULL : holder->constants()->symbol_at(source_file_name_index);
       
   137 }
       
   138 
    76 #endif // SHARE_VM_CLASSFILE_JAVACLASSES_INLINE_HPP
   139 #endif // SHARE_VM_CLASSFILE_JAVACLASSES_INLINE_HPP