comparison src/share/vm/runtime/sharedRuntime.cpp @ 2181:d25d4ca69222

Merge.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Wed, 16 Feb 2011 13:47:20 +0100
parents 06f017f7daa7 3582bf76420e
children 0cd39a385a72
comparison
equal deleted inserted replaced
2108:50b45e2d9725 2181:d25d4ca69222
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
525 #endif // PRODUCT 525 #endif // PRODUCT
526 return stub; 526 return stub;
527 } 527 }
528 528
529 529
530 oop SharedRuntime::retrieve_receiver( symbolHandle sig, frame caller ) { 530 oop SharedRuntime::retrieve_receiver( Symbol* sig, frame caller ) {
531 assert(caller.is_interpreted_frame(), ""); 531 assert(caller.is_interpreted_frame(), "");
532 int args_size = ArgumentSizeComputer(sig).size() + 1; 532 int args_size = ArgumentSizeComputer(sig).size() + 1;
533 assert(args_size <= caller.interpreter_frame_expression_stack_size(), "receiver must be on interpreter stack"); 533 assert(args_size <= caller.interpreter_frame_expression_stack_size(), "receiver must be on interpreter stack");
534 oop result = (oop) *caller.interpreter_frame_tos_at(args_size - 1); 534 oop result = (oop) *caller.interpreter_frame_tos_at(args_size - 1);
535 assert(Universe::heap()->is_in(result) && result->is_oop(), "receiver must be an oop"); 535 assert(Universe::heap()->is_in(result) && result->is_oop(), "receiver must be an oop");
545 JvmtiExport::post_exception_throw(thread, method(), bcp, h_exception()); 545 JvmtiExport::post_exception_throw(thread, method(), bcp, h_exception());
546 } 546 }
547 Exceptions::_throw(thread, __FILE__, __LINE__, h_exception); 547 Exceptions::_throw(thread, __FILE__, __LINE__, h_exception);
548 } 548 }
549 549
550 void SharedRuntime::throw_and_post_jvmti_exception(JavaThread *thread, symbolOop name, const char *message) { 550 void SharedRuntime::throw_and_post_jvmti_exception(JavaThread *thread, Symbol* name, const char *message) {
551 Handle h_exception = Exceptions::new_exception(thread, name, message); 551 Handle h_exception = Exceptions::new_exception(thread, name, message);
552 throw_and_post_jvmti_exception(thread, h_exception); 552 throw_and_post_jvmti_exception(thread, h_exception);
553 } 553 }
554 554
555 // The interpreter code to call this tracing function is only 555 // The interpreter code to call this tracing function is only
890 890
891 int SharedRuntime::dtrace_object_alloc_base(Thread* thread, oopDesc* o) { 891 int SharedRuntime::dtrace_object_alloc_base(Thread* thread, oopDesc* o) {
892 assert(DTraceAllocProbes, "wrong call"); 892 assert(DTraceAllocProbes, "wrong call");
893 Klass* klass = o->blueprint(); 893 Klass* klass = o->blueprint();
894 int size = o->size(); 894 int size = o->size();
895 symbolOop name = klass->name(); 895 Symbol* name = klass->name();
896 HS_DTRACE_PROBE4(hotspot, object__alloc, get_java_tid(thread), 896 HS_DTRACE_PROBE4(hotspot, object__alloc, get_java_tid(thread),
897 name->bytes(), name->utf8_length(), size * HeapWordSize); 897 name->bytes(), name->utf8_length(), size * HeapWordSize);
898 return 0; 898 return 0;
899 } 899 }
900 900
901 JRT_LEAF(int, SharedRuntime::dtrace_method_entry( 901 JRT_LEAF(int, SharedRuntime::dtrace_method_entry(
902 JavaThread* thread, methodOopDesc* method)) 902 JavaThread* thread, methodOopDesc* method))
903 assert(DTraceMethodProbes, "wrong call"); 903 assert(DTraceMethodProbes, "wrong call");
904 symbolOop kname = method->klass_name(); 904 Symbol* kname = method->klass_name();
905 symbolOop name = method->name(); 905 Symbol* name = method->name();
906 symbolOop sig = method->signature(); 906 Symbol* sig = method->signature();
907 HS_DTRACE_PROBE7(hotspot, method__entry, get_java_tid(thread), 907 HS_DTRACE_PROBE7(hotspot, method__entry, get_java_tid(thread),
908 kname->bytes(), kname->utf8_length(), 908 kname->bytes(), kname->utf8_length(),
909 name->bytes(), name->utf8_length(), 909 name->bytes(), name->utf8_length(),
910 sig->bytes(), sig->utf8_length()); 910 sig->bytes(), sig->utf8_length());
911 return 0; 911 return 0;
912 JRT_END 912 JRT_END
913 913
914 JRT_LEAF(int, SharedRuntime::dtrace_method_exit( 914 JRT_LEAF(int, SharedRuntime::dtrace_method_exit(
915 JavaThread* thread, methodOopDesc* method)) 915 JavaThread* thread, methodOopDesc* method))
916 assert(DTraceMethodProbes, "wrong call"); 916 assert(DTraceMethodProbes, "wrong call");
917 symbolOop kname = method->klass_name(); 917 Symbol* kname = method->klass_name();
918 symbolOop name = method->name(); 918 Symbol* name = method->name();
919 symbolOop sig = method->signature(); 919 Symbol* sig = method->signature();
920 HS_DTRACE_PROBE7(hotspot, method__return, get_java_tid(thread), 920 HS_DTRACE_PROBE7(hotspot, method__return, get_java_tid(thread),
921 kname->bytes(), kname->utf8_length(), 921 kname->bytes(), kname->utf8_length(),
922 name->bytes(), name->utf8_length(), 922 name->bytes(), name->utf8_length(),
923 sig->bytes(), sig->utf8_length()); 923 sig->bytes(), sig->utf8_length());
924 return 0; 924 return 0;
954 // Find caller and bci from vframe 954 // Find caller and bci from vframe
955 methodHandle caller (THREAD, vfst.method()); 955 methodHandle caller (THREAD, vfst.method());
956 int bci = vfst.bci(); 956 int bci = vfst.bci();
957 957
958 // Find bytecode 958 // Find bytecode
959 Bytecode_invoke* bytecode = Bytecode_invoke_at(caller, bci); 959 Bytecode_invoke bytecode(caller, bci);
960 bc = bytecode->java_code(); 960 bc = bytecode.java_code();
961 int bytecode_index = bytecode->index(); 961 int bytecode_index = bytecode.index();
962 962
963 // Find receiver for non-static call 963 // Find receiver for non-static call
964 if (bc != Bytecodes::_invokestatic) { 964 if (bc != Bytecodes::_invokestatic) {
965 // This register map must be update since we need to find the receiver for 965 // This register map must be update since we need to find the receiver for
966 // compiled frames. The receiver might be in a register. 966 // compiled frames. The receiver might be in a register.
967 RegisterMap reg_map2(thread); 967 RegisterMap reg_map2(thread);
968 frame stubFrame = thread->last_frame(); 968 frame stubFrame = thread->last_frame();
969 // Caller-frame is a compiled frame 969 // Caller-frame is a compiled frame
970 frame callerFrame = stubFrame.sender(&reg_map2); 970 frame callerFrame = stubFrame.sender(&reg_map2);
971 971
972 methodHandle callee = bytecode->static_target(CHECK_(nullHandle)); 972 methodHandle callee = bytecode.static_target(CHECK_(nullHandle));
973 if (callee.is_null()) { 973 if (callee.is_null()) {
974 THROW_(vmSymbols::java_lang_NoSuchMethodException(), nullHandle); 974 THROW_(vmSymbols::java_lang_NoSuchMethodException(), nullHandle);
975 } 975 }
976 // Retrieve from a compiled argument list 976 // Retrieve from a compiled argument list
977 receiver = Handle(THREAD, callerFrame.retrieve_receiver(&reg_map2)); 977 receiver = Handle(THREAD, callerFrame.retrieve_receiver(&reg_map2));
1684 JavaThread* thread, const char* objName) { 1684 JavaThread* thread, const char* objName) {
1685 1685
1686 // Get target class name from the checkcast instruction 1686 // Get target class name from the checkcast instruction
1687 vframeStream vfst(thread, true); 1687 vframeStream vfst(thread, true);
1688 assert(!vfst.at_end(), "Java frame must exist"); 1688 assert(!vfst.at_end(), "Java frame must exist");
1689 Bytecode_checkcast* cc = Bytecode_checkcast_at( 1689 Bytecode_checkcast cc(vfst.method(), vfst.method()->bcp_from(vfst.bci()));
1690 vfst.method()->bcp_from(vfst.bci()));
1691 Klass* targetKlass = Klass::cast(vfst.method()->constants()->klass_at( 1690 Klass* targetKlass = Klass::cast(vfst.method()->constants()->klass_at(
1692 cc->index(), thread)); 1691 cc.index(), thread));
1693 return generate_class_cast_message(objName, targetKlass->external_name()); 1692 return generate_class_cast_message(objName, targetKlass->external_name());
1694 } 1693 }
1695 1694
1696 char* SharedRuntime::generate_wrong_method_type_message(JavaThread* thread, 1695 char* SharedRuntime::generate_wrong_method_type_message(JavaThread* thread,
1697 oopDesc* required, 1696 oopDesc* required,
1721 // Get a signature from the invoke instruction 1720 // Get a signature from the invoke instruction
1722 const char* mhName = "method handle"; 1721 const char* mhName = "method handle";
1723 const char* targetType = "the required signature"; 1722 const char* targetType = "the required signature";
1724 vframeStream vfst(thread, true); 1723 vframeStream vfst(thread, true);
1725 if (!vfst.at_end()) { 1724 if (!vfst.at_end()) {
1726 Bytecode_invoke* call = Bytecode_invoke_at(vfst.method(), vfst.bci()); 1725 Bytecode_invoke call(vfst.method(), vfst.bci());
1727 methodHandle target; 1726 methodHandle target;
1728 { 1727 {
1729 EXCEPTION_MARK; 1728 EXCEPTION_MARK;
1730 target = call->static_target(THREAD); 1729 target = call.static_target(THREAD);
1731 if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; } 1730 if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; }
1732 } 1731 }
1733 if (target.not_null() 1732 if (target.not_null()
1734 && target->is_method_handle_invoke() 1733 && target->is_method_handle_invoke()
1735 && required == target->method_handle_type()) { 1734 && required == target->method_handle_type()) {
2648 // Return argument 0 register. In the LP64 build pointers 2647 // Return argument 0 register. In the LP64 build pointers
2649 // take 2 registers, but the VM wants only the 'main' name. 2648 // take 2 registers, but the VM wants only the 'main' name.
2650 return regs.first(); 2649 return regs.first();
2651 } 2650 }
2652 2651
2653 VMRegPair *SharedRuntime::find_callee_arguments(symbolOop sig, bool has_receiver, int* arg_size) { 2652 VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver, int* arg_size) {
2654 // This method is returning a data structure allocating as a 2653 // This method is returning a data structure allocating as a
2655 // ResourceObject, so do not put any ResourceMarks in here. 2654 // ResourceObject, so do not put any ResourceMarks in here.
2656 char *s = sig->as_C_string(); 2655 char *s = sig->as_C_string();
2657 int len = (int)strlen(s); 2656 int len = (int)strlen(s);
2658 *s++; len--; // Skip opening paren 2657 *s++; len--; // Skip opening paren