mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
7010180: JSR 292 InvokeDynamicPrintArgs fails with: assert(_adapter == NULL) failed: init'd to NULL
Reviewed-by: never
This commit is contained in:
parent
5bce844ff6
commit
b2f607fcb6
4 changed files with 29 additions and 22 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2011, 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
|
||||||
|
@ -395,7 +395,7 @@ int MethodHandles::adapter_conversion_ops_supported_mask() {
|
||||||
//
|
//
|
||||||
// Generate an "entry" field for a method handle.
|
// Generate an "entry" field for a method handle.
|
||||||
// This determines how the method handle will respond to calls.
|
// This determines how the method handle will respond to calls.
|
||||||
void MethodHandles::generate_method_handle_stub(MacroAssembler* _masm, MethodHandles::EntryKind ek, TRAPS) {
|
void MethodHandles::generate_method_handle_stub(MacroAssembler* _masm, MethodHandles::EntryKind ek) {
|
||||||
// Here is the register state during an interpreted call,
|
// Here is the register state during an interpreted call,
|
||||||
// as set up by generate_method_handle_interpreter_entry():
|
// as set up by generate_method_handle_interpreter_entry():
|
||||||
// - G5: garbage temp (was MethodHandle.invoke methodOop, unused)
|
// - G5: garbage temp (was MethodHandle.invoke methodOop, unused)
|
||||||
|
@ -447,8 +447,9 @@ void MethodHandles::generate_method_handle_stub(MacroAssembler* _masm, MethodHan
|
||||||
// exception. Since we use a C2I adapter to set up the
|
// exception. Since we use a C2I adapter to set up the
|
||||||
// interpreter state, arguments are expected in compiler
|
// interpreter state, arguments are expected in compiler
|
||||||
// argument registers.
|
// argument registers.
|
||||||
methodHandle mh(raise_exception_method());
|
assert(raise_exception_method(), "must be set");
|
||||||
address c2i_entry = methodOopDesc::make_adapters(mh, CATCH);
|
address c2i_entry = raise_exception_method()->get_c2i_entry();
|
||||||
|
assert(c2i_entry, "method must be linked");
|
||||||
|
|
||||||
__ mov(O5_savedSP, SP); // Cut the stack back to where the caller started.
|
__ mov(O5_savedSP, SP); // Cut the stack back to where the caller started.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2011, 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
|
||||||
|
@ -390,7 +390,7 @@ int MethodHandles::adapter_conversion_ops_supported_mask() {
|
||||||
//
|
//
|
||||||
// Generate an "entry" field for a method handle.
|
// Generate an "entry" field for a method handle.
|
||||||
// This determines how the method handle will respond to calls.
|
// This determines how the method handle will respond to calls.
|
||||||
void MethodHandles::generate_method_handle_stub(MacroAssembler* _masm, MethodHandles::EntryKind ek, TRAPS) {
|
void MethodHandles::generate_method_handle_stub(MacroAssembler* _masm, MethodHandles::EntryKind ek) {
|
||||||
// Here is the register state during an interpreted call,
|
// Here is the register state during an interpreted call,
|
||||||
// as set up by generate_method_handle_interpreter_entry():
|
// as set up by generate_method_handle_interpreter_entry():
|
||||||
// - rbx: garbage temp (was MethodHandle.invoke methodOop, unused)
|
// - rbx: garbage temp (was MethodHandle.invoke methodOop, unused)
|
||||||
|
@ -451,8 +451,9 @@ void MethodHandles::generate_method_handle_stub(MacroAssembler* _masm, MethodHan
|
||||||
// exception. Since we use a C2I adapter to set up the
|
// exception. Since we use a C2I adapter to set up the
|
||||||
// interpreter state, arguments are expected in compiler
|
// interpreter state, arguments are expected in compiler
|
||||||
// argument registers.
|
// argument registers.
|
||||||
methodHandle mh(raise_exception_method());
|
assert(raise_exception_method(), "must be set");
|
||||||
address c2i_entry = methodOopDesc::make_adapters(mh, CHECK);
|
address c2i_entry = raise_exception_method()->get_c2i_entry();
|
||||||
|
assert(c2i_entry, "method must be linked");
|
||||||
|
|
||||||
const Register rdi_pc = rax;
|
const Register rdi_pc = rax;
|
||||||
__ pop(rdi_pc); // caller PC
|
__ pop(rdi_pc); // caller PC
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2011, 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
|
||||||
|
@ -111,7 +111,7 @@ bool MethodHandles::spot_check_entry_names() {
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// MethodHandles::generate_adapters
|
// MethodHandles::generate_adapters
|
||||||
//
|
//
|
||||||
void MethodHandles::generate_adapters(TRAPS) {
|
void MethodHandles::generate_adapters() {
|
||||||
if (!EnableMethodHandles || SystemDictionary::MethodHandle_klass() == NULL) return;
|
if (!EnableMethodHandles || SystemDictionary::MethodHandle_klass() == NULL) return;
|
||||||
|
|
||||||
assert(_adapter_code == NULL, "generate only once");
|
assert(_adapter_code == NULL, "generate only once");
|
||||||
|
@ -123,20 +123,20 @@ void MethodHandles::generate_adapters(TRAPS) {
|
||||||
vm_exit_out_of_memory(_adapter_code_size, "CodeCache: no room for MethodHandles adapters");
|
vm_exit_out_of_memory(_adapter_code_size, "CodeCache: no room for MethodHandles adapters");
|
||||||
CodeBuffer code(_adapter_code);
|
CodeBuffer code(_adapter_code);
|
||||||
MethodHandlesAdapterGenerator g(&code);
|
MethodHandlesAdapterGenerator g(&code);
|
||||||
g.generate(CHECK);
|
g.generate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// MethodHandlesAdapterGenerator::generate
|
// MethodHandlesAdapterGenerator::generate
|
||||||
//
|
//
|
||||||
void MethodHandlesAdapterGenerator::generate(TRAPS) {
|
void MethodHandlesAdapterGenerator::generate() {
|
||||||
// Generate generic method handle adapters.
|
// Generate generic method handle adapters.
|
||||||
for (MethodHandles::EntryKind ek = MethodHandles::_EK_FIRST;
|
for (MethodHandles::EntryKind ek = MethodHandles::_EK_FIRST;
|
||||||
ek < MethodHandles::_EK_LIMIT;
|
ek < MethodHandles::_EK_LIMIT;
|
||||||
ek = MethodHandles::EntryKind(1 + (int)ek)) {
|
ek = MethodHandles::EntryKind(1 + (int)ek)) {
|
||||||
StubCodeMark mark(this, "MethodHandle", MethodHandles::entry_name(ek));
|
StubCodeMark mark(this, "MethodHandle", MethodHandles::entry_name(ek));
|
||||||
MethodHandles::generate_method_handle_stub(_masm, ek, CHECK);
|
MethodHandles::generate_method_handle_stub(_masm, ek);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2621,10 +2621,20 @@ JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class))
|
||||||
warning("JSR 292 method handle code is mismatched to this JVM. Disabling support.");
|
warning("JSR 292 method handle code is mismatched to this JVM. Disabling support.");
|
||||||
enable_MH = false;
|
enable_MH = false;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
enable_MH = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enable_MH) {
|
if (enable_MH) {
|
||||||
|
// We need to link the MethodHandleImpl klass before we generate
|
||||||
|
// the method handle adapters as the _raise_exception adapter uses
|
||||||
|
// one of its methods (and its c2i-adapter).
|
||||||
|
KlassHandle k = SystemDictionaryHandles::MethodHandleImpl_klass();
|
||||||
|
instanceKlass* ik = instanceKlass::cast(k());
|
||||||
|
ik->link_class(CHECK);
|
||||||
|
|
||||||
|
MethodHandles::generate_adapters();
|
||||||
MethodHandles::set_enabled(true);
|
MethodHandles::set_enabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2645,10 +2655,5 @@ JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class))
|
||||||
MethodHandles::set_enabled(true);
|
MethodHandles::set_enabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate method handles adapters if enabled.
|
|
||||||
if (MethodHandles::enabled()) {
|
|
||||||
MethodHandles::generate_adapters(CHECK);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
JVM_END
|
JVM_END
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2011, 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
|
||||||
|
@ -294,11 +294,11 @@ class MethodHandles: AllStatic {
|
||||||
enum { _suppress_defc = 1, _suppress_name = 2, _suppress_type = 4 };
|
enum { _suppress_defc = 1, _suppress_name = 2, _suppress_type = 4 };
|
||||||
|
|
||||||
// Generate MethodHandles adapters.
|
// Generate MethodHandles adapters.
|
||||||
static void generate_adapters(TRAPS);
|
static void generate_adapters();
|
||||||
|
|
||||||
// Called from InterpreterGenerator and MethodHandlesAdapterGenerator.
|
// Called from InterpreterGenerator and MethodHandlesAdapterGenerator.
|
||||||
static address generate_method_handle_interpreter_entry(MacroAssembler* _masm);
|
static address generate_method_handle_interpreter_entry(MacroAssembler* _masm);
|
||||||
static void generate_method_handle_stub(MacroAssembler* _masm, EntryKind ek, TRAPS);
|
static void generate_method_handle_stub(MacroAssembler* _masm, EntryKind ek);
|
||||||
|
|
||||||
// argument list parsing
|
// argument list parsing
|
||||||
static int argument_slot(oop method_type, int arg);
|
static int argument_slot(oop method_type, int arg);
|
||||||
|
@ -530,7 +530,7 @@ class MethodHandlesAdapterGenerator : public StubCodeGenerator {
|
||||||
public:
|
public:
|
||||||
MethodHandlesAdapterGenerator(CodeBuffer* code) : StubCodeGenerator(code) {}
|
MethodHandlesAdapterGenerator(CodeBuffer* code) : StubCodeGenerator(code) {}
|
||||||
|
|
||||||
void generate(TRAPS);
|
void generate();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SHARE_VM_PRIMS_METHODHANDLES_HPP
|
#endif // SHARE_VM_PRIMS_METHODHANDLES_HPP
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue