Skip to content
Permalink
Browse files
8256254: Convert vmIntrinsics::ID to enum class
Reviewed-by: redestad, kvn
  • Loading branch information
iklam committed Dec 1, 2020
1 parent b5ce8af commit f48737c7b39acbf2556ceca016fda7b8de4f7254
Showing with 199 additions and 124 deletions.
  1. +1 −1 src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp
  2. +1 −1 src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp
  3. +1 −1 src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp
  4. +1 −1 src/hotspot/cpu/arm/methodHandles_arm.cpp
  5. +1 −1 src/hotspot/cpu/arm/sharedRuntime_arm.cpp
  6. +1 −1 src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp
  7. +1 −1 src/hotspot/cpu/ppc/methodHandles_ppc.cpp
  8. +1 −1 src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
  9. +2 −2 src/hotspot/cpu/s390/interp_masm_s390.cpp
  10. +1 −1 src/hotspot/cpu/s390/methodHandles_s390.cpp
  11. +1 −1 src/hotspot/cpu/x86/interp_masm_x86.cpp
  12. +1 −1 src/hotspot/cpu/x86/methodHandles_x86.cpp
  13. +1 −1 src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp
  14. +1 −1 src/hotspot/share/c1/c1_GraphBuilder.cpp
  15. +3 −3 src/hotspot/share/c1/c1_Optimizer.cpp
  16. +1 −0 src/hotspot/share/classfile/classFileError.cpp
  17. +4 −4 src/hotspot/share/classfile/classFileParser.cpp
  18. +1 −0 src/hotspot/share/classfile/classListParser.cpp
  19. +1 −0 src/hotspot/share/classfile/defaultMethods.cpp
  20. +1 −0 src/hotspot/share/classfile/packageEntry.cpp
  21. +1 −0 src/hotspot/share/classfile/stackMapFrame.cpp
  22. +8 −7 src/hotspot/share/classfile/systemDictionary.cpp
  23. +2 −1 src/hotspot/share/classfile/systemDictionary.hpp
  24. +1 −0 src/hotspot/share/classfile/verificationType.cpp
  25. +26 −23 src/hotspot/share/classfile/vmIntrinsics.cpp
  26. +72 −28 src/hotspot/share/classfile/vmIntrinsics.hpp
  27. +5 −5 src/hotspot/share/compiler/compilerDirectives.cpp
  28. +1 −1 src/hotspot/share/compiler/compilerDirectives.hpp
  29. +1 −0 src/hotspot/share/compiler/methodMatcher.cpp
  30. +3 −2 src/hotspot/share/interpreter/abstractInterpreter.cpp
  31. +4 −3 src/hotspot/share/interpreter/abstractInterpreter.hpp
  32. +1 −0 src/hotspot/share/interpreter/bytecodeUtils.cpp
  33. +1 −0 src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleDescription.cpp
  34. +1 −0 src/hotspot/share/jfr/recorder/service/jfrRecorderThread.cpp
  35. +4 −2 src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp
  36. +2 −1 src/hotspot/share/memory/filemap.cpp
  37. +1 −0 src/hotspot/share/memory/metaspaceShared.cpp
  38. +1 −0 src/hotspot/share/oops/generateOopMap.cpp
  39. +1 −0 src/hotspot/share/oops/instanceKlass.inline.hpp
  40. +2 −2 src/hotspot/share/oops/method.cpp
  41. +3 −4 src/hotspot/share/oops/method.hpp
  42. +1 −1 src/hotspot/share/opto/callGenerator.cpp
  43. +18 −14 src/hotspot/share/opto/compile.cpp
  44. +2 −2 src/hotspot/share/opto/compile.hpp
  45. +2 −2 src/hotspot/share/opto/library_call.cpp
  46. +1 −1 src/hotspot/share/opto/library_call.hpp
  47. +1 −0 src/hotspot/share/prims/foreign_globals.cpp
  48. +3 −3 src/hotspot/share/prims/methodHandles.cpp
  49. +1 −0 src/hotspot/share/prims/vectorSupport.cpp
  50. +1 −0 src/hotspot/share/runtime/monitorDeflationThread.cpp
  51. +1 −0 src/hotspot/share/runtime/signature.cpp
  52. +1 −0 src/hotspot/share/utilities/vmEnums.hpp
@@ -1783,7 +1783,7 @@ void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret,
br(Assembler::EQ, do_profile);
get_method(tmp);
ldrh(rscratch1, Address(tmp, Method::intrinsic_id_offset_in_bytes()));
subs(zr, rscratch1, vmIntrinsics::_compiledLambdaForm);
subs(zr, rscratch1, static_cast<int>(vmIntrinsics::_compiledLambdaForm));
br(Assembler::NE, profile_continue);

bind(do_profile);
@@ -424,7 +424,7 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
}

default:
fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid));
fatal("unexpected intrinsic %d: %s", vmIntrinsics::as_int(iid), vmIntrinsics::name_at(iid));
break;
}

@@ -1198,7 +1198,7 @@ static void gen_special_dispatch(MacroAssembler* masm,
} else if (iid == vmIntrinsics::_invokeBasic || iid == vmIntrinsics::_linkToNative) {
has_receiver = true;
} else {
fatal("unexpected intrinsic id %d", iid);
fatal("unexpected intrinsic id %d", vmIntrinsics::as_int(iid));
}

if (member_reg != noreg) {
@@ -435,7 +435,7 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
}

default:
fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid));
fatal("unexpected intrinsic %d: %s", vmIntrinsics::as_int(iid), vmIntrinsics::name_at(iid));
break;
}

@@ -701,7 +701,7 @@ static void gen_special_dispatch(MacroAssembler* masm,
} else if (iid == vmIntrinsics::_invokeBasic) {
has_receiver = true;
} else {
fatal("unexpected intrinsic id %d", iid);
fatal("unexpected intrinsic id %d", vmIntrinsics::as_int(iid));
}

if (member_reg != noreg) {
@@ -1919,7 +1919,7 @@ void InterpreterMacroAssembler::profile_return_type(Register ret, Register tmp1,
cmpwi(CCR0, tmp1, Bytecodes::_invokedynamic);
cmpwi(CCR1, tmp1, Bytecodes::_invokehandle);
cror(CCR0, Assembler::equal, CCR1, Assembler::equal);
cmpwi(CCR1, tmp2, vmIntrinsics::_compiledLambdaForm);
cmpwi(CCR1, tmp2, static_cast<int>(vmIntrinsics::_compiledLambdaForm));
cror(CCR0, Assembler::equal, CCR1, Assembler::equal);
bne(CCR0, profile_continue);
}
@@ -458,7 +458,7 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
}

default:
fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid));
fatal("unexpected intrinsic %d: %s", vmIntrinsics::as_int(iid), vmIntrinsics::name_at(iid));
break;
}

@@ -1621,7 +1621,7 @@ static void gen_special_dispatch(MacroAssembler* masm,
} else if (iid == vmIntrinsics::_invokeBasic || iid == vmIntrinsics::_linkToNative) {
has_receiver = true;
} else {
fatal("unexpected intrinsic id %d", iid);
fatal("unexpected intrinsic id %d", vmIntrinsics::as_int(iid));
}

if (member_reg != noreg) {
@@ -1806,11 +1806,11 @@ void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret,
get_method(tmp);
// Supplement to 8139891: _intrinsic_id exceeded 1-byte size limit.
if (Method::intrinsic_id_size_in_bytes() == 1) {
z_cli(Method::intrinsic_id_offset_in_bytes(), tmp, vmIntrinsics::_compiledLambdaForm);
z_cli(Method::intrinsic_id_offset_in_bytes(), tmp, static_cast<int>(vmIntrinsics::_compiledLambdaForm));
} else {
assert(Method::intrinsic_id_size_in_bytes() == 2, "size error: check Method::_intrinsic_id");
z_lh(tmp, Method::intrinsic_id_offset_in_bytes(), Z_R0, tmp);
z_chi(tmp, vmIntrinsics::_compiledLambdaForm);
z_chi(tmp, static_cast<int>(vmIntrinsics::_compiledLambdaForm));
}
z_brne(profile_continue);

@@ -532,7 +532,7 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
}

default:
fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid));
fatal("unexpected intrinsic %d: %s", vmIntrinsics::as_int(iid), vmIntrinsics::name_at(iid));
break;
}

@@ -190,7 +190,7 @@ void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret,
cmpb(Address(_bcp_register, 0), Bytecodes::_invokehandle);
jcc(Assembler::equal, do_profile);
get_method(tmp);
cmpw(Address(tmp, Method::intrinsic_id_offset_in_bytes()), vmIntrinsics::_compiledLambdaForm);
cmpw(Address(tmp, Method::intrinsic_id_offset_in_bytes()), static_cast<int>(vmIntrinsics::_compiledLambdaForm));
jcc(Assembler::notEqual, profile_continue);

bind(do_profile);
@@ -478,7 +478,7 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
}

default:
fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid));
fatal("unexpected intrinsic %d: %s", vmIntrinsics::as_int(iid), vmIntrinsics::name_at(iid));
break;
}

@@ -1646,7 +1646,7 @@ static void gen_special_dispatch(MacroAssembler* masm,
} else if (iid == vmIntrinsics::_invokeBasic || iid == vmIntrinsics::_linkToNative) {
has_receiver = true;
} else {
fatal("unexpected intrinsic id %d", iid);
fatal("unexpected intrinsic id %d", vmIntrinsics::as_int(iid));
}

if (member_reg != noreg) {
@@ -4133,7 +4133,7 @@ bool GraphBuilder::try_method_handle_inline(ciMethod* callee, bool ignore_return
break; // TODO: NYI

default:
fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid));
fatal("unexpected intrinsic %d: %s", vmIntrinsics::as_int(iid), vmIntrinsics::name_at(iid));
break;
}
set_state(state_before->copy_for_parsing());
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. 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
@@ -1102,13 +1102,13 @@ void NullCheckEliminator::handle_Intrinsic(Intrinsic* x) {
if (set_contains(recv)) {
// Value is non-null => update Intrinsic
if (PrintNullCheckElimination) {
tty->print_cr("Eliminated Intrinsic %d's null check for value %d", x->id(), recv->id());
tty->print_cr("Eliminated Intrinsic %d's null check for value %d", vmIntrinsics::as_int(x->id()), recv->id());
}
x->set_needs_null_check(false);
} else {
set_put(recv);
if (PrintNullCheckElimination) {
tty->print_cr("Intrinsic %d of value %d proves value to be non-null", x->id(), recv->id());
tty->print_cr("Intrinsic %d of value %d proves value to be non-null", vmIntrinsics::as_int(x->id()), recv->id());
}
// Ensure previous passes do not cause wrong state
x->set_needs_null_check(true);
@@ -26,6 +26,7 @@
#include "classfile/classFileParser.hpp"
#include "classfile/stackMapTable.hpp"
#include "classfile/verifier.hpp"
#include "classfile/vmSymbols.hpp"
#include "memory/resourceArea.hpp"

// Keep these in a separate file to prevent inlining
@@ -5287,15 +5287,16 @@ static void check_methods_for_intrinsics(const InstanceKlass* ik,
// The check is potentially expensive, therefore it is available
// only in debug builds.

for (int id = vmIntrinsics::FIRST_ID; id < (int)vmIntrinsics::ID_LIMIT; ++id) {
for (vmIntrinsicsIterator it = vmIntrinsicsRange.begin(); it != vmIntrinsicsRange.end(); ++it) {
vmIntrinsicID id = *it;
if (vmIntrinsics::_compiledLambdaForm == id) {
// The _compiledLamdbdaForm intrinsic is a special marker for bytecode
// generated for the JVM from a LambdaForm and therefore no method
// is defined for it.
continue;
}

if (vmIntrinsics::class_for(vmIntrinsics::ID_from(id)) == klass_id) {
if (vmIntrinsics::class_for(id) == klass_id) {
// Check if the current class contains a method with the same
// name, flags, signature.
bool match = false;
@@ -5311,8 +5312,7 @@ static void check_methods_for_intrinsics(const InstanceKlass* ik,
char buf[1000];
tty->print("Compiler intrinsic is defined for method [%s], "
"but the method is not available in class [%s].%s",
vmIntrinsics::short_name_as_C_string(vmIntrinsics::ID_from(id),
buf, sizeof(buf)),
vmIntrinsics::short_name_as_C_string(id, buf, sizeof(buf)),
ik->name()->as_C_string(),
NOT_DEBUG("") DEBUG_ONLY(" Exiting.")
);
@@ -32,6 +32,7 @@
#include "classfile/symbolTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/systemDictionaryShared.hpp"
#include "classfile/vmSymbols.hpp"
#include "interpreter/bytecode.hpp"
#include "interpreter/bytecodeStream.hpp"
#include "interpreter/linkResolver.hpp"
@@ -27,6 +27,7 @@
#include "classfile/defaultMethods.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
#include "logging/log.hpp"
#include "logging/logStream.hpp"
#include "memory/allocation.hpp"
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "classfile/moduleEntry.hpp"
#include "classfile/packageEntry.hpp"
#include "classfile/vmSymbols.hpp"
#include "logging/log.hpp"
#include "memory/archiveBuilder.hpp"
#include "memory/archiveUtils.hpp"
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "classfile/stackMapFrame.hpp"
#include "classfile/verifier.hpp"
#include "classfile/vmSymbols.hpp"
#include "memory/resourceArea.hpp"
#include "oops/oop.inline.hpp"
#include "oops/symbol.hpp"
@@ -2518,18 +2518,19 @@ Symbol* SystemDictionary::check_signature_loaders(Symbol* signature,
return NULL;
}

Method* SystemDictionary::find_method_handle_intrinsic(vmIntrinsics::ID iid,
Method* SystemDictionary::find_method_handle_intrinsic(vmIntrinsicID iid,
Symbol* signature,
TRAPS) {
methodHandle empty;
const int iid_as_int = vmIntrinsics::as_int(iid);
assert(MethodHandles::is_signature_polymorphic(iid) &&
MethodHandles::is_signature_polymorphic_intrinsic(iid) &&
iid != vmIntrinsics::_invokeGeneric,
"must be a known MH intrinsic iid=%d: %s", iid, vmIntrinsics::name_at(iid));
"must be a known MH intrinsic iid=%d: %s", iid_as_int, vmIntrinsics::name_at(iid));

unsigned int hash = invoke_method_table()->compute_hash(signature, iid);
unsigned int hash = invoke_method_table()->compute_hash(signature, iid_as_int);
int index = invoke_method_table()->hash_to_index(hash);
SymbolPropertyEntry* spe = invoke_method_table()->find_entry(index, hash, signature, iid);
SymbolPropertyEntry* spe = invoke_method_table()->find_entry(index, hash, signature, iid_as_int);
methodHandle m;
if (spe == NULL || spe->method() == NULL) {
spe = NULL;
@@ -2548,9 +2549,9 @@ Method* SystemDictionary::find_method_handle_intrinsic(vmIntrinsics::ID iid,
// if a racing thread has managed to install one at the same time.
{
MutexLocker ml(THREAD, SystemDictionary_lock);
spe = invoke_method_table()->find_entry(index, hash, signature, iid);
spe = invoke_method_table()->find_entry(index, hash, signature, iid_as_int);
if (spe == NULL)
spe = invoke_method_table()->add_entry(index, hash, signature, iid);
spe = invoke_method_table()->add_entry(index, hash, signature, iid_as_int);
if (spe->method() == NULL)
spe->set_method(m());
}
@@ -2701,7 +2702,7 @@ Handle SystemDictionary::find_method_handle_type(Symbol* signature,
Klass* accessing_klass,
TRAPS) {
Handle empty;
vmIntrinsics::ID null_iid = vmIntrinsics::_none; // distinct from all method handle invoker intrinsics
int null_iid = vmIntrinsics::as_int(vmIntrinsics::_none); // distinct from all method handle invoker intrinsics
unsigned int hash = invoke_method_table()->compute_hash(signature, null_iid);
int index = invoke_method_table()->hash_to_index(hash);
SymbolPropertyEntry* spe = invoke_method_table()->find_entry(index, hash, signature, null_iid);
@@ -28,6 +28,7 @@
#include "oops/oopHandle.hpp"
#include "runtime/handles.hpp"
#include "runtime/signature.hpp"
#include "utilities/vmEnums.hpp"

// The dictionary in each ClassLoaderData stores all loaded classes, either
// initiatied by its class loader or defined by its class loader:
@@ -463,7 +464,7 @@ class SystemDictionary : AllStatic {
TRAPS);
// for a given signature, find the internal MethodHandle method (linkTo* or invokeBasic)
// (does not ask Java, since this is a low-level intrinsic defined by the JVM)
static Method* find_method_handle_intrinsic(vmIntrinsics::ID iid,
static Method* find_method_handle_intrinsic(vmIntrinsicID iid,
Symbol* signature,
TRAPS);

@@ -27,6 +27,7 @@
#include "classfile/systemDictionaryShared.hpp"
#include "classfile/verificationType.hpp"
#include "classfile/verifier.hpp"
#include "classfile/vmSymbols.hpp"
#include "logging/log.hpp"
#include "oops/klass.inline.hpp"
#include "runtime/arguments.hpp"
Loading

1 comment on commit f48737c

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on f48737c Dec 1, 2020

Please sign in to comment.