Skip to content

Commit 0570cc1

Browse files
committed
8254855: Clean up and remove unused code in vmIntrinsics
Reviewed-by: kbarrett, iklam, kvn
1 parent 1742c44 commit 0570cc1

File tree

2 files changed

+5
-122
lines changed

2 files changed

+5
-122
lines changed

src/hotspot/share/classfile/vmIntrinsics.cpp

Lines changed: 2 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -59,53 +59,6 @@ inline bool match_F_SN(jshort flags) {
5959
return (flags & (req | neg)) == req;
6060
}
6161

62-
inline bool match_F_RNY(jshort flags) {
63-
const int req = JVM_ACC_NATIVE | JVM_ACC_SYNCHRONIZED;
64-
const int neg = JVM_ACC_STATIC;
65-
return (flags & (req | neg)) == req;
66-
}
67-
68-
static vmIntrinsics::ID wrapper_intrinsic(BasicType type, bool unboxing) {
69-
#define TYPE2(type, unboxing) ((int)(type)*2 + ((unboxing) ? 1 : 0))
70-
switch (TYPE2(type, unboxing)) {
71-
#define BASIC_TYPE_CASE(type, box, unbox) \
72-
case TYPE2(type, false): return vmIntrinsics::box; \
73-
case TYPE2(type, true): return vmIntrinsics::unbox
74-
BASIC_TYPE_CASE(T_BOOLEAN, _Boolean_valueOf, _booleanValue);
75-
BASIC_TYPE_CASE(T_BYTE, _Byte_valueOf, _byteValue);
76-
BASIC_TYPE_CASE(T_CHAR, _Character_valueOf, _charValue);
77-
BASIC_TYPE_CASE(T_SHORT, _Short_valueOf, _shortValue);
78-
BASIC_TYPE_CASE(T_INT, _Integer_valueOf, _intValue);
79-
BASIC_TYPE_CASE(T_LONG, _Long_valueOf, _longValue);
80-
BASIC_TYPE_CASE(T_FLOAT, _Float_valueOf, _floatValue);
81-
BASIC_TYPE_CASE(T_DOUBLE, _Double_valueOf, _doubleValue);
82-
#undef BASIC_TYPE_CASE
83-
}
84-
#undef TYPE2
85-
return vmIntrinsics::_none;
86-
}
87-
88-
vmIntrinsics::ID vmIntrinsics::for_boxing(BasicType type) {
89-
return wrapper_intrinsic(type, false);
90-
}
91-
vmIntrinsics::ID vmIntrinsics::for_unboxing(BasicType type) {
92-
return wrapper_intrinsic(type, true);
93-
}
94-
95-
vmIntrinsics::ID vmIntrinsics::for_raw_conversion(BasicType src, BasicType dest) {
96-
#define SRC_DEST(s,d) (((int)(s) << 4) + (int)(d))
97-
switch (SRC_DEST(src, dest)) {
98-
case SRC_DEST(T_INT, T_FLOAT): return vmIntrinsics::_intBitsToFloat;
99-
case SRC_DEST(T_FLOAT, T_INT): return vmIntrinsics::_floatToRawIntBits;
100-
101-
case SRC_DEST(T_LONG, T_DOUBLE): return vmIntrinsics::_longBitsToDouble;
102-
case SRC_DEST(T_DOUBLE, T_LONG): return vmIntrinsics::_doubleToRawLongBits;
103-
}
104-
#undef SRC_DEST
105-
106-
return vmIntrinsics::_none;
107-
}
108-
10962
bool vmIntrinsics::preserves_state(vmIntrinsics::ID id) {
11063
assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
11164
switch(id) {
@@ -731,7 +684,6 @@ const char* vmIntrinsics::short_name_as_C_string(vmIntrinsics::ID id, char* buf,
731684
case F_RN: fname = "native "; break;
732685
case F_SN: fname = "native static "; break;
733686
case F_S: fname = "static "; break;
734-
case F_RNY:fname = "native synchronized "; break;
735687
default: break;
736688
}
737689
const char* kptr = strrchr(kname, JVM_SIGNATURE_SLASH);
@@ -749,6 +701,7 @@ const char* vmIntrinsics::short_name_as_C_string(vmIntrinsics::ID id, char* buf,
749701

750702
#define ID4(x, y, z, f) ((ID3(x, y, z) << vmIntrinsics::log2_FLAG_LIMIT) | (jlong) (f))
751703

704+
#ifdef ASSERT
752705
static const jlong intrinsic_info_array[vmIntrinsics::ID_LIMIT+1] = {
753706
#define VM_INTRINSIC_INFO(ignore_id, klass, name, sig, fcode) \
754707
ID4(SID_ENUM(klass), SID_ENUM(name), SID_ENUM(sig), vmIntrinsics::fcode),
@@ -790,66 +743,4 @@ vmIntrinsics::Flags vmIntrinsics::flags_for(vmIntrinsics::ID id) {
790743
assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 15, "");
791744
return Flags( (info >> shift) & mask );
792745
}
793-
794-
795-
#ifndef PRODUCT
796-
// verify_method performs an extra check on a matched intrinsic method
797-
798-
static bool match_method(Method* m, Symbol* n, Symbol* s) {
799-
return (m->name() == n &&
800-
m->signature() == s);
801-
}
802-
803-
static vmIntrinsics::ID match_method_with_klass(Method* m, Symbol* mk) {
804-
#define VM_INTRINSIC_MATCH(id, klassname, namepart, sigpart, flags) \
805-
{ Symbol* k = vmSymbols::klassname(); \
806-
if (mk == k) { \
807-
Symbol* n = vmSymbols::namepart(); \
808-
Symbol* s = vmSymbols::sigpart(); \
809-
if (match_method(m, n, s)) \
810-
return vmIntrinsics::id; \
811-
} }
812-
VM_INTRINSICS_DO(VM_INTRINSIC_MATCH,
813-
VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE);
814-
return vmIntrinsics::_none;
815-
#undef VM_INTRINSIC_MATCH
816-
}
817-
818-
void vmIntrinsics::verify_method(ID actual_id, Method* m) {
819-
Symbol* mk = m->method_holder()->name();
820-
ID declared_id = match_method_with_klass(m, mk);
821-
822-
if (declared_id == actual_id) return; // success
823-
824-
if (declared_id == _none && actual_id != _none && mk == vmSymbols::java_lang_StrictMath()) {
825-
// Here are a few special cases in StrictMath not declared in vmSymbols.hpp.
826-
switch (actual_id) {
827-
case _min:
828-
case _max:
829-
case _dsqrt:
830-
declared_id = match_method_with_klass(m, vmSymbols::java_lang_Math());
831-
if (declared_id == actual_id) return; // acceptable alias
832-
break;
833-
default:
834-
break;
835-
}
836-
}
837-
838-
const char* declared_name = name_at(declared_id);
839-
const char* actual_name = name_at(actual_id);
840-
m = NULL;
841-
ttyLocker ttyl;
842-
if (xtty != NULL) {
843-
xtty->begin_elem("intrinsic_misdeclared actual='%s' declared='%s'",
844-
actual_name, declared_name);
845-
xtty->method(m);
846-
xtty->end_elem("%s", "");
847-
}
848-
if (PrintMiscellaneous && (WizardMode || Verbose)) {
849-
tty->print_cr("*** misidentified method; %s(%d) should be %s(%d):",
850-
declared_name, declared_id, actual_name, actual_id);
851-
m->print_short_name(tty);
852-
tty->cr();
853-
}
854-
}
855-
#endif //PRODUCT
746+
#endif // ASSERT

src/hotspot/share/classfile/vmIntrinsics.hpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,12 +1036,11 @@ class vmIntrinsics : AllStatic {
10361036
F_Y, // !static ?native synchronized
10371037
F_RN, // !static native !synchronized
10381038
F_SN, // static native !synchronized
1039-
F_RNY, // !static native synchronized
10401039

10411040
FLAG_LIMIT
10421041
};
10431042
enum {
1044-
log2_FLAG_LIMIT = 4 // checked by an assert at start-up
1043+
log2_FLAG_LIMIT = 3 // checked by an assert at start-up
10451044
};
10461045

10471046
public:
@@ -1079,23 +1078,16 @@ class vmIntrinsics : AllStatic {
10791078
return id;
10801079
}
10811080

1082-
static void verify_method(ID actual_id, Method* m) PRODUCT_RETURN;
1083-
1081+
#ifdef ASSERT
10841082
// Find out the symbols behind an intrinsic:
10851083
static vmSymbolID class_for(ID id);
10861084
static vmSymbolID name_for(ID id);
10871085
static vmSymbolID signature_for(ID id);
10881086
static Flags flags_for(ID id);
1087+
#endif
10891088

10901089
static const char* short_name_as_C_string(ID id, char* buf, int size);
10911090

1092-
// Wrapper object methods:
1093-
static ID for_boxing(BasicType type);
1094-
static ID for_unboxing(BasicType type);
1095-
1096-
// Raw conversion:
1097-
static ID for_raw_conversion(BasicType src, BasicType dest);
1098-
10991091
// The methods below provide information related to compiling intrinsics.
11001092

11011093
// (1) Information needed by the C1 compiler.

0 commit comments

Comments
 (0)