Mercurial > hg > truffle
comparison src/share/vm/runtime/sharedRuntime.cpp @ 4970:33df1aeaebbf
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Mon, 27 Feb 2012 13:10:13 +0100 |
parents | 6336b144e391 09d00c18e323 |
children | 18a5539bf19b |
comparison
equal
deleted
inserted
replaced
4703:2cfb7fb2dce7 | 4970:33df1aeaebbf |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2012, 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. |
119 | 119 |
120 //----------------------------generate_ricochet_blob--------------------------- | 120 //----------------------------generate_ricochet_blob--------------------------- |
121 void SharedRuntime::generate_ricochet_blob() { | 121 void SharedRuntime::generate_ricochet_blob() { |
122 if (!EnableInvokeDynamic) return; // leave it as a null | 122 if (!EnableInvokeDynamic) return; // leave it as a null |
123 | 123 |
124 #ifndef TARGET_ARCH_NYI_6939861 | |
125 // allocate space for the code | 124 // allocate space for the code |
126 ResourceMark rm; | 125 ResourceMark rm; |
127 // setup code generation tools | 126 // setup code generation tools |
128 CodeBuffer buffer("ricochet_blob", 256 LP64_ONLY(+ 256), 256); // XXX x86 LP64L: 512, 512 | 127 CodeBuffer buffer("ricochet_blob", 256 LP64_ONLY(+ 256), 256); // XXX x86 LP64L: 512, 512 |
129 MacroAssembler* masm = new MacroAssembler(&buffer); | 128 MacroAssembler* masm = new MacroAssembler(&buffer); |
140 assert(false, "bad ricochet blob"); | 139 assert(false, "bad ricochet blob"); |
141 return; | 140 return; |
142 } | 141 } |
143 | 142 |
144 _ricochet_blob = RicochetBlob::create(&buffer, bounce_offset, exception_offset, frame_size_in_words); | 143 _ricochet_blob = RicochetBlob::create(&buffer, bounce_offset, exception_offset, frame_size_in_words); |
145 #endif | |
146 } | 144 } |
147 | 145 |
148 | 146 |
149 #include <math.h> | 147 #include <math.h> |
150 | 148 |
838 // and processed. | 836 // and processed. |
839 // For stack overflow in deoptimization blob, cleanup thread. | 837 // For stack overflow in deoptimization blob, cleanup thread. |
840 if (thread->deopt_mark() != NULL) { | 838 if (thread->deopt_mark() != NULL) { |
841 Deoptimization::cleanup_deopt_info(thread, NULL); | 839 Deoptimization::cleanup_deopt_info(thread, NULL); |
842 } | 840 } |
841 Events::log_exception(thread, "StackOverflowError at " INTPTR_FORMAT, pc); | |
843 return StubRoutines::throw_StackOverflowError_entry(); | 842 return StubRoutines::throw_StackOverflowError_entry(); |
844 } | 843 } |
845 | 844 |
846 case IMPLICIT_NULL: { | 845 case IMPLICIT_NULL: { |
847 if (VtableStubs::contains(pc)) { | 846 if (VtableStubs::contains(pc)) { |
854 // If vt_stub is NULL, then return NULL to signal handler to report the SEGV error. | 853 // If vt_stub is NULL, then return NULL to signal handler to report the SEGV error. |
855 if (vt_stub == NULL) return NULL; | 854 if (vt_stub == NULL) return NULL; |
856 | 855 |
857 if (vt_stub->is_abstract_method_error(pc)) { | 856 if (vt_stub->is_abstract_method_error(pc)) { |
858 assert(!vt_stub->is_vtable_stub(), "should never see AbstractMethodErrors from vtable-type VtableStubs"); | 857 assert(!vt_stub->is_vtable_stub(), "should never see AbstractMethodErrors from vtable-type VtableStubs"); |
858 Events::log_exception(thread, "AbstractMethodError at " INTPTR_FORMAT, pc); | |
859 return StubRoutines::throw_AbstractMethodError_entry(); | 859 return StubRoutines::throw_AbstractMethodError_entry(); |
860 } else { | 860 } else { |
861 Events::log_exception(thread, "NullPointerException at vtable entry " INTPTR_FORMAT, pc); | |
861 return StubRoutines::throw_NullPointerException_at_call_entry(); | 862 return StubRoutines::throw_NullPointerException_at_call_entry(); |
862 } | 863 } |
863 } else { | 864 } else { |
864 CodeBlob* cb = CodeCache::find_blob(pc); | 865 CodeBlob* cb = CodeCache::find_blob(pc); |
865 | 866 |
872 // 3. Implict null exception in nmethod | 873 // 3. Implict null exception in nmethod |
873 | 874 |
874 if (!cb->is_nmethod()) { | 875 if (!cb->is_nmethod()) { |
875 guarantee(cb->is_adapter_blob() || cb->is_method_handles_adapter_blob(), | 876 guarantee(cb->is_adapter_blob() || cb->is_method_handles_adapter_blob(), |
876 "exception happened outside interpreter, nmethods and vtable stubs (1)"); | 877 "exception happened outside interpreter, nmethods and vtable stubs (1)"); |
878 Events::log_exception(thread, "NullPointerException in code blob at " INTPTR_FORMAT, pc); | |
877 // There is no handler here, so we will simply unwind. | 879 // There is no handler here, so we will simply unwind. |
878 return StubRoutines::throw_NullPointerException_at_call_entry(); | 880 return StubRoutines::throw_NullPointerException_at_call_entry(); |
879 } | 881 } |
880 | 882 |
881 // Otherwise, it's an nmethod. Consult its exception handlers. | 883 // Otherwise, it's an nmethod. Consult its exception handlers. |
883 if (nm->inlinecache_check_contains(pc)) { | 885 if (nm->inlinecache_check_contains(pc)) { |
884 // exception happened inside inline-cache check code | 886 // exception happened inside inline-cache check code |
885 // => the nmethod is not yet active (i.e., the frame | 887 // => the nmethod is not yet active (i.e., the frame |
886 // is not set up yet) => use return address pushed by | 888 // is not set up yet) => use return address pushed by |
887 // caller => don't push another return address | 889 // caller => don't push another return address |
890 Events::log_exception(thread, "NullPointerException in IC check " INTPTR_FORMAT, pc); | |
888 return StubRoutines::throw_NullPointerException_at_call_entry(); | 891 return StubRoutines::throw_NullPointerException_at_call_entry(); |
889 } | 892 } |
890 | 893 |
891 #ifndef PRODUCT | 894 #ifndef PRODUCT |
892 _implicit_null_throws++; | 895 _implicit_null_throws++; |
931 assert(exception_kind == IMPLICIT_NULL || exception_kind == IMPLICIT_DIVIDE_BY_ZERO, "wrong implicit exception kind"); | 934 assert(exception_kind == IMPLICIT_NULL || exception_kind == IMPLICIT_DIVIDE_BY_ZERO, "wrong implicit exception kind"); |
932 | 935 |
933 // for AbortVMOnException flag | 936 // for AbortVMOnException flag |
934 NOT_PRODUCT(Exceptions::debug_check_abort("java.lang.NullPointerException")); | 937 NOT_PRODUCT(Exceptions::debug_check_abort("java.lang.NullPointerException")); |
935 if (exception_kind == IMPLICIT_NULL) { | 938 if (exception_kind == IMPLICIT_NULL) { |
936 Events::log("Implicit null exception at " INTPTR_FORMAT " to " INTPTR_FORMAT, pc, target_pc); | 939 Events::log_exception(thread, "Implicit null exception at " INTPTR_FORMAT " to " INTPTR_FORMAT, pc, target_pc); |
937 } else { | 940 } else { |
938 Events::log("Implicit division by zero exception at " INTPTR_FORMAT " to " INTPTR_FORMAT, pc, target_pc); | 941 Events::log_exception(thread, "Implicit division by zero exception at " INTPTR_FORMAT " to " INTPTR_FORMAT, pc, target_pc); |
939 } | 942 } |
940 return target_pc; | 943 return target_pc; |
941 } | 944 } |
942 | 945 |
943 ShouldNotReachHere(); | 946 ShouldNotReachHere(); |
1586 // so no update to the caller is needed. | 1589 // so no update to the caller is needed. |
1587 | 1590 |
1588 if (caller.is_compiled_frame() && !caller.is_deoptimized_frame()) { | 1591 if (caller.is_compiled_frame() && !caller.is_deoptimized_frame()) { |
1589 | 1592 |
1590 address pc = caller.pc(); | 1593 address pc = caller.pc(); |
1591 Events::log("update call-site at pc " INTPTR_FORMAT, pc); | |
1592 | 1594 |
1593 // Default call_addr is the location of the "basic" call. | 1595 // Default call_addr is the location of the "basic" call. |
1594 // Determine the address of the call we a reresolving. With | 1596 // Determine the address of the call we a reresolving. With |
1595 // Inline Caches we will always find a recognizable call. | 1597 // Inline Caches we will always find a recognizable call. |
1596 // With Inline Caches disabled we may or may not find a | 1598 // With Inline Caches disabled we may or may not find a |
2724 CompileBroker::handle_full_code_cache(); | 2726 CompileBroker::handle_full_code_cache(); |
2725 } | 2727 } |
2726 return nm; | 2728 return nm; |
2727 } | 2729 } |
2728 | 2730 |
2731 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::block_for_jni_critical(JavaThread* thread)) | |
2732 assert(thread == JavaThread::current(), "must be"); | |
2733 // The code is about to enter a JNI lazy critical native method and | |
2734 // _needs_gc is true, so if this thread is already in a critical | |
2735 // section then just return, otherwise this thread should block | |
2736 // until needs_gc has been cleared. | |
2737 if (thread->in_critical()) { | |
2738 return; | |
2739 } | |
2740 // Lock and unlock a critical section to give the system a chance to block | |
2741 GC_locker::lock_critical(thread); | |
2742 GC_locker::unlock_critical(thread); | |
2743 JRT_END | |
2744 | |
2729 #ifdef HAVE_DTRACE_H | 2745 #ifdef HAVE_DTRACE_H |
2730 // Create a dtrace nmethod for this method. The wrapper converts the | 2746 // Create a dtrace nmethod for this method. The wrapper converts the |
2731 // java compiled calling convention to the native convention, makes a dummy call | 2747 // java compiled calling convention to the native convention, makes a dummy call |
2732 // (actually nops for the size of the call instruction, which become a trap if | 2748 // (actually nops for the size of the call instruction, which become a trap if |
2733 // probe is enabled). The returns to the caller. Since this all looks like a | 2749 // probe is enabled). The returns to the caller. Since this all looks like a |