Merge
This commit is contained in:
commit
b1d07c3707
@ -419,10 +419,8 @@ void CppInterpreterGenerator::generate_compute_interpreter_state(Label& stack_ov
|
||||
// TODO: PPC port: assert(2 == ConstMethod::sz_max_stack(), "unexpected field size");
|
||||
__ lhz(max_stack, in_bytes(ConstMethod::max_stack_offset()), max_stack);
|
||||
|
||||
if (EnableInvokeDynamic) {
|
||||
// Take into account 'extra_stack_entries' needed by method handles (see method.hpp).
|
||||
// Take into account 'extra_stack_entries' needed by method handles (see method.hpp).
|
||||
__ addi(max_stack, max_stack, Method::extra_stack_entries());
|
||||
}
|
||||
|
||||
// mem_stack_limit = thread->stack_limit();
|
||||
__ ld(mem_stack_limit, thread_(stack_overflow_limit));
|
||||
|
@ -380,7 +380,6 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register Rdst, int bcp_of
|
||||
if (index_size == sizeof(u2)) {
|
||||
get_2_byte_integer_at_bcp(bcp_offset, Rdst, Unsigned);
|
||||
} else if (index_size == sizeof(u4)) {
|
||||
assert(EnableInvokeDynamic, "giant index used only for JSR 292");
|
||||
get_4_byte_integer_at_bcp(bcp_offset, Rdst, Signed);
|
||||
assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
|
||||
nand(Rdst, Rdst, Rdst); // convert to plain index
|
||||
|
@ -3453,16 +3453,6 @@ void TemplateTable::invokedynamic(int byte_no) {
|
||||
Rscratch1 = R11_scratch1,
|
||||
Rscratch2 = R12_scratch2;
|
||||
|
||||
if (!EnableInvokeDynamic) {
|
||||
// We should not encounter this bytecode if !EnableInvokeDynamic.
|
||||
// The verifier will stop it. However, if we get past the verifier,
|
||||
// this will stop the thread in a reasonable way, without crashing the JVM.
|
||||
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_IncompatibleClassChangeError));
|
||||
// The call_VM checks for exception, so we should never return here.
|
||||
__ should_not_reach_here();
|
||||
return;
|
||||
}
|
||||
|
||||
prepare_invoke(byte_no, Rmethod, Rret_addr, Rscratch1, noreg, Rflags, Rscratch2);
|
||||
|
||||
// Profile this call.
|
||||
@ -3486,12 +3476,6 @@ void TemplateTable::invokehandle(int byte_no) {
|
||||
Rscratch1 = R11_scratch1,
|
||||
Rscratch2 = R12_scratch2;
|
||||
|
||||
if (!EnableInvokeDynamic) {
|
||||
// Rewriter does not generate this bytecode.
|
||||
__ should_not_reach_here();
|
||||
return;
|
||||
}
|
||||
|
||||
prepare_invoke(byte_no, Rmethod, Rret_addr, Rscratch1, Rrecv, Rflags, Rscratch2);
|
||||
__ verify_method_ptr(Rmethod);
|
||||
__ null_check_throw(Rrecv, -1, Rscratch2);
|
||||
|
@ -727,7 +727,6 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register temp, Register i
|
||||
if (index_size == sizeof(u2)) {
|
||||
get_2_byte_integer_at_bcp(bcp_offset, temp, index, Unsigned);
|
||||
} else if (index_size == sizeof(u4)) {
|
||||
assert(EnableInvokeDynamic, "giant index used only for JSR 292");
|
||||
get_4_byte_integer_at_bcp(bcp_offset, temp, index);
|
||||
assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
|
||||
xor3(index, -1, index); // convert to plain index
|
||||
|
@ -1888,7 +1888,7 @@ void TemplateInterpreterGenerator::generate_throw_exception() {
|
||||
}
|
||||
|
||||
#if INCLUDE_JVMTI
|
||||
if (EnableInvokeDynamic) {
|
||||
{
|
||||
Label L_done;
|
||||
|
||||
__ ldub(Address(Lbcp, 0), G1_scratch); // Load current bytecode
|
||||
|
@ -3209,12 +3209,6 @@ void TemplateTable::invokehandle(int byte_no) {
|
||||
transition(vtos, vtos);
|
||||
assert(byte_no == f1_byte, "use this argument");
|
||||
|
||||
if (!EnableInvokeDynamic) {
|
||||
// rewriter does not generate this bytecode
|
||||
__ should_not_reach_here();
|
||||
return;
|
||||
}
|
||||
|
||||
const Register Rret = Lscratch;
|
||||
const Register G4_mtype = G4_scratch;
|
||||
const Register O0_recv = O0;
|
||||
@ -3240,17 +3234,6 @@ void TemplateTable::invokedynamic(int byte_no) {
|
||||
transition(vtos, vtos);
|
||||
assert(byte_no == f1_byte, "use this argument");
|
||||
|
||||
if (!EnableInvokeDynamic) {
|
||||
// We should not encounter this bytecode if !EnableInvokeDynamic.
|
||||
// The verifier will stop it. However, if we get past the verifier,
|
||||
// this will stop the thread in a reasonable way, without crashing the JVM.
|
||||
__ call_VM(noreg, CAST_FROM_FN_PTR(address,
|
||||
InterpreterRuntime::throw_IncompatibleClassChangeError));
|
||||
// the call_VM checks for exception, so we should never return here.
|
||||
__ should_not_reach_here();
|
||||
return;
|
||||
}
|
||||
|
||||
const Register Rret = Lscratch;
|
||||
const Register G4_callsite = G4_scratch;
|
||||
const Register Rscratch = G3_scratch;
|
||||
|
@ -207,7 +207,6 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register reg, int bcp_off
|
||||
if (index_size == sizeof(u2)) {
|
||||
load_unsigned_short(reg, Address(rsi, bcp_offset));
|
||||
} else if (index_size == sizeof(u4)) {
|
||||
assert(EnableInvokeDynamic, "giant index used only for JSR 292");
|
||||
movl(reg, Address(rsi, bcp_offset));
|
||||
// Check if the secondary index definition is still ~x, otherwise
|
||||
// we have to change the following assembler code to calculate the
|
||||
|
@ -205,7 +205,6 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index,
|
||||
if (index_size == sizeof(u2)) {
|
||||
load_unsigned_short(index, Address(r13, bcp_offset));
|
||||
} else if (index_size == sizeof(u4)) {
|
||||
assert(EnableInvokeDynamic, "giant index used only for JSR 292");
|
||||
movl(index, Address(r13, bcp_offset));
|
||||
// Check if the secondary index definition is still ~x, otherwise
|
||||
// we have to change the following assembler code to calculate the
|
||||
|
@ -76,12 +76,7 @@ void AbstractInterpreter::layout_activation(Method* method,
|
||||
Interpreter::stackElementWords;
|
||||
|
||||
#ifdef ASSERT
|
||||
if (!EnableInvokeDynamic) {
|
||||
// @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences?
|
||||
// Probably, since deoptimization doesn't work yet.
|
||||
assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), "Frame not properly walkable");
|
||||
}
|
||||
assert(caller->sp() == interpreter_frame->sender_sp(), "Frame not properly walkable(2)");
|
||||
assert(caller->sp() == interpreter_frame->sender_sp(), "Frame not properly walkable");
|
||||
#endif
|
||||
|
||||
interpreter_frame->interpreter_frame_set_method(method);
|
||||
|
@ -1831,7 +1831,7 @@ void TemplateInterpreterGenerator::generate_throw_exception() {
|
||||
__ movl(Address(thread, JavaThread::popframe_condition_offset()), JavaThread::popframe_inactive);
|
||||
|
||||
#if INCLUDE_JVMTI
|
||||
if (EnableInvokeDynamic) {
|
||||
{
|
||||
Label L_done;
|
||||
const Register local0 = rdi;
|
||||
|
||||
|
@ -1848,7 +1848,7 @@ void TemplateInterpreterGenerator::generate_throw_exception() {
|
||||
JavaThread::popframe_inactive);
|
||||
|
||||
#if INCLUDE_JVMTI
|
||||
if (EnableInvokeDynamic) {
|
||||
{
|
||||
Label L_done;
|
||||
const Register local0 = r14;
|
||||
|
||||
|
@ -3128,12 +3128,6 @@ void TemplateTable::invokehandle(int byte_no) {
|
||||
const Register rcx_recv = rcx;
|
||||
const Register rdx_flags = rdx;
|
||||
|
||||
if (!EnableInvokeDynamic) {
|
||||
// rewriter does not generate this bytecode
|
||||
__ should_not_reach_here();
|
||||
return;
|
||||
}
|
||||
|
||||
prepare_invoke(byte_no, rbx_method, rax_mtype, rcx_recv);
|
||||
__ verify_method_ptr(rbx_method);
|
||||
__ verify_oop(rcx_recv);
|
||||
@ -3156,17 +3150,6 @@ void TemplateTable::invokedynamic(int byte_no) {
|
||||
transition(vtos, vtos);
|
||||
assert(byte_no == f1_byte, "use this argument");
|
||||
|
||||
if (!EnableInvokeDynamic) {
|
||||
// We should not encounter this bytecode if !EnableInvokeDynamic.
|
||||
// The verifier will stop it. However, if we get past the verifier,
|
||||
// this will stop the thread in a reasonable way, without crashing the JVM.
|
||||
__ call_VM(noreg, CAST_FROM_FN_PTR(address,
|
||||
InterpreterRuntime::throw_IncompatibleClassChangeError));
|
||||
// the call_VM checks for exception, so we should never return here.
|
||||
__ should_not_reach_here();
|
||||
return;
|
||||
}
|
||||
|
||||
const Register rbx_method = rbx;
|
||||
const Register rax_callsite = rax;
|
||||
|
||||
|
@ -3179,12 +3179,6 @@ void TemplateTable::invokehandle(int byte_no) {
|
||||
const Register rcx_recv = rcx;
|
||||
const Register rdx_flags = rdx;
|
||||
|
||||
if (!EnableInvokeDynamic) {
|
||||
// rewriter does not generate this bytecode
|
||||
__ should_not_reach_here();
|
||||
return;
|
||||
}
|
||||
|
||||
prepare_invoke(byte_no, rbx_method, rax_mtype, rcx_recv);
|
||||
__ verify_method_ptr(rbx_method);
|
||||
__ verify_oop(rcx_recv);
|
||||
@ -3207,17 +3201,6 @@ void TemplateTable::invokedynamic(int byte_no) {
|
||||
transition(vtos, vtos);
|
||||
assert(byte_no == f1_byte, "use this argument");
|
||||
|
||||
if (!EnableInvokeDynamic) {
|
||||
// We should not encounter this bytecode if !EnableInvokeDynamic.
|
||||
// The verifier will stop it. However, if we get past the verifier,
|
||||
// this will stop the thread in a reasonable way, without crashing the JVM.
|
||||
__ call_VM(noreg, CAST_FROM_FN_PTR(address,
|
||||
InterpreterRuntime::throw_IncompatibleClassChangeError));
|
||||
// the call_VM checks for exception, so we should never return here.
|
||||
__ should_not_reach_here();
|
||||
return;
|
||||
}
|
||||
|
||||
const Register rbx_method = rbx;
|
||||
const Register rax_callsite = rax;
|
||||
|
||||
|
@ -181,9 +181,8 @@ bool ciObject::should_be_constant() {
|
||||
if (klass() == env->String_klass() || klass() == env->Class_klass()) {
|
||||
return true;
|
||||
}
|
||||
if (EnableInvokeDynamic &&
|
||||
(klass()->is_subclass_of(env->MethodHandle_klass()) ||
|
||||
klass()->is_subclass_of(env->CallSite_klass()))) {
|
||||
if (klass()->is_subclass_of(env->MethodHandle_klass()) ||
|
||||
klass()->is_subclass_of(env->CallSite_klass())) {
|
||||
assert(ScavengeRootsInCode >= 1, "must be");
|
||||
// We want to treat these aggressively.
|
||||
return true;
|
||||
|
@ -164,11 +164,6 @@ void ClassFileParser::parse_constant_pool_entries(int length, TRAPS) {
|
||||
"Class file version does not support constant tag %u in class file %s",
|
||||
tag, CHECK);
|
||||
}
|
||||
if (!EnableInvokeDynamic) {
|
||||
classfile_parse_error(
|
||||
"This JVM does not support constant tag %u in class file %s",
|
||||
tag, CHECK);
|
||||
}
|
||||
if (tag == JVM_CONSTANT_MethodHandle) {
|
||||
cfs->guarantee_more(4, CHECK); // ref_kind, method_index, tag/access_flags
|
||||
u1 ref_kind = cfs->get_u1_fast();
|
||||
@ -189,11 +184,6 @@ void ClassFileParser::parse_constant_pool_entries(int length, TRAPS) {
|
||||
"Class file version does not support constant tag %u in class file %s",
|
||||
tag, CHECK);
|
||||
}
|
||||
if (!EnableInvokeDynamic) {
|
||||
classfile_parse_error(
|
||||
"This JVM does not support constant tag %u in class file %s",
|
||||
tag, CHECK);
|
||||
}
|
||||
cfs->guarantee_more(5, CHECK); // bsm_index, nt, tag/access_flags
|
||||
u2 bootstrap_specifier_index = cfs->get_u2_fast();
|
||||
u2 name_and_type_index = cfs->get_u2_fast();
|
||||
@ -263,7 +253,7 @@ void ClassFileParser::parse_constant_pool_entries(int length, TRAPS) {
|
||||
verify_legal_utf8((unsigned char*)utf8_buffer, utf8_length, CHECK);
|
||||
}
|
||||
|
||||
if (EnableInvokeDynamic && has_cp_patch_at(index)) {
|
||||
if (has_cp_patch_at(index)) {
|
||||
Handle patch = clear_cp_patch_at(index);
|
||||
guarantee_property(java_lang_String::is_instance(patch()),
|
||||
"Illegal utf8 patch at %d in class file %s",
|
||||
@ -419,8 +409,7 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) {
|
||||
{
|
||||
int ref_index = cp->method_handle_index_at(index);
|
||||
check_property(
|
||||
valid_cp_range(ref_index, length) &&
|
||||
EnableInvokeDynamic,
|
||||
valid_cp_range(ref_index, length),
|
||||
"Invalid constant pool index %u in class file %s",
|
||||
ref_index, CHECK_(nullHandle));
|
||||
constantTag tag = cp->tag_at(ref_index);
|
||||
@ -466,7 +455,7 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) {
|
||||
case JVM_CONSTANT_MethodType :
|
||||
{
|
||||
int ref_index = cp->method_type_index_at(index);
|
||||
check_property(valid_symbol_at(ref_index) && EnableInvokeDynamic,
|
||||
check_property(valid_symbol_at(ref_index),
|
||||
"Invalid constant pool index %u in class file %s",
|
||||
ref_index, CHECK_(nullHandle));
|
||||
}
|
||||
@ -492,7 +481,6 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) {
|
||||
|
||||
if (_cp_patches != NULL) {
|
||||
// need to treat this_class specially...
|
||||
assert(EnableInvokeDynamic, "");
|
||||
int this_class_index;
|
||||
{
|
||||
cfs->guarantee_more(8, CHECK_(nullHandle)); // flags, this_class, super_class, infs_len
|
||||
@ -640,7 +628,6 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) {
|
||||
|
||||
|
||||
void ClassFileParser::patch_constant_pool(constantPoolHandle cp, int index, Handle patch, TRAPS) {
|
||||
assert(EnableInvokeDynamic, "");
|
||||
BasicType patch_type = T_VOID;
|
||||
|
||||
switch (cp->tag_at(index).value()) {
|
||||
|
@ -377,11 +377,9 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
|
||||
char* skip_over_field_signature(char* signature, bool void_ok, unsigned int length, TRAPS);
|
||||
|
||||
bool is_anonymous() {
|
||||
assert(EnableInvokeDynamic || _host_klass.is_null(), "");
|
||||
return _host_klass.not_null();
|
||||
}
|
||||
bool has_cp_patch_at(int index) {
|
||||
assert(EnableInvokeDynamic, "");
|
||||
assert(index >= 0, "oob");
|
||||
return (_cp_patches != NULL
|
||||
&& index < _cp_patches->length()
|
||||
@ -404,10 +402,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
|
||||
// constant pool construction, but in later versions they can.
|
||||
// %%% Let's phase out the old is_klass_reference.
|
||||
bool valid_klass_reference_at(int index) {
|
||||
return _cp->is_within_bounds(index) &&
|
||||
(EnableInvokeDynamic
|
||||
? _cp->tag_at(index).is_klass_or_reference()
|
||||
: _cp->tag_at(index).is_klass_reference());
|
||||
return _cp->is_within_bounds(index) && _cp->tag_at(index).is_klass_or_reference();
|
||||
}
|
||||
|
||||
// Checks that the cpool index is in range and is a utf8
|
||||
|
@ -2637,7 +2637,7 @@ oop java_lang_invoke_DirectMethodHandle::member(oop dmh) {
|
||||
|
||||
void java_lang_invoke_DirectMethodHandle::compute_offsets() {
|
||||
Klass* klass_oop = SystemDictionary::DirectMethodHandle_klass();
|
||||
if (klass_oop != NULL && EnableInvokeDynamic) {
|
||||
if (klass_oop != NULL) {
|
||||
compute_offset(_member_offset, klass_oop, vmSymbols::member_name(), vmSymbols::java_lang_invoke_MemberName_signature());
|
||||
}
|
||||
}
|
||||
@ -2659,18 +2659,15 @@ int java_lang_invoke_LambdaForm::_vmentry_offset;
|
||||
|
||||
void java_lang_invoke_MethodHandle::compute_offsets() {
|
||||
Klass* klass_oop = SystemDictionary::MethodHandle_klass();
|
||||
if (klass_oop != NULL && EnableInvokeDynamic) {
|
||||
if (klass_oop != NULL) {
|
||||
compute_offset(_type_offset, klass_oop, vmSymbols::type_name(), vmSymbols::java_lang_invoke_MethodType_signature());
|
||||
compute_optional_offset(_form_offset, klass_oop, vmSymbols::form_name(), vmSymbols::java_lang_invoke_LambdaForm_signature());
|
||||
if (_form_offset == 0) {
|
||||
EnableInvokeDynamic = false;
|
||||
}
|
||||
compute_offset(_form_offset, klass_oop, vmSymbols::form_name(), vmSymbols::java_lang_invoke_LambdaForm_signature());
|
||||
}
|
||||
}
|
||||
|
||||
void java_lang_invoke_MemberName::compute_offsets() {
|
||||
Klass* klass_oop = SystemDictionary::MemberName_klass();
|
||||
if (klass_oop != NULL && EnableInvokeDynamic) {
|
||||
if (klass_oop != NULL) {
|
||||
compute_offset(_clazz_offset, klass_oop, vmSymbols::clazz_name(), vmSymbols::class_signature());
|
||||
compute_offset(_name_offset, klass_oop, vmSymbols::name_name(), vmSymbols::string_signature());
|
||||
compute_offset(_type_offset, klass_oop, vmSymbols::type_name(), vmSymbols::object_signature());
|
||||
@ -2681,7 +2678,7 @@ void java_lang_invoke_MemberName::compute_offsets() {
|
||||
|
||||
void java_lang_invoke_LambdaForm::compute_offsets() {
|
||||
Klass* klass_oop = SystemDictionary::LambdaForm_klass();
|
||||
if (klass_oop != NULL && EnableInvokeDynamic) {
|
||||
if (klass_oop != NULL) {
|
||||
compute_offset(_vmentry_offset, klass_oop, vmSymbols::vmentry_name(), vmSymbols::java_lang_invoke_MemberName_signature());
|
||||
}
|
||||
}
|
||||
@ -2896,7 +2893,6 @@ int java_lang_invoke_MethodType::rtype_slot_count(oop mt) {
|
||||
int java_lang_invoke_CallSite::_target_offset;
|
||||
|
||||
void java_lang_invoke_CallSite::compute_offsets() {
|
||||
if (!EnableInvokeDynamic) return;
|
||||
Klass* k = SystemDictionary::CallSite_klass();
|
||||
if (k != NULL) {
|
||||
compute_offset(_target_offset, k, vmSymbols::target_name(), vmSymbols::java_lang_invoke_MethodHandle_signature());
|
||||
@ -3287,14 +3283,12 @@ void JavaClasses::compute_offsets() {
|
||||
java_lang_ClassLoader::compute_offsets();
|
||||
java_lang_Thread::compute_offsets();
|
||||
java_lang_ThreadGroup::compute_offsets();
|
||||
if (EnableInvokeDynamic) {
|
||||
java_lang_invoke_MethodHandle::compute_offsets();
|
||||
java_lang_invoke_DirectMethodHandle::compute_offsets();
|
||||
java_lang_invoke_MemberName::compute_offsets();
|
||||
java_lang_invoke_LambdaForm::compute_offsets();
|
||||
java_lang_invoke_MethodType::compute_offsets();
|
||||
java_lang_invoke_CallSite::compute_offsets();
|
||||
}
|
||||
java_lang_invoke_MethodHandle::compute_offsets();
|
||||
java_lang_invoke_DirectMethodHandle::compute_offsets();
|
||||
java_lang_invoke_MemberName::compute_offsets();
|
||||
java_lang_invoke_LambdaForm::compute_offsets();
|
||||
java_lang_invoke_MethodType::compute_offsets();
|
||||
java_lang_invoke_CallSite::compute_offsets();
|
||||
java_security_AccessControlContext::compute_offsets();
|
||||
// Initialize reflection classes. The layouts of these classes
|
||||
// changed with the new reflection implementation in JDK 1.4, and
|
||||
|
@ -971,7 +971,6 @@ Klass* SystemDictionary::parse_stream(Symbol* class_name,
|
||||
if (host_klass.not_null()) {
|
||||
// Create a new CLD for anonymous class, that uses the same class loader
|
||||
// as the host_klass
|
||||
assert(EnableInvokeDynamic, "");
|
||||
guarantee(host_klass->class_loader() == class_loader(), "should be the same");
|
||||
loader_data = ClassLoaderData::anonymous_class_loader_data(class_loader(), CHECK_NULL);
|
||||
loader_data->record_dependency(host_klass(), CHECK_NULL);
|
||||
@ -996,7 +995,6 @@ Klass* SystemDictionary::parse_stream(Symbol* class_name,
|
||||
|
||||
|
||||
if (host_klass.not_null() && k.not_null()) {
|
||||
assert(EnableInvokeDynamic, "");
|
||||
k->set_host_klass(host_klass());
|
||||
// If it's anonymous, initialize it now, since nobody else will.
|
||||
|
||||
@ -1877,13 +1875,7 @@ void SystemDictionary::initialize_preloaded_classes(TRAPS) {
|
||||
WKID jsr292_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass);
|
||||
WKID jsr292_group_end = WK_KLASS_ENUM_NAME(VolatileCallSite_klass);
|
||||
initialize_wk_klasses_until(jsr292_group_start, scan, CHECK);
|
||||
if (EnableInvokeDynamic) {
|
||||
initialize_wk_klasses_through(jsr292_group_end, scan, CHECK);
|
||||
} else {
|
||||
// Skip the JSR 292 classes, if not enabled.
|
||||
scan = WKID(jsr292_group_end + 1);
|
||||
}
|
||||
|
||||
initialize_wk_klasses_through(jsr292_group_end, scan, CHECK);
|
||||
initialize_wk_klasses_until(WKID_LIMIT, scan, CHECK);
|
||||
|
||||
_box_klasses[T_BOOLEAN] = WK_KLASS(Boolean_klass);
|
||||
@ -2221,7 +2213,6 @@ methodHandle SystemDictionary::find_method_handle_intrinsic(vmIntrinsics::ID iid
|
||||
Symbol* signature,
|
||||
TRAPS) {
|
||||
methodHandle empty;
|
||||
assert(EnableInvokeDynamic, "");
|
||||
assert(MethodHandles::is_signature_polymorphic(iid) &&
|
||||
MethodHandles::is_signature_polymorphic_intrinsic(iid) &&
|
||||
iid != vmIntrinsics::_invokeGeneric,
|
||||
@ -2295,7 +2286,6 @@ methodHandle SystemDictionary::find_method_handle_invoker(Symbol* name,
|
||||
Handle *method_type_result,
|
||||
TRAPS) {
|
||||
methodHandle empty;
|
||||
assert(EnableInvokeDynamic, "");
|
||||
assert(!THREAD->is_Compiler_thread(), "");
|
||||
Handle method_type =
|
||||
SystemDictionary::find_method_handle_type(signature, accessing_klass, CHECK_(empty));
|
||||
|
@ -151,16 +151,16 @@ class Ticks;
|
||||
\
|
||||
/* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \
|
||||
do_klass(DirectMethodHandle_klass, java_lang_invoke_DirectMethodHandle, Opt ) \
|
||||
do_klass(MethodHandle_klass, java_lang_invoke_MethodHandle, Pre_JSR292 ) \
|
||||
do_klass(MemberName_klass, java_lang_invoke_MemberName, Pre_JSR292 ) \
|
||||
do_klass(MethodHandleNatives_klass, java_lang_invoke_MethodHandleNatives, Pre_JSR292 ) \
|
||||
do_klass(MethodHandle_klass, java_lang_invoke_MethodHandle, Pre ) \
|
||||
do_klass(MemberName_klass, java_lang_invoke_MemberName, Pre ) \
|
||||
do_klass(MethodHandleNatives_klass, java_lang_invoke_MethodHandleNatives, Pre ) \
|
||||
do_klass(LambdaForm_klass, java_lang_invoke_LambdaForm, Opt ) \
|
||||
do_klass(MethodType_klass, java_lang_invoke_MethodType, Pre_JSR292 ) \
|
||||
do_klass(BootstrapMethodError_klass, java_lang_BootstrapMethodError, Pre_JSR292 ) \
|
||||
do_klass(CallSite_klass, java_lang_invoke_CallSite, Pre_JSR292 ) \
|
||||
do_klass(ConstantCallSite_klass, java_lang_invoke_ConstantCallSite, Pre_JSR292 ) \
|
||||
do_klass(MutableCallSite_klass, java_lang_invoke_MutableCallSite, Pre_JSR292 ) \
|
||||
do_klass(VolatileCallSite_klass, java_lang_invoke_VolatileCallSite, Pre_JSR292 ) \
|
||||
do_klass(MethodType_klass, java_lang_invoke_MethodType, Pre ) \
|
||||
do_klass(BootstrapMethodError_klass, java_lang_BootstrapMethodError, Pre ) \
|
||||
do_klass(CallSite_klass, java_lang_invoke_CallSite, Pre ) \
|
||||
do_klass(ConstantCallSite_klass, java_lang_invoke_ConstantCallSite, Pre ) \
|
||||
do_klass(MutableCallSite_klass, java_lang_invoke_MutableCallSite, Pre ) \
|
||||
do_klass(VolatileCallSite_klass, java_lang_invoke_VolatileCallSite, Pre ) \
|
||||
/* Note: MethodHandle must be first, and VolatileCallSite last in group */ \
|
||||
\
|
||||
do_klass(StringBuffer_klass, java_lang_StringBuffer, Pre ) \
|
||||
@ -204,7 +204,6 @@ class SystemDictionary : AllStatic {
|
||||
|
||||
enum InitOption {
|
||||
Pre, // preloaded; error if not present
|
||||
Pre_JSR292, // preloaded if EnableInvokeDynamic
|
||||
|
||||
// Order is significant. Options before this point require resolve_or_fail.
|
||||
// Options after this point will use resolve_or_null instead.
|
||||
@ -385,7 +384,6 @@ public:
|
||||
}
|
||||
|
||||
static Klass* check_klass_Pre( Klass* k) { return check_klass(k); }
|
||||
static Klass* check_klass_Pre_JSR292(Klass* k) { return EnableInvokeDynamic ? check_klass(k) : k; }
|
||||
static Klass* check_klass_Opt( Klass* k) { return k; }
|
||||
static Klass* check_klass_Opt_Only_JDK15(Klass* k) {
|
||||
assert(JDK_Version::is_gte_jdk15x_version(), "JDK 1.5 only");
|
||||
|
@ -2361,12 +2361,9 @@ void ClassVerifier::verify_invoke_instructions(
|
||||
// Get referenced class type
|
||||
VerificationType ref_class_type;
|
||||
if (opcode == Bytecodes::_invokedynamic) {
|
||||
if (!EnableInvokeDynamic ||
|
||||
_klass->major_version() < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
|
||||
if (_klass->major_version() < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
|
||||
class_format_error(
|
||||
(!EnableInvokeDynamic ?
|
||||
"invokedynamic instructions not enabled in this JVM" :
|
||||
"invokedynamic instructions not supported by this class file version"),
|
||||
"invokedynamic instructions not supported by this class file version",
|
||||
_klass->external_name());
|
||||
return;
|
||||
}
|
||||
|
@ -507,25 +507,8 @@ BytecodeInterpreter::run(interpreterState istate) {
|
||||
|
||||
#ifdef ASSERT
|
||||
if (istate->_msg != initialize) {
|
||||
// We have a problem here if we are running with a pre-hsx24 JDK (for example during bootstrap)
|
||||
// because in that case, EnableInvokeDynamic is true by default but will be later switched off
|
||||
// if java_lang_invoke_MethodHandle::compute_offsets() detects that the JDK only has the classes
|
||||
// for the old JSR292 implementation.
|
||||
// This leads to a situation where 'istate->_stack_limit' always accounts for
|
||||
// methodOopDesc::extra_stack_entries() because it is computed in
|
||||
// CppInterpreterGenerator::generate_compute_interpreter_state() which was generated while
|
||||
// EnableInvokeDynamic was still true. On the other hand, istate->_method->max_stack() doesn't
|
||||
// account for extra_stack_entries() anymore because at the time when it is called
|
||||
// EnableInvokeDynamic was already set to false.
|
||||
// So we have a second version of the assertion which handles the case where EnableInvokeDynamic was
|
||||
// switched off because of the wrong classes.
|
||||
if (EnableInvokeDynamic || FLAG_IS_CMDLINE(EnableInvokeDynamic)) {
|
||||
assert(labs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + 1), "bad stack limit");
|
||||
} else {
|
||||
const int extra_stack_entries = Method::extra_stack_entries_for_jsr292;
|
||||
assert(labs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + extra_stack_entries
|
||||
+ 1), "bad stack limit");
|
||||
}
|
||||
assert(labs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + 1), "bad stack limit");
|
||||
}
|
||||
#ifndef SHARK
|
||||
IA32_ONLY(assert(istate->_stack_limit == istate->_thread->last_Java_sp() + 1, "wrong"));
|
||||
#endif // !SHARK
|
||||
@ -2458,15 +2441,6 @@ run:
|
||||
|
||||
CASE(_invokedynamic): {
|
||||
|
||||
if (!EnableInvokeDynamic) {
|
||||
// We should not encounter this bytecode if !EnableInvokeDynamic.
|
||||
// The verifier will stop it. However, if we get past the verifier,
|
||||
// this will stop the thread in a reasonable way, without crashing the JVM.
|
||||
CALL_VM(InterpreterRuntime::throw_IncompatibleClassChangeError(THREAD),
|
||||
handle_exception);
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
|
||||
u4 index = Bytes::get_native_u4(pc+1);
|
||||
ConstantPoolCacheEntry* cache = cp->constant_pool()->invokedynamic_cp_cache_entry_at(index);
|
||||
|
||||
@ -2501,10 +2475,6 @@ run:
|
||||
|
||||
CASE(_invokehandle): {
|
||||
|
||||
if (!EnableInvokeDynamic) {
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
|
||||
u2 index = Bytes::get_native_u2(pc+1);
|
||||
ConstantPoolCacheEntry* cache = cp->entry_at(index);
|
||||
|
||||
|
@ -224,7 +224,7 @@ class Bytecodes: AllStatic {
|
||||
_invokespecial = 183, // 0xb7
|
||||
_invokestatic = 184, // 0xb8
|
||||
_invokeinterface = 185, // 0xb9
|
||||
_invokedynamic = 186, // 0xba // if EnableInvokeDynamic
|
||||
_invokedynamic = 186, // 0xba
|
||||
_new = 187, // 0xbb
|
||||
_newarray = 188, // 0xbc
|
||||
_anewarray = 189, // 0xbd
|
||||
|
@ -769,7 +769,6 @@ IRT_END
|
||||
|
||||
// First time execution: Resolve symbols, create a permanent MethodType object.
|
||||
IRT_ENTRY(void, InterpreterRuntime::resolve_invokehandle(JavaThread* thread)) {
|
||||
assert(EnableInvokeDynamic, "");
|
||||
const Bytecodes::Code bytecode = Bytecodes::_invokehandle;
|
||||
|
||||
// resolve method
|
||||
@ -789,7 +788,6 @@ IRT_END
|
||||
|
||||
// First time execution: Resolve symbols, create a permanent CallSite object.
|
||||
IRT_ENTRY(void, InterpreterRuntime::resolve_invokedynamic(JavaThread* thread)) {
|
||||
assert(EnableInvokeDynamic, "");
|
||||
const Bytecodes::Code bytecode = Bytecodes::_invokedynamic;
|
||||
|
||||
//TO DO: consider passing BCI to Java.
|
||||
|
@ -270,7 +270,7 @@ void LinkResolver::lookup_method_in_klasses(methodHandle& result, KlassHandle kl
|
||||
}
|
||||
}
|
||||
|
||||
if (checkpolymorphism && EnableInvokeDynamic && result_oop != NULL) {
|
||||
if (checkpolymorphism && result_oop != NULL) {
|
||||
vmIntrinsics::ID iid = result_oop->intrinsic_id();
|
||||
if (MethodHandles::is_signature_polymorphic(iid)) {
|
||||
// Do not link directly to these. The VM must produce a synthetic one using lookup_polymorphic_method.
|
||||
@ -345,8 +345,7 @@ void LinkResolver::lookup_polymorphic_method(methodHandle& result,
|
||||
vmIntrinsics::name_at(iid), klass->external_name(),
|
||||
name->as_C_string(), full_signature->as_C_string());
|
||||
}
|
||||
if (EnableInvokeDynamic &&
|
||||
klass() == SystemDictionary::MethodHandle_klass() &&
|
||||
if (klass() == SystemDictionary::MethodHandle_klass() &&
|
||||
iid != vmIntrinsics::_none) {
|
||||
if (MethodHandles::is_signature_polymorphic_intrinsic(iid)) {
|
||||
// Most of these do not need an up-call to Java to resolve, so can be done anywhere.
|
||||
@ -1543,7 +1542,6 @@ void LinkResolver::resolve_invokeinterface(CallInfo& result, Handle recv, consta
|
||||
|
||||
|
||||
void LinkResolver::resolve_invokehandle(CallInfo& result, constantPoolHandle pool, int index, TRAPS) {
|
||||
assert(EnableInvokeDynamic, "");
|
||||
// This guy is reached from InterpreterRuntime::resolve_invokehandle.
|
||||
KlassHandle resolved_klass;
|
||||
Symbol* method_name = NULL;
|
||||
@ -1575,8 +1573,6 @@ void LinkResolver::resolve_handle_call(CallInfo& result, KlassHandle resolved_kl
|
||||
|
||||
|
||||
void LinkResolver::resolve_invokedynamic(CallInfo& result, constantPoolHandle pool, int index, TRAPS) {
|
||||
assert(EnableInvokeDynamic, "");
|
||||
|
||||
//resolve_pool(<resolved_klass>, method_name, method_signature, current_klass, pool, index, CHECK);
|
||||
Symbol* method_name = pool->name_ref_at(index);
|
||||
Symbol* method_signature = pool->signature_ref_at(index);
|
||||
|
@ -1827,9 +1827,7 @@ void ConstantPool::set_on_stack(const bool value) {
|
||||
// We can't do this during classfile parsing, which is how the other indexes are
|
||||
// patched. The other patches are applied early for some error checking
|
||||
// so only defer the pseudo_strings.
|
||||
void ConstantPool::patch_resolved_references(
|
||||
GrowableArray<Handle>* cp_patches) {
|
||||
assert(EnableInvokeDynamic, "");
|
||||
void ConstantPool::patch_resolved_references(GrowableArray<Handle>* cp_patches) {
|
||||
for (int index = 1; index < cp_patches->length(); index++) { // Index 0 is unused
|
||||
Handle patch = cp_patches->at(index);
|
||||
if (patch.not_null()) {
|
||||
|
@ -413,9 +413,9 @@ class ConstantPool : public Metadata {
|
||||
// Version that can be used before string oop array is created.
|
||||
oop uncached_string_at(int which, TRAPS);
|
||||
|
||||
// A "pseudo-string" is an non-string oop that has found is way into
|
||||
// A "pseudo-string" is an non-string oop that has found its way into
|
||||
// a String entry.
|
||||
// Under EnableInvokeDynamic this can happen if the user patches a live
|
||||
// This can happen if the user patches a live
|
||||
// object into a CONSTANT_String entry of an anonymous class.
|
||||
// Method oops internally created for method handles may also
|
||||
// use pseudo-strings to link themselves to related metaobjects.
|
||||
@ -441,7 +441,6 @@ class ConstantPool : public Metadata {
|
||||
}
|
||||
|
||||
void pseudo_string_at_put(int which, int obj_index, oop x) {
|
||||
assert(EnableInvokeDynamic, "");
|
||||
assert(tag_at(which).is_string(), "Corrupted constant pool");
|
||||
unresolved_string_at_put(which, NULL); // indicates patched string
|
||||
string_at_put(which, obj_index, x); // this works just fine
|
||||
|
@ -2398,7 +2398,6 @@ const char* InstanceKlass::signature_name() const {
|
||||
|
||||
// If this is an anonymous class, append a hash to make the name unique
|
||||
if (is_anonymous()) {
|
||||
assert(EnableInvokeDynamic, "EnableInvokeDynamic was not set.");
|
||||
intptr_t hash = (java_mirror() != NULL) ? java_mirror()->identity_hash() : 0;
|
||||
sprintf(hash_buf, "/" UINTX_FORMAT, (uintx)hash);
|
||||
hash_len = (int)strlen(hash_buf);
|
||||
|
@ -543,7 +543,6 @@ const char* Klass::external_name() const {
|
||||
if (oop_is_instance()) {
|
||||
InstanceKlass* ik = (InstanceKlass*) this;
|
||||
if (ik->is_anonymous()) {
|
||||
assert(EnableInvokeDynamic, "");
|
||||
intptr_t hash = 0;
|
||||
if (ik->java_mirror() != NULL) {
|
||||
// java_mirror might not be created yet, return 0 as hash.
|
||||
|
@ -661,7 +661,7 @@ class Method : public Metadata {
|
||||
// this operates only on invoke methods:
|
||||
// presize interpreter frames for extra interpreter stack entries, if needed
|
||||
// Account for the extra appendix argument for invokehandle/invokedynamic
|
||||
static int extra_stack_entries() { return EnableInvokeDynamic ? extra_stack_entries_for_jsr292 : 0; }
|
||||
static int extra_stack_entries() { return extra_stack_entries_for_jsr292; }
|
||||
static int extra_stack_words(); // = extra_stack_entries() * Interpreter::stackElementSize
|
||||
|
||||
// RedefineClasses() support:
|
||||
|
@ -851,7 +851,7 @@ void JvmtiClassFileReconstituter::copy_bytecodes(methodHandle mh,
|
||||
"sanity check");
|
||||
|
||||
int cpci = Bytes::get_native_u2(bcp+1);
|
||||
bool is_invokedynamic = (EnableInvokeDynamic && code == Bytecodes::_invokedynamic);
|
||||
bool is_invokedynamic = (code == Bytecodes::_invokedynamic);
|
||||
ConstantPoolCacheEntry* entry;
|
||||
if (is_invokedynamic) {
|
||||
cpci = Bytes::get_native_u4(bcp+1);
|
||||
|
@ -59,7 +59,7 @@ MethodHandlesAdapterBlob* MethodHandles::_adapter_code = NULL;
|
||||
// MethodHandles::generate_adapters
|
||||
//
|
||||
void MethodHandles::generate_adapters() {
|
||||
if (!EnableInvokeDynamic || SystemDictionary::MethodHandle_klass() == NULL) return;
|
||||
if (SystemDictionary::MethodHandle_klass() == NULL) return;
|
||||
|
||||
assert(_adapter_code == NULL, "generate only once");
|
||||
|
||||
@ -98,7 +98,7 @@ void MethodHandlesAdapterGenerator::generate() {
|
||||
|
||||
void MethodHandles::set_enabled(bool z) {
|
||||
if (_enabled != z) {
|
||||
guarantee(z && EnableInvokeDynamic, "can only enable once, and only if -XX:+EnableInvokeDynamic");
|
||||
guarantee(z, "can only enable once");
|
||||
_enabled = z;
|
||||
}
|
||||
}
|
||||
@ -1374,11 +1374,6 @@ static bool register_natives(JNIEnv* env, jclass clazz, const JNINativeMethod* m
|
||||
* This one function is exported, used by NativeLookup.
|
||||
*/
|
||||
JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) {
|
||||
if (!EnableInvokeDynamic) {
|
||||
warning("JSR 292 is disabled in this JVM. Use -XX:+UnlockDiagnosticVMOptions -XX:+EnableInvokeDynamic to enable.");
|
||||
return; // bind nothing
|
||||
}
|
||||
|
||||
assert(!MethodHandles::enabled(), "must not be enabled");
|
||||
bool enable_MH = true;
|
||||
|
||||
|
@ -1727,14 +1727,10 @@ JVM_ENTRY(void, JVM_RegisterUnsafeMethods(JNIEnv *env, jclass unsafecls))
|
||||
}
|
||||
|
||||
// Unsafe.defineAnonymousClass
|
||||
if (EnableInvokeDynamic) {
|
||||
register_natives("1.7 define anonymous class method", env, unsafecls, anonk_methods, sizeof(anonk_methods)/sizeof(JNINativeMethod));
|
||||
}
|
||||
register_natives("1.7 define anonymous class method", env, unsafecls, anonk_methods, sizeof(anonk_methods)/sizeof(JNINativeMethod));
|
||||
|
||||
// Unsafe.shouldBeInitialized
|
||||
if (EnableInvokeDynamic) {
|
||||
register_natives("1.7 LambdaForm support", env, unsafecls, lform_methods, sizeof(lform_methods)/sizeof(JNINativeMethod));
|
||||
}
|
||||
register_natives("1.7 LambdaForm support", env, unsafecls, lform_methods, sizeof(lform_methods)/sizeof(JNINativeMethod));
|
||||
|
||||
// Fence methods
|
||||
register_natives("1.8 fence methods", env, unsafecls, fence_methods, sizeof(fence_methods)/sizeof(JNINativeMethod));
|
||||
|
@ -3638,19 +3638,9 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
|
||||
}
|
||||
#endif // PRODUCT
|
||||
|
||||
// JSR 292 is not supported before 1.7
|
||||
if (!JDK_Version::is_gte_jdk17x_version()) {
|
||||
if (EnableInvokeDynamic) {
|
||||
if (!FLAG_IS_DEFAULT(EnableInvokeDynamic)) {
|
||||
warning("JSR 292 is not supported before 1.7. Disabling support.");
|
||||
}
|
||||
EnableInvokeDynamic = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (EnableInvokeDynamic && ScavengeRootsInCode == 0) {
|
||||
if (ScavengeRootsInCode == 0) {
|
||||
if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) {
|
||||
warning("forcing ScavengeRootsInCode non-zero because EnableInvokeDynamic is true");
|
||||
warning("forcing ScavengeRootsInCode non-zero");
|
||||
}
|
||||
ScavengeRootsInCode = 1;
|
||||
}
|
||||
|
@ -3784,10 +3784,6 @@ class CommandLineFlags {
|
||||
NOT_LP64(LINUX_ONLY(2*G) NOT_LINUX(0)), \
|
||||
"Address to allocate shared memory region for class data") \
|
||||
\
|
||||
diagnostic(bool, EnableInvokeDynamic, true, \
|
||||
"support JSR 292 (method handles, invokedynamic, " \
|
||||
"anonymous classes") \
|
||||
\
|
||||
diagnostic(bool, PrintMethodHandleStubs, false, \
|
||||
"Print generated stub code for method handles") \
|
||||
\
|
||||
|
@ -3602,9 +3602,7 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
|
||||
// It is done after compilers are initialized, because otherwise compilations of
|
||||
// signature polymorphic MH intrinsics can be missed
|
||||
// (see SystemDictionary::find_method_handle_intrinsic).
|
||||
if (EnableInvokeDynamic) {
|
||||
initialize_jsr292_core_classes(CHECK_JNI_ERR);
|
||||
}
|
||||
initialize_jsr292_core_classes(CHECK_JNI_ERR);
|
||||
|
||||
#if INCLUDE_MANAGEMENT
|
||||
Management::initialize(THREAD);
|
||||
|
Loading…
Reference in New Issue
Block a user