Wed, 02 Dec 2009 20:32:27 -0500
Merge
1.1 --- a/src/cpu/zero/vm/cppInterpreter_zero.cpp Tue Dec 01 22:29:02 2009 -0500 1.2 +++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp Wed Dec 02 20:32:27 2009 -0500 1.3 @@ -204,6 +204,20 @@ 1.4 goto unwind_and_return; 1.5 } 1.6 1.7 + // Update the invocation counter 1.8 + if ((UseCompiler || CountCompiledCalls) && !method->is_synchronized()) { 1.9 + thread->set_do_not_unlock(); 1.10 + InvocationCounter *counter = method->invocation_counter(); 1.11 + counter->increment(); 1.12 + if (counter->reached_InvocationLimit()) { 1.13 + CALL_VM_NOCHECK( 1.14 + InterpreterRuntime::frequency_counter_overflow(thread, NULL)); 1.15 + if (HAS_PENDING_EXCEPTION) 1.16 + goto unwind_and_return; 1.17 + } 1.18 + thread->clr_do_not_unlock(); 1.19 + } 1.20 + 1.21 // Lock if necessary 1.22 BasicObjectLock *monitor; 1.23 monitor = NULL;
2.1 --- a/src/cpu/zero/vm/frame_zero.cpp Tue Dec 01 22:29:02 2009 -0500 2.2 +++ b/src/cpu/zero/vm/frame_zero.cpp Wed Dec 02 20:32:27 2009 -0500 2.3 @@ -36,11 +36,8 @@ 2.4 return zeroframe()->is_interpreter_frame(); 2.5 } 2.6 2.7 -bool frame::is_fake_stub_frame() const { 2.8 - return zeroframe()->is_fake_stub_frame(); 2.9 -} 2.10 - 2.11 frame frame::sender_for_entry_frame(RegisterMap *map) const { 2.12 + assert(zeroframe()->is_entry_frame(), "wrong type of frame"); 2.13 assert(map != NULL, "map must be set"); 2.14 assert(!entry_frame_is_first(), "next Java fp must be non zero"); 2.15 assert(entry_frame_call_wrapper()->anchor()->last_Java_sp() == sender_sp(), 2.16 @@ -50,15 +47,10 @@ 2.17 return frame(sender_sp(), sp() + 1); 2.18 } 2.19 2.20 -frame frame::sender_for_interpreter_frame(RegisterMap *map) const { 2.21 - return frame(sender_sp(), sp() + 1); 2.22 -} 2.23 - 2.24 -frame frame::sender_for_compiled_frame(RegisterMap *map) const { 2.25 - return frame(sender_sp(), sp() + 1); 2.26 -} 2.27 - 2.28 -frame frame::sender_for_fake_stub_frame(RegisterMap *map) const { 2.29 +frame frame::sender_for_nonentry_frame(RegisterMap *map) const { 2.30 + assert(zeroframe()->is_interpreter_frame() || 2.31 + zeroframe()->is_shark_frame() || 2.32 + zeroframe()->is_fake_stub_frame(), "wrong type of frame"); 2.33 return frame(sender_sp(), sp() + 1); 2.34 } 2.35 2.36 @@ -69,17 +61,8 @@ 2.37 2.38 if (is_entry_frame()) 2.39 return sender_for_entry_frame(map); 2.40 - 2.41 - if (is_interpreted_frame()) 2.42 - return sender_for_interpreter_frame(map); 2.43 - 2.44 - if (is_compiled_frame()) 2.45 - return sender_for_compiled_frame(map); 2.46 - 2.47 - if (is_fake_stub_frame()) 2.48 - return sender_for_fake_stub_frame(map); 2.49 - 2.50 - ShouldNotReachHere(); 2.51 + else 2.52 + return sender_for_nonentry_frame(map); 2.53 } 2.54 2.55 #ifdef CC_INTERP
3.1 --- a/src/cpu/zero/vm/frame_zero.hpp Tue Dec 01 22:29:02 2009 -0500 3.2 +++ b/src/cpu/zero/vm/frame_zero.hpp Wed Dec 02 20:32:27 2009 -0500 3.3 @@ -65,10 +65,7 @@ 3.4 } 3.5 3.6 public: 3.7 - bool is_fake_stub_frame() const; 3.8 - 3.9 - public: 3.10 - frame sender_for_fake_stub_frame(RegisterMap* map) const; 3.11 + frame sender_for_nonentry_frame(RegisterMap* map) const; 3.12 3.13 public: 3.14 void zero_print_on_error(int index,
4.1 --- a/src/cpu/zero/vm/globals_zero.hpp Tue Dec 01 22:29:02 2009 -0500 4.2 +++ b/src/cpu/zero/vm/globals_zero.hpp Wed Dec 02 20:32:27 2009 -0500 4.3 @@ -36,7 +36,6 @@ 4.4 4.5 define_pd_global(intx, CodeEntryAlignment, 32); 4.6 define_pd_global(intx, InlineFrequencyCount, 100); 4.7 -define_pd_global(intx, InlineSmallCode, 1000); 4.8 define_pd_global(intx, PreInflateSpin, 10); 4.9 4.10 define_pd_global(intx, StackYellowPages, 2);
5.1 --- a/src/cpu/zero/vm/sharedRuntime_zero.cpp Tue Dec 01 22:29:02 2009 -0500 5.2 +++ b/src/cpu/zero/vm/sharedRuntime_zero.cpp Wed Dec 02 20:32:27 2009 -0500 5.3 @@ -1,6 +1,6 @@ 5.4 /* 5.5 * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 5.6 - * Copyright 2007, 2008 Red Hat, Inc. 5.7 + * Copyright 2007, 2008, 2009 Red Hat, Inc. 5.8 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.9 * 5.10 * This code is free software; you can redistribute it and/or modify it 5.11 @@ -61,7 +61,14 @@ 5.12 BasicType *in_sig_bt, 5.13 VMRegPair *in_regs, 5.14 BasicType ret_type) { 5.15 +#ifdef SHARK 5.16 + return SharkCompiler::compiler()->generate_native_wrapper(masm, 5.17 + method, 5.18 + in_sig_bt, 5.19 + ret_type); 5.20 +#else 5.21 ShouldNotCallThis(); 5.22 +#endif // SHARK 5.23 } 5.24 5.25 int Deoptimization::last_frame_adjust(int callee_parameters,
6.1 --- a/src/cpu/zero/vm/sharkFrame_zero.hpp Tue Dec 01 22:29:02 2009 -0500 6.2 +++ b/src/cpu/zero/vm/sharkFrame_zero.hpp Wed Dec 02 20:32:27 2009 -0500 6.3 @@ -1,6 +1,6 @@ 6.4 /* 6.5 * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. 6.6 - * Copyright 2008 Red Hat, Inc. 6.7 + * Copyright 2008, 2009 Red Hat, Inc. 6.8 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.9 * 6.10 * This code is free software; you can redistribute it and/or modify it 6.11 @@ -41,7 +41,7 @@ 6.12 // | ... | 6.13 6.14 class SharkFrame : public ZeroFrame { 6.15 - friend class SharkFunction; 6.16 + friend class SharkStack; 6.17 6.18 private: 6.19 SharkFrame() : ZeroFrame() {
7.1 --- a/src/share/vm/interpreter/bytecodeInterpreter.cpp Tue Dec 01 22:29:02 2009 -0500 7.2 +++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp Wed Dec 02 20:32:27 2009 -0500 7.3 @@ -281,7 +281,7 @@ 7.4 7.5 #define DO_BACKEDGE_CHECKS(skip, branch_pc) \ 7.6 if ((skip) <= 0) { \ 7.7 - if (UseCompiler && UseLoopCounter) { \ 7.8 + if (UseLoopCounter) { \ 7.9 bool do_OSR = UseOnStackReplacement; \ 7.10 BACKEDGE_COUNT->increment(); \ 7.11 if (do_OSR) do_OSR = BACKEDGE_COUNT->reached_InvocationLimit(); \ 7.12 @@ -289,16 +289,12 @@ 7.13 nmethod* osr_nmethod; \ 7.14 OSR_REQUEST(osr_nmethod, branch_pc); \ 7.15 if (osr_nmethod != NULL && osr_nmethod->osr_entry_bci() != InvalidOSREntryBci) { \ 7.16 - intptr_t* buf; \ 7.17 - CALL_VM(buf=SharedRuntime::OSR_migration_begin(THREAD), handle_exception); \ 7.18 + intptr_t* buf = SharedRuntime::OSR_migration_begin(THREAD); \ 7.19 istate->set_msg(do_osr); \ 7.20 istate->set_osr_buf((address)buf); \ 7.21 istate->set_osr_entry(osr_nmethod->osr_entry()); \ 7.22 return; \ 7.23 } \ 7.24 - } else { \ 7.25 - INCR_INVOCATION_COUNT; \ 7.26 - SAFEPOINT; \ 7.27 } \ 7.28 } /* UseCompiler ... */ \ 7.29 INCR_INVOCATION_COUNT; \ 7.30 @@ -1281,12 +1277,7 @@ 7.31 jfloat f; 7.32 jdouble r; 7.33 f = STACK_FLOAT(-1); 7.34 -#ifdef IA64 7.35 - // IA64 gcc bug 7.36 - r = ( f == 0.0f ) ? (jdouble) f : (jdouble) f + ia64_double_zero; 7.37 -#else 7.38 r = (jdouble) f; 7.39 -#endif 7.40 MORE_STACK(-1); // POP 7.41 SET_STACK_DOUBLE(r, 1); 7.42 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 2);
8.1 --- a/src/share/vm/interpreter/templateInterpreter.cpp Tue Dec 01 22:29:02 2009 -0500 8.2 +++ b/src/share/vm/interpreter/templateInterpreter.cpp Wed Dec 02 20:32:27 2009 -0500 8.3 @@ -465,9 +465,11 @@ 8.4 void TemplateInterpreterGenerator::set_short_entry_points(Template* t, address& bep, address& cep, address& sep, address& aep, address& iep, address& lep, address& fep, address& dep, address& vep) { 8.5 assert(t->is_valid(), "template must exist"); 8.6 switch (t->tos_in()) { 8.7 - case btos: vep = __ pc(); __ pop(btos); bep = __ pc(); generate_and_dispatch(t); break; 8.8 - case ctos: vep = __ pc(); __ pop(ctos); sep = __ pc(); generate_and_dispatch(t); break; 8.9 - case stos: vep = __ pc(); __ pop(stos); sep = __ pc(); generate_and_dispatch(t); break; 8.10 + case btos: 8.11 + case ctos: 8.12 + case stos: 8.13 + ShouldNotReachHere(); // btos/ctos/stos should use itos. 8.14 + break; 8.15 case atos: vep = __ pc(); __ pop(atos); aep = __ pc(); generate_and_dispatch(t); break; 8.16 case itos: vep = __ pc(); __ pop(itos); iep = __ pc(); generate_and_dispatch(t); break; 8.17 case ltos: vep = __ pc(); __ pop(ltos); lep = __ pc(); generate_and_dispatch(t); break;
9.1 --- a/src/share/vm/opto/escape.cpp Tue Dec 01 22:29:02 2009 -0500 9.2 +++ b/src/share/vm/opto/escape.cpp Wed Dec 02 20:32:27 2009 -0500 9.3 @@ -1150,7 +1150,6 @@ 9.4 } else { 9.5 assert(n->is_Mem(), "memory node required."); 9.6 Node *addr = n->in(MemNode::Address); 9.7 - assert(addr->is_AddP(), "AddP required"); 9.8 const Type *addr_t = igvn->type(addr); 9.9 if (addr_t == Type::TOP) 9.10 continue;
10.1 --- a/src/share/vm/opto/parse1.cpp Tue Dec 01 22:29:02 2009 -0500 10.2 +++ b/src/share/vm/opto/parse1.cpp Wed Dec 02 20:32:27 2009 -0500 10.3 @@ -231,12 +231,13 @@ 10.4 10.5 // Use the raw liveness computation to make sure that unexpected 10.6 // values don't propagate into the OSR frame. 10.7 - MethodLivenessResult live_locals = method()->raw_liveness_at_bci(osr_bci()); 10.8 + MethodLivenessResult live_locals = method()->liveness_at_bci(osr_bci()); 10.9 if (!live_locals.is_valid()) { 10.10 // Degenerate or breakpointed method. 10.11 C->record_method_not_compilable("OSR in empty or breakpointed method"); 10.12 return; 10.13 } 10.14 + MethodLivenessResult raw_live_locals = method()->raw_liveness_at_bci(osr_bci()); 10.15 10.16 // Extract the needed locals from the interpreter frame. 10.17 Node *locals_addr = basic_plus_adr(osr_buf, osr_buf, (max_locals-1)*wordSize); 10.18 @@ -316,6 +317,10 @@ 10.19 continue; 10.20 } 10.21 } 10.22 + if (type->basic_type() == T_ADDRESS && !raw_live_locals.at(index)) { 10.23 + // Skip type check for dead address locals 10.24 + continue; 10.25 + } 10.26 set_local(index, check_interpreter_type(l, type, bad_type_exit)); 10.27 } 10.28
11.1 --- a/src/share/vm/prims/jni.cpp Tue Dec 01 22:29:02 2009 -0500 11.2 +++ b/src/share/vm/prims/jni.cpp Wed Dec 02 20:32:27 2009 -0500 11.3 @@ -3231,6 +3231,21 @@ 11.4 jint result = JNI_ERR; 11.5 DT_RETURN_MARK(CreateJavaVM, jint, (const jint&)result); 11.6 11.7 + // We're about to use Atomic::xchg for synchronization. Some Zero 11.8 + // platforms use the GCC builtin __sync_lock_test_and_set for this, 11.9 + // but __sync_lock_test_and_set is not guaranteed to do what we want 11.10 + // on all architectures. So we check it works before relying on it. 11.11 +#if defined(ZERO) && defined(ASSERT) 11.12 + { 11.13 + jint a = 0xcafebabe; 11.14 + jint b = Atomic::xchg(0xdeadbeef, &a); 11.15 + void *c = &a; 11.16 + void *d = Atomic::xchg_ptr(&b, &c); 11.17 + assert(a == 0xdeadbeef && b == (jint) 0xcafebabe, "Atomic::xchg() works"); 11.18 + assert(c == &b && d == &a, "Atomic::xchg_ptr() works"); 11.19 + } 11.20 +#endif // ZERO && ASSERT 11.21 + 11.22 // At the moment it's only possible to have one Java VM, 11.23 // since some of the runtime state is in global variables. 11.24
12.1 --- a/src/share/vm/prims/jvmtiManageCapabilities.cpp Tue Dec 01 22:29:02 2009 -0500 12.2 +++ b/src/share/vm/prims/jvmtiManageCapabilities.cpp Wed Dec 02 20:32:27 2009 -0500 12.3 @@ -115,8 +115,10 @@ 12.4 jvmtiCapabilities jc; 12.5 12.6 memset(&jc, 0, sizeof(jc)); 12.7 +#ifndef CC_INTERP 12.8 jc.can_pop_frame = 1; 12.9 jc.can_force_early_return = 1; 12.10 +#endif // !CC_INTERP 12.11 jc.can_get_source_debug_extension = 1; 12.12 jc.can_access_local_variables = 1; 12.13 jc.can_maintain_original_method_order = 1;
13.1 --- a/src/share/vm/runtime/os.hpp Tue Dec 01 22:29:02 2009 -0500 13.2 +++ b/src/share/vm/runtime/os.hpp Wed Dec 02 20:32:27 2009 -0500 13.3 @@ -294,19 +294,16 @@ 13.4 } 13.5 13.6 static bool is_memory_serialize_page(JavaThread *thread, address addr) { 13.7 - address thr_addr; 13.8 if (UseMembar) return false; 13.9 - // Calculate thread specific address 13.10 + // Previously this function calculated the exact address of this 13.11 + // thread's serialize page, and checked if the faulting address 13.12 + // was equal. However, some platforms mask off faulting addresses 13.13 + // to the page size, so now we just check that the address is 13.14 + // within the page. This makes the thread argument unnecessary, 13.15 + // but we retain the NULL check to preserve existing behaviour. 13.16 if (thread == NULL) return false; 13.17 - // TODO-FIXME: some platforms mask off faulting addresses to the base pagesize. 13.18 - // Instead of using a test for equality we should probably use something 13.19 - // of the form: 13.20 - // return ((_mem_serialize_page ^ addr) & -pagesize) == 0 13.21 - // 13.22 - thr_addr = (address)(((uintptr_t)thread >> 13.23 - get_serialize_page_shift_count()) & 13.24 - get_serialize_page_mask()) + (uintptr_t)_mem_serialize_page; 13.25 - return (thr_addr == addr); 13.26 + address page = (address) _mem_serialize_page; 13.27 + return addr >= page && addr < (page + os::vm_page_size()); 13.28 } 13.29 13.30 static void block_on_serialize_page_trap();