< prev index next >

hotspot/src/share/vm/classfile/javaClasses.inline.hpp

Print this page

        

*** 71,76 **** --- 71,139 ---- inline bool java_lang_invoke_DirectMethodHandle::is_instance(oop obj) { return obj != NULL && is_subclass(obj->klass()); } + inline int Backtrace::merge_bci_and_version(int bci, int version) { + // only store u2 for version, checking for overflow. + if (version > USHRT_MAX || version < 0) version = USHRT_MAX; + assert((jushort)bci == bci, "bci should be short"); + return build_int_from_shorts(version, bci); + } + + inline int Backtrace::merge_mid_and_cpref(int mid, int cpref) { + // only store u2 for mid and cpref, checking for overflow. + assert((jushort)mid == mid, "mid should be short"); + assert((jushort)cpref == cpref, "cpref should be short"); + return build_int_from_shorts(cpref, mid); + } + + inline int Backtrace::bci_at(unsigned int merged) { + return extract_high_short_from_int(merged); + } + + inline int Backtrace::version_at(unsigned int merged) { + return extract_low_short_from_int(merged); + } + + inline int Backtrace::mid_at(unsigned int merged) { + return extract_high_short_from_int(merged); + } + + inline int Backtrace::cpref_at(unsigned int merged) { + return extract_low_short_from_int(merged); + } + + inline int Backtrace::get_line_number(const methodHandle& method, int bci) { + int line_number = 0; + if (method->is_native()) { + // Negative value different from -1 below, enabling Java code in + // class java.lang.StackTraceElement to distinguish "native" from + // "no LineNumberTable". JDK tests for -2. + line_number = -2; + } else { + // Returns -1 if no LineNumberTable, and otherwise actual line number + line_number = method->line_number_from_bci(bci); + if (line_number == -1 && ShowHiddenFrames) { + line_number = bci + 1000000; + } + } + return line_number; + } + + /* + * Returns the source file name of a given InstanceKlass and version + */ + inline Symbol* Backtrace::get_source_file_name(InstanceKlass* holder, int version) { + // Find the specific ik version that contains this source_file_name_index + // via the previous versions list, but use the current version's + // constant pool to look it up. The previous version's index has been + // merged for the current constant pool. + InstanceKlass* ik = holder->get_klass_version(version); + // This version has been cleaned up. + if (ik == NULL) return NULL; + int source_file_name_index = ik->source_file_name_index(); + return (source_file_name_index == 0) ? + (Symbol*)NULL : holder->constants()->symbol_at(source_file_name_index); + } + #endif // SHARE_VM_CLASSFILE_JAVACLASSES_INLINE_HPP
< prev index next >