提交 cc07855f 编写于 作者: N never

Merge

/* /*
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -1727,7 +1727,6 @@ void SystemDictionary::always_strong_classes_do(OopClosure* blk) { ...@@ -1727,7 +1727,6 @@ void SystemDictionary::always_strong_classes_do(OopClosure* blk) {
placeholders_do(blk); placeholders_do(blk);
// Visit extra methods // Visit extra methods
if (invoke_method_table() != NULL)
invoke_method_table()->oops_do(blk); invoke_method_table()->oops_do(blk);
// Loader constraints. We must keep the symbolOop used in the name alive. // Loader constraints. We must keep the symbolOop used in the name alive.
...@@ -1766,7 +1765,6 @@ void SystemDictionary::oops_do(OopClosure* f) { ...@@ -1766,7 +1765,6 @@ void SystemDictionary::oops_do(OopClosure* f) {
dictionary()->oops_do(f); dictionary()->oops_do(f);
// Visit extra methods // Visit extra methods
if (invoke_method_table() != NULL)
invoke_method_table()->oops_do(f); invoke_method_table()->oops_do(f);
// Partially loaded classes // Partially loaded classes
...@@ -1841,7 +1839,6 @@ void SystemDictionary::placeholders_do(void f(symbolOop, oop)) { ...@@ -1841,7 +1839,6 @@ void SystemDictionary::placeholders_do(void f(symbolOop, oop)) {
void SystemDictionary::methods_do(void f(methodOop)) { void SystemDictionary::methods_do(void f(methodOop)) {
dictionary()->methods_do(f); dictionary()->methods_do(f);
if (invoke_method_table() != NULL)
invoke_method_table()->methods_do(f); invoke_method_table()->methods_do(f);
} }
...@@ -1875,7 +1872,7 @@ void SystemDictionary::initialize(TRAPS) { ...@@ -1875,7 +1872,7 @@ void SystemDictionary::initialize(TRAPS) {
_number_of_modifications = 0; _number_of_modifications = 0;
_loader_constraints = new LoaderConstraintTable(_loader_constraint_size); _loader_constraints = new LoaderConstraintTable(_loader_constraint_size);
_resolution_errors = new ResolutionErrorTable(_resolution_error_size); _resolution_errors = new ResolutionErrorTable(_resolution_error_size);
// _invoke_method_table is allocated lazily in find_method_handle_invoke() _invoke_method_table = new SymbolPropertyTable(_invoke_method_size);
// Allocate private object used as system class loader lock // Allocate private object used as system class loader lock
_system_loader_lock_obj = oopFactory::new_system_objArray(0, CHECK); _system_loader_lock_obj = oopFactory::new_system_objArray(0, CHECK);
...@@ -2346,10 +2343,6 @@ methodOop SystemDictionary::find_method_handle_invoke(symbolHandle name, ...@@ -2346,10 +2343,6 @@ methodOop SystemDictionary::find_method_handle_invoke(symbolHandle name,
KlassHandle accessing_klass, KlassHandle accessing_klass,
TRAPS) { TRAPS) {
if (!EnableMethodHandles) return NULL; if (!EnableMethodHandles) return NULL;
if (invoke_method_table() == NULL) {
// create this side table lazily
_invoke_method_table = new SymbolPropertyTable(_invoke_method_size);
}
vmSymbols::SID name_id = vmSymbols::find_sid(name()); vmSymbols::SID name_id = vmSymbols::find_sid(name());
assert(name_id != vmSymbols::NO_SID, "must be a known name"); assert(name_id != vmSymbols::NO_SID, "must be a known name");
unsigned int hash = invoke_method_table()->compute_hash(signature, name_id); unsigned int hash = invoke_method_table()->compute_hash(signature, name_id);
......
...@@ -720,8 +720,8 @@ IRT_ENTRY(void, InterpreterRuntime::resolve_invokedynamic(JavaThread* thread)) { ...@@ -720,8 +720,8 @@ IRT_ENTRY(void, InterpreterRuntime::resolve_invokedynamic(JavaThread* thread)) {
// first resolve the signature to a MH.invoke methodOop // first resolve the signature to a MH.invoke methodOop
if (!pool->cache()->entry_at(main_index)->is_resolved(bytecode)) { if (!pool->cache()->entry_at(main_index)->is_resolved(bytecode)) {
JvmtiHideSingleStepping jhss(thread); JvmtiHideSingleStepping jhss(thread);
CallInfo info; CallInfo callinfo;
LinkResolver::resolve_invoke(info, Handle(), pool, LinkResolver::resolve_invoke(callinfo, Handle(), pool,
site_index, bytecode, CHECK); site_index, bytecode, CHECK);
// The main entry corresponds to a JVM_CONSTANT_InvokeDynamic, and serves // The main entry corresponds to a JVM_CONSTANT_InvokeDynamic, and serves
// as a common reference point for all invokedynamic call sites with // as a common reference point for all invokedynamic call sites with
...@@ -729,8 +729,8 @@ IRT_ENTRY(void, InterpreterRuntime::resolve_invokedynamic(JavaThread* thread)) { ...@@ -729,8 +729,8 @@ IRT_ENTRY(void, InterpreterRuntime::resolve_invokedynamic(JavaThread* thread)) {
// as if it were an invokevirtual of MethodHandle.invoke. // as if it were an invokevirtual of MethodHandle.invoke.
pool->cache()->entry_at(main_index)->set_method( pool->cache()->entry_at(main_index)->set_method(
bytecode, bytecode,
info.resolved_method(), callinfo.resolved_method(),
info.vtable_index()); callinfo.vtable_index());
} }
// The method (f2 entry) of the main entry is the MH.invoke for the // The method (f2 entry) of the main entry is the MH.invoke for the
......
/* /*
* Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -87,6 +87,19 @@ void ConstantPoolCacheEntry::set_bytecode_2(Bytecodes::Code code) { ...@@ -87,6 +87,19 @@ void ConstantPoolCacheEntry::set_bytecode_2(Bytecodes::Code code) {
OrderAccess::release_store_ptr(&_indices, _indices | ((u_char)code << 24)); OrderAccess::release_store_ptr(&_indices, _indices | ((u_char)code << 24));
} }
// Atomically sets f1 if it is still NULL, otherwise it keeps the
// current value.
void ConstantPoolCacheEntry::set_f1_if_null_atomic(oop f1) {
// Use barriers as in oop_store
HeapWord* f1_addr = (HeapWord*) &_f1;
update_barrier_set_pre(f1_addr, f1);
void* result = Atomic::cmpxchg_ptr(f1, f1_addr, NULL);
bool success = (result == NULL);
if (success) {
update_barrier_set((void*) f1_addr, f1);
}
}
#ifdef ASSERT #ifdef ASSERT
// It is possible to have two different dummy methodOops created // It is possible to have two different dummy methodOops created
// when the resolve code for invoke interface executes concurrently // when the resolve code for invoke interface executes concurrently
...@@ -165,7 +178,12 @@ void ConstantPoolCacheEntry::set_method(Bytecodes::Code invoke_code, ...@@ -165,7 +178,12 @@ void ConstantPoolCacheEntry::set_method(Bytecodes::Code invoke_code,
} }
assert(method->can_be_statically_bound(), "must be a MH invoker method"); assert(method->can_be_statically_bound(), "must be a MH invoker method");
assert(AllowTransitionalJSR292 || _f2 >= constantPoolOopDesc::CPCACHE_INDEX_TAG, "BSM index initialized"); assert(AllowTransitionalJSR292 || _f2 >= constantPoolOopDesc::CPCACHE_INDEX_TAG, "BSM index initialized");
set_f1(method()); // SystemDictionary::find_method_handle_invoke only caches
// methods which signature classes are on the boot classpath,
// otherwise the newly created method is returned. To avoid
// races in that case we store the first one coming in into the
// cp-cache atomically if it's still unset.
set_f1_if_null_atomic(method());
needs_vfinal_flag = false; // _f2 is not an oop needs_vfinal_flag = false; // _f2 is not an oop
assert(!is_vfinal(), "f2 not an oop"); assert(!is_vfinal(), "f2 not an oop");
byte_no = 1; // coordinate this with bytecode_number & is_resolved byte_no = 1; // coordinate this with bytecode_number & is_resolved
......
/* /*
* Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -130,6 +130,7 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC { ...@@ -130,6 +130,7 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC {
assert(existing_f1 == NULL || existing_f1 == f1, "illegal field change"); assert(existing_f1 == NULL || existing_f1 == f1, "illegal field change");
oop_store(&_f1, f1); oop_store(&_f1, f1);
} }
void set_f1_if_null_atomic(oop f1);
void set_f2(intx f2) { assert(_f2 == 0 || _f2 == f2, "illegal field change"); _f2 = f2; } void set_f2(intx f2) { assert(_f2 == 0 || _f2 == f2, "illegal field change"); _f2 = f2; }
int as_flags(TosState state, bool is_final, bool is_vfinal, bool is_volatile, int as_flags(TosState state, bool is_final, bool is_vfinal, bool is_volatile,
bool is_method_interface, bool is_method); bool is_method_interface, bool is_method);
......
...@@ -1199,6 +1199,7 @@ void JavaThread::initialize() { ...@@ -1199,6 +1199,7 @@ void JavaThread::initialize() {
_exception_pc = 0; _exception_pc = 0;
_exception_handler_pc = 0; _exception_handler_pc = 0;
_exception_stack_size = 0; _exception_stack_size = 0;
_is_method_handle_return = 0;
_jvmti_thread_state= NULL; _jvmti_thread_state= NULL;
_should_post_on_exceptions_flag = JNI_FALSE; _should_post_on_exceptions_flag = JNI_FALSE;
_jvmti_get_loaded_classes_closure = NULL; _jvmti_get_loaded_classes_closure = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册