# HG changeset patch # User coleenp # Date 1231529947 18000 # Node ID fc7ab6287598874e544d40e03c3acb3869f796f8 # Parent a0401dc51d0b4fe9a92e76810936a41d2387ef9e# Parent 1a767c61ad016baf553fac7082613f3b2b7d881f Merge diff -r 1a767c61ad01 -r fc7ab6287598 src/cpu/sparc/vm/jni_sparc.h --- a/src/cpu/sparc/vm/jni_sparc.h Tue Jan 06 16:10:11 2009 -0800 +++ b/src/cpu/sparc/vm/jni_sparc.h Fri Jan 09 14:39:07 2009 -0500 @@ -28,5 +28,11 @@ #define JNICALL typedef int jint; -typedef long long jlong; + +#ifdef _LP64 + typedef long jlong; +#else + typedef long long jlong; +#endif + typedef signed char jbyte; diff -r 1a767c61ad01 -r fc7ab6287598 src/cpu/x86/vm/assembler_x86.cpp --- a/src/cpu/x86/vm/assembler_x86.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/cpu/x86/vm/assembler_x86.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -5212,15 +5212,15 @@ void MacroAssembler::reset_last_Java_frame(bool clear_fp, bool clear_pc) { // we must set sp to zero to clear frame - movptr(Address(r15_thread, JavaThread::last_Java_sp_offset()), (int32_t)NULL_WORD); + movptr(Address(r15_thread, JavaThread::last_Java_sp_offset()), NULL_WORD); // must clear fp, so that compiled frames are not confused; it is // possible that we need it only for debugging if (clear_fp) { - movptr(Address(r15_thread, JavaThread::last_Java_fp_offset()), (int32_t)NULL_WORD); + movptr(Address(r15_thread, JavaThread::last_Java_fp_offset()), NULL_WORD); } if (clear_pc) { - movptr(Address(r15_thread, JavaThread::last_Java_pc_offset()), (int32_t)NULL_WORD); + movptr(Address(r15_thread, JavaThread::last_Java_pc_offset()), NULL_WORD); } } @@ -5670,7 +5670,7 @@ // get oop result if there is one and reset the value in the thread if (oop_result->is_valid()) { movptr(oop_result, Address(java_thread, JavaThread::vm_result_offset())); - movptr(Address(java_thread, JavaThread::vm_result_offset()), (int32_t)NULL_WORD); + movptr(Address(java_thread, JavaThread::vm_result_offset()), NULL_WORD); verify_oop(oop_result, "broken oop in call_VM_base"); } } @@ -6426,13 +6426,13 @@ get_thread(java_thread); } // we must set sp to zero to clear frame - movptr(Address(java_thread, JavaThread::last_Java_sp_offset()), (int32_t)NULL_WORD); + movptr(Address(java_thread, JavaThread::last_Java_sp_offset()), NULL_WORD); if (clear_fp) { - movptr(Address(java_thread, JavaThread::last_Java_fp_offset()), (int32_t)NULL_WORD); + movptr(Address(java_thread, JavaThread::last_Java_fp_offset()), NULL_WORD); } if (clear_pc) - movptr(Address(java_thread, JavaThread::last_Java_pc_offset()), (int32_t)NULL_WORD); + movptr(Address(java_thread, JavaThread::last_Java_pc_offset()), NULL_WORD); } diff -r 1a767c61ad01 -r fc7ab6287598 src/cpu/x86/vm/c1_LIRAssembler_x86.cpp --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -779,7 +779,7 @@ case T_OBJECT: // fall through case T_ARRAY: if (c->as_jobject() == NULL) { - __ movptr(as_Address(addr), (int32_t)NULL_WORD); + __ movptr(as_Address(addr), NULL_WORD); } else { if (is_literal_address(addr)) { ShouldNotReachHere(); diff -r 1a767c61ad01 -r fc7ab6287598 src/cpu/x86/vm/c1_Runtime1_x86.cpp --- a/src/cpu/x86/vm/c1_Runtime1_x86.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/cpu/x86/vm/c1_Runtime1_x86.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -78,10 +78,10 @@ movptr(rax, Address(thread, Thread::pending_exception_offset())); // make sure that the vm_results are cleared if (oop_result1->is_valid()) { - movptr(Address(thread, JavaThread::vm_result_offset()), (int32_t)NULL_WORD); + movptr(Address(thread, JavaThread::vm_result_offset()), NULL_WORD); } if (oop_result2->is_valid()) { - movptr(Address(thread, JavaThread::vm_result_2_offset()), (int32_t)NULL_WORD); + movptr(Address(thread, JavaThread::vm_result_2_offset()), NULL_WORD); } if (frame_size() == no_frame_size) { leave(); @@ -96,12 +96,12 @@ // get oop results if there are any and reset the values in the thread if (oop_result1->is_valid()) { movptr(oop_result1, Address(thread, JavaThread::vm_result_offset())); - movptr(Address(thread, JavaThread::vm_result_offset()), (int32_t)NULL_WORD); + movptr(Address(thread, JavaThread::vm_result_offset()), NULL_WORD); verify_oop(oop_result1); } if (oop_result2->is_valid()) { movptr(oop_result2, Address(thread, JavaThread::vm_result_2_offset())); - movptr(Address(thread, JavaThread::vm_result_2_offset()), (int32_t)NULL_WORD); + movptr(Address(thread, JavaThread::vm_result_2_offset()), NULL_WORD); verify_oop(oop_result2); } return call_offset; @@ -728,8 +728,8 @@ // clear exception fields in JavaThread because they are no longer needed // (fields must be cleared because they are processed by GC otherwise) - __ movptr(Address(thread, JavaThread::exception_oop_offset()), (int32_t)NULL_WORD); - __ movptr(Address(thread, JavaThread::exception_pc_offset()), (int32_t)NULL_WORD); + __ movptr(Address(thread, JavaThread::exception_oop_offset()), NULL_WORD); + __ movptr(Address(thread, JavaThread::exception_pc_offset()), NULL_WORD); // pop the stub frame off __ leave(); @@ -878,7 +878,7 @@ // load and clear pending exception __ movptr(rax, Address(thread, Thread::pending_exception_offset())); - __ movptr(Address(thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); + __ movptr(Address(thread, Thread::pending_exception_offset()), NULL_WORD); // check that there is really a valid exception __ verify_not_null_oop(rax); @@ -971,14 +971,14 @@ // load pending exception oop into rax, __ movptr(exception_oop, Address(thread, Thread::pending_exception_offset())); // clear pending exception - __ movptr(Address(thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); + __ movptr(Address(thread, Thread::pending_exception_offset()), NULL_WORD); // load issuing PC (the return address for this stub) into rdx __ movptr(exception_pc, Address(rbp, 1*BytesPerWord)); // make sure that the vm_results are cleared (may be unnecessary) - __ movptr(Address(thread, JavaThread::vm_result_offset()), (int32_t)NULL_WORD); - __ movptr(Address(thread, JavaThread::vm_result_2_offset()), (int32_t)NULL_WORD); + __ movptr(Address(thread, JavaThread::vm_result_offset()), NULL_WORD); + __ movptr(Address(thread, JavaThread::vm_result_2_offset()), NULL_WORD); // verify that that there is really a valid exception in rax, __ verify_not_null_oop(exception_oop); diff -r 1a767c61ad01 -r fc7ab6287598 src/cpu/x86/vm/interp_masm_x86_32.cpp --- a/src/cpu/x86/vm/interp_masm_x86_32.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/cpu/x86/vm/interp_masm_x86_32.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -133,7 +133,7 @@ + in_ByteSize(wordSize)); switch (state) { case atos: movptr(rax, oop_addr); - movptr(oop_addr, (int32_t)NULL_WORD); + movptr(oop_addr, NULL_WORD); verify_oop(rax, state); break; case ltos: movl(rdx, val_addr1); // fall through @@ -148,7 +148,7 @@ } // Clean up tos value in the thread object movl(tos_addr, (int32_t) ilgl); - movptr(val_addr, (int32_t)NULL_WORD); + movptr(val_addr, NULL_WORD); NOT_LP64(movl(val_addr1, (int32_t)NULL_WORD)); } @@ -944,7 +944,7 @@ movptr(obj_reg, Address(lock_reg, BasicObjectLock::obj_offset_in_bytes ())); // Free entry - movptr(Address(lock_reg, BasicObjectLock::obj_offset_in_bytes()), (int32_t)NULL_WORD); + movptr(Address(lock_reg, BasicObjectLock::obj_offset_in_bytes()), NULL_WORD); if (UseBiasedLocking) { biased_locking_exit(obj_reg, header_reg, done); diff -r 1a767c61ad01 -r fc7ab6287598 src/cpu/x86/vm/interp_masm_x86_32.hpp --- a/src/cpu/x86/vm/interp_masm_x86_32.hpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/cpu/x86/vm/interp_masm_x86_32.hpp Fri Jan 09 14:39:07 2009 -0500 @@ -120,7 +120,7 @@ void empty_expression_stack() { movptr(rsp, Address(rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize)); // NULL last_sp until next java call - movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); + movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD); } // Tagged stack helpers for swap and dup diff -r 1a767c61ad01 -r fc7ab6287598 src/cpu/x86/vm/interpreterRT_x86_32.cpp --- a/src/cpu/x86/vm/interpreterRT_x86_32.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/cpu/x86/vm/interpreterRT_x86_32.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -54,7 +54,7 @@ __ cmpptr(Address(from(), Interpreter::local_offset_in_bytes(from_offset)), (int32_t)NULL_WORD); // do not use temp() to avoid AGI Label L; __ jcc(Assembler::notZero, L); - __ movptr(temp(), ((int32_t)NULL_WORD)); + __ movptr(temp(), NULL_WORD); __ bind(L); __ movptr(Address(to(), to_offset * wordSize), temp()); } diff -r 1a767c61ad01 -r fc7ab6287598 src/cpu/x86/vm/jni_x86.h --- a/src/cpu/x86/vm/jni_x86.h Tue Jan 06 16:10:11 2009 -0800 +++ b/src/cpu/x86/vm/jni_x86.h Fri Jan 09 14:39:07 2009 -0500 @@ -32,7 +32,13 @@ #define JNICALL typedef int jint; + +#ifdef _LP64 + typedef long jlong; +#else typedef long long jlong; +#endif + #else #define JNIEXPORT __declspec(dllexport) #define JNIIMPORT __declspec(dllimport) diff -r 1a767c61ad01 -r fc7ab6287598 src/cpu/x86/vm/runtime_x86_32.cpp --- a/src/cpu/x86/vm/runtime_x86_32.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/cpu/x86/vm/runtime_x86_32.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -129,11 +129,11 @@ // Get the exception pc in case we are deoptimized __ movptr(rdx, Address(rcx, JavaThread::exception_pc_offset())); #ifdef ASSERT - __ movptr(Address(rcx, JavaThread::exception_handler_pc_offset()), (int32_t)NULL_WORD); - __ movptr(Address(rcx, JavaThread::exception_pc_offset()), (int32_t)NULL_WORD); + __ movptr(Address(rcx, JavaThread::exception_handler_pc_offset()), NULL_WORD); + __ movptr(Address(rcx, JavaThread::exception_pc_offset()), NULL_WORD); #endif // Clear the exception oop so GC no longer processes it as a root. - __ movptr(Address(rcx, JavaThread::exception_oop_offset()), (int32_t)NULL_WORD); + __ movptr(Address(rcx, JavaThread::exception_oop_offset()), NULL_WORD); __ pop(rcx); diff -r 1a767c61ad01 -r fc7ab6287598 src/cpu/x86/vm/sharedRuntime_x86_32.cpp --- a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -1793,7 +1793,7 @@ // reset handle block __ movptr(rcx, Address(thread, JavaThread::active_handles_offset())); - __ movptr(Address(rcx, JNIHandleBlock::top_offset_in_bytes()), (int32_t)NULL_WORD); + __ movptr(Address(rcx, JNIHandleBlock::top_offset_in_bytes()), NULL_WORD); // Any exception pending? __ cmpptr(Address(thread, in_bytes(Thread::pending_exception_offset())), (int32_t)NULL_WORD); @@ -1865,7 +1865,7 @@ // Save pending exception around call to VM (which contains an EXCEPTION_MARK) __ pushptr(Address(thread, in_bytes(Thread::pending_exception_offset()))); - __ movptr(Address(thread, in_bytes(Thread::pending_exception_offset())), (int32_t)NULL_WORD); + __ movptr(Address(thread, in_bytes(Thread::pending_exception_offset())), NULL_WORD); // should be a peal @@ -2431,7 +2431,7 @@ __ get_thread(rdi); __ movptr(rdx, Address(rdi, JavaThread::exception_pc_offset())); __ movptr(Address(rbp, wordSize), rdx); - __ movptr(Address(rdi, JavaThread::exception_pc_offset()), (int32_t)NULL_WORD); + __ movptr(Address(rdi, JavaThread::exception_pc_offset()), NULL_WORD); #ifdef ASSERT // verify that there is really an exception oop in JavaThread @@ -2489,8 +2489,8 @@ __ jcc(Assembler::notEqual, noException); __ movptr(rax, Address(rcx, JavaThread::exception_oop_offset())); __ movptr(rdx, Address(rcx, JavaThread::exception_pc_offset())); - __ movptr(Address(rcx, JavaThread::exception_oop_offset()), (int32_t)NULL_WORD); - __ movptr(Address(rcx, JavaThread::exception_pc_offset()), (int32_t)NULL_WORD); + __ movptr(Address(rcx, JavaThread::exception_oop_offset()), NULL_WORD); + __ movptr(Address(rcx, JavaThread::exception_pc_offset()), NULL_WORD); __ verify_oop(rax); @@ -2582,7 +2582,7 @@ rbx); // Make it walkable #else /* CC_INTERP */ // This value is corrected by layout_activation_impl - __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD ); + __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD); __ movptr(Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize), rbx); // Make it walkable #endif /* CC_INTERP */ __ movptr(sp_temp, rsp); // pass to next frame @@ -2802,7 +2802,7 @@ rbx); // Make it walkable #else /* CC_INTERP */ // This value is corrected by layout_activation_impl - __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD ); + __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD ); __ movptr(Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize), rbx); // Make it walkable #endif /* CC_INTERP */ __ movptr(sp_temp, rsp); // pass to next frame @@ -3020,7 +3020,7 @@ // exception pending => remove activation and forward to exception handler __ get_thread(thread); - __ movptr(Address(thread, JavaThread::vm_result_offset()), (int32_t)NULL_WORD); + __ movptr(Address(thread, JavaThread::vm_result_offset()), NULL_WORD); __ movptr(rax, Address(thread, Thread::pending_exception_offset())); __ jump(RuntimeAddress(StubRoutines::forward_exception_entry())); diff -r 1a767c61ad01 -r fc7ab6287598 src/cpu/x86/vm/stubGenerator_x86_64.cpp --- a/src/cpu/x86/vm/stubGenerator_x86_64.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/cpu/x86/vm/stubGenerator_x86_64.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -472,7 +472,7 @@ // setup rax & rdx, remove return address & clear pending exception __ pop(rdx); __ movptr(rax, Address(r15_thread, Thread::pending_exception_offset())); - __ movptr(Address(r15_thread, Thread::pending_exception_offset()), (int)NULL_WORD); + __ movptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); #ifdef ASSERT // make sure exception is set @@ -954,9 +954,9 @@ __ jcc(Assembler::zero, exit); // if obj is NULL it is OK // Check if the oop is in the right area of memory __ movptr(c_rarg2, rax); - __ movptr(c_rarg3, (int64_t) Universe::verify_oop_mask()); + __ movptr(c_rarg3, (intptr_t) Universe::verify_oop_mask()); __ andptr(c_rarg2, c_rarg3); - __ movptr(c_rarg3, (int64_t) Universe::verify_oop_bits()); + __ movptr(c_rarg3, (intptr_t) Universe::verify_oop_bits()); __ cmpptr(c_rarg2, c_rarg3); __ jcc(Assembler::notZero, error); @@ -969,9 +969,9 @@ __ jcc(Assembler::zero, error); // if klass is NULL it is broken // Check if the klass is in the right area of memory __ mov(c_rarg2, rax); - __ movptr(c_rarg3, (int64_t) Universe::verify_klass_mask()); + __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_mask()); __ andptr(c_rarg2, c_rarg3); - __ movptr(c_rarg3, (int64_t) Universe::verify_klass_bits()); + __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_bits()); __ cmpptr(c_rarg2, c_rarg3); __ jcc(Assembler::notZero, error); @@ -980,9 +980,9 @@ __ testptr(rax, rax); __ jcc(Assembler::zero, error); // if klass' klass is NULL it is broken // Check if the klass' klass is in the right area of memory - __ movptr(c_rarg3, (int64_t) Universe::verify_klass_mask()); + __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_mask()); __ andptr(rax, c_rarg3); - __ movptr(c_rarg3, (int64_t) Universe::verify_klass_bits()); + __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_bits()); __ cmpptr(rax, c_rarg3); __ jcc(Assembler::notZero, error); diff -r 1a767c61ad01 -r fc7ab6287598 src/cpu/x86/vm/templateInterpreter_x86_32.cpp --- a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -110,7 +110,7 @@ if (message != NULL) { __ lea(rbx, ExternalAddress((address)message)); } else { - __ movptr(rbx, (int32_t)NULL_WORD); + __ movptr(rbx, NULL_WORD); } __ call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::create_exception), rax, rbx); } @@ -123,7 +123,7 @@ address TemplateInterpreterGenerator::generate_continuation_for(TosState state) { address entry = __ pc(); // NULL last_sp until next java call - __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); + __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD); __ dispatch_next(state); return entry; } @@ -176,7 +176,7 @@ // Restore stack bottom in case i2c adjusted stack __ movptr(rsp, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize)); // and NULL it as marker that rsp is now tos until next java call - __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); + __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD); __ restore_bcp(); __ restore_locals(); @@ -211,7 +211,7 @@ // The stack is not extended by deopt but we must NULL last_sp as this // entry is like a "return". - __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); + __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD); __ restore_bcp(); __ restore_locals(); // handle exceptions @@ -1028,7 +1028,7 @@ // reset handle block __ movptr(t, Address(thread, JavaThread::active_handles_offset())); - __ movptr(Address(t, JNIHandleBlock::top_offset_in_bytes()), (int32_t)NULL_WORD); + __ movptr(Address(t, JNIHandleBlock::top_offset_in_bytes()), NULL_WORD); // If result was an oop then unbox and save it in the frame { Label L; @@ -1488,7 +1488,7 @@ // Restore sp to interpreter_frame_last_sp even though we are going // to empty the expression stack for the exception processing. - __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); + __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD); // rax,: exception // rdx: return address/pc that threw exception __ restore_bcp(); // rsi points to call/send @@ -1608,7 +1608,7 @@ __ reset_last_Java_frame(rcx, true, true); // Restore the last_sp and null it out __ movptr(rsp, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize)); - __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); + __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD); __ restore_bcp(); __ restore_locals(); @@ -1636,7 +1636,7 @@ // restore exception __ get_thread(rcx); __ movptr(rax, Address(rcx, JavaThread::vm_result_offset())); - __ movptr(Address(rcx, JavaThread::vm_result_offset()), (int32_t)NULL_WORD); + __ movptr(Address(rcx, JavaThread::vm_result_offset()), NULL_WORD); __ verify_oop(rax); // Inbetween activations - previous activation type unknown yet diff -r 1a767c61ad01 -r fc7ab6287598 src/cpu/x86/vm/templateTable_x86_32.cpp --- a/src/cpu/x86/vm/templateTable_x86_32.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/cpu/x86/vm/templateTable_x86_32.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -137,7 +137,7 @@ // Do the actual store // noreg means NULL if (val == noreg) { - __ movl(Address(rdx, 0), NULL_WORD); + __ movl(Address(rdx, 0), (int32_t)NULL_WORD); // No post barrier for NULL } else { __ movl(Address(rdx, 0), val); diff -r 1a767c61ad01 -r fc7ab6287598 src/cpu/x86/vm/x86_32.ad --- a/src/cpu/x86/vm/x86_32.ad Tue Jan 06 16:10:11 2009 -0800 +++ b/src/cpu/x86/vm/x86_32.ad Fri Jan 09 14:39:07 2009 -0500 @@ -3371,7 +3371,7 @@ masm.movptr(Address(boxReg, 0), 3) ; // results in ST-before-CAS penalty masm.get_thread (scrReg) ; masm.movptr(boxReg, tmpReg); // consider: LEA box, [tmp-2] - masm.movptr(tmpReg, 0); // consider: xor vs mov + masm.movptr(tmpReg, NULL_WORD); // consider: xor vs mov if (os::is_MP()) { masm.lock(); } masm.cmpxchgptr(scrReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2)) ; } else @@ -3387,7 +3387,7 @@ if ((EmitSync & 64) == 0) { // Optimistic form: consider XORL tmpReg,tmpReg - masm.movptr(tmpReg, 0 ) ; + masm.movptr(tmpReg, NULL_WORD) ; } else { // Can suffer RTS->RTO upgrades on shared or cold $ lines // Test-And-CAS instead of CAS @@ -3587,7 +3587,7 @@ masm.orptr(boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2)) ; masm.orptr(boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2)) ; masm.jccb (Assembler::notZero, DONE_LABEL) ; - masm.movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), 0) ; + masm.movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), NULL_WORD) ; masm.jmpb (DONE_LABEL) ; } else { masm.xorptr(boxReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2)) ; @@ -3596,7 +3596,7 @@ masm.movptr(boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2)) ; masm.orptr(boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2)) ; masm.jccb (Assembler::notZero, CheckSucc) ; - masm.movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), 0) ; + masm.movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), NULL_WORD) ; masm.jmpb (DONE_LABEL) ; } @@ -3644,7 +3644,7 @@ // We currently use (3), although it's likely that switching to (2) // is correct for the future. - masm.movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), 0) ; + masm.movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), NULL_WORD) ; if (os::is_MP()) { if (VM_Version::supports_sse2() && 1 == FenceInstruction) { masm.mfence(); diff -r 1a767c61ad01 -r fc7ab6287598 src/os/linux/vm/os_linux.cpp --- a/src/os/linux/vm/os_linux.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/os/linux/vm/os_linux.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -1164,7 +1164,10 @@ /* 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 */ /* 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 */ - i = sscanf(s, "%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld %lu %lu %ld %lu %lu %lu %lu", + i = sscanf(s, "%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld " + UINTX_FORMAT UINTX_FORMAT UINTX_FORMAT + " %lu " + UINTX_FORMAT UINTX_FORMAT UINTX_FORMAT, &state, /* 3 %c */ &ppid, /* 4 %d */ &pgrp, /* 5 %d */ @@ -1184,13 +1187,13 @@ &nice, /* 19 %ld */ &junk, /* 20 %ld */ &it_real, /* 21 %ld */ - &start, /* 22 %lu */ - &vsize, /* 23 %lu */ - &rss, /* 24 %ld */ + &start, /* 22 UINTX_FORMAT */ + &vsize, /* 23 UINTX_FORMAT */ + &rss, /* 24 UINTX_FORMAT */ &rsslim, /* 25 %lu */ - &scodes, /* 26 %lu */ - &ecode, /* 27 %lu */ - &stack_start); /* 28 %lu */ + &scodes, /* 26 UINTX_FORMAT */ + &ecode, /* 27 UINTX_FORMAT */ + &stack_start); /* 28 UINTX_FORMAT */ } if (i != 28 - 2) { @@ -2028,7 +2031,8 @@ CAST_FROM_FN_PTR(address, os::jvm_path), dli_fname, sizeof(dli_fname), NULL); assert(ret != 0, "cannot locate libjvm"); - realpath(dli_fname, buf); + if (realpath(dli_fname, buf) == NULL) + return; if (strcmp(Arguments::sun_java_launcher(), "gamma") == 0) { // Support for the gamma launcher. Typical value for buf is @@ -2052,7 +2056,8 @@ assert(strstr(p, "/libjvm") == p, "invalid library name"); p = strstr(p, "_g") ? "_g" : ""; - realpath(java_home_var, buf); + if (realpath(java_home_var, buf) == NULL) + return; sprintf(buf + strlen(buf), "/jre/lib/%s", cpu_arch); if (0 == access(buf, F_OK)) { // Use current module name "libjvm[_g].so" instead of @@ -2063,7 +2068,8 @@ sprintf(buf + strlen(buf), "/hotspot/libjvm%s.so", p); } else { // Go back to path of .so - realpath(dli_fname, buf); + if (realpath(dli_fname, buf) == NULL) + return; } } } @@ -4188,11 +4194,11 @@ // Skip blank chars do s++; while (isspace(*s)); - count = sscanf(s,"%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu", - &idummy, &idummy, &idummy, &idummy, &idummy, &idummy, + count = sscanf(s,"%*c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu", + &idummy, &idummy, &idummy, &idummy, &idummy, &ldummy, &ldummy, &ldummy, &ldummy, &ldummy, &user_time, &sys_time); - if ( count != 13 ) return -1; + if ( count != 12 ) return -1; if (user_sys_cpu_time) { return ((jlong)sys_time + (jlong)user_time) * (1000000000 / clock_tics_per_sec); } else { diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/classfile/javaClasses.cpp --- a/src/share/vm/classfile/javaClasses.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/classfile/javaClasses.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -441,6 +441,7 @@ bool java_lang_Class::offsets_computed = false; int java_lang_Class::classRedefinedCount_offset = -1; +int java_lang_Class::parallelCapable_offset = -1; void java_lang_Class::compute_offsets() { assert(!offsets_computed, "offsets should be initialized only once"); @@ -451,6 +452,23 @@ // so don't go fatal. compute_optional_offset(classRedefinedCount_offset, k, vmSymbols::classRedefinedCount_name(), vmSymbols::int_signature()); + + // The field indicating parallelCapable (parallelLockMap) is only present starting in 7, + klassOop k1 = SystemDictionary::classloader_klass(); + compute_optional_offset(parallelCapable_offset, + k1, vmSymbols::parallelCapable_name(), vmSymbols::concurrenthashmap_signature()); +} + +// For class loader classes, parallelCapable defined +// based on non-null field +// Written to by java.lang.ClassLoader, vm only reads this field, doesn't set it +bool java_lang_Class::parallelCapable(oop class_loader) { + if (!JDK_Version::is_gte_jdk17x_version() + || parallelCapable_offset == -1) { + // Default for backward compatibility is false + return false; + } + return (class_loader->obj_field(parallelCapable_offset) != NULL); } int java_lang_Class::classRedefinedCount(oop the_class_mirror) { @@ -866,7 +884,7 @@ } nmethod* nm = method->code(); if (WizardMode && nm != NULL) { - sprintf(buf + (int)strlen(buf), "(nmethod %#x)", nm); + sprintf(buf + (int)strlen(buf), "(nmethod " PTR_FORMAT ")", (intptr_t)nm); } } diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/classfile/javaClasses.hpp --- a/src/share/vm/classfile/javaClasses.hpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/classfile/javaClasses.hpp Fri Jan 09 14:39:07 2009 -0500 @@ -141,6 +141,7 @@ static void compute_offsets(); static bool offsets_computed; static int classRedefinedCount_offset; + static int parallelCapable_offset; public: // Instance creation @@ -168,6 +169,8 @@ // Support for classRedefinedCount field static int classRedefinedCount(oop the_class_mirror); static void set_classRedefinedCount(oop the_class_mirror, int value); + // Support for parallelCapable field + static bool parallelCapable(oop the_class_mirror); // Debugging friend class JavaClasses; friend class instanceKlass; // verification code accesses offsets diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/classfile/systemDictionary.cpp --- a/src/share/vm/classfile/systemDictionary.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/classfile/systemDictionary.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -90,6 +90,14 @@ #endif // ---------------------------------------------------------------------------- +// Parallel class loading check + +bool SystemDictionary::is_parallelCapable(Handle class_loader) { + if (UnsyncloadClass || class_loader.is_null()) return true; + if (AlwaysLockClassLoader) return false; + return java_lang_Class::parallelCapable(class_loader()); +} +// ---------------------------------------------------------------------------- // Resolving of classes // Forwards to resolve_or_null @@ -196,7 +204,8 @@ // super-class callers: // ClassFileParser - for defineClass & jvmtiRedefineClasses // load_shared_class - while loading a class from shared archive -// resolve_instance_class_or_fail: +// resolve_instance_class_or_null: +// via: handle_parallel_super_load // when resolving a class that has an existing placeholder with // a saved superclass [i.e. a defineClass is currently in progress] // if another thread is trying to resolve the class, it must do @@ -283,12 +292,9 @@ if (probe && probe->check_seen_thread(THREAD, PlaceholderTable::LOAD_SUPER)) { throw_circularity_error = true; } - - // add placeholder entry even if error - callers will remove on error + } + if (!throw_circularity_error) { PlaceholderEntry* newprobe = placeholders()->find_and_add(p_index, p_hash, child_name, class_loader, PlaceholderTable::LOAD_SUPER, class_name, THREAD); - if (throw_circularity_error) { - newprobe->remove_seen_thread(THREAD, PlaceholderTable::LOAD_SUPER); - } } } if (throw_circularity_error) { @@ -325,7 +331,6 @@ return superk_h(); } - void SystemDictionary::validate_protection_domain(instanceKlassHandle klass, Handle class_loader, Handle protection_domain, @@ -421,7 +426,7 @@ bool calledholdinglock = ObjectSynchronizer::current_thread_holds_lock((JavaThread*)THREAD, lockObject); assert(calledholdinglock,"must hold lock for notify"); - assert(!UnsyncloadClass, "unexpected double_lock_wait"); + assert((!(lockObject() == _system_loader_lock_obj) && !is_parallelCapable(lockObject)), "unexpected double_lock_wait"); ObjectSynchronizer::notifyall(lockObject, THREAD); intptr_t recursions = ObjectSynchronizer::complete_exit(lockObject, THREAD); SystemDictionary_lock->wait(); @@ -439,7 +444,7 @@ // even in non-circularity situations. // Note: only one thread can define the class, but multiple can resolve // Note: must call resolve_super_or_fail even if null super - -// to force placeholder entry creation for this class +// to force placeholder entry creation for this class for circularity detection // Caller must check for pending exception // Returns non-null klassOop if other thread has completed load // and we are done, @@ -477,9 +482,9 @@ SystemDictionary_lock->notify_all(); } - // UnsyncloadClass does NOT wait for parallel superclass loads to complete - // Bootstrap classloader does wait for parallel superclass loads - if (UnsyncloadClass) { + // parallelCapable class loaders do NOT wait for parallel superclass loads to complete + // Serial class loaders and bootstrap classloader do wait for superclass loads + if (!class_loader.is_null() && is_parallelCapable(class_loader)) { MutexLocker mu(SystemDictionary_lock, THREAD); // Check if classloading completed while we were loading superclass or waiting klassOop check = find_class(d_index, d_hash, name, class_loader); @@ -566,10 +571,10 @@ // This lock must be acquired here so the waiter will find // any successful result in the SystemDictionary and not attempt // the define - // Classloaders that support parallelism, e.g. bootstrap classloader, + // ParallelCapable Classloaders and the bootstrap classloader, // or all classloaders with UnsyncloadClass do not acquire lock here bool DoObjectLock = true; - if (UnsyncloadClass || (class_loader.is_null())) { + if (is_parallelCapable(class_loader)) { DoObjectLock = false; } @@ -627,6 +632,9 @@ // Five cases: // All cases need to prevent modifying bootclasssearchpath // in parallel with a classload of same classname + // Redefineclasses uses existence of the placeholder for the duration + // of the class load to prevent concurrent redefinition of not completely + // defined classes. // case 1. traditional classloaders that rely on the classloader object lock // - no other need for LOAD_INSTANCE // case 2. traditional classloaders that break the classloader object lock @@ -642,12 +650,13 @@ // This classloader supports parallelism at the classloader level, // but only allows a single load of a class/classloader pair. // No performance benefit and no deadlock issues. - // case 5. Future: parallel user level classloaders - without objectLocker + // case 5. parallelCapable user level classloaders - without objectLocker + // Allow parallel classloading of a class/classloader pair symbolHandle nullsymbolHandle; bool throw_circularity_error = false; { MutexLocker mu(SystemDictionary_lock, THREAD); - if (!UnsyncloadClass) { + if (class_loader.is_null() || !is_parallelCapable(class_loader)) { PlaceholderEntry* oldprobe = placeholders()->get_entry(p_index, p_hash, name, class_loader); if (oldprobe) { // only need check_seen_thread once, not on each loop @@ -681,25 +690,25 @@ } } // All cases: add LOAD_INSTANCE - // case 3: UnsyncloadClass: allow competing threads to try + // case 3: UnsyncloadClass || case 5: parallelCapable: allow competing threads to try // LOAD_INSTANCE in parallel // add placeholder entry even if error - callers will remove on error - if (!class_has_been_loaded) { + if (!throw_circularity_error && !class_has_been_loaded) { PlaceholderEntry* newprobe = placeholders()->find_and_add(p_index, p_hash, name, class_loader, PlaceholderTable::LOAD_INSTANCE, nullsymbolHandle, THREAD); - if (throw_circularity_error) { - newprobe->remove_seen_thread(THREAD, PlaceholderTable::LOAD_INSTANCE); - } // For class loaders that do not acquire the classloader object lock, // if they did not catch another thread holding LOAD_INSTANCE, // need a check analogous to the acquire ObjectLocker/find_class // i.e. now that we hold the LOAD_INSTANCE token on loading this class/CL // one final check if the load has already completed + // class loaders holding the ObjectLock shouldn't find the class here klassOop check = find_class(d_index, d_hash, name, class_loader); if (check != NULL) { // Klass is already loaded, so just return it k = instanceKlassHandle(THREAD, check); class_has_been_loaded = true; newprobe->remove_seen_thread(THREAD, PlaceholderTable::LOAD_INSTANCE); + placeholders()->find_and_remove(p_index, p_hash, name, class_loader, THREAD); + SystemDictionary_lock->notify_all(); } } } @@ -714,18 +723,14 @@ // Do actual loading k = load_instance_class(name, class_loader, THREAD); - // In custom class loaders, the usual findClass calls - // findLoadedClass, which directly searches the SystemDictionary, then - // defineClass. If these are not atomic with respect to other threads, - // the findLoadedClass can fail, but the defineClass can get a - // LinkageError:: duplicate class definition. + // For UnsyncloadClass and AllowParallelDefineClass only: // If they got a linkageError, check if a parallel class load succeeded. // If it did, then for bytecode resolution the specification requires // that we return the same result we did for the other thread, i.e. the // successfully loaded instanceKlass - // Note: Class can not be unloaded as long as any classloader refs exist // Should not get here for classloaders that support parallelism - // with the new cleaner mechanism, e.g. bootstrap classloader + // with the new cleaner mechanism + // Bootstrap goes through here to allow for an extra guarantee check if (UnsyncloadClass || (class_loader.is_null())) { if (k.is_null() && HAS_PENDING_EXCEPTION && PENDING_EXCEPTION->is_a(SystemDictionary::linkageError_klass())) { @@ -955,10 +960,10 @@ instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name, class_loader, protection_domain, - cp_patches, parsed_name, THREAD); + // We don't redefine the class, so we just need to clean up whether there // was an error or not (don't want to modify any system dictionary // data structures). @@ -1013,11 +1018,17 @@ ClassFileStream* st, TRAPS) { - // Make sure we are synchronized on the class loader before we initiate - // loading. + // Classloaders that support parallelism, e.g. bootstrap classloader, + // or all classloaders with UnsyncloadClass do not acquire lock here + bool DoObjectLock = true; + if (is_parallelCapable(class_loader)) { + DoObjectLock = false; + } + + // Make sure we are synchronized on the class loader before we proceed Handle lockObject = compute_loader_lock_object(class_loader, THREAD); check_loader_lock_contention(lockObject, THREAD); - ObjectLocker ol(lockObject, THREAD); + ObjectLocker ol(lockObject, THREAD, DoObjectLock); symbolHandle parsed_name; @@ -1069,7 +1080,13 @@ "external class name format used internally"); // Add class just loaded - define_instance_class(k, THREAD); + // If a class loader supports parallel classloading handle parallel define requests + // find_or_define_instance_class may return a different instanceKlass + if (is_parallelCapable(class_loader)) { + k = find_or_define_instance_class(class_name, class_loader, k, THREAD); + } else { + define_instance_class(k, THREAD); + } } // If parsing the class file or define_instance_class failed, we @@ -1299,7 +1316,7 @@ } #endif // KERNEL - // find_or_define_instance_class may return a different k + // find_or_define_instance_class may return a different instanceKlass if (!k.is_null()) { k = find_or_define_instance_class(class_name, class_loader, k, CHECK_(nh)); } @@ -1316,14 +1333,24 @@ KlassHandle spec_klass (THREAD, SystemDictionary::classloader_klass()); - // UnsyncloadClass option means don't synchronize loadClass() calls. - // loadClassInternal() is synchronized and public loadClass(String) is not. - // This flag is for diagnostic purposes only. It is risky to call + // Call public unsynchronized loadClass(String) directly for all class loaders + // for parallelCapable class loaders. JDK >=7, loadClass(String, boolean) will + // acquire a class-name based lock rather than the class loader object lock. + // JDK < 7 already acquire the class loader lock in loadClass(String, boolean), + // so the call to loadClassInternal() was not required. + // + // UnsyncloadClass flag means both call loadClass(String) and do + // not acquire the class loader lock even for class loaders that are + // not parallelCapable. This was a risky transitional + // flag for diagnostic purposes only. It is risky to call // custom class loaders without synchronization. // WARNING If a custom class loader does NOT synchronizer findClass, or callers of - // findClass, this flag risks unexpected timing bugs in the field. + // findClass, the UnsyncloadClass flag risks unexpected timing bugs in the field. // Do NOT assume this will be supported in future releases. - if (!UnsyncloadClass && has_loadClassInternal()) { + // + // Added MustCallLoadClassInternal in case we discover in the field + // a customer that counts on this call + if (MustCallLoadClassInternal && has_loadClassInternal()) { JavaCalls::call_special(&result, class_loader, spec_klass, @@ -1365,14 +1392,17 @@ Handle class_loader_h(THREAD, k->class_loader()); - // for bootstrap classloader don't acquire lock - if (!class_loader_h.is_null()) { + // for bootstrap and other parallel classloaders don't acquire lock, + // use placeholder token + // If a parallelCapable class loader calls define_instance_class instead of + // find_or_define_instance_class to get here, we have a timing + // hole with systemDictionary updates and check_constraints + if (!class_loader_h.is_null() && !is_parallelCapable(class_loader_h)) { assert(ObjectSynchronizer::current_thread_holds_lock((JavaThread*)THREAD, compute_loader_lock_object(class_loader_h, THREAD)), "define called without lock"); } - // Check class-loading constraints. Throw exception if violation is detected. // Grabs and releases SystemDictionary_lock // The check_constraints/find_class call and update_dictionary sequence @@ -1427,59 +1457,63 @@ // Support parallel classloading // Initial implementation for bootstrap classloader -// For future: // For custom class loaders that support parallel classloading, -// in case they do not synchronize around -// FindLoadedClass/DefineClass calls, we check for parallel +// With AllowParallelDefine flag==true, in case they do not synchronize around +// FindLoadedClass/DefineClass, calls, we check for parallel // loading for them, wait if a defineClass is in progress // and return the initial requestor's results +// With AllowParallelDefine flag==false, call through to define_instance_class +// which will throw LinkageError: duplicate class definition. // For better performance, the class loaders should synchronize -// findClass(), i.e. FindLoadedClass/DefineClass or they +// findClass(), i.e. FindLoadedClass/DefineClassIfAbsent or they // potentially waste time reading and parsing the bytestream. // Note: VM callers should ensure consistency of k/class_name,class_loader instanceKlassHandle SystemDictionary::find_or_define_instance_class(symbolHandle class_name, Handle class_loader, instanceKlassHandle k, TRAPS) { instanceKlassHandle nh = instanceKlassHandle(); // null Handle + symbolHandle name_h(THREAD, k->name()); // passed in class_name may be null - unsigned int d_hash = dictionary()->compute_hash(class_name, class_loader); + unsigned int d_hash = dictionary()->compute_hash(name_h, class_loader); int d_index = dictionary()->hash_to_index(d_hash); // Hold SD lock around find_class and placeholder creation for DEFINE_CLASS - unsigned int p_hash = placeholders()->compute_hash(class_name, class_loader); + unsigned int p_hash = placeholders()->compute_hash(name_h, class_loader); int p_index = placeholders()->hash_to_index(p_hash); PlaceholderEntry* probe; { MutexLocker mu(SystemDictionary_lock, THREAD); // First check if class already defined - klassOop check = find_class(d_index, d_hash, class_name, class_loader); + klassOop check = find_class(d_index, d_hash, name_h, class_loader); if (check != NULL) { return(instanceKlassHandle(THREAD, check)); } // Acquire define token for this class/classloader symbolHandle nullsymbolHandle; - probe = placeholders()->find_and_add(p_index, p_hash, class_name, class_loader, PlaceholderTable::DEFINE_CLASS, nullsymbolHandle, THREAD); - // Check if another thread defining in parallel - if (probe->definer() == NULL) { - // Thread will define the class - probe->set_definer(THREAD); + probe = placeholders()->find_and_add(p_index, p_hash, name_h, class_loader, PlaceholderTable::DEFINE_CLASS, nullsymbolHandle, THREAD); + // Wait if another thread defining in parallel + // All threads wait - even those that will throw duplicate class: otherwise + // caller is surprised by LinkageError: duplicate, but findLoadedClass fails + // if other thread has not finished updating dictionary + while (probe->definer() != NULL) { + SystemDictionary_lock->wait(); + } + // Only special cases allow parallel defines and can use other thread's results + // Other cases fall through, and may run into duplicate defines + // caught by finding an entry in the SystemDictionary + if ((UnsyncloadClass || AllowParallelDefineClass) && (probe->instanceKlass() != NULL)) { + probe->remove_seen_thread(THREAD, PlaceholderTable::DEFINE_CLASS); + placeholders()->find_and_remove(p_index, p_hash, name_h, class_loader, THREAD); + SystemDictionary_lock->notify_all(); +#ifdef ASSERT + klassOop check = find_class(d_index, d_hash, name_h, class_loader); + assert(check != NULL, "definer missed recording success"); +#endif + return(instanceKlassHandle(THREAD, probe->instanceKlass())); } else { - // Wait for defining thread to finish and return results - while (probe->definer() != NULL) { - SystemDictionary_lock->wait(); - } - if (probe->instanceKlass() != NULL) { - probe->remove_seen_thread(THREAD, PlaceholderTable::DEFINE_CLASS); - return(instanceKlassHandle(THREAD, probe->instanceKlass())); - } else { - // If definer had an error, try again as any new thread would - probe->set_definer(THREAD); -#ifdef ASSERT - klassOop check = find_class(d_index, d_hash, class_name, class_loader); - assert(check == NULL, "definer missed recording success"); -#endif - } + // This thread will define the class (even if earlier thread tried and had an error) + probe->set_definer(THREAD); } } @@ -1490,7 +1524,7 @@ // definer must notify any waiting threads { MutexLocker mu(SystemDictionary_lock, THREAD); - PlaceholderEntry* probe = placeholders()->get_entry(p_index, p_hash, class_name, class_loader); + PlaceholderEntry* probe = placeholders()->get_entry(p_index, p_hash, name_h, class_loader); assert(probe != NULL, "DEFINE_CLASS placeholder lost?"); if (probe != NULL) { if (HAS_PENDING_EXCEPTION) { @@ -1501,6 +1535,7 @@ } probe->set_definer(NULL); probe->remove_seen_thread(THREAD, PlaceholderTable::DEFINE_CLASS); + placeholders()->find_and_remove(p_index, p_hash, name_h, class_loader, THREAD); SystemDictionary_lock->notify_all(); } } @@ -1512,7 +1547,6 @@ return k; } - Handle SystemDictionary::compute_loader_lock_object(Handle class_loader, TRAPS) { // If class_loader is NULL we synchronize on _system_loader_lock_obj if (class_loader.is_null()) { @@ -1902,11 +1936,11 @@ warning("Cannot find sun/jkernel/DownloadManager"); } #endif // KERNEL + { // Compute whether we should use loadClass or loadClassInternal when loading classes. methodOop method = instanceKlass::cast(classloader_klass())->find_method(vmSymbols::loadClassInternal_name(), vmSymbols::string_class_signature()); _has_loadClassInternal = (method != NULL); } - { // Compute whether we should use checkPackageAccess or NOT methodOop method = instanceKlass::cast(classloader_klass())->find_method(vmSymbols::checkPackageAccess_name(), vmSymbols::class_protectiondomain_signature()); _has_checkPackageAccess = (method != NULL); diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/classfile/systemDictionary.hpp --- a/src/share/vm/classfile/systemDictionary.hpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/classfile/systemDictionary.hpp Fri Jan 09 14:39:07 2009 -0500 @@ -526,6 +526,7 @@ static instanceKlassHandle load_instance_class(symbolHandle class_name, Handle class_loader, TRAPS); static Handle compute_loader_lock_object(Handle class_loader, TRAPS); static void check_loader_lock_contention(Handle loader_lock, TRAPS); + static bool is_parallelCapable(Handle class_loader); static klassOop find_shared_class(symbolHandle class_name); diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/classfile/vmSymbols.hpp --- a/src/share/vm/classfile/vmSymbols.hpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/classfile/vmSymbols.hpp Fri Jan 09 14:39:07 2009 -0500 @@ -362,6 +362,7 @@ template(class_signature, "Ljava/lang/Class;") \ template(string_signature, "Ljava/lang/String;") \ template(reference_signature, "Ljava/lang/ref/Reference;") \ + template(concurrenthashmap_signature, "Ljava/util/concurrent/ConcurrentHashMap;") \ /* signature symbols needed by intrinsics */ \ VM_INTRINSICS_DO(VM_INTRINSIC_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, template, VM_ALIAS_IGNORE) \ \ @@ -374,6 +375,9 @@ /* used by ClassFormatError when class name is not known yet */ \ template(unknown_class_name, "") \ \ + /* used to identify class loaders handling parallel class loading */ \ + template(parallelCapable_name, "parallelLockMap;") \ + \ /* JVM monitoring and management support */ \ template(java_lang_StackTraceElement_array, "[Ljava/lang/StackTraceElement;") \ template(java_lang_management_ThreadState, "java/lang/management/ThreadState") \ diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/libadt/port.hpp --- a/src/share/vm/libadt/port.hpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/libadt/port.hpp Fri Jan 09 14:39:07 2009 -0500 @@ -34,17 +34,6 @@ #include #include #include -#undef bzero -inline void bzero(void *b, int len) { memset(b,0,len); } -#undef bcopy -inline void bcopy(const void *s, void *d, size_t len) { memmove(d,s,len); } -#undef bcmp -inline int bcmp(const void *s,const void *t,int len) { return memcmp(s,t,len);} -extern "C" unsigned long strtoul(const char *s, char **end, int base); - -// Definition for sys_errlist varies from Sun 4.1 & Solaris. -// We use the new Solaris definition. -#include // Access to the C++ class virtual function pointer // Put the class in the macro diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/oops/constantPoolOop.cpp --- a/src/share/vm/oops/constantPoolOop.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/oops/constantPoolOop.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -962,7 +962,7 @@ } case JVM_CONSTANT_Long: { u8 val = Bytes::get_Java_u8(bytes); - printf("long %lldl", *(jlong *) &val); + printf("long "INT64_FORMAT, *(jlong *) &val); ent_size = 8; idx++; // Long takes two cpool slots break; diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/oops/oopsHierarchy.hpp --- a/src/share/vm/oops/oopsHierarchy.hpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/oops/oopsHierarchy.hpp Fri Jan 09 14:39:07 2009 -0500 @@ -126,8 +126,11 @@ operator jobject () const { return (jobject)obj(); } // from javaClasses.cpp operator JavaThread* () const { return (JavaThread*)obj(); } + +#ifndef _LP64 // from jvm.cpp operator jlong* () const { return (jlong*)obj(); } +#endif // from parNewGeneration and other things that want to get to the end of // an oop for stuff (like constMethodKlass.cpp, objArrayKlass.cpp) diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/opto/idealGraphPrinter.cpp --- a/src/share/vm/opto/idealGraphPrinter.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/opto/idealGraphPrinter.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -557,7 +557,7 @@ // max. 2 chars allowed if (value >= -9 && value <= 99) { - sprintf(buffer, "%d", value); + sprintf(buffer, INT64_FORMAT, value); print_prop(short_name, buffer); } else { print_prop(short_name, "L"); diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/prims/jvm.cpp --- a/src/share/vm/prims/jvm.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/prims/jvm.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -2475,7 +2475,8 @@ if (Arguments::vfprintf_hook() != NULL) { jio_fprintf(defaultStream::output_stream(), "%s", s); } else { - ::write(defaultStream::output_fd(), s, (int)strlen(s)); + // Make an unused local variable to avoid warning from gcc 4.x compiler. + size_t count = ::write(defaultStream::output_fd(), s, (int)strlen(s)); } } diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/runtime/arguments.cpp --- a/src/share/vm/runtime/arguments.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/runtime/arguments.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -1361,7 +1361,7 @@ // Feed the cache size setting into the JDK char buffer[1024]; - sprintf(buffer, "java.lang.Integer.IntegerCache.high=%d", AutoBoxCacheMax); + sprintf(buffer, "java.lang.Integer.IntegerCache.high=" INTX_FORMAT, AutoBoxCacheMax); add_property(buffer); } if (AggressiveOpts && FLAG_IS_DEFAULT(DoEscapeAnalysis)) { diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/runtime/globals.hpp --- a/src/share/vm/runtime/globals.hpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/runtime/globals.hpp Fri Jan 09 14:39:07 2009 -0500 @@ -835,8 +835,21 @@ "Prints the system dictionary at exit") \ \ diagnostic(bool, UnsyncloadClass, false, \ - "Unstable: VM calls loadClass unsynchronized. Custom classloader "\ - "must call VM synchronized for findClass & defineClass") \ + "Unstable: VM calls loadClass unsynchronized. Custom " \ + "class loader must call VM synchronized for findClass " \ + "and defineClass.") \ + \ + product(bool, AlwaysLockClassLoader, false, \ + "Require the VM to acquire the class loader lock before calling " \ + "loadClass() even for class loaders registering " \ + "as parallel capable. Default false. ") \ + \ + product(bool, AllowParallelDefineClass, false, \ + "Allow parallel defineClass requests for class loaders " \ + "registering as parallel capable. Default false") \ + \ + product(bool, MustCallLoadClassInternal, false, \ + "Call loadClassInternal() rather than loadClass().Default false") \ \ product_pd(bool, DontYieldALot, \ "Throw away obvious excess yield calls (for SOLARIS only)") \ diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/runtime/memprofiler.cpp --- a/src/share/vm/runtime/memprofiler.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/runtime/memprofiler.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -104,21 +104,22 @@ } // Print trace line in log - fprintf(_log_fp, "%6.1f,%5d,%5d,%6ld,%6ld,%6ld,%6ld,", - os::elapsedTime(), - Threads::number_of_threads(), - SystemDictionary::number_of_classes(), - Universe::heap()->used() / K, - Universe::heap()->capacity() / K, - Universe::heap()->permanent_used() / HWperKB, - Universe::heap()->permanent_capacity() / HWperKB); + fprintf(_log_fp, "%6.1f,%5d,%5d," UINTX_FORMAT_W(6) "," UINTX_FORMAT_W(6) "," + UINTX_FORMAT_W(6) "," UINTX_FORMAT_W(6) ",", + os::elapsedTime(), + Threads::number_of_threads(), + SystemDictionary::number_of_classes(), + Universe::heap()->used() / K, + Universe::heap()->capacity() / K, + Universe::heap()->permanent_used() / HWperKB, + Universe::heap()->permanent_capacity() / HWperKB); - fprintf(_log_fp, "%6ld,", CodeCache::capacity() / K); + fprintf(_log_fp, UINTX_FORMAT_W(6) ",", CodeCache::capacity() / K); - fprintf(_log_fp, "%6ld,%6ld,%6ld\n", - handles_memory_usage / K, - resource_memory_usage / K, - OopMapCache::memory_usage() / K); + fprintf(_log_fp, UINTX_FORMAT_W(6) "," UINTX_FORMAT_W(6) ",%6ld\n", + handles_memory_usage / K, + resource_memory_usage / K, + OopMapCache::memory_usage() / K); fflush(_log_fp); } diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/runtime/safepoint.cpp --- a/src/share/vm/runtime/safepoint.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/runtime/safepoint.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -730,7 +730,7 @@ if (DieOnSafepointTimeout) { char msg[1024]; VM_Operation *op = VMThread::vm_operation(); - sprintf(msg, "Safepoint sync time longer than %d ms detected when executing %s.", + sprintf(msg, "Safepoint sync time longer than " INTX_FORMAT "ms detected when executing %s.", SafepointTimeoutDelay, op != NULL ? op->name() : "no vm operation"); fatal(msg); diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/runtime/synchronizer.cpp --- a/src/share/vm/runtime/synchronizer.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/runtime/synchronizer.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -424,7 +424,7 @@ // asserts is that error message -- often something about negative array // indices -- is opaque. -#define CTASSERT(x) { int tag[1-(2*!(x))]; printf ("Tag @%X\n", tag); } +#define CTASSERT(x) { int tag[1-(2*!(x))]; printf ("Tag @" INTPTR_FORMAT "\n", (intptr_t)tag); } void ObjectMonitor::ctAsserts() { CTASSERT(offset_of (ObjectMonitor, _header) == 0); diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/utilities/globalDefinitions.hpp --- a/src/share/vm/utilities/globalDefinitions.hpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/utilities/globalDefinitions.hpp Fri Jan 09 14:39:07 2009 -0500 @@ -1087,15 +1087,24 @@ // Format macros that allow the field width to be specified. The width must be // a string literal (e.g., "8") or a macro that evaluates to one. #ifdef _LP64 +#define UINTX_FORMAT_W(width) UINT64_FORMAT_W(width) #define SSIZE_FORMAT_W(width) INT64_FORMAT_W(width) #define SIZE_FORMAT_W(width) UINT64_FORMAT_W(width) #else +#define UINTX_FORMAT_W(width) UINT32_FORMAT_W(width) #define SSIZE_FORMAT_W(width) INT32_FORMAT_W(width) #define SIZE_FORMAT_W(width) UINT32_FORMAT_W(width) #endif // _LP64 // Format pointers and size_t (or size_t-like integer types) which change size -// between 32- and 64-bit. +// between 32- and 64-bit. The pointer format theoretically should be "%p", +// however, it has different output on different platforms. On Windows, the data +// will be padded with zeros automatically. On Solaris, we can use "%016p" & +// "%08p" on 64 bit & 32 bit platforms to make the data padded with extra zeros. +// On Linux, "%016p" or "%08p" is not be allowed, at least on the latest GCC +// 4.3.2. So we have to use "%016x" or "%08x" to simulate the printing format. +// GCC 4.3.2, however requires the data to be converted to "intptr_t" when +// using "%x". #ifdef _LP64 #define PTR_FORMAT PTR64_FORMAT #define UINTX_FORMAT UINT64_FORMAT diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/utilities/globalDefinitions_gcc.hpp --- a/src/share/vm/utilities/globalDefinitions_gcc.hpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/utilities/globalDefinitions_gcc.hpp Fri Jan 09 14:39:07 2009 -0500 @@ -116,7 +116,9 @@ #ifdef _LP64 #define NULL_WORD 0L #else - #define NULL_WORD 0 + // Cast 0 to intptr_t rather than int32_t since they are not the same type + // on platforms such as Mac OS X. + #define NULL_WORD ((intptr_t)0) #endif #else #define NULL_WORD NULL diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/utilities/globalDefinitions_sparcWorks.hpp --- a/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp Fri Jan 09 14:39:07 2009 -0500 @@ -115,7 +115,9 @@ #ifdef _LP64 #define NULL_WORD 0L #else - #define NULL_WORD 0 + // Cast 0 to intptr_t rather than int32_t since they are not the same type + // on some platforms. + #define NULL_WORD ((intptr_t)0) #endif #else #define NULL_WORD NULL diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/utilities/ostream.cpp --- a/src/share/vm/utilities/ostream.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/utilities/ostream.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -300,7 +300,10 @@ } void fileStream::write(const char* s, size_t len) { - if (_file != NULL) fwrite(s, 1, len, _file); + if (_file != NULL) { + // Make an unused local variable to avoid warning from gcc 4.x compiler. + size_t count = fwrite(s, 1, len, _file); + } update_position(s, len); } @@ -328,7 +331,10 @@ } void fdStream::write(const char* s, size_t len) { - if (_fd != -1) ::write(_fd, s, (int)len); + if (_fd != -1) { + // Make an unused local variable to avoid warning from gcc 4.x compiler. + size_t count = ::write(_fd, s, (int)len); + } update_position(s, len); } diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/utilities/vmError.cpp --- a/src/share/vm/utilities/vmError.cpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/utilities/vmError.cpp Fri Jan 09 14:39:07 2009 -0500 @@ -674,6 +674,11 @@ reset_signal_handlers(); } else { + // If UseOsErrorReporting we call this for each level of the call stack + // while searching for the exception handler. Only the first level needs + // to be reported. + if (UseOSErrorReporting && log_done) return; + // This is not the first error, see if it happened in a different thread // or in the same thread during error reporting. if (first_error_tid != mytid) { diff -r 1a767c61ad01 -r fc7ab6287598 src/share/vm/utilities/vmError.hpp --- a/src/share/vm/utilities/vmError.hpp Tue Jan 06 16:10:11 2009 -0800 +++ b/src/share/vm/utilities/vmError.hpp Fri Jan 09 14:39:07 2009 -0500 @@ -50,7 +50,7 @@ // additional info for VM internal errors const char * _filename; - int _lineno; + size_t _lineno; // used by fatal error handler int _current_step;