Skip to content

Commit b1fb82a

Browse files
Merge branch 'master' into feat/Fold-layout-helper-check-for-objects-implementing-non-array-interfaces
2 parents 0467722 + d9f2e69 commit b1fb82a

File tree

25 files changed

+526
-147
lines changed

25 files changed

+526
-147
lines changed

Diff for: make/autoconf/lib-bundled.m4

+55-11
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,29 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBJPEG],
6262
6363
if test "x${with_libjpeg}" = "xbundled"; then
6464
USE_EXTERNAL_LIBJPEG=false
65+
LIBJPEG_CFLAGS=""
66+
LIBJPEG_LIBS=""
6567
elif test "x${with_libjpeg}" = "xsystem"; then
66-
AC_CHECK_HEADER(jpeglib.h, [],
67-
[ AC_MSG_ERROR([--with-libjpeg=system specified, but jpeglib.h not found!])])
68-
AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, [],
69-
[ AC_MSG_ERROR([--with-libjpeg=system specified, but no libjpeg found])])
70-
71-
USE_EXTERNAL_LIBJPEG=true
72-
LIBJPEG_LIBS="-ljpeg"
68+
PKG_CHECK_MODULES(LIBJPEG, libjpeg, [LIBJPEG_FOUND=yes], [LIBJPEG_FOUND=no])
69+
if test "x${LIBJPEG_FOUND}" = "xyes"; then
70+
# PKG_CHECK_MODULES will set LIBJPEG_CFLAGS and LIBJPEG_LIBS
71+
USE_EXTERNAL_LIBJPEG=true
72+
else
73+
AC_CHECK_HEADER(jpeglib.h, [],
74+
[ AC_MSG_ERROR([--with-libjpeg=system specified, but jpeglib.h not found!])])
75+
AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, [],
76+
[ AC_MSG_ERROR([--with-libjpeg=system specified, but no libjpeg found])])
77+
78+
USE_EXTERNAL_LIBJPEG=true
79+
LIBJPEG_CFLAGS=""
80+
LIBJPEG_LIBS="-ljpeg"
81+
fi
7382
else
7483
AC_MSG_ERROR([Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'])
7584
fi
7685
7786
AC_SUBST(USE_EXTERNAL_LIBJPEG)
87+
AC_SUBST(LIBJPEG_CFLAGS)
7888
AC_SUBST(LIBJPEG_LIBS)
7989
])
8090

@@ -85,6 +95,10 @@ AC_DEFUN_ONCE([LIB_SETUP_GIFLIB],
8595
[
8696
AC_ARG_WITH(giflib, [AS_HELP_STRING([--with-giflib],
8797
[use giflib from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
98+
AC_ARG_WITH(giflib-include, [AS_HELP_STRING([--with-giflib-include],
99+
[specify directory for the system giflib include files])])
100+
AC_ARG_WITH(giflib-lib, [AS_HELP_STRING([--with-giflib-lib],
101+
[specify directory for the system giflib library])])
88102
89103
AC_MSG_CHECKING([for which giflib to use])
90104
# default is bundled
@@ -97,11 +111,40 @@ AC_DEFUN_ONCE([LIB_SETUP_GIFLIB],
97111
98112
if test "x${with_giflib}" = "xbundled"; then
99113
USE_EXTERNAL_LIBGIF=false
114+
GIFLIB_CFLAGS=""
115+
GIFLIB_LIBS=""
100116
elif test "x${with_giflib}" = "xsystem"; then
101-
AC_CHECK_HEADER(gif_lib.h, [],
102-
[ AC_MSG_ERROR([--with-giflib=system specified, but gif_lib.h not found!])])
103-
AC_CHECK_LIB(gif, DGifGetCode, [],
104-
[ AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])])
117+
GIFLIB_H_FOUND=no
118+
if test "x${with_giflib_include}" != x; then
119+
GIFLIB_CFLAGS="-I${with_giflib_include}"
120+
GIFLIB_H_FOUND=yes
121+
fi
122+
if test "x$GIFLIB_H_FOUND" = xno; then
123+
AC_CHECK_HEADER(gif_lib.h,
124+
[
125+
GIFLIB_CFLAGS=""
126+
GIFLIB_H_FOUND=yes
127+
])
128+
fi
129+
if test "x$GIFLIB_H_FOUND" = xno; then
130+
AC_MSG_ERROR([--with-giflib=system specified, but gif_lib.h not found!])
131+
fi
132+
133+
GIFLIB_LIB_FOUND=no
134+
if test "x${with_giflib_lib}" != x; then
135+
GIFLIB_LIBS="-L${with_giflib_lib} -lgif"
136+
GIFLIB_LIB_FOUND=yes
137+
fi
138+
if test "x$GIFLIB_LIB_FOUND" = xno; then
139+
AC_CHECK_LIB(gif, DGifGetCode,
140+
[
141+
GIFLIB_LIBS="-lgif"
142+
GIFLIB_LIB_FOUND=yes
143+
])
144+
fi
145+
if test "x$GIFLIB_LIB_FOUND" = xno; then
146+
AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])
147+
fi
105148
106149
USE_EXTERNAL_LIBGIF=true
107150
GIFLIB_LIBS=-lgif
@@ -110,6 +153,7 @@ AC_DEFUN_ONCE([LIB_SETUP_GIFLIB],
110153
fi
111154
112155
AC_SUBST(USE_EXTERNAL_LIBGIF)
156+
AC_SUBST(GIFLIB_CFLAGS)
113157
AC_SUBST(GIFLIB_LIBS)
114158
])
115159

Diff for: make/autoconf/spec.gmk.template

+2
Original file line numberDiff line numberDiff line change
@@ -800,8 +800,10 @@ TAR_SUPPORTS_TRANSFORM := @TAR_SUPPORTS_TRANSFORM@
800800

801801
# Build setup
802802
USE_EXTERNAL_LIBJPEG := @USE_EXTERNAL_LIBJPEG@
803+
LIBJPEG_CFLAGS := @LIBJPEG_CFLAGS@
803804
LIBJPEG_LIBS := @LIBJPEG_LIBS@
804805
USE_EXTERNAL_LIBGIF := @USE_EXTERNAL_LIBGIF@
806+
GIFLIB_CFLAGS := @GIFLIB_CFLAGS@
805807
GIFLIB_LIBS := @GIFLIB_LIBS@
806808
USE_EXTERNAL_LIBZ := @USE_EXTERNAL_LIBZ@
807809
LIBZ_CFLAGS := @LIBZ_CFLAGS@

Diff for: src/hotspot/cpu/riscv/riscv_v.ad

+4-21
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@ source %{
8080
case Op_PopCountVI:
8181
case Op_ReverseBytesV:
8282
case Op_ReverseV:
83+
return UseZvbb;
8384
case Op_RotateLeftV:
8485
case Op_RotateRightV:
86+
if (bt != T_INT && bt != T_LONG) {
87+
return false;
88+
}
8589
return UseZvbb;
8690
case Op_LoadVectorGather:
8791
case Op_LoadVectorGatherMasked:
@@ -3413,27 +3417,6 @@ instruct vshiftcnt(vReg dst, iRegIorL2I cnt) %{
34133417
%}
34143418

34153419
// --------------------------------- Vector Rotation ----------------------------------
3416-
//
3417-
// Following rotate instruct's are shared by vectorization (in SLP, superword.cpp) and Vector API.
3418-
//
3419-
// Rotate behaviour in vectorization is defined by java API, which includes:
3420-
// 1. Integer.rorateRight, Integer.rorateLeft.
3421-
// `rotation by any multiple of 32 is a no-op, so all but the last five bits of the rotation distance can be ignored`.
3422-
// 2. Long.rorateRight, Long.rorateLeft.
3423-
// `rotation by any multiple of 64 is a no-op, so all but the last six bits of the rotation distance can be ignored`.
3424-
//
3425-
// Rotate behaviour in Vector API is defined as below, e.g.
3426-
// 1. For Byte ROR, `a ROR b` is: (byte)(((((byte)a) & 0xFF) >>> (b & 7)) | ((((byte)a) & 0xFF) << (8 - (b & 7))))
3427-
// 2. For Short ROR, `a ROR b` is: (short)(((((short)a) & 0xFFFF) >>> (b & 15)) | ((((short)a) & 0xFFFF) << (16 - (b & 15))))
3428-
// 3. For Integer ROR, `a ROR b` is: Integer.rotateRight(a, ((int)b))
3429-
// 4. For Long ROR, `a ROR b` is: Long.rotateRight(a, ((int)b))
3430-
//
3431-
// Basically, the behaviour between vectorization and Vector API is the same for Long and Integer, except that Vector API
3432-
// also supports Byte and Short rotation. But we can still share the intrinsics between vectorization and Vector API.
3433-
//
3434-
// NOTE: As vror.vi encodes 6-bits immediate rotate amount, which is different from other vector-immediate instructions,
3435-
// implementation of vector rotation for long and other types can be unified.
3436-
34373420
// Rotate right
34383421

34393422
instruct vrotate_right(vReg dst, vReg src, vReg shift) %{

Diff for: src/hotspot/share/opto/callGenerator.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ class LateInlineVirtualCallGenerator : public VirtualCallGenerator {
470470
virtual void do_late_inline();
471471

472472
virtual void set_callee_method(ciMethod* m) {
473-
assert(_callee == nullptr, "repeated inlining attempt");
473+
assert(_callee == nullptr || _callee == m, "repeated inline attempt with different callee");
474474
_callee = m;
475475
}
476476

@@ -987,8 +987,8 @@ CallGenerator* CallGenerator::for_method_handle_call(JVMState* jvms, ciMethod* c
987987
Compile* C = Compile::current();
988988
bool should_delay = C->should_delay_inlining();
989989
if (cg != nullptr) {
990-
if (should_delay) {
991-
return CallGenerator::for_late_inline(callee, cg);
990+
if (should_delay && IncrementalInlineMH) {
991+
return CallGenerator::for_mh_late_inline(caller, callee, input_not_const);
992992
} else {
993993
return cg;
994994
}

Diff for: src/hotspot/share/opto/callnode.cpp

+72-47
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,15 @@ void CallJavaNode::dump_compact_spec(outputStream* st) const {
10911091
}
10921092
#endif
10931093

1094+
void CallJavaNode::register_for_late_inline() {
1095+
if (generator() != nullptr) {
1096+
Compile::current()->prepend_late_inline(generator());
1097+
set_generator(nullptr);
1098+
} else {
1099+
assert(false, "repeated inline attempt");
1100+
}
1101+
}
1102+
10941103
//=============================================================================
10951104
uint CallStaticJavaNode::size_of() const { return sizeof(*this); }
10961105
bool CallStaticJavaNode::cmp( const Node &n ) const {
@@ -1101,26 +1110,35 @@ bool CallStaticJavaNode::cmp( const Node &n ) const {
11011110
Node* CallStaticJavaNode::Ideal(PhaseGVN* phase, bool can_reshape) {
11021111
CallGenerator* cg = generator();
11031112
if (can_reshape && cg != nullptr) {
1104-
assert(IncrementalInlineMH, "required");
1105-
assert(cg->call_node() == this, "mismatch");
1106-
assert(cg->is_mh_late_inline(), "not virtual");
1107-
1108-
// Check whether this MH handle call becomes a candidate for inlining.
1109-
ciMethod* callee = cg->method();
1110-
vmIntrinsics::ID iid = callee->intrinsic_id();
1111-
if (iid == vmIntrinsics::_invokeBasic) {
1112-
if (in(TypeFunc::Parms)->Opcode() == Op_ConP) {
1113-
phase->C->prepend_late_inline(cg);
1114-
set_generator(nullptr);
1113+
if (cg->is_mh_late_inline()) {
1114+
assert(IncrementalInlineMH, "required");
1115+
assert(cg->call_node() == this, "mismatch");
1116+
assert(cg->method()->is_method_handle_intrinsic(), "required");
1117+
1118+
// Check whether this MH handle call becomes a candidate for inlining.
1119+
ciMethod* callee = cg->method();
1120+
vmIntrinsics::ID iid = callee->intrinsic_id();
1121+
if (iid == vmIntrinsics::_invokeBasic) {
1122+
if (in(TypeFunc::Parms)->Opcode() == Op_ConP) {
1123+
register_for_late_inline();
1124+
}
1125+
} else if (iid == vmIntrinsics::_linkToNative) {
1126+
// never retry
1127+
} else {
1128+
assert(callee->has_member_arg(), "wrong type of call?");
1129+
if (in(TypeFunc::Parms + callee->arg_size() - 1)->Opcode() == Op_ConP) {
1130+
register_for_late_inline();
1131+
phase->C->inc_number_of_mh_late_inlines();
1132+
}
11151133
}
1116-
} else if (iid == vmIntrinsics::_linkToNative) {
1117-
// never retry
11181134
} else {
1119-
assert(callee->has_member_arg(), "wrong type of call?");
1120-
if (in(TypeFunc::Parms + callee->arg_size() - 1)->Opcode() == Op_ConP) {
1121-
phase->C->prepend_late_inline(cg);
1122-
set_generator(nullptr);
1135+
assert(IncrementalInline, "required");
1136+
assert(!cg->method()->is_method_handle_intrinsic(), "required");
1137+
if (phase->C->print_inlining()) {
1138+
phase->C->inline_printer()->record(cg->method(), cg->call_node()->jvms(), InliningResult::FAILURE,
1139+
"static call node changed: trying again");
11231140
}
1141+
register_for_late_inline();
11241142
}
11251143
}
11261144
return CallNode::Ideal(phase, can_reshape);
@@ -1189,39 +1207,46 @@ bool CallDynamicJavaNode::cmp( const Node &n ) const {
11891207
Node* CallDynamicJavaNode::Ideal(PhaseGVN* phase, bool can_reshape) {
11901208
CallGenerator* cg = generator();
11911209
if (can_reshape && cg != nullptr) {
1192-
assert(IncrementalInlineVirtual, "required");
1193-
assert(cg->call_node() == this, "mismatch");
1194-
assert(cg->is_virtual_late_inline(), "not virtual");
1195-
1196-
// Recover symbolic info for method resolution.
1197-
ciMethod* caller = jvms()->method();
1198-
ciBytecodeStream iter(caller);
1199-
iter.force_bci(jvms()->bci());
1200-
1201-
bool not_used1;
1202-
ciSignature* not_used2;
1203-
ciMethod* orig_callee = iter.get_method(not_used1, &not_used2); // callee in the bytecode
1204-
ciKlass* holder = iter.get_declared_method_holder();
1205-
if (orig_callee->is_method_handle_intrinsic()) {
1206-
assert(_override_symbolic_info, "required");
1207-
orig_callee = method();
1208-
holder = method()->holder();
1209-
}
1210+
if (cg->is_virtual_late_inline()) {
1211+
assert(IncrementalInlineVirtual, "required");
1212+
assert(cg->call_node() == this, "mismatch");
1213+
1214+
// Recover symbolic info for method resolution.
1215+
ciMethod* caller = jvms()->method();
1216+
ciBytecodeStream iter(caller);
1217+
iter.force_bci(jvms()->bci());
1218+
1219+
bool not_used1;
1220+
ciSignature* not_used2;
1221+
ciMethod* orig_callee = iter.get_method(not_used1, &not_used2); // callee in the bytecode
1222+
ciKlass* holder = iter.get_declared_method_holder();
1223+
if (orig_callee->is_method_handle_intrinsic()) {
1224+
assert(_override_symbolic_info, "required");
1225+
orig_callee = method();
1226+
holder = method()->holder();
1227+
}
12101228

1211-
ciInstanceKlass* klass = ciEnv::get_instance_klass_for_declared_method_holder(holder);
1229+
ciInstanceKlass* klass = ciEnv::get_instance_klass_for_declared_method_holder(holder);
12121230

1213-
Node* receiver_node = in(TypeFunc::Parms);
1214-
const TypeOopPtr* receiver_type = phase->type(receiver_node)->isa_oopptr();
1231+
Node* receiver_node = in(TypeFunc::Parms);
1232+
const TypeOopPtr* receiver_type = phase->type(receiver_node)->isa_oopptr();
12151233

1216-
int not_used3;
1217-
bool call_does_dispatch;
1218-
ciMethod* callee = phase->C->optimize_virtual_call(caller, klass, holder, orig_callee, receiver_type, true /*is_virtual*/,
1219-
call_does_dispatch, not_used3); // out-parameters
1220-
if (!call_does_dispatch) {
1221-
// Register for late inlining.
1222-
cg->set_callee_method(callee);
1223-
phase->C->prepend_late_inline(cg); // MH late inlining prepends to the list, so do the same
1224-
set_generator(nullptr);
1234+
int not_used3;
1235+
bool call_does_dispatch;
1236+
ciMethod* callee = phase->C->optimize_virtual_call(caller, klass, holder, orig_callee, receiver_type, true /*is_virtual*/,
1237+
call_does_dispatch, not_used3); // out-parameters
1238+
if (!call_does_dispatch) {
1239+
// Register for late inlining.
1240+
cg->set_callee_method(callee);
1241+
register_for_late_inline(); // MH late inlining prepends to the list, so do the same
1242+
}
1243+
} else {
1244+
assert(IncrementalInline, "required");
1245+
if (phase->C->print_inlining()) {
1246+
phase->C->inline_printer()->record(cg->method(), cg->call_node()->jvms(), InliningResult::FAILURE,
1247+
"dynamic call node changed: trying again");
1248+
}
1249+
register_for_late_inline();
12251250
}
12261251
}
12271252
return CallNode::Ideal(phase, can_reshape);

Diff for: src/hotspot/share/opto/callnode.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,7 @@ class CallJavaNode : public CallNode {
790790
void set_arg_escape(bool f) { _arg_escape = f; }
791791
bool arg_escape() const { return _arg_escape; }
792792
void copy_call_debug_info(PhaseIterGVN* phase, SafePointNode *sfpt);
793+
void register_for_late_inline();
793794

794795
DEBUG_ONLY( bool validate_symbolic_info() const; )
795796

Diff for: src/hotspot/share/opto/compile.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -2085,6 +2085,7 @@ bool Compile::inline_incrementally_one() {
20852085
for (int i = 0; i < _late_inlines.length(); i++) {
20862086
_late_inlines_pos = i+1;
20872087
CallGenerator* cg = _late_inlines.at(i);
2088+
bool is_scheduled_for_igvn_before = C->igvn_worklist()->member(cg->call_node());
20882089
bool does_dispatch = cg->is_virtual_late_inline() || cg->is_mh_late_inline();
20892090
if (inlining_incrementally() || does_dispatch) { // a call can be either inlined or strength-reduced to a direct call
20902091
cg->do_late_inline();
@@ -2095,6 +2096,16 @@ bool Compile::inline_incrementally_one() {
20952096
_late_inlines_pos = i+1; // restore the position in case new elements were inserted
20962097
print_method(PHASE_INCREMENTAL_INLINE_STEP, 3, cg->call_node());
20972098
break; // process one call site at a time
2099+
} else {
2100+
bool is_scheduled_for_igvn_after = C->igvn_worklist()->member(cg->call_node());
2101+
if (!is_scheduled_for_igvn_before && is_scheduled_for_igvn_after) {
2102+
// Avoid potential infinite loop if node already in the IGVN list
2103+
assert(false, "scheduled for IGVN during inlining attempt");
2104+
} else {
2105+
// Ensure call node has not disappeared from IGVN worklist during a failed inlining attempt
2106+
assert(!is_scheduled_for_igvn_before || is_scheduled_for_igvn_after, "call node removed from IGVN list during inlining pass");
2107+
cg->call_node()->set_generator(cg);
2108+
}
20982109
}
20992110
} else {
21002111
// Ignore late inline direct calls when inlining is not allowed.

Diff for: src/hotspot/share/opto/idealGraphPrinter.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,15 @@ void IdealGraphPrinter::visit_node(Node* n, bool edges) {
667667
print_prop("lrg", lrg_id);
668668
}
669669

670+
if (node->is_MachSafePoint()) {
671+
const OopMap* oopmap = node->as_MachSafePoint()->oop_map();
672+
if (oopmap != nullptr) {
673+
stringStream oopmap_stream;
674+
oopmap->print_on(&oopmap_stream);
675+
print_prop("oopmap", oopmap_stream.freeze());
676+
}
677+
}
678+
670679
Compile::current()->_in_dump_cnt--;
671680

672681
tail(PROPERTIES_ELEMENT);

Diff for: src/hotspot/share/runtime/objectMonitor.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -2058,6 +2058,12 @@ void ObjectMonitor::notify(TRAPS) {
20582058
return;
20592059
}
20602060

2061+
quick_notify(current);
2062+
}
2063+
2064+
void ObjectMonitor::quick_notify(JavaThread* current) {
2065+
assert(has_owner(current), "Precondition");
2066+
20612067
EventJavaMonitorNotify event;
20622068
DTRACE_MONITOR_PROBE(notify, this, object(), current);
20632069
int tally = notify_internal(current) ? 1 : 0;
@@ -2080,6 +2086,12 @@ void ObjectMonitor::notifyAll(TRAPS) {
20802086
return;
20812087
}
20822088

2089+
quick_notifyAll(current);
2090+
}
2091+
2092+
void ObjectMonitor::quick_notifyAll(JavaThread* current) {
2093+
assert(has_owner(current), "Precondition");
2094+
20832095
EventJavaMonitorNotify event;
20842096
DTRACE_MONITOR_PROBE(notifyAll, this, object(), current);
20852097
int tally = 0;

0 commit comments

Comments
 (0)