Compare commits

...

8 Commits

Author SHA1 Message Date
Alexander Lobas
7d31563471 JBR-4305 (#119)
* IDEA-283934 Top panel (toolbar, Editor tabs) hides under the Mac menu in full-screen mode

* IDEA-283934 Top panel (toolbar, Editor tabs) hides under the Mac menu in full-screen mode

* JBR-4305 IDEA-283934 Top panel (toolbar, Editor tabs) hides under the Mac menu in full-screen mode

* JBR-4305 IDEA-283934 Top panel (toolbar, Editor tabs) hides under the Mac menu in full-screen mode
2022-03-10 20:23:11 +01:00
Alexey Ushakov
36ded60698 JBR-3365 SIGILL at [libsystem_kernel] __kill in java.lang.RuntimeException: Failed to convert, no screen / primaryScreen
Wrapped the native exception and added logging
2022-03-10 14:28:18 +01:00
Dmitry Batrak
d53de90f8a JBR-3751 Window content isn't rendered with some window managers on Linux
(cherry picked from commit 8d22e4dcb0)
2022-03-09 13:40:40 +03:00
VladimirKempik
6196076b95 JBR-4291: Ability to ignore all add-opens 2022-03-04 15:05:43 +03:00
Vitaly Provodin
0ee50cbed6 JBR-4272 generate and save debug symbols for JBR on macos/linux 2022-03-03 19:34:10 +07:00
Roland Westrelin
d6e6d315d2 JBR-4256: backport 8280799: С2: assert(false) failed: cyclic dependency prevents range check elimination
Reviewed-by: thartmann, kvn
2022-02-28 18:31:45 +07:00
Roland Westrelin
0a3f7bd9b1 JBR-4256: 8275330: C2: assert(n->is_Root() || n->is_Region() || n->is_Phi() || n->is_MachMerge() || def_block->dominates(block)) failed: uses must be dominated by definitions
Reviewed-by: thartmann, chagedorn
(cherry picked from commit 3e798dd40c)
2022-02-28 18:31:43 +07:00
Vladimir Kempik
a2636bc8b2 JBR-4283: Provide native JBR builds for alpine Linux-aarch64 2022-02-28 11:11:24 +03:00
31 changed files with 2283 additions and 109 deletions

View File

@@ -31,6 +31,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \
libxt-dev \
libxtst-dev \
make \
rsync \
tar \
unzip \
zip && \

View File

@@ -0,0 +1,22 @@
# NOTE: This Dockerfile is meant to be used from the mkdocker_musl_aarch64.sh script.
# Pull a concrete version of Linux that does NOT recieve updates after it's
# been created. This is so that the image is as stable as possible to make
# image creation reproducible.
# NB: this also means there may be no security-related fixes there, need to
# move the version to the next manually.
FROM arm64v8/alpine:3.12
# Install the necessary build tools
RUN apk --no-cache add --update bash grep tar zip bzip2 rsync fontconfig build-base \
git libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev \
libxtst-dev autoconf freetype-dev cups-dev alsa-lib-dev file \
fontconfig fontconfig-dev linux-headers
# Set up boot JDK for building
COPY boot_jdk_musl_aarch64.tar.gz /jdk17/
RUN cd /jdk17 && tar --strip-components=1 -xzf boot_jdk_musl_aarch64.tar.gz && rm /jdk17/boot_jdk_musl_aarch64.tar.gz
ENV BOOT_JDK=/jdk17
RUN git config --global user.email "teamcity@jetbrains.com" && \
git config --global user.name "builduser"

View File

@@ -8,7 +8,7 @@
FROM alpine:3.5
# Install the necessary build tools
RUN apk --no-cache add --update bash grep tar zip bzip2 fontconfig build-base \
RUN apk --no-cache add --update bash grep tar zip bzip2 rsync fontconfig build-base \
git libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev \
libxtst-dev autoconf freetype-dev cups-dev alsa-lib-dev file \
fontconfig fontconfig-dev linux-headers

View File

@@ -0,0 +1,26 @@
#!/bin/bash -x
# This script creates a Docker image suitable for building musl AArch64 variant
# of the JetBrains Runtime version 17.
BOOT_JDK_REMOTE_FILE=zulu17.32.13-ca-jdk17.0.2-linux_musl_aarch64.tar.gz
BOOT_JDK_SHA=6b920559abafbe9bdef386a20ecf3a2f318bc1f0d8359eb1f95aee26606bbc70
BOOT_JDK_LOCAL_FILE=boot_jdk_musl_aarch64.tar.gz
if [ ! -f $BOOT_JDK_LOCAL_FILE ]; then
# Obtain "boot JDK" from outside of the container.
wget -nc https://cdn.azul.com/zulu/bin/${BOOT_JDK_REMOTE_FILE} -O $BOOT_JDK_LOCAL_FILE
else
echo "boot JDK \"$BOOT_JDK_LOCAL_FILE\" present, skipping download"
fi
# Verify that what we've downloaded can be trusted.
sha256sum -c - <<EOF
$BOOT_JDK_SHA *$BOOT_JDK_LOCAL_FILE
EOF
docker build -t jbr17buildenv -f Dockerfile.musl_aarch64 .
# NB: the resulting container can (and should) be used without the network
# connection (--network none) during build in order to reduce the chance
# of build contamination.

View File

@@ -77,12 +77,24 @@ case "$OS_NAME" in
;;
esac
WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS="--with-native-debug-symbols=zipped"
REPRODUCIBLE_BUILD_OPTS="--enable-reproducible-build
--with-source-date=$SOURCE_DATE_EPOCH
--with-hotspot-build-time=$BUILD_TIME
--with-copyright-year=$COPYRIGHT_YEAR
--disable-absolute-paths-in-output"
function zip_native_debug_symbols() {
image_bundle_path=$(echo $1 | cut -d"/" -f-4)
jbr_diz_name=$2
(cd $image_bundle_path && find . -name '*.diz' -exec rsync -R {} ../../../../dizfiles \; )
(cd dizfiles && find . -print0 | COPYFILE_DISABLE=1 \
tar --no-recursion --null -T - -czf ../"$jbr_diz_name".tar.gz) || do_exit $?
}
function do_exit() {
exit_code=$1
[ $do_reset_changes -eq 1 ] && git checkout HEAD jb/project/tools/common/modules.list src/java.desktop/share/classes/module-info.java

View File

@@ -6,8 +6,21 @@
source jb/project/tools/common/scripts/common.sh
function is_musl {
libc=$(ldd /bin/ls | grep 'musl' | head -1 | cut -d ' ' -f1)
if [ -z $libc ]; then
# This is not Musl, return 1 == false
return 1
fi
return 0
}
JBRSDK_BASE_NAME=jbrsdk-${JBSDK_VERSION}
LIBC_TYPE_SUFFIX=''
if is_musl; then LIBC_TYPE_SUFFIX='musl-' ; fi
sh configure \
--with-debug-level=release \
--with-vendor-name="${VENDOR_NAME}" \
@@ -19,11 +32,12 @@ sh configure \
--with-boot-jdk=${BOOT_JDK} \
--enable-cds=yes \
$REPRODUCIBLE_BUILD_OPTS \
$WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS \
|| exit $?
make clean CONF=linux-aarch64-server-release || exit $?
make images CONF=linux-aarch64-server-release test-image || exit $?
JBSDK=${JBRSDK_BASE_NAME}-linux-aarch64-b${build_number}
JBSDK=${JBRSDK_BASE_NAME}-linux-${LIBC_TYPE_SUFFIX}aarch64-b${build_number}
BASE_DIR=build/linux-aarch64-server-release/images
JSDK=${BASE_DIR}/jdk
JBRSDK_BUNDLE=jbrsdk
@@ -38,6 +52,8 @@ echo Creating $JBSDK.tar.gz ...
sed 's/JBR/JBRSDK/g' ${BASE_DIR}/${JBRSDK_BUNDLE}/release > release
mv release ${BASE_DIR}/${JBRSDK_BUNDLE}/release
zip_native_debug_symbols $JSDK "${JBSDK}_diz"
# NB: --sort=name requires tar1.28
tar $REPRODUCIBLE_TAR_OPTS --sort=name -pcf $JBSDK.tar \
--exclude=*.debuginfo --exclude=demo --exclude=sample --exclude=man \
@@ -49,7 +65,7 @@ JBR_BUNDLE=jbr
JBR_BASE_NAME=jbr-$JBSDK_VERSION
rm -rf $BASE_DIR/$JBR_BUNDLE
JBR=$JBR_BASE_NAME-linux-aarch64-b$build_number
JBR=$JBR_BASE_NAME-linux-${LIBC_TYPE_SUFFIX}aarch64-b$build_number
grep -v javafx jb/project/tools/common/modules.list | grep -v "jdk.internal.vm\|jdk.aot\|jcef" > modules.list.aarch64
echo Running jlink....
${JSDK}/bin/jlink \
@@ -65,7 +81,7 @@ tar $REPRODUCIBLE_TAR_OPTS --sort=name -pcf $JBR.tar -C $BASE_DIR ${JBR_BUNDLE}
touch -c -d @$SOURCE_DATE_EPOCH $JBR.tar
gzip $JBR.tar || exit $?
JBRSDK_TEST=$JBRSDK_BASE_NAME-linux-test-aarch64-b$build_number
JBRSDK_TEST=$JBRSDK_BASE_NAME-linux-${LIBC_TYPE_SUFFIX}test-aarch64-b$build_number
echo Creating $JBRSDK_TEST.tar.gz ...
tar -pcf $JBRSDK_TEST.tar -C $BASE_DIR --exclude='test/jdk/demos' test || exit $?
gzip $JBRSDK_TEST.tar || exit $?

View File

@@ -33,6 +33,7 @@ function do_configure {
--with-boot-jdk="$BOOT_JDK" \
--enable-cds=yes \
$REPRODUCIBLE_BUILD_OPTS \
$WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS \
|| do_exit $?
}
@@ -69,6 +70,7 @@ function create_image_bundle {
sed 's/JBR/JBRSDK/g' "$IMAGES_DIR"/"$__arch_name"/release > release
mv release "$IMAGES_DIR"/"$__arch_name"/release
copy_jmods "$__modules" "$__modules_path" "$IMAGES_DIR"/"$__arch_name"/jmods
zip_native_debug_symbols $IMAGES_DIR/jdk "${JBR}_diz"
fi
# jmod does not preserve file permissions (JDK-8173610)

View File

@@ -45,6 +45,7 @@ function do_configure {
--with-extra-cxxflags="-F$(pwd)/Frameworks" \
--with-extra-ldflags="-F$(pwd)/Frameworks" \
$REPRODUCIBLE_BUILD_OPTS \
$WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS \
|| do_exit $?
else
sh configure \
@@ -61,6 +62,7 @@ function do_configure {
--with-macosx-version-max="${MACOSX_VERSION_MAX:="10.12.00"}" \
--enable-cds=yes \
$REPRODUCIBLE_BUILD_OPTS \
$WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS \
|| do_exit $?
fi
}
@@ -90,6 +92,7 @@ function create_image_bundle {
sed 's/JBR/JBRSDK/g' $JRE_CONTENTS/Home/release > release
mv release $JRE_CONTENTS/Home/release
copy_jmods "$__modules" "$__modules_path" "$JRE_CONTENTS"/Home/jmods
zip_native_debug_symbols $IMAGES_DIR/jdk-bundle/jdk-$JBSDK_VERSION.jdk "${JBR}_diz"
fi
cp -R "$JSDK"/../MacOS "$JRE_CONTENTS"

View File

@@ -341,9 +341,9 @@ void PhaseIdealLoop::clone_skeleton_predicates_to_unswitched_loop(IdealLoopTree*
assert(predicate->is_Proj() && predicate->as_Proj()->is_IfProj(), "predicate must be a projection of an if node");
IfProjNode* predicate_proj = predicate->as_IfProj();
ProjNode* fast_proj = clone_skeleton_predicate_for_unswitched_loops(iff, predicate_proj, uncommon_proj, reason, iffast_pred, loop);
ProjNode* fast_proj = clone_skeleton_predicate_for_unswitched_loops(iff, predicate_proj, reason, iffast_pred);
assert(skeleton_predicate_has_opaque(fast_proj->in(0)->as_If()), "must find skeleton predicate for fast loop");
ProjNode* slow_proj = clone_skeleton_predicate_for_unswitched_loops(iff, predicate_proj, uncommon_proj, reason, ifslow_pred, loop);
ProjNode* slow_proj = clone_skeleton_predicate_for_unswitched_loops(iff, predicate_proj, reason, ifslow_pred);
assert(skeleton_predicate_has_opaque(slow_proj->in(0)->as_If()), "must find skeleton predicate for slow loop");
// Update control dependent data nodes.
@@ -397,10 +397,10 @@ void PhaseIdealLoop::get_skeleton_predicates(Node* predicate, Unique_Node_List&
// Clone a skeleton predicate for an unswitched loop. OpaqueLoopInit and OpaqueLoopStride nodes are cloned and uncommon
// traps are kept for the predicate (a Halt node is used later when creating pre/main/post loops and copying this cloned
// predicate again).
ProjNode* PhaseIdealLoop::clone_skeleton_predicate_for_unswitched_loops(Node* iff, ProjNode* predicate, Node* uncommon_proj,
Deoptimization::DeoptReason reason, ProjNode* output_proj,
IdealLoopTree* loop) {
Node* bol = clone_skeleton_predicate_bool(iff, NULL, NULL, predicate, uncommon_proj, output_proj, loop);
ProjNode* PhaseIdealLoop::clone_skeleton_predicate_for_unswitched_loops(Node* iff, ProjNode* predicate,
Deoptimization::DeoptReason reason,
ProjNode* output_proj) {
Node* bol = clone_skeleton_predicate_bool(iff, NULL, NULL, output_proj);
ProjNode* proj = create_new_if_for_predicate(output_proj, NULL, reason, iff->Opcode(), predicate->is_IfTrue());
_igvn.replace_input_of(proj->in(0), 1, bol);
_igvn.replace_input_of(output_proj->in(0), 0, proj);

View File

@@ -1264,10 +1264,12 @@ void PhaseIdealLoop::copy_skeleton_predicates_to_main_loop_helper(Node* predicat
// Clone the skeleton predicate twice and initialize one with the initial
// value of the loop induction variable. Leave the other predicate
// to be initialized when increasing the stride during loop unrolling.
prev_proj = clone_skeleton_predicate_for_main_loop(iff, opaque_init, NULL, predicate, uncommon_proj, current_proj, outer_loop, prev_proj);
prev_proj = clone_skeleton_predicate_for_main_or_post_loop(iff, opaque_init, NULL, predicate, uncommon_proj,
current_proj, outer_loop, prev_proj);
assert(skeleton_predicate_has_opaque(prev_proj->in(0)->as_If()), "");
prev_proj = clone_skeleton_predicate_for_main_loop(iff, init, stride, predicate, uncommon_proj, current_proj, outer_loop, prev_proj);
prev_proj = clone_skeleton_predicate_for_main_or_post_loop(iff, init, stride, predicate, uncommon_proj,
current_proj, outer_loop, prev_proj);
assert(!skeleton_predicate_has_opaque(prev_proj->in(0)->as_If()), "");
// Rewire any control inputs from the cloned skeleton predicates down to the main and post loop for data nodes that are part of the
@@ -1344,8 +1346,7 @@ bool PhaseIdealLoop::skeleton_predicate_has_opaque(IfNode* iff) {
// Clone the skeleton predicate bool for a main or unswitched loop:
// Main loop: Set new_init and new_stride nodes as new inputs.
// Unswitched loop: new_init and new_stride are both NULL. Clone OpaqueLoopInit and OpaqueLoopStride instead.
Node* PhaseIdealLoop::clone_skeleton_predicate_bool(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj,
Node* control, IdealLoopTree* outer_loop) {
Node* PhaseIdealLoop::clone_skeleton_predicate_bool(Node* iff, Node* new_init, Node* new_stride, Node* control) {
Node_Stack to_clone(2);
to_clone.push(iff->in(1), 1);
uint current = C->unique();
@@ -1421,9 +1422,9 @@ Node* PhaseIdealLoop::clone_skeleton_predicate_bool(Node* iff, Node* new_init, N
// Clone a skeleton predicate for the main loop. new_init and new_stride are set as new inputs. Since the predicates cannot fail at runtime,
// Halt nodes are inserted instead of uncommon traps.
Node* PhaseIdealLoop::clone_skeleton_predicate_for_main_loop(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj,
Node* control, IdealLoopTree* outer_loop, Node* input_proj) {
Node* result = clone_skeleton_predicate_bool(iff, new_init, new_stride, predicate, uncommon_proj, control, outer_loop);
Node* PhaseIdealLoop::clone_skeleton_predicate_for_main_or_post_loop(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj,
Node* control, IdealLoopTree* outer_loop, Node* input_proj) {
Node* result = clone_skeleton_predicate_bool(iff, new_init, new_stride, control);
Node* proj = predicate->clone();
Node* other_proj = uncommon_proj->clone();
Node* new_iff = iff->clone();
@@ -1437,8 +1438,8 @@ Node* PhaseIdealLoop::clone_skeleton_predicate_for_main_loop(Node* iff, Node* ne
C->root()->add_req(halt);
new_iff->set_req(0, input_proj);
register_control(new_iff, outer_loop->_parent, input_proj);
register_control(proj, outer_loop->_parent, new_iff);
register_control(new_iff, outer_loop == _ltree_root ? _ltree_root : outer_loop->_parent, input_proj);
register_control(proj, outer_loop == _ltree_root ? _ltree_root : outer_loop->_parent, new_iff);
register_control(other_proj, _ltree_root, new_iff);
register_control(halt, _ltree_root, other_proj);
return proj;
@@ -1521,7 +1522,8 @@ void PhaseIdealLoop::insert_pre_post_loops(IdealLoopTree *loop, Node_List &old_n
// Add the post loop
const uint idx_before_pre_post = Compile::current()->unique();
CountedLoopNode *post_head = NULL;
Node *main_exit = insert_post_loop(loop, old_new, main_head, main_end, incr, limit, post_head);
Node* post_incr = incr;
Node* main_exit = insert_post_loop(loop, old_new, main_head, main_end, post_incr, limit, post_head);
const uint idx_after_post_before_pre = Compile::current()->unique();
//------------------------------
@@ -1620,6 +1622,7 @@ void PhaseIdealLoop::insert_pre_post_loops(IdealLoopTree *loop, Node_List &old_n
assert(post_head->in(1)->is_IfProj(), "must be zero-trip guard If node projection of the post loop");
copy_skeleton_predicates_to_main_loop(pre_head, castii, stride, outer_loop, outer_main_head, dd_main_head,
idx_before_pre_post, idx_after_post_before_pre, min_taken, post_head->in(1), old_new);
copy_skeleton_predicates_to_post_loop(outer_main_head, post_head, post_incr, stride);
// Step B4: Shorten the pre-loop to run only 1 iteration (for now).
// RCE and alignment may change this later.
@@ -1742,6 +1745,7 @@ void PhaseIdealLoop::insert_vector_post_loop(IdealLoopTree *loop, Node_List &old
// In this case we throw away the result as we are not using it to connect anything else.
CountedLoopNode *post_head = NULL;
insert_post_loop(loop, old_new, main_head, main_end, incr, limit, post_head);
copy_skeleton_predicates_to_post_loop(main_head->skip_strip_mined(), post_head, incr, main_head->stride());
// It's difficult to be precise about the trip-counts
// for post loops. They are usually very short,
@@ -1788,6 +1792,7 @@ void PhaseIdealLoop::insert_scalar_rced_post_loop(IdealLoopTree *loop, Node_List
// In this case we throw away the result as we are not using it to connect anything else.
CountedLoopNode *post_head = NULL;
insert_post_loop(loop, old_new, main_head, main_end, incr, limit, post_head);
copy_skeleton_predicates_to_post_loop(main_head->skip_strip_mined(), post_head, incr, main_head->stride());
// It's difficult to be precise about the trip-counts
// for post loops. They are usually very short,
@@ -1804,9 +1809,9 @@ void PhaseIdealLoop::insert_scalar_rced_post_loop(IdealLoopTree *loop, Node_List
//------------------------------insert_post_loop-------------------------------
// Insert post loops. Add a post loop to the given loop passed.
Node *PhaseIdealLoop::insert_post_loop(IdealLoopTree *loop, Node_List &old_new,
CountedLoopNode *main_head, CountedLoopEndNode *main_end,
Node *incr, Node *limit, CountedLoopNode *&post_head) {
Node *PhaseIdealLoop::insert_post_loop(IdealLoopTree* loop, Node_List& old_new,
CountedLoopNode* main_head, CountedLoopEndNode* main_end,
Node*& incr, Node* limit, CountedLoopNode*& post_head) {
IfNode* outer_main_end = main_end;
IdealLoopTree* outer_loop = loop;
if (main_head->is_strip_mined()) {
@@ -1890,8 +1895,8 @@ Node *PhaseIdealLoop::insert_post_loop(IdealLoopTree *loop, Node_List &old_new,
}
// CastII for the new post loop:
Node* castii = cast_incr_before_loop(zer_opaq->in(1), zer_taken, post_head);
assert(castii != NULL, "no castII inserted");
incr = cast_incr_before_loop(zer_opaq->in(1), zer_taken, post_head);
assert(incr != NULL, "no castII inserted");
return new_main_exit;
}
@@ -1933,7 +1938,8 @@ void PhaseIdealLoop::update_main_loop_skeleton_predicates(Node* ctrl, CountedLoo
_igvn.replace_input_of(iff, 1, iff->in(1)->in(2));
} else {
// Add back predicates updated for the new stride.
prev_proj = clone_skeleton_predicate_for_main_loop(iff, init, max_value, entry, proj, ctrl, outer_loop, prev_proj);
prev_proj = clone_skeleton_predicate_for_main_or_post_loop(iff, init, max_value, entry, proj, ctrl, outer_loop,
prev_proj);
assert(!skeleton_predicate_has_opaque(prev_proj->in(0)->as_If()), "unexpected");
}
}
@@ -1945,6 +1951,34 @@ void PhaseIdealLoop::update_main_loop_skeleton_predicates(Node* ctrl, CountedLoo
}
}
void PhaseIdealLoop::copy_skeleton_predicates_to_post_loop(LoopNode* main_loop_head, CountedLoopNode* post_loop_head, Node* init, Node* stride) {
// Go over the skeleton predicates of the main loop and make a copy for the post loop with its initial iv value and
// stride as inputs.
Node* post_loop_entry = post_loop_head->in(LoopNode::EntryControl);
Node* main_loop_entry = main_loop_head->in(LoopNode::EntryControl);
IdealLoopTree* post_loop = get_loop(post_loop_head);
Node* ctrl = main_loop_entry;
Node* prev_proj = post_loop_entry;
while (ctrl != NULL && ctrl->is_Proj() && ctrl->in(0)->is_If()) {
IfNode* iff = ctrl->in(0)->as_If();
ProjNode* proj = iff->proj_out(1 - ctrl->as_Proj()->_con);
if (proj->unique_ctrl_out()->Opcode() != Op_Halt) {
break;
}
if (iff->in(1)->Opcode() == Op_Opaque4 && skeleton_predicate_has_opaque(iff)) {
prev_proj = clone_skeleton_predicate_for_main_or_post_loop(iff, init, stride, ctrl, proj, post_loop_entry,
post_loop, prev_proj);
assert(!skeleton_predicate_has_opaque(prev_proj->in(0)->as_If()), "unexpected");
}
ctrl = ctrl->in(0)->in(0);
}
if (prev_proj != post_loop_entry) {
_igvn.replace_input_of(post_loop_head, LoopNode::EntryControl, prev_proj);
set_idom(post_loop_head, prev_proj, dom_depth(post_loop_head));
}
}
//------------------------------do_unroll--------------------------------------
// Unroll the loop body one step - make each trip do 2 iterations.
void PhaseIdealLoop::do_unroll(IdealLoopTree *loop, Node_List &old_new, bool adjust_min_trip) {

View File

@@ -2150,12 +2150,14 @@ Node* CountedLoopNode::skip_predicates_from_entry(Node* ctrl) {
}
Node* CountedLoopNode::skip_predicates() {
Node* ctrl = in(LoopNode::EntryControl);
if (is_main_loop()) {
Node* ctrl = skip_strip_mined()->in(LoopNode::EntryControl);
ctrl = skip_strip_mined()->in(LoopNode::EntryControl);
}
if (is_main_loop() || is_post_loop()) {
return skip_predicates_from_entry(ctrl);
}
return in(LoopNode::EntryControl);
return ctrl;
}
@@ -5351,38 +5353,45 @@ void PhaseIdealLoop::build_loop_late_post_work(Node *n, bool pinned) {
}
assert(early == legal || legal != C->root(), "bad dominance of inputs");
if (least != early) {
// Move the node above predicates as far up as possible so a
// following pass of loop predication doesn't hoist a predicate
// that depends on it above that node.
Node* new_ctrl = least;
for (;;) {
if (!new_ctrl->is_Proj()) {
break;
}
CallStaticJavaNode* call = new_ctrl->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
if (call == NULL) {
break;
}
int req = call->uncommon_trap_request();
Deoptimization::DeoptReason trap_reason = Deoptimization::trap_request_reason(req);
if (trap_reason != Deoptimization::Reason_loop_limit_check &&
trap_reason != Deoptimization::Reason_predicate &&
trap_reason != Deoptimization::Reason_profile_predicate) {
break;
}
Node* c = new_ctrl->in(0)->in(0);
if (is_dominator(c, early) && c != early) {
break;
}
new_ctrl = c;
}
least = new_ctrl;
}
// Try not to place code on a loop entry projection
// which can inhibit range check elimination.
if (least != early) {
Node* ctrl_out = least->unique_ctrl_out();
if (ctrl_out && ctrl_out->is_Loop() &&
least == ctrl_out->in(LoopNode::EntryControl)) {
// Move the node above predicates as far up as possible so a
// following pass of loop predication doesn't hoist a predicate
// that depends on it above that node.
Node* new_ctrl = least;
for (;;) {
if (!new_ctrl->is_Proj()) {
break;
}
CallStaticJavaNode* call = new_ctrl->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
if (call == NULL) {
break;
}
int req = call->uncommon_trap_request();
Deoptimization::DeoptReason trap_reason = Deoptimization::trap_request_reason(req);
if (trap_reason != Deoptimization::Reason_loop_limit_check &&
trap_reason != Deoptimization::Reason_predicate &&
trap_reason != Deoptimization::Reason_profile_predicate) {
break;
}
Node* c = new_ctrl->in(0)->in(0);
if (is_dominator(c, early) && c != early) {
break;
}
new_ctrl = c;
least == ctrl_out->in(LoopNode::EntryControl) &&
(ctrl_out->is_CountedLoop() || ctrl_out->is_OuterStripMinedLoop())) {
Node* least_dom = idom(least);
if (get_loop(least_dom)->is_member(get_loop(least))) {
least = least_dom;
}
least = new_ctrl;
}
}

View File

@@ -915,13 +915,13 @@ private:
void copy_skeleton_predicates_to_main_loop(CountedLoopNode* pre_head, Node* init, Node* stride, IdealLoopTree* outer_loop, LoopNode* outer_main_head,
uint dd_main_head, const uint idx_before_pre_post, const uint idx_after_post_before_pre,
Node* zero_trip_guard_proj_main, Node* zero_trip_guard_proj_post, const Node_List &old_new);
Node* clone_skeleton_predicate_for_main_loop(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj, Node* control,
IdealLoopTree* outer_loop, Node* input_proj);
Node* clone_skeleton_predicate_bool(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj, Node* control,
IdealLoopTree* outer_loop);
Node* clone_skeleton_predicate_for_main_or_post_loop(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj, Node* control,
IdealLoopTree* outer_loop, Node* input_proj);
Node* clone_skeleton_predicate_bool(Node* iff, Node* new_init, Node* new_stride, Node* control);
static bool skeleton_predicate_has_opaque(IfNode* iff);
static void get_skeleton_predicates(Node* predicate, Unique_Node_List& list, bool get_opaque = false);
void update_main_loop_skeleton_predicates(Node* ctrl, CountedLoopNode* loop_head, Node* init, int stride_con);
void copy_skeleton_predicates_to_post_loop(LoopNode* main_loop_head, CountedLoopNode* post_loop_head, Node* init, Node* stride);
void insert_loop_limit_check(ProjNode* limit_check_proj, Node* cmp_limit, Node* bol);
#ifdef ASSERT
bool only_has_infinite_loops();
@@ -1244,9 +1244,9 @@ public:
void insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_new, bool peel_only );
// Add post loop after the given loop.
Node *insert_post_loop(IdealLoopTree *loop, Node_List &old_new,
CountedLoopNode *main_head, CountedLoopEndNode *main_end,
Node *incr, Node *limit, CountedLoopNode *&post_head);
Node *insert_post_loop(IdealLoopTree* loop, Node_List& old_new,
CountedLoopNode* main_head, CountedLoopEndNode* main_end,
Node*& incr, Node* limit, CountedLoopNode*& post_head);
// Add an RCE'd post loop which we will multi-version adapt for run time test path usage
void insert_scalar_rced_post_loop( IdealLoopTree *loop, Node_List &old_new );
@@ -1579,8 +1579,9 @@ private:
Node_List* old_new = NULL);
void clone_skeleton_predicates_to_unswitched_loop(IdealLoopTree* loop, const Node_List& old_new, Deoptimization::DeoptReason reason,
ProjNode* old_predicate_proj, ProjNode* iffast_pred, ProjNode* ifslow_pred);
ProjNode* clone_skeleton_predicate_for_unswitched_loops(Node* iff, ProjNode* predicate, Node* uncommon_proj, Deoptimization::DeoptReason reason,
ProjNode* output_proj, IdealLoopTree* loop);
ProjNode* clone_skeleton_predicate_for_unswitched_loops(Node* iff, ProjNode* predicate,
Deoptimization::DeoptReason reason,
ProjNode* output_proj);
static void check_created_predicate_for_unswitching(const Node* new_entry) PRODUCT_RETURN;
bool _created_loop_node;

View File

@@ -2562,6 +2562,7 @@ void PhaseMacroExpand::eliminate_macro_nodes() {
assert(n->Opcode() == Op_LoopLimit ||
n->Opcode() == Op_Opaque2 ||
n->Opcode() == Op_Opaque3 ||
n->Opcode() == Op_Opaque4 ||
BarrierSet::barrier_set()->barrier_set_c2()->is_gc_barrier_node(n),
"unknown node type in macro list");
}
@@ -2623,6 +2624,19 @@ bool PhaseMacroExpand::expand_macro_nodes() {
_igvn.replace_node(n, repl);
success = true;
#endif
} else if (n->Opcode() == Op_Opaque4) {
// With Opaque4 nodes, the expectation is that the test of input 1
// is always equal to the constant value of input 2. So we can
// remove the Opaque4 and replace it by input 2. In debug builds,
// leave the non constant test in instead to sanity check that it
// never fails (if it does, that subgraph was constructed so, at
// runtime, a Halt node is executed).
#ifdef ASSERT
_igvn.replace_node(n, n->in(1));
#else
_igvn.replace_node(n, n->in(2));
#endif
success = true;
} else if (n->Opcode() == Op_OuterStripMinedLoop) {
n->as_OuterStripMinedLoop()->adjust_strip_mined_loop(&_igvn);
C->remove_macro_node(n);

View File

@@ -60,25 +60,6 @@ bool Opaque2Node::cmp( const Node &n ) const {
return (&n == this); // Always fail except on self
}
Node* Opaque4Node::Identity(PhaseGVN* phase) {
if (phase->C->post_loop_opts_phase()) {
// With Opaque4 nodes, the expectation is that the test of input 1
// is always equal to the constant value of input 2. So we can
// remove the Opaque4 and replace it by input 2. In debug builds,
// leave the non constant test in instead to sanity check that it
// never fails (if it does, that subgraph was constructed so, at
// runtime, a Halt node is executed).
#ifdef ASSERT
return this->in(1);
#else
return this->in(2);
#endif
} else {
phase->C->record_for_post_loop_opts_igvn(this);
}
return this;
}
const Type* Opaque4Node::Value(PhaseGVN* phase) const {
return phase->type(in(1));
}

View File

@@ -114,11 +114,13 @@ class Opaque3Node : public Opaque2Node {
// GraphKit::must_be_not_null().
class Opaque4Node : public Node {
public:
Opaque4Node(Compile* C, Node *tst, Node* final_tst) : Node(NULL, tst, final_tst) {}
Opaque4Node(Compile* C, Node *tst, Node* final_tst) : Node(NULL, tst, final_tst) {
init_flags(Flag_is_macro);
C->add_macro_node(this);
}
virtual int Opcode() const;
virtual const Type *bottom_type() const { return TypeInt::BOOL; }
virtual Node* Identity(PhaseGVN* phase);
virtual const Type* Value(PhaseGVN* phase) const;
};

View File

@@ -200,6 +200,24 @@ bool PhaseIdealLoop::split_up( Node *n, Node *blk1, Node *blk2 ) {
return true;
}
}
if (n->Opcode() == Op_OpaqueLoopStride || n->Opcode() == Op_OpaqueLoopInit) {
Unique_Node_List wq;
wq.push(n);
for (uint i = 0; i < wq.size(); i++) {
Node* m = wq.at(i);
if (m->is_If()) {
assert(skeleton_predicate_has_opaque(m->as_If()), "opaque node not reachable from if?");
Node* bol = clone_skeleton_predicate_bool(m, NULL, NULL, m->in(0));
_igvn.replace_input_of(m, 1, bol);
} else {
assert(!m->is_CFG(), "not CFG expected");
for (DUIterator_Fast jmax, j = m->fast_outs(jmax); j < jmax; j++) {
Node* u = m->fast_out(j);
wq.push(u);
}
}
}
}
// See if splitting-up a Store. Any anti-dep loads must go up as
// well. An anti-dep load might be in the wrong block, because in

View File

@@ -1337,6 +1337,7 @@ bool Arguments::add_property(const char* prop, PropertyWriteable writeable, Prop
log_info(cds)("optimized module handling: disabled due to incompatible property: %s=%s", key, value);
}
if (strcmp(key, "jdk.module.showModuleResolution") == 0 ||
strcmp(key, "jdk.module.illegalAccess") == 0 ||
strcmp(key, "jdk.module.validation") == 0 ||
strcmp(key, "java.system.class.loader") == 0) {
MetaspaceShared::disable_full_module_graph();
@@ -2131,7 +2132,8 @@ bool Arguments::parse_uintx(const char* value,
}
bool Arguments::create_module_property(const char* prop_name, const char* prop_value, PropertyInternal internal) {
assert(is_internal_module_property(prop_name), "unknown module property: '%s'", prop_name);
assert(is_internal_module_property(prop_name) ||
strcmp(prop_name, "jdk.module.illegalAccess") == 0, "unknown module property: '%s'", prop_name);
size_t prop_len = strlen(prop_name) + strlen(prop_value) + 2;
char* property = AllocateHeap(prop_len, mtArguments);
int ret = jio_snprintf(property, prop_len, "%s=%s", prop_name, prop_value);
@@ -2499,10 +2501,11 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
if (res != JNI_OK) {
return res;
}
} else if (match_option(option, "--illegal-access=", &tail)) {
char version[256];
JDK_Version::jdk(17).to_string(version, sizeof(version));
warning("Ignoring option %s; support was removed in %s", option->optionString, version);
} else if (match_option(option, "--jbr-illegal-access", &tail)) {
warning("Option --jbr-illegal-access is deprecated and will be removed in a future release.");
if (!create_module_property("jdk.module.illegalAccess", "permit", ExternalProperty)) {
return JNI_ENOMEM;
}
// -agentlib and -agentpath
} else if (match_option(option, "-agentlib:", &tail) ||
(is_absolute_path = match_option(option, "-agentpath:", &tail))) {

View File

@@ -68,4 +68,14 @@ class ExplodedSystemModules implements SystemModules {
public Map<String, Set<String>> moduleReads() {
throw new InternalError();
}
@Override
public Map<String, Set<String>> concealedPackagesToOpen() {
return Map.of();
}
@Override
public Map<String, Set<String>> exportedPackagesToOpen() {
return Map.of();
}
}

View File

@@ -0,0 +1,130 @@
/*
* Copyright (c) 2017, 2019, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.internal.module;
import sun.nio.cs.UTF_8;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
import java.lang.module.ModuleReference;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* Generates the maps of concealed and exported packages to open at run-time.
*
* This is used at run-time for exploded builds, and at link-time to generate
* the maps for the system modules in the run-time image.
*/
public class IllegalAccessMaps {
private final Map<String, Set<String>> concealedPackagesToOpen;
private final Map<String, Set<String>> exportedPackagesToOpen;
private IllegalAccessMaps(Map<String, Set<String>> map1,
Map<String, Set<String>> map2) {
this.concealedPackagesToOpen = map1;
this.exportedPackagesToOpen = map2;
}
/**
* Returns the map of concealed packages to open. The map key is the
* module name, the value is the set of concealed packages to open.
*/
public Map<String, Set<String>> concealedPackagesToOpen() {
return concealedPackagesToOpen;
}
/**
* Returns the map of exported packages to open. The map key is the
* module name, the value is the set of exported packages to open.
*/
public Map<String, Set<String>> exportedPackagesToOpen() {
return exportedPackagesToOpen;
}
/**
* Generate the maps of module to concealed and exported packages for
* the system modules that are observable with the given module finder.
*/
public static IllegalAccessMaps generate(ModuleFinder finder) {
Map<String, ModuleDescriptor> map = new HashMap<>();
finder.findAll().stream()
.map(ModuleReference::descriptor)
.forEach(md -> md.packages().forEach(pn -> map.putIfAbsent(pn, md)));
Map<String, Set<String>> concealedPackagesToOpen = new HashMap<>();
Map<String, Set<String>> exportedPackagesToOpen = new HashMap<>();
String rn = "jdk8_packages.dat";
InputStream in = IllegalAccessMaps.class.getResourceAsStream(rn);
if (in == null) {
throw new InternalError(rn + " not found");
}
try (BufferedReader br = new BufferedReader(
new InputStreamReader(in, UTF_8.INSTANCE)))
{
br.lines()
.filter(line -> !line.isEmpty() && !line.startsWith("#"))
.forEach(pn -> {
ModuleDescriptor descriptor = map.get(pn);
if (descriptor != null && !isOpen(descriptor, pn)) {
String name = descriptor.name();
if (isExported(descriptor, pn)) {
exportedPackagesToOpen.computeIfAbsent(name,
k -> new HashSet<>()).add(pn);
} else {
concealedPackagesToOpen.computeIfAbsent(name,
k -> new HashSet<>()).add(pn);
}
}
});
} catch (IOException ioe) {
throw new UncheckedIOException(ioe);
}
return new IllegalAccessMaps(concealedPackagesToOpen, exportedPackagesToOpen);
}
private static boolean isExported(ModuleDescriptor descriptor, String pn) {
return descriptor.exports()
.stream()
.anyMatch(e -> e.source().equals(pn) && !e.isQualified());
}
private static boolean isOpen(ModuleDescriptor descriptor, String pn) {
return descriptor.opens()
.stream()
.anyMatch(e -> e.source().equals(pn) && !e.isQualified());
}
}

View File

@@ -147,7 +147,8 @@ public final class ModuleBootstrap {
getProperty("jdk.module.limitmods") == null && // --limit-modules
getProperty("jdk.module.addreads.0") == null && // --add-reads
getProperty("jdk.module.addexports.0") == null && // --add-exports
getProperty("jdk.module.addopens.0") == null; // --add-opens
getProperty("jdk.module.addopens.0") == null && // --add-opens
getProperty("jdk.module.illegalAccess") == null; // --jbr-illegal-access
}
/**
@@ -188,6 +189,7 @@ public final class ModuleBootstrap {
String mainModule = System.getProperty("jdk.module.main");
Set<String> addModules = addModules();
Set<String> limitModules = limitModules();
String illegalAccess = getAndRemoveProperty("jdk.module.illegalAccess");
PrintStream traceOutput = null;
String trace = getAndRemoveProperty("jdk.module.showModuleResolution");
@@ -219,7 +221,8 @@ public final class ModuleBootstrap {
&& !haveModulePath
&& addModules.isEmpty()
&& limitModules.isEmpty()
&& !isPatched) {
&& !isPatched
&& illegalAccess == null) {
systemModuleFinder = archivedModuleGraph.finder();
hasSplitPackages = archivedModuleGraph.hasSplitPackages();
hasIncubatorModules = archivedModuleGraph.hasIncubatorModules();
@@ -454,10 +457,19 @@ public final class ModuleBootstrap {
checkIncubatingStatus(cf);
}
// --add-reads, --add-exports/--add-opens
// --add-reads, --add-exports/--add-opens, and --jbr-illegal-access
addExtraReads(bootLayer);
boolean extraExportsOrOpens = addExtraExportsAndOpens(bootLayer);
if (illegalAccess != null) {
assert systemModules != null;
addIllegalAccess(illegalAccess,
systemModules,
upgradeModulePath,
bootLayer,
extraExportsOrOpens);
}
// add enable native access
addEnableNativeAccess(bootLayer);
@@ -813,6 +825,74 @@ public final class ModuleBootstrap {
return modules;
}
/**
* Process the --jbr-illegal-access option to open packages of system modules
* in the boot layer to code in unnamed modules.
*/
private static void addIllegalAccess(String illegalAccess,
SystemModules systemModules,
ModuleFinder upgradeModulePath,
ModuleLayer bootLayer,
boolean extraExportsOrOpens) {
Map<String, Set<String>> concealedPackagesToOpen = systemModules.concealedPackagesToOpen();
Map<String, Set<String>> exportedPackagesToOpen = systemModules.exportedPackagesToOpen();
if (concealedPackagesToOpen.isEmpty() && exportedPackagesToOpen.isEmpty()) {
// need to generate (exploded build)
IllegalAccessMaps maps = IllegalAccessMaps.generate(limitedFinder());
concealedPackagesToOpen = maps.concealedPackagesToOpen();
exportedPackagesToOpen = maps.exportedPackagesToOpen();
}
// open specific packages in the system modules
Set<String> emptySet = Set.of();
for (Module m : bootLayer.modules()) {
ModuleDescriptor descriptor = m.getDescriptor();
String name = m.getName();
// skip open modules
if (descriptor.isOpen()) {
continue;
}
// skip modules loaded from the upgrade module path
if (upgradeModulePath != null
&& upgradeModulePath.find(name).isPresent()) {
continue;
}
Set<String> concealedPackages = concealedPackagesToOpen.getOrDefault(name, emptySet);
Set<String> exportedPackages = exportedPackagesToOpen.getOrDefault(name, emptySet);
// refresh the set of concealed and exported packages if needed
if (extraExportsOrOpens) {
concealedPackages = new HashSet<>(concealedPackages);
exportedPackages = new HashSet<>(exportedPackages);
Iterator<String> iterator = concealedPackages.iterator();
while (iterator.hasNext()) {
String pn = iterator.next();
if (m.isExported(pn, BootLoader.getUnnamedModule())) {
// concealed package is exported to ALL-UNNAMED
iterator.remove();
exportedPackages.add(pn);
}
}
iterator = exportedPackages.iterator();
while (iterator.hasNext()) {
String pn = iterator.next();
if (m.isOpen(pn, BootLoader.getUnnamedModule())) {
// exported package is opened to ALL-UNNAMED
iterator.remove();
}
}
}
// open the packages to unnamed modules
JLA.addOpensToAllUnnamed(m, concealedPackages, exportedPackages);
}
}
/**
* Decodes the values of --add-reads, -add-exports, --add-opens or
* --patch-modules options that are encoded in system properties.

View File

@@ -83,4 +83,16 @@ interface SystemModules {
* by this SystemModules object.
*/
Map<String, Set<String>> moduleReads();
/**
* Returns the map of module concealed packages to open. The map key is the
* module name, the value is the set of concealed packages to open.
*/
Map<String, Set<String>> concealedPackagesToOpen();
/**
* Returns the map of module exported packages to open. The map key is the
* module name, the value is the set of exported packages to open.
*/
Map<String, Set<String>> exportedPackagesToOpen();
}

File diff suppressed because it is too large Load Diff

View File

@@ -188,6 +188,10 @@ java.launcher.X.usage=\n\
\ --add-opens <module>/<package>=<target-module>(,<target-module>)*\n\
\ updates <module> to open <package> to\n\
\ <target-module>, regardless of module declaration.\n\
\ --jbr-illegal-access\n\
\ permit access to members of types in named modules\n\
\ by code in unnamed modules.\n\
\ This option will be removed in a future release.\n\
\ --limit-modules <module name>[,<module name>...]\n\
\ limit the universe of observable modules\n\
\ --patch-module <module>=<file>({0}<file>)*\n\

View File

@@ -106,6 +106,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
private static native boolean nativeDelayShowing(long nsWindowPtr);
private static native void nativeRaiseLevel(long nsWindowPtr, boolean popup, boolean onlyIfParentIsActive);
private static native void nativeSetTransparentTitleBarHeight(long nsWindowPtr, float height);
private static native void nativeCallDeliverMoveResizeEvent(long nsWindowPtr);
// Loger to report issues happened during execution but that do not affect functionality
private static final PlatformLogger logger = PlatformLogger.getLogger("sun.lwawt.macosx.CPlatformWindow");
@@ -1196,6 +1197,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
responder.handleWindowFocusEvent(gained, oppositePeer);
}
public void doDeliverMoveResizeEvent() {
execute(ptr -> nativeCallDeliverMoveResizeEvent(ptr));
}
protected void deliverMoveResizeEvent(int x, int y, int width, int height,
boolean byUser) {
AtomicBoolean ref = new AtomicBoolean();

View File

@@ -776,7 +776,7 @@ AWT_ASSERT_APPKIT_THREAD;
// NSWindowDelegate methods
- (void) _deliverMoveResizeEvent {
AWT_ASSERT_APPKIT_THREAD;
AWT_ASSERT_APPKIT_THREAD;
// deliver the event if this is a user-initiated live resize or as a side-effect
// of a Java initiated resize, because AppKit can override the bounds and force
@@ -785,10 +785,18 @@ AWT_ASSERT_APPKIT_THREAD;
JNIEnv *env = [ThreadUtilities getJNIEnv];
jobject platformWindow = (*env)->NewLocalRef(env, self.javaPlatformWindow);
if (platformWindow == NULL) {
// TODO: create generic AWT assert
NSLog(@"[AWTWindow _deliverMoveResizeEvent]: platformWindow == NULL");
return;
}
NSRect frame;
@try {
frame = ConvertNSScreenRect(env, [self.nsWindow frame]);
} @catch (NSException *e) {
NSLog(@"WARNING: suppressed exception from ConvertNSScreenRect() in [AWTWindow _deliverMoveResizeEvent]");
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
[NSApplicationAWT logException:e forProcess:processInfo];
return;
}
NSRect frame = ConvertNSScreenRect(env, [self.nsWindow frame]);
GET_CPLATFORM_WINDOW_CLASS();
DECLARE_METHOD(jm_deliverMoveResizeEvent, jc_CPlatformWindow, "deliverMoveResizeEvent", "(IIIIZ)V");
@@ -2333,4 +2341,18 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetTransparen
[window setTransparentTitleBarHeight:((CGFloat) transparentTitleBarHeight)];
JNI_COCOA_EXIT(env);
}
}
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeCallDeliverMoveResizeEvent
(JNIEnv *env, jclass clazz, jlong windowPtr)
{
JNI_COCOA_ENTER(env);
NSWindow *nsWindow = (NSWindow *)jlong_to_ptr(windowPtr);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
AWTWindow *window = (AWTWindow*)[nsWindow delegate];
[window _deliverMoveResizeEvent];
}];
JNI_COCOA_EXIT(env);
}

View File

@@ -781,19 +781,12 @@ abstract class XDecoratedPeer extends XWindowPeer {
return;
}
/*
* Some window managers configure before we are reparented and
* the send event flag is set! ugh... (Enlighetenment for one,
* possibly MWM as well). If we haven't been reparented yet
* this is just the WM shuffling us into position. Ignore
* it!!!! or we wind up in a bogus location.
*/
int runningWM = XWM.getWMID();
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
insLog.fine("reparented={0}, visible={1}, WM={2}, decorations={3}",
isReparented(), isVisible(), runningWM, getDecorations());
}
if (!isReparented() && isVisible() && runningWM != XWM.NO_WM
if (ENABLE_REPARENTING_CHECK && !isReparented() && isVisible() && runningWM != XWM.NO_WM
&& !XWM.isNonReparentingWM()
&& getDecorations() != XWindowAttributesData.AWT_DECOR_NONE) {
insLog.fine("- visible but not reparented, skipping");

View File

@@ -52,6 +52,8 @@ import sun.awt.X11GraphicsEnvironment;
import sun.java2d.pipe.Region;
import sun.util.logging.PlatformLogger;
import sun.security.action.GetPropertyAction;
class XWindowPeer extends XPanelPeer implements WindowPeer,
DisplayChangedListener {
@@ -61,6 +63,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
private static final PlatformLogger grabLog = PlatformLogger.getLogger("sun.awt.X11.grab.XWindowPeer");
private static final PlatformLogger iconLog = PlatformLogger.getLogger("sun.awt.X11.icon.XWindowPeer");
static final boolean ENABLE_REPARENTING_CHECK
= "true".equals(GetPropertyAction.privilegedGetProperty("reparenting.check"));
// should be synchronized on awtLock
private static Set<XWindowPeer> windows = new HashSet<XWindowPeer>();
@@ -747,7 +752,8 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
int runningWM = XWM.getWMID();
Point newLocation = targetBounds.getLocation();
if (xe.get_send_event() || runningWM == XWM.NO_WM || XWM.isNonReparentingWM()) {
if (xe.get_send_event() ||
(ENABLE_REPARENTING_CHECK ? (runningWM == XWM.NO_WM || XWM.isNonReparentingWM()) : !isReparented())) {
// Location, Client size + insets
newLocation = new Point(scaleDown(xe.get_x()) - leftInset,
scaleDown(xe.get_y()) - topInset);
@@ -1443,6 +1449,14 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
isUnhiding |= isWMStateNetHidden();
super.handleMapNotifyEvent(xev);
if (!ENABLE_REPARENTING_CHECK && delayedModalBlocking) {
// case of non-re-parenting WM
// (for a re-parenting WM this should have been already done on ReparentNotify processing)
addToTransientFors(AWTAccessor.getComponentAccessor().getPeer(modalBlocker));
delayedModalBlocking = false;
}
if (isBeforeFirstMapNotify && !winAttr.initialFocus && shouldSuppressWmTakeFocus()) {
suppressWmTakeFocus(false); // restore the protocol.
if (!XWM.isKDE2()) {
@@ -1662,7 +1676,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
}
modalBlocker = d;
if (isReparented() || XWM.isNonReparentingWM()) {
if (isReparented() || ENABLE_REPARENTING_CHECK && XWM.isNonReparentingWM()) {
addToTransientFors(blockerPeer, javaToplevels);
} else {
delayedModalBlocking = true;
@@ -1673,7 +1687,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
}
modalBlocker = null;
if (isReparented() || XWM.isNonReparentingWM()) {
if (isReparented() || ENABLE_REPARENTING_CHECK && XWM.isNonReparentingWM()) {
removeFromTransientFors();
} else {
delayedModalBlocking = false;

View File

@@ -60,6 +60,7 @@ import java.util.stream.Collectors;
import jdk.internal.module.Checks;
import jdk.internal.module.DefaultRoots;
import jdk.internal.module.IllegalAccessMaps;
import jdk.internal.module.Modules;
import jdk.internal.module.ModuleHashes;
import jdk.internal.module.ModuleInfo.Attributes;
@@ -621,6 +622,9 @@ public final class SystemModulesPlugin extends AbstractPlugin {
// generate moduleReads
genModuleReads(cw, cf);
// generate concealedPackagesToOpen and exportedPackagesToOpen
genXXXPackagesToOpenMethods(cw);
return cw;
}
@@ -851,6 +855,16 @@ public final class SystemModulesPlugin extends AbstractPlugin {
generate(cw, "moduleReads", map, true);
}
/**
* Generate concealedPackagesToOpen and exportedPackagesToOpen methods.
*/
private void genXXXPackagesToOpenMethods(ClassWriter cw) {
ModuleFinder finder = finderOf(moduleInfos);
IllegalAccessMaps maps = IllegalAccessMaps.generate(finder);
generate(cw, "concealedPackagesToOpen", maps.concealedPackagesToOpen(), false);
generate(cw, "exportedPackagesToOpen", maps.exportedPackagesToOpen(), false);
}
/**
* Generate method to return {@code Map<String, Set<String>>}.
*

View File

@@ -0,0 +1,79 @@
/*
* Copyright (c) 2021, Red Hat, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8275330
* @summary C2: assert(n->is_Root() || n->is_Region() || n->is_Phi() || n->is_MachMerge() || def_block->dominates(block)) failed: uses must be dominated by definitions
*
* @run main/othervm -Xmx512m -XX:+UnlockDiagnosticVMOptions -Xcomp -XX:CompileOnly=TestDeadPostLoopBecausePredicate TestDeadPostLoopBecausePredicate
*
*/
public class TestDeadPostLoopBecausePredicate {
public static final int N = 400;
public static int iFld=54270;
public static int iFld1=-4;
public int iFld2=201;
public int mainTest(String[] strArr1) {
int i=0, i17=8052, i19=22380, i20=60894, iArr[]=new int[N];
init(iArr, 4);
i = 1;
do {
for (i17 = 5; i17 < 114; i17++) {
switch ((i17 % 7) + 126) {
case 126:
for (i19 = 2; i19 > i; i19 -= 3) {
try {
i20 = (iFld2 % TestDeadPostLoopBecausePredicate.iFld1);
i20 = (iArr[i19 - 1] % TestDeadPostLoopBecausePredicate.iFld);
TestDeadPostLoopBecausePredicate.iFld = (TestDeadPostLoopBecausePredicate.iFld1 % iArr[i19]);
} catch (ArithmeticException a_e) {}
}
break;
}
}
} while (++i < 220);
return i20;
}
public static void init(int[] a, int seed) {
for (int j = 0; j < a.length; j++) {
a[j] = (j % 2 == 0) ? seed + j : seed - j;
}
}
public static void main(String[] strArr) {
TestDeadPostLoopBecausePredicate _instance = new TestDeadPostLoopBecausePredicate();
for (int i = 0; i < 10; i++ ) {
_instance.mainTest(strArr);
}
}
}

View File

@@ -0,0 +1,268 @@
/*
* Copyright (c) 2022, Red Hat, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* bug 8280799
* @summary С2: assert(false) failed: cyclic dependency prevents range check elimination
* @run main/othervm -XX:-BackgroundCompilation -XX:-UseCountedLoopSafepoints TestPredicateInputBelowLoopPredicate
*/
public class TestPredicateInputBelowLoopPredicate {
private static final Object object = new Object();
private static int fieldStop = 100;
private static int[] array = new int[200];
private static int[] array2 = new int[200];
private static int fieldStart = 0;
public static void main(String[] args) {
for (int i = 0; i < 20_000; i++) {
test(true);
test(false);
}
}
private static void test(boolean flag) {
if (array == null) {
}
int start = fieldStart;
int i = start;
for(;;) {
int j;
for (j = -10; j < 0; j++) {
}
int stop = fieldStop;
// bound check becomes candidate for predication once
// loop above is optimized out
array[stop - i + j] = 0;
// A bunch of stuff to grow loop body size and prevent peeling:
array2[0] = 0;
array2[1] = 0;
array2[2] = 0;
array2[3] = 0;
array2[4] = 0;
array2[5] = 0;
array2[6] = 0;
array2[7] = 0;
array2[8] = 0;
array2[9] = 0;
array2[10] = 0;
array2[11] = 0;
array2[12] = 0;
array2[13] = 0;
array2[14] = 0;
array2[15] = 0;
array2[16] = 0;
array2[17] = 0;
array2[18] = 0;
array2[19] = 0;
array2[20] = 0;
array2[21] = 0;
array2[22] = 0;
array2[23] = 0;
array2[24] = 0;
array2[25] = 0;
array2[26] = 0;
array2[27] = 0;
array2[28] = 0;
array2[29] = 0;
array2[30] = 0;
array2[31] = 0;
array2[32] = 0;
array2[33] = 0;
array2[34] = 0;
array2[35] = 0;
array2[36] = 0;
array2[37] = 0;
array2[38] = 0;
array2[39] = 0;
array2[40] = 0;
array2[41] = 0;
array2[42] = 0;
array2[43] = 0;
array2[44] = 0;
array2[45] = 0;
array2[46] = 0;
array2[47] = 0;
array2[48] = 0;
array2[49] = 0;
array2[50] = 0;
array2[51] = 0;
array2[52] = 0;
array2[53] = 0;
array2[54] = 0;
array2[55] = 0;
array2[56] = 0;
array2[57] = 0;
array2[58] = 0;
array2[59] = 0;
array2[60] = 0;
array2[61] = 0;
array2[62] = 0;
array2[63] = 0;
array2[64] = 0;
array2[65] = 0;
array2[66] = 0;
array2[67] = 0;
array2[68] = 0;
array2[69] = 0;
array2[70] = 0;
array2[71] = 0;
array2[72] = 0;
array2[73] = 0;
array2[74] = 0;
array2[75] = 0;
array2[76] = 0;
array2[77] = 0;
array2[78] = 0;
array2[79] = 0;
array2[80] = 0;
array2[81] = 0;
array2[82] = 0;
array2[83] = 0;
array2[84] = 0;
array2[85] = 0;
array2[86] = 0;
array2[87] = 0;
array2[88] = 0;
array2[89] = 0;
array2[90] = 0;
array2[91] = 0;
array2[92] = 0;
array2[93] = 0;
array2[94] = 0;
array2[95] = 0;
array2[96] = 0;
array2[97] = 0;
array2[98] = 0;
array2[99] = 0;
array2[100] = 0;
array2[101] = 0;
array2[102] = 0;
array2[103] = 0;
array2[104] = 0;
array2[105] = 0;
array2[106] = 0;
array2[107] = 0;
array2[108] = 0;
array2[109] = 0;
array2[110] = 0;
array2[111] = 0;
array2[112] = 0;
array2[113] = 0;
array2[114] = 0;
array2[115] = 0;
array2[116] = 0;
array2[117] = 0;
array2[118] = 0;
array2[119] = 0;
array2[120] = 0;
array2[121] = 0;
array2[122] = 0;
array2[123] = 0;
array2[124] = 0;
array2[125] = 0;
array2[126] = 0;
array2[127] = 0;
array2[128] = 0;
array2[129] = 0;
array2[130] = 0;
array2[131] = 0;
array2[132] = 0;
array2[133] = 0;
array2[134] = 0;
array2[135] = 0;
array2[136] = 0;
array2[137] = 0;
array2[138] = 0;
array2[139] = 0;
array2[140] = 0;
array2[141] = 0;
array2[142] = 0;
array2[143] = 0;
array2[144] = 0;
array2[145] = 0;
array2[146] = 0;
array2[147] = 0;
array2[148] = 0;
array2[149] = 0;
array2[150] = 0;
array2[151] = 0;
array2[152] = 0;
array2[153] = 0;
array2[154] = 0;
array2[155] = 0;
array2[156] = 0;
array2[157] = 0;
array2[158] = 0;
array2[159] = 0;
array2[160] = 0;
array2[161] = 0;
array2[162] = 0;
array2[163] = 0;
array2[164] = 0;
array2[165] = 0;
array2[166] = 0;
array2[167] = 0;
array2[168] = 0;
array2[169] = 0;
array2[170] = 0;
array2[171] = 0;
array2[172] = 0;
array2[173] = 0;
array2[174] = 0;
array2[175] = 0;
array2[176] = 0;
array2[177] = 0;
array2[178] = 0;
array2[179] = 0;
array2[180] = 0;
array2[181] = 0;
array2[182] = 0;
array2[183] = 0;
array2[184] = 0;
array2[185] = 0;
array2[186] = 0;
array2[187] = 0;
array2[188] = 0;
array2[189] = 0;
array2[190] = 0;
array2[191] = 0;
array2[192] = 0;
array2[193] = 0;
array2[194] = 0;
array2[195] = 0;
array2[196] = 0;
array2[197] = 0;
array2[198] = 0;
array2[199] = 0;
i++;
if (i == stop) { // requires a loop limit predicate
break;
}
}
}
}

View File

@@ -0,0 +1,59 @@
/*
* Copyright (c) 2017, 2021, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8266851
* @library /test/lib
* @build JbrIllegalAccessTest
* @run testng JbrIllegalAccessTest
* @summary Make sure that --jbr-illegal-access is working.
*/
import jdk.test.lib.process.*;
import org.testng.annotations.*;
/**
* Make sure that --jbr-illegal-access is working as expected.
*/
@Test
public class JbrIllegalAccessTest {
void run(String text, String... vmopts)
throws Exception
{
var outputAnalyzer = ProcessTools
.executeTestJava(vmopts)
.outputTo(System.out)
.errorTo(System.out);
outputAnalyzer.shouldContain(text);
}
public void testObsolete() throws Exception {
run("Option --jbr-illegal-access is deprecated",
"-XX:-IgnoreUnrecognizedVMOptions",
"--jbr-illegal-access", "--version");
}
}