mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
Merge
This commit is contained in:
commit
f5e5b2b6e2
15 changed files with 331 additions and 61 deletions
|
@ -25,9 +25,11 @@
|
|||
#include "precompiled.hpp"
|
||||
#include "classfile/symbolTable.hpp"
|
||||
#include "interpreter/interpreter.hpp"
|
||||
#include "interpreter/oopMapCache.hpp"
|
||||
#include "memory/allocation.inline.hpp"
|
||||
#include "memory/oopFactory.hpp"
|
||||
#include "prims/methodHandles.hpp"
|
||||
#include "prims/methodHandleWalk.hpp"
|
||||
#include "runtime/javaCalls.hpp"
|
||||
#include "runtime/reflection.hpp"
|
||||
#include "runtime/signature.hpp"
|
||||
|
@ -2599,6 +2601,50 @@ void MethodHandles::ensure_vmlayout_field(Handle target, TRAPS) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ASSERT
|
||||
|
||||
extern "C"
|
||||
void print_method_handle(oop mh);
|
||||
|
||||
static void stress_method_handle_walk_impl(Handle mh, TRAPS) {
|
||||
if (StressMethodHandleWalk) {
|
||||
// Exercise the MethodHandleWalk code in various ways and validate
|
||||
// the resulting method oop. Some of these produce output so they
|
||||
// are guarded under Verbose.
|
||||
ResourceMark rm;
|
||||
HandleMark hm;
|
||||
if (Verbose) {
|
||||
print_method_handle(mh());
|
||||
}
|
||||
TempNewSymbol name = SymbolTable::new_symbol("invoke", CHECK);
|
||||
Handle mt = java_lang_invoke_MethodHandle::type(mh());
|
||||
TempNewSymbol signature = java_lang_invoke_MethodType::as_signature(mt(), true, CHECK);
|
||||
MethodHandleCompiler mhc(mh, name, signature, 10000, false, CHECK);
|
||||
methodHandle m = mhc.compile(CHECK);
|
||||
if (Verbose) {
|
||||
m->print_codes();
|
||||
}
|
||||
InterpreterOopMap mask;
|
||||
OopMapCache::compute_one_oop_map(m, m->code_size() - 1, &mask);
|
||||
}
|
||||
}
|
||||
|
||||
static void stress_method_handle_walk(Handle mh, TRAPS) {
|
||||
stress_method_handle_walk_impl(mh, THREAD);
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
oop ex = PENDING_EXCEPTION;
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
tty->print("StressMethodHandleWalk: ");
|
||||
java_lang_Throwable::print(ex, tty);
|
||||
tty->cr();
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
static void stress_method_handle_walk(Handle mh, TRAPS) {}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// Here are the native methods on sun.invoke.MethodHandleImpl.
|
||||
// They are the private interface between this JVM and the HotSpot-specific
|
||||
|
@ -2666,6 +2712,7 @@ JVM_ENTRY(void, MHN_init_DMH(JNIEnv *env, jobject igcls, jobject mh_jh,
|
|||
}
|
||||
|
||||
MethodHandles::init_DirectMethodHandle(mh, m, (do_dispatch != JNI_FALSE), CHECK);
|
||||
stress_method_handle_walk(mh, CHECK);
|
||||
}
|
||||
JVM_END
|
||||
|
||||
|
@ -2694,11 +2741,11 @@ JVM_ENTRY(void, MHN_init_BMH(JNIEnv *env, jobject igcls, jobject mh_jh,
|
|||
receiver_limit,
|
||||
decode_flags,
|
||||
CHECK);
|
||||
return;
|
||||
} else {
|
||||
// Build a BMH on top of a DMH or another BMH:
|
||||
MethodHandles::init_BoundMethodHandle(mh, target, argnum, CHECK);
|
||||
}
|
||||
|
||||
// Build a BMH on top of a DMH or another BMH:
|
||||
MethodHandles::init_BoundMethodHandle(mh, target, argnum, CHECK);
|
||||
stress_method_handle_walk(mh, CHECK);
|
||||
}
|
||||
JVM_END
|
||||
|
||||
|
@ -2716,6 +2763,7 @@ JVM_ENTRY(void, MHN_init_AMH(JNIEnv *env, jobject igcls, jobject mh_jh,
|
|||
assert(java_lang_invoke_MethodHandle::vmentry(mh()) == NULL, "must be safely null");
|
||||
|
||||
MethodHandles::init_AdapterMethodHandle(mh, target, argnum, CHECK);
|
||||
stress_method_handle_walk(mh, CHECK);
|
||||
}
|
||||
JVM_END
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue