1131 char* buf = NEW_RESOURCE_ARRAY(char, buf_len + 64);
1132
1133 // Print stack trace line in buffer
1134 sprintf(buf, "\tat %s.%s", klass_name, method_name);
1135 if (method->is_native()) {
1136 strcat(buf, "(Native Method)");
1137 } else {
1138 int line_number = method->line_number_from_bci(bci);
1139 if (source_file_name != NULL && (line_number != -1)) {
1140 // Sourcename and linenumber
1141 sprintf(buf + (int)strlen(buf), "(%s:%d)", source_file_name, line_number);
1142 } else if (source_file_name != NULL) {
1143 // Just sourcename
1144 sprintf(buf + (int)strlen(buf), "(%s)", source_file_name);
1145 } else {
1146 // Neither soucename and linenumber
1147 sprintf(buf + (int)strlen(buf), "(Unknown Source)");
1148 }
1149 nmethod* nm = method->code();
1150 if (WizardMode && nm != NULL) {
1151 sprintf(buf + (int)strlen(buf), "(nmethod " PTR_FORMAT ")", (intptr_t)nm);
1152 }
1153 }
1154
1155 return buf;
1156 }
1157
1158
1159 void java_lang_Throwable::print_stack_element(Handle stream, methodOop method, int bci) {
1160 ResourceMark rm;
1161 char* buf = print_stack_element_to_buffer(method, bci);
1162 print_to_stream(stream, buf);
1163 }
1164
1165 void java_lang_Throwable::print_stack_element(outputStream *st, methodOop method, int bci) {
1166 ResourceMark rm;
1167 char* buf = print_stack_element_to_buffer(method, bci);
1168 st->print_cr("%s", buf);
1169 }
1170
1171 void java_lang_Throwable::print_to_stream(Handle stream, const char* str) {
2680 }
2681
2682
2683 // Support for java_lang_invoke_CallSite
2684
2685 int java_lang_invoke_CallSite::_target_offset;
2686
2687 void java_lang_invoke_CallSite::compute_offsets() {
2688 if (!EnableInvokeDynamic) return;
2689 klassOop k = SystemDictionary::CallSite_klass();
2690 if (k != NULL) {
2691 compute_offset(_target_offset, k, vmSymbols::target_name(), vmSymbols::java_lang_invoke_MethodHandle_signature());
2692 }
2693
2694 // Disallow compilation of CallSite.setTargetNormal and CallSite.setTargetVolatile
2695 // (For C2: keep this until we have throttling logic for uncommon traps.)
2696 if (k != NULL) {
2697 instanceKlass* ik = instanceKlass::cast(k);
2698 methodOop m_normal = ik->lookup_method(vmSymbols::setTargetNormal_name(), vmSymbols::setTarget_signature());
2699 methodOop m_volatile = ik->lookup_method(vmSymbols::setTargetVolatile_name(), vmSymbols::setTarget_signature());
2700 guarantee(m_normal && m_volatile, "must exist");
2701 m_normal->set_not_compilable_quietly();
2702 m_volatile->set_not_compilable_quietly();
2703 }
2704 }
2705
2706
2707 // Support for java_security_AccessControlContext
2708
2709 int java_security_AccessControlContext::_context_offset = 0;
2710 int java_security_AccessControlContext::_privilegedContext_offset = 0;
2711 int java_security_AccessControlContext::_isPrivileged_offset = 0;
2712
2713 void java_security_AccessControlContext::compute_offsets() {
2714 assert(_isPrivileged_offset == 0, "offsets should be initialized only once");
2715 fieldDescriptor fd;
2716 instanceKlass* ik = instanceKlass::cast(SystemDictionary::AccessControlContext_klass());
2717
2718 if (!ik->find_local_field(vmSymbols::context_name(), vmSymbols::protectiondomain_signature(), &fd)) {
2719 fatal("Invalid layout of java.security.AccessControlContext");
2720 }
|
1131 char* buf = NEW_RESOURCE_ARRAY(char, buf_len + 64);
1132
1133 // Print stack trace line in buffer
1134 sprintf(buf, "\tat %s.%s", klass_name, method_name);
1135 if (method->is_native()) {
1136 strcat(buf, "(Native Method)");
1137 } else {
1138 int line_number = method->line_number_from_bci(bci);
1139 if (source_file_name != NULL && (line_number != -1)) {
1140 // Sourcename and linenumber
1141 sprintf(buf + (int)strlen(buf), "(%s:%d)", source_file_name, line_number);
1142 } else if (source_file_name != NULL) {
1143 // Just sourcename
1144 sprintf(buf + (int)strlen(buf), "(%s)", source_file_name);
1145 } else {
1146 // Neither soucename and linenumber
1147 sprintf(buf + (int)strlen(buf), "(Unknown Source)");
1148 }
1149 nmethod* nm = method->code();
1150 if (WizardMode && nm != NULL) {
1151 sprintf(buf + (int)strlen(buf), "(nmethod " INTPTR_FORMAT ")", (intptr_t)nm);
1152 }
1153 }
1154
1155 return buf;
1156 }
1157
1158
1159 void java_lang_Throwable::print_stack_element(Handle stream, methodOop method, int bci) {
1160 ResourceMark rm;
1161 char* buf = print_stack_element_to_buffer(method, bci);
1162 print_to_stream(stream, buf);
1163 }
1164
1165 void java_lang_Throwable::print_stack_element(outputStream *st, methodOop method, int bci) {
1166 ResourceMark rm;
1167 char* buf = print_stack_element_to_buffer(method, bci);
1168 st->print_cr("%s", buf);
1169 }
1170
1171 void java_lang_Throwable::print_to_stream(Handle stream, const char* str) {
2680 }
2681
2682
2683 // Support for java_lang_invoke_CallSite
2684
2685 int java_lang_invoke_CallSite::_target_offset;
2686
2687 void java_lang_invoke_CallSite::compute_offsets() {
2688 if (!EnableInvokeDynamic) return;
2689 klassOop k = SystemDictionary::CallSite_klass();
2690 if (k != NULL) {
2691 compute_offset(_target_offset, k, vmSymbols::target_name(), vmSymbols::java_lang_invoke_MethodHandle_signature());
2692 }
2693
2694 // Disallow compilation of CallSite.setTargetNormal and CallSite.setTargetVolatile
2695 // (For C2: keep this until we have throttling logic for uncommon traps.)
2696 if (k != NULL) {
2697 instanceKlass* ik = instanceKlass::cast(k);
2698 methodOop m_normal = ik->lookup_method(vmSymbols::setTargetNormal_name(), vmSymbols::setTarget_signature());
2699 methodOop m_volatile = ik->lookup_method(vmSymbols::setTargetVolatile_name(), vmSymbols::setTarget_signature());
2700 guarantee(m_normal != NULL && m_volatile != NULL, "must exist");
2701 m_normal->set_not_compilable_quietly();
2702 m_volatile->set_not_compilable_quietly();
2703 }
2704 }
2705
2706
2707 // Support for java_security_AccessControlContext
2708
2709 int java_security_AccessControlContext::_context_offset = 0;
2710 int java_security_AccessControlContext::_privilegedContext_offset = 0;
2711 int java_security_AccessControlContext::_isPrivileged_offset = 0;
2712
2713 void java_security_AccessControlContext::compute_offsets() {
2714 assert(_isPrivileged_offset == 0, "offsets should be initialized only once");
2715 fieldDescriptor fd;
2716 instanceKlass* ik = instanceKlass::cast(SystemDictionary::AccessControlContext_klass());
2717
2718 if (!ik->find_local_field(vmSymbols::context_name(), vmSymbols::protectiondomain_signature(), &fd)) {
2719 fatal("Invalid layout of java.security.AccessControlContext");
2720 }
|