This commit is contained in:
Karen Kinnear 2010-03-26 11:10:26 -04:00
commit 7aaaad73cf
241 changed files with 6074 additions and 1483 deletions

View file

@ -1346,9 +1346,7 @@ void Arguments::set_g1_gc_flags() {
}
if (FLAG_IS_DEFAULT(MarkStackSize)) {
// Size as a multiple of TaskQueueSuper::N which is larger
// for 64-bit.
FLAG_SET_DEFAULT(MarkStackSize, 128 * TaskQueueSuper::total_size());
FLAG_SET_DEFAULT(MarkStackSize, 128 * TASKQUEUE_SIZE);
}
if (PrintGCDetails && Verbose) {
tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk",
@ -2859,6 +2857,12 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
}
#endif // _LP64
// MethodHandles code does not support TaggedStackInterpreter.
if (EnableMethodHandles && TaggedStackInterpreter) {
warning("TaggedStackInterpreter is not supported by MethodHandles code. Disabling TaggedStackInterpreter.");
TaggedStackInterpreter = false;
}
// Check the GC selections again.
if (!check_gc_consistency()) {
return JNI_EINVAL;

View file

@ -1795,6 +1795,10 @@ class CommandLineFlags {
product(uintx, PreserveMarkStackSize, 1024, \
"Size for stack used in promotion failure handling") \
\
develop(uintx, ObjArrayMarkingStride, 512, \
"Number of ObjArray elements to push onto the marking stack" \
"before pushing a continuation entry") \
\
product_pd(bool, UseTLAB, "Use thread-local object allocation") \
\
product_pd(bool, ResizeTLAB, \

View file

@ -1,5 +1,5 @@
/*
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -118,6 +118,9 @@ jint init_globals() {
javaClasses_init(); // must happen after vtable initialization
stubRoutines_init2(); // note: StubRoutines need 2-phase init
// Generate MethodHandles adapters.
MethodHandles::generate_adapters();
// Although we'd like to, we can't easily do a heap verify
// here because the main thread isn't yet a JavaThread, so
// its TLAB may not be made parseable from the usual interfaces.

View file

@ -256,7 +256,7 @@ JRT_END
// The continuation address is the entry point of the exception handler of the
// previous frame depending on the return address.
address SharedRuntime::raw_exception_handler_for_return_address(address return_address) {
address SharedRuntime::raw_exception_handler_for_return_address(JavaThread* thread, address return_address) {
assert(frame::verify_return_pc(return_address), "must be a return pc");
// the fastest case first
@ -264,6 +264,8 @@ address SharedRuntime::raw_exception_handler_for_return_address(address return_a
if (blob != NULL && blob->is_nmethod()) {
nmethod* code = (nmethod*)blob;
assert(code != NULL, "nmethod must be present");
// Check if the return address is a MethodHandle call site.
thread->set_is_method_handle_exception(code->is_method_handle_return(return_address));
// native nmethods don't have exception handlers
assert(!code->is_native_method(), "no exception handler");
assert(code->header_begin() != code->exception_begin(), "no exception handler");
@ -289,6 +291,8 @@ address SharedRuntime::raw_exception_handler_for_return_address(address return_a
if (blob->is_nmethod()) {
nmethod* code = (nmethod*)blob;
assert(code != NULL, "nmethod must be present");
// Check if the return address is a MethodHandle call site.
thread->set_is_method_handle_exception(code->is_method_handle_return(return_address));
assert(code->header_begin() != code->exception_begin(), "no exception handler");
return code->exception_begin();
}
@ -309,10 +313,11 @@ address SharedRuntime::raw_exception_handler_for_return_address(address return_a
}
JRT_LEAF(address, SharedRuntime::exception_handler_for_return_address(address return_address))
return raw_exception_handler_for_return_address(return_address);
JRT_LEAF(address, SharedRuntime::exception_handler_for_return_address(JavaThread* thread, address return_address))
return raw_exception_handler_for_return_address(thread, return_address);
JRT_END
address SharedRuntime::get_poll_stub(address pc) {
address stub;
// Look up the code blob
@ -465,16 +470,6 @@ address SharedRuntime::compute_compiled_exc_handler(nmethod* nm, address ret_pc,
t = table.entry_for(catch_pco, -1, 0);
}
#ifdef COMPILER1
if (nm->is_compiled_by_c1() && t == NULL && handler_bci == -1) {
// Exception is not handled by this frame so unwind. Note that
// this is not the same as how C2 does this. C2 emits a table
// entry that dispatches to the unwind code in the nmethod.
return NULL;
}
#endif /* COMPILER1 */
if (t == NULL) {
tty->print_cr("MISSING EXCEPTION HANDLER for pc " INTPTR_FORMAT " and handler bci %d", ret_pc, handler_bci);
tty->print_cr(" Exception:");
@ -587,7 +582,7 @@ address SharedRuntime::continuation_for_implicit_exception(JavaThread* thread,
// 3. Implict null exception in nmethod
if (!cb->is_nmethod()) {
guarantee(cb->is_adapter_blob(),
guarantee(cb->is_adapter_blob() || cb->is_method_handles_adapter_blob(),
"exception happened outside interpreter, nmethods and vtable stubs (1)");
// There is no handler here, so we will simply unwind.
return StubRoutines::throw_NullPointerException_at_call_entry();
@ -892,12 +887,13 @@ methodHandle SharedRuntime::resolve_sub_helper(JavaThread *thread,
RegisterMap cbl_map(thread, false);
frame caller_frame = thread->last_frame().sender(&cbl_map);
CodeBlob* cb = caller_frame.cb();
guarantee(cb != NULL && cb->is_nmethod(), "must be called from nmethod");
CodeBlob* caller_cb = caller_frame.cb();
guarantee(caller_cb != NULL && caller_cb->is_nmethod(), "must be called from nmethod");
nmethod* caller_nm = caller_cb->as_nmethod_or_null();
// make sure caller is not getting deoptimized
// and removed before we are done with it.
// CLEANUP - with lazy deopt shouldn't need this lock
nmethodLocker caller_lock((nmethod*)cb);
nmethodLocker caller_lock(caller_nm);
// determine call info & receiver
@ -929,6 +925,13 @@ methodHandle SharedRuntime::resolve_sub_helper(JavaThread *thread,
}
#endif
// JSR 292
// If the resolved method is a MethodHandle invoke target the call
// site must be a MethodHandle call site.
if (callee_method->is_method_handle_invoke()) {
assert(caller_nm->is_method_handle_return(caller_frame.pc()), "must be MH call site");
}
// Compute entry points. This might require generation of C2I converter
// frames, so we cannot be holding any locks here. Furthermore, the
// computation of the entry points is independent of patching the call. We
@ -940,13 +943,12 @@ methodHandle SharedRuntime::resolve_sub_helper(JavaThread *thread,
StaticCallInfo static_call_info;
CompiledICInfo virtual_call_info;
// Make sure the callee nmethod does not get deoptimized and removed before
// we are done patching the code.
nmethod* nm = callee_method->code();
nmethodLocker nl_callee(nm);
nmethod* callee_nm = callee_method->code();
nmethodLocker nl_callee(callee_nm);
#ifdef ASSERT
address dest_entry_point = nm == NULL ? 0 : nm->entry_point(); // used below
address dest_entry_point = callee_nm == NULL ? 0 : callee_nm->entry_point(); // used below
#endif
if (is_virtual) {
@ -2077,7 +2079,6 @@ class AdapterHandlerTableIterator : public StackObj {
// ---------------------------------------------------------------------------
// Implementation of AdapterHandlerLibrary
const char* AdapterHandlerEntry::name = "I2C/C2I adapters";
AdapterHandlerTable* AdapterHandlerLibrary::_adapters = NULL;
AdapterHandlerEntry* AdapterHandlerLibrary::_abstract_method_handler = NULL;
const int AdapterHandlerLibrary_size = 16*K;
@ -2129,7 +2130,7 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
ResourceMark rm;
NOT_PRODUCT(int code_size);
BufferBlob *B = NULL;
AdapterBlob* B = NULL;
AdapterHandlerEntry* entry = NULL;
AdapterFingerPrint* fingerprint = NULL;
{
@ -2179,7 +2180,7 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
// Create I2C & C2I handlers
BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache
BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache
if (buf != NULL) {
CodeBuffer buffer(buf->instructions_begin(), buf->instructions_size());
short buffer_locs[20];
@ -2208,7 +2209,7 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
}
#endif
B = BufferBlob::create(AdapterHandlerEntry::name, &buffer);
B = AdapterBlob::create(&buffer);
NOT_PRODUCT(code_size = buffer.code_size());
}
if (B == NULL) {
@ -2240,7 +2241,7 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
jio_snprintf(blob_id,
sizeof(blob_id),
"%s(%s)@" PTR_FORMAT,
AdapterHandlerEntry::name,
B->name(),
fingerprint->as_string(),
B->instructions_begin());
VTune::register_stub(blob_id, B->instructions_begin(), B->instructions_end());

View file

@ -96,10 +96,9 @@ class SharedRuntime: AllStatic {
static jdouble dexp(jdouble x);
static jdouble dpow(jdouble x, jdouble y);
// exception handling across interpreter/compiler boundaries
static address raw_exception_handler_for_return_address(address return_address);
static address exception_handler_for_return_address(address return_address);
static address raw_exception_handler_for_return_address(JavaThread* thread, address return_address);
static address exception_handler_for_return_address(JavaThread* thread, address return_address);
#ifndef SERIALGC
// G1 write barriers
@ -568,9 +567,6 @@ class AdapterHandlerEntry : public BasicHashtableEntry {
AdapterHandlerEntry();
public:
// The name we give all buffer blobs
static const char* name;
address get_i2c_entry() { return _i2c_entry; }
address get_c2i_entry() { return _c2i_entry; }
address get_c2i_unverified_entry() { return _c2i_unverified_entry; }

View file

@ -223,7 +223,7 @@ void vframeArrayElement::unpack_on_stack(int callee_parameters,
break;
case Deoptimization::Unpack_exception:
// exception is pending
pc = SharedRuntime::raw_exception_handler_for_return_address(pc);
pc = SharedRuntime::raw_exception_handler_for_return_address(thread, pc);
// [phh] We're going to end up in some handler or other, so it doesn't
// matter what mdp we point to. See exception_handler_for_exception()
// in interpreterRuntime.cpp.