Mercurial > hg > release > icedtea7-2.2
changeset 2252:254a1f83b7da
Fix PR icedtea/484: Method still in use can be marked as a zombie
2010-05-14 Gary Benson <gbenson@redhat.com>
PR icedtea/484
* ports/hotspot/src/share/vm/shark/sharkBuilder.hpp
(SharkBuilder::deoptimized_entry_point): New method.
* ports/hotspot/src/share/vm/shark/sharkBuilder.hpp
(SharkBuilder::uncommon_trap): Return int instead of void.
(SharkBuilder::deoptimized_entry_point): New method.
* ports/hotspot/src/share/vm/shark/sharkContext.cpp
(SharkContext::SharkContext): Updated entry point types.
* ports/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp
(SharkNativeWrapper::initialize): Make generated wrappers
return 0 instead of void.
* ports/hotspot/src/share/vm/shark/sharkRuntime.cpp
(SharkRuntime::uncommon_trap): Return int instead of void.
* ports/hotspot/src/share/vm/shark/sharkRuntime.cpp
(SharkRuntime::uncommon_trap): Don't enter the interpreter,
just return the number of frames that have been deoptimized.
* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
(SharkTopLevelBlock::do_trap): Return the number of deoptimized
frames instead of void.
(SharkTopLevelBlock::handle_return): Return 0 instead of void.
(SharkTopLevelBlock::do_call): Deoptimize where necessary.
author | Gary Benson <gbenson@redhat.com> |
---|---|
date | Fri, 14 May 2010 13:55:26 +0100 |
parents | 86213d4d475a |
children | 494ed9fb8215 |
files | ChangeLog ports/hotspot/src/share/vm/shark/sharkBuilder.cpp ports/hotspot/src/share/vm/shark/sharkBuilder.hpp ports/hotspot/src/share/vm/shark/sharkContext.cpp ports/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp ports/hotspot/src/share/vm/shark/sharkRuntime.cpp ports/hotspot/src/share/vm/shark/sharkRuntime.hpp ports/hotspot/src/share/vm/shark/sharkStack.cpp ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp |
diffstat | 9 files changed, 71 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri May 07 10:49:34 2010 +0100 +++ b/ChangeLog Fri May 14 13:55:26 2010 +0100 @@ -1,3 +1,27 @@ +2010-05-14 Gary Benson <gbenson@redhat.com> + + PR icedtea/484 + * ports/hotspot/src/share/vm/shark/sharkBuilder.hpp + (SharkBuilder::deoptimized_entry_point): New method. + * ports/hotspot/src/share/vm/shark/sharkBuilder.hpp + (SharkBuilder::uncommon_trap): Return int instead of void. + (SharkBuilder::deoptimized_entry_point): New method. + * ports/hotspot/src/share/vm/shark/sharkContext.cpp + (SharkContext::SharkContext): Updated entry point types. + * ports/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp + (SharkNativeWrapper::initialize): Make generated wrappers + return 0 instead of void. + * ports/hotspot/src/share/vm/shark/sharkRuntime.cpp + (SharkRuntime::uncommon_trap): Return int instead of void. + * ports/hotspot/src/share/vm/shark/sharkRuntime.cpp + (SharkRuntime::uncommon_trap): Don't enter the interpreter, + just return the number of frames that have been deoptimized. + * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp + (SharkTopLevelBlock::do_trap): Return the number of deoptimized + frames instead of void. + (SharkTopLevelBlock::handle_return): Return 0 instead of void. + (SharkTopLevelBlock::do_call): Deoptimize where necessary. + 2010-05-13 Gary Benson <gbenson@redhat.com> PR icedtea/483
--- a/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Fri May 07 10:49:34 2010 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Fri May 14 13:55:26 2010 +0100 @@ -326,7 +326,11 @@ } Value* SharkBuilder::uncommon_trap() { - return make_function((address) SharkRuntime::uncommon_trap, "Ti", "v"); + return make_function((address) SharkRuntime::uncommon_trap, "Ti", "i"); +} + +Value* SharkBuilder::deoptimized_entry_point() { + return make_function((address) CppInterpreter::main_loop, "iT", "v"); } // Native-Java transition
--- a/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp Fri May 07 10:49:34 2010 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp Fri May 14 13:55:26 2010 +0100 @@ -133,6 +133,7 @@ public: llvm::Value* throw_StackOverflowError(); llvm::Value* uncommon_trap(); + llvm::Value* deoptimized_entry_point(); // Intrinsics and external functions, part 4: Native-Java transition. // This is a special case in that it is invoked during a thread
--- a/ports/hotspot/src/share/vm/shark/sharkContext.cpp Fri May 07 10:49:34 2010 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkContext.cpp Fri May 14 13:55:26 2010 +0100 @@ -1,6 +1,6 @@ /* * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. - * Copyright 2009 Red Hat, Inc. + * Copyright 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -76,14 +76,14 @@ params.push_back(methodOop_type()); params.push_back(intptr_type()); params.push_back(thread_type()); - _entry_point_type = FunctionType::get(void_type(), params, false); + _entry_point_type = FunctionType::get(jint_type(), params, false); params.clear(); params.push_back(methodOop_type()); params.push_back(PointerType::getUnqual(jbyte_type())); params.push_back(intptr_type()); params.push_back(thread_type()); - _osr_entry_point_type = FunctionType::get(void_type(), params, false); + _osr_entry_point_type = FunctionType::get(jint_type(), params, false); // Create mappings for (int i = 0; i < T_CONFLICT; i++) {
--- a/ports/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp Fri May 07 10:49:34 2010 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp Fri May 14 13:55:26 2010 +0100 @@ -283,7 +283,7 @@ builder()->SetInsertPoint(exception); CreateResetHandleBlock(); stack()->CreatePopFrame(0); - builder()->CreateRetVoid(); + builder()->CreateRet(LLVMValue::jint_constant(0)); builder()->SetInsertPoint(no_exception); @@ -348,5 +348,5 @@ result_addr, PointerType::getUnqual(SharkType::to_stackType(result_type)))); } - builder()->CreateRetVoid(); + builder()->CreateRet(LLVMValue::jint_constant(0)); }
--- a/ports/hotspot/src/share/vm/shark/sharkRuntime.cpp Fri May 07 10:49:34 2010 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkRuntime.cpp Fri May 14 13:55:26 2010 +0100 @@ -192,14 +192,14 @@ return object_klass->klass_part()->is_subtype_of(check_klass); } -void SharkRuntime::uncommon_trap(JavaThread* thread, int trap_request) { +int SharkRuntime::uncommon_trap(JavaThread* thread, int trap_request) { + Thread *THREAD = thread; + // In C2, uncommon_trap_blob creates a frame, so all the various // deoptimization functions expect to find the frame of the method // being deopted one frame down on the stack. We create a dummy // frame to mirror this. - FakeStubFrame *stubframe = FakeStubFrame::build(thread); - if (thread->has_pending_exception()) - return; + FakeStubFrame *stubframe = FakeStubFrame::build(CHECK_0); thread->push_zero_frame(stubframe); // Initiate the trap @@ -216,16 +216,12 @@ int number_of_frames = urb->number_of_frames(); for (int i = 0; i < number_of_frames; i++) { intptr_t size = urb->frame_sizes()[i]; - InterpreterFrame *frame = InterpreterFrame::build(size, thread); - if (thread->has_pending_exception()) - return; + InterpreterFrame *frame = InterpreterFrame::build(size, CHECK_0); thread->push_zero_frame(frame); } // Push another dummy frame - stubframe = FakeStubFrame::build(thread); - if (thread->has_pending_exception()) - return; + stubframe = FakeStubFrame::build(CHECK_0); thread->push_zero_frame(stubframe); // Fill in the skeleton frames @@ -236,12 +232,8 @@ // Pop our dummy frame thread->pop_zero_frame(); - // Jump into the interpreter -#ifdef CC_INTERP - CppInterpreter::main_loop(number_of_frames - 1, thread); -#else - Unimplemented(); -#endif // CC_INTERP + // Fall back into the interpreter + return number_of_frames; } FakeStubFrame* FakeStubFrame::build(TRAPS) {
--- a/ports/hotspot/src/share/vm/shark/sharkRuntime.hpp Fri May 07 10:49:34 2010 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkRuntime.hpp Fri May 14 13:55:26 2010 +0100 @@ -1,6 +1,6 @@ /* * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. - * Copyright 2008, 2009 Red Hat, Inc. + * Copyright 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -79,5 +79,5 @@ public: static void dump(const char *name, intptr_t value); static bool is_subtype_of(klassOop check_klass, klassOop object_klass); - static void uncommon_trap(JavaThread* thread, int trap_request); + static int uncommon_trap(JavaThread* thread, int trap_request); };
--- a/ports/hotspot/src/share/vm/shark/sharkStack.cpp Fri May 07 10:49:34 2010 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkStack.cpp Fri May 14 13:55:26 2010 +0100 @@ -135,7 +135,7 @@ // Handle overflows builder()->SetInsertPoint(overflow); builder()->CreateCall(builder()->throw_StackOverflowError(), thread()); - builder()->CreateRetVoid(); + builder()->CreateRet(LLVMValue::jint_constant(0)); builder()->SetInsertPoint(abi_ok); }
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp Fri May 07 10:49:34 2010 +0100 +++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp Fri May 14 13:55:26 2010 +0100 @@ -594,11 +594,11 @@ void SharkTopLevelBlock::do_trap(int trap_request) { decache_for_trap(); - builder()->CreateCall2( - builder()->uncommon_trap(), - thread(), - LLVMValue::jint_constant(trap_request)); - builder()->CreateRetVoid(); + builder()->CreateRet( + builder()->CreateCall2( + builder()->uncommon_trap(), + thread(), + LLVMValue::jint_constant(trap_request))); } void SharkTopLevelBlock::call_register_finalizer(Value *receiver) { @@ -677,7 +677,7 @@ PointerType::getUnqual(SharkType::to_stackType(type)))); } - builder()->CreateRetVoid(); + builder()->CreateRet(LLVMValue::jint_constant(0)); } void SharkTopLevelBlock::do_arraylength() { @@ -1203,7 +1203,25 @@ // Make the call decache_for_Java_call(call_method); - builder()->CreateCall3(entry_point, callee, base_pc, thread()); + Value *deoptimized_frames = builder()->CreateCall3( + entry_point, callee, base_pc, thread()); + + // If the callee got deoptimized then reexecute in the interpreter + BasicBlock *reexecute = function()->CreateBlock("reexecute"); + BasicBlock *call_completed = function()->CreateBlock("call_completed"); + builder()->CreateCondBr( + builder()->CreateICmpNE(deoptimized_frames, LLVMValue::jint_constant(0)), + reexecute, call_completed); + + builder()->SetInsertPoint(reexecute); + builder()->CreateCall2( + builder()->deoptimized_entry_point(), + builder()->CreateSub(deoptimized_frames, LLVMValue::jint_constant(1)), + thread()); + builder()->CreateBr(call_completed); + + // Cache after the call + builder()->SetInsertPoint(call_completed); cache_after_Java_call(call_method); // Check for pending exceptions