Skip to content

Commit

Permalink
Merge master HEAD into openj9-staging
Browse files Browse the repository at this point in the history
Signed-off-by: J9 Build <j9build@ca.ibm.com>
  • Loading branch information
j9build committed Jun 22, 2023
2 parents 81f34f4 + 1168c60 commit 335cca2
Show file tree
Hide file tree
Showing 124 changed files with 1,237 additions and 621 deletions.
31 changes: 19 additions & 12 deletions make/Images.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 2023, 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
Expand Down Expand Up @@ -29,6 +29,7 @@ include $(SPEC)
include MakeBase.gmk
include Execute.gmk
include Modules.gmk
include Utils.gmk

JDK_TARGETS :=
JRE_TARGETS :=
Expand All @@ -39,7 +40,7 @@ $(eval $(call IncludeCustomExtension, Images-pre.gmk))
################################################################################

# All modules for the current target platform.
ALL_MODULES := $(call FindAllModules)
ALL_MODULES := $(call FindAllModules) $(EXTRA_MODULES)

$(eval $(call ReadImportMetaData))

Expand All @@ -54,7 +55,10 @@ JDK_MODULES_LIST := $(call CommaList, $(JDK_MODULES))

BASE_RELEASE_FILE := $(JDK_OUTPUTDIR)/release

JMODS := $(wildcard $(IMAGES_OUTPUTDIR)/jmods/*.jmod)
JMODS_DIRS := $(EXTRA_JMODS_DIR) $(IMAGES_OUTPUTDIR)/jmods

JDK_JMODS := $(foreach m, $(JDK_MODULES), $(firstword $(wildcard $(addsuffix /$m.jmod, $(JMODS_DIRS)))))
JRE_JMODS := $(foreach m, $(JRE_MODULES), $(firstword $(wildcard $(addsuffix /$m.jmod, $(JMODS_DIRS)))))

JLINK_ORDER_RESOURCES := **module-info.class
JLINK_JLI_CLASSES :=
Expand All @@ -71,7 +75,7 @@ JLINK_ORDER_RESOURCES += \
#

JLINK_TOOL := $(JLINK) -J-Djlink.debug=true \
--module-path $(IMAGES_OUTPUTDIR)/jmods \
--module-path $(call PathList, $(JMODS_DIRS)) \
--endian $(OPENJDK_TARGET_CPU_ENDIAN) \
--release-info $(BASE_RELEASE_FILE) \
--order-resources=$(call CommaList, $(JLINK_ORDER_RESOURCES)) \
Expand All @@ -87,12 +91,15 @@ endif

JLINK_DISABLE_WARNINGS := | ( $(GREP) -v -e "WARNING: Using incubator module" || test "$$?" = "1" )

JDK_IMAGE_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jdk
JRE_IMAGE_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jre

$(eval $(call SetupExecute, jlink_jdk, \
WARN := Creating jdk image, \
DEPS := $(JMODS) $(BASE_RELEASE_FILE) \
$(call DependOnVariable, JDK_MODULES_LIST), \
DEPS := $(JDK_JMODS) $(BASE_RELEASE_FILE) \
$(call DependOnVariable, JDK_MODULES_LIST, $(JDK_IMAGE_SUPPORT_DIR)/_jlink_jdk.vardeps), \
OUTPUT_DIR := $(JDK_IMAGE_DIR), \
SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jdk, \
SUPPORT_DIR := $(JDK_IMAGE_SUPPORT_DIR), \
PRE_COMMAND := $(RM) -r $(JDK_IMAGE_DIR), \
COMMAND := $(JLINK_TOOL) --add-modules $(JDK_MODULES_LIST) \
$(JLINK_JDK_EXTRA_OPTS) --output $(JDK_IMAGE_DIR) \
Expand All @@ -103,10 +110,10 @@ JLINK_JDK_TARGETS := $(jlink_jdk)

$(eval $(call SetupExecute, jlink_jre, \
WARN := Creating legacy jre image, \
DEPS := $(JMODS) $(BASE_RELEASE_FILE) \
$(call DependOnVariable, JDK_MODULES_LIST), \
DEPS := $(JRE_JMODS) $(BASE_RELEASE_FILE) \
$(call DependOnVariable, JRE_MODULES_LIST, $(JRE_IMAGE_SUPPORT_DIR)/_jlink_jre.vardeps), \
OUTPUT_DIR := $(JRE_IMAGE_DIR), \
SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jre, \
SUPPORT_DIR := $(JRE_IMAGE_SUPPORT_DIR), \
PRE_COMMAND := $(RM) -r $(JRE_IMAGE_DIR), \
COMMAND := $(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \
$(JLINK_JRE_EXTRA_OPTS) --output $(JRE_IMAGE_DIR), \
Expand Down Expand Up @@ -142,7 +149,7 @@ define CreateCDSArchive
INFO := Using CDS flags for $1: $$($1_$2_CDS_DUMP_FLAGS), \
DEPS := $$(jlink_jdk), \
OUTPUT_FILE := $$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE), \
SUPPORT_DIR := $$(SUPPORT_OUTPUTDIR)/images/jdk, \
SUPPORT_DIR := $$(JDK_IMAGE_SUPPORT_DIR), \
COMMAND := $$(FIXPATH) $$(JDK_IMAGE_DIR)/bin/java -Xshare:dump \
-XX:SharedArchiveFile=$$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE) \
-$1 $$($1_$2_DUMP_EXTRA_ARG) $$($1_$2_CDS_DUMP_FLAGS) $$(LOG_INFO), \
Expand All @@ -155,7 +162,7 @@ define CreateCDSArchive
INFO := Using CDS flags for $1: $$($1_$2_CDS_DUMP_FLAGS), \
DEPS := $$(jlink_jre), \
OUTPUT_FILE := $$(JRE_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE), \
SUPPORT_DIR := $$(SUPPORT_OUTPUTDIR)/images/jre, \
SUPPORT_DIR := $$(JRE_IMAGE_SUPPORT_DIR), \
COMMAND := $$(FIXPATH) $$(JRE_IMAGE_DIR)/bin/java -Xshare:dump \
-XX:SharedArchiveFile=$$(JRE_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE) \
-$1 $$($1_$2_DUMP_EXTRA_ARG) $$($1_$2_CDS_DUMP_FLAGS) $$(LOG_INFO), \
Expand Down
3 changes: 2 additions & 1 deletion make/Main.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,8 @@ else
# When creating the BUILDJDK, we don't need to add hashes to java.base, thus
# we don't need to depend on all other jmods
ifneq ($(CREATING_BUILDJDK), true)
java.base-jmod: jrtfs-jar $(filter-out java.base-jmod, $(JMOD_TARGETS))
java.base-jmod: jrtfs-jar $(filter-out java.base-jmod \
$(addsuffix -jmod, $(call FindAllUpgradeableModules)), $(JMOD_TARGETS))
endif

# If not already set, set the JVM target so that the JVM will be built.
Expand Down
9 changes: 7 additions & 2 deletions make/MainSupport.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2023, 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
Expand Down Expand Up @@ -38,11 +38,16 @@ _MAINSUPPORT_GMK := 1
# TARGET the makefile target
# ARGS arguments to the makefile
# DEPS the target(s) this new rule depends on
# DIR the directory of the makefile (defaults to $(TOPDIR)/make)
#
SetupTarget = $(NamedParamsMacroTemplate)
define SetupTargetBody
ifeq ($$($1_DIR), )
$1_DIR := $(TOPDIR)/make
endif

$1:
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f $$($1_MAKEFILE).gmk $$($1_TARGET) $$($1_ARGS))
+($(CD) $$($1_DIR) && $(MAKE) $(MAKE_ARGS) -f $$($1_MAKEFILE).gmk $$($1_TARGET) $$($1_ARGS))

ALL_TARGETS += $1

Expand Down
3 changes: 3 additions & 0 deletions make/autoconf/jdk-options.m4
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,9 @@ AC_DEFUN([JDKOPT_CHECK_CODESIGN_PARAMS],
$RM "$CODESIGN_TESTFILE"
$TOUCH "$CODESIGN_TESTFILE"
CODESIGN_SUCCESS=false
$ECHO "check codesign, calling $CODESIGN $PARAMS $CODESIGN_TESTFILE" >&AS_MESSAGE_LOG_FD
eval \"$CODESIGN\" $PARAMS \"$CODESIGN_TESTFILE\" 2>&AS_MESSAGE_LOG_FD \
>&AS_MESSAGE_LOG_FD && CODESIGN_SUCCESS=true
$RM "$CODESIGN_TESTFILE"
Expand Down
32 changes: 16 additions & 16 deletions make/autoconf/util.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2023, 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
Expand Down Expand Up @@ -496,7 +496,7 @@ AC_DEFUN([UTIL_CHECK_TYPE_directory],
FAILURE="Directory $1 does not exist or is not readable"
fi
if test "[x]ARG_CHECK_FOR_FILES" != x; then
if test "[x]ARG_CHECK_FOR_FILES" != "x:"; then
for file in ARG_CHECK_FOR_FILES; do
found_files=$($ECHO $(ls $1/$file 2> /dev/null))
if test "x$found_files" = x; then
Expand Down Expand Up @@ -768,25 +768,25 @@ UTIL_DEFUN_NAMED([UTIL_ARG_WITH],
else
AC_MSG_RESULT([$ARG_RESULT, $REASON])
fi
fi
# Verify value
# First use our dispatcher to verify that type requirements are satisfied
UTIL_CHECK_TYPE(ARG_TYPE, $ARG_RESULT)
# Verify value
# First use our dispatcher to verify that type requirements are satisfied
UTIL_CHECK_TYPE(ARG_TYPE, $ARG_RESULT)
if test "x$FAILURE" = x; then
# Execute custom verification payload, if present
RESULT="$ARG_RESULT"
if test "x$FAILURE" = x; then
# Execute custom verification payload, if present
RESULT="$ARG_RESULT"
ARG_CHECK_VALUE
ARG_CHECK_VALUE
ARG_RESULT="$RESULT"
fi
ARG_RESULT="$RESULT"
fi
if test "x$FAILURE" != x; then
AC_MSG_NOTICE([Invalid value for [--with-]ARG_NAME: "$ARG_RESULT"])
AC_MSG_NOTICE([$FAILURE])
AC_MSG_ERROR([Cannot continue])
if test "x$FAILURE" != x; then
AC_MSG_NOTICE([Invalid value for [--with-]ARG_NAME: "$ARG_RESULT"])
AC_MSG_NOTICE([$FAILURE])
AC_MSG_ERROR([Cannot continue])
fi
fi
# Execute result payloads, if present
Expand Down
4 changes: 2 additions & 2 deletions src/java.base/unix/native/jspawnhelper/jspawnhelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ void initChildStuff (int fdin, int fdout, ChildStuff *c) {
int main(int argc, char *argv[]) {
ChildStuff c;
struct stat buf;
/* argv[0] contains the fd number to read all the child info */
/* argv[1] contains the fd number to read all the child info */
int r, fdinr, fdinw, fdout;
sigset_t unblock_signals;

#ifdef DEBUG
jtregSimulateCrash(0, 4);
#endif
r = sscanf (argv[argc-1], "%d:%d:%d", &fdinr, &fdinw, &fdout);
r = sscanf (argv[1], "%d:%d:%d", &fdinr, &fdinw, &fdout);
if (r == 3 && fcntl(fdinr, F_GETFD) != -1 && fcntl(fdinw, F_GETFD) != -1) {
fstat(fdinr, &buf);
if (!S_ISFIFO(buf.st_mode))
Expand Down
12 changes: 8 additions & 4 deletions src/java.base/unix/native/libjava/ProcessImpl_md.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,16 +488,20 @@ spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath)
pid_t resultPid;
int i, offset, rval, bufsize, magic;
char *buf, buf1[(3 * 11) + 3]; // "%d:%d:%d\0"
char *hlpargs[2];
char *hlpargs[3];
SpawnInfo sp;

/* need to tell helper which fd is for receiving the childstuff
* and which fd to send response back on
*/
snprintf(buf1, sizeof(buf1), "%d:%d:%d", c->childenv[0], c->childenv[1], c->fail[1]);
/* put the fd string as argument to the helper cmd */
hlpargs[0] = buf1;
hlpargs[1] = 0;
/* NULL-terminated argv array.
* argv[0] contains path to jspawnhelper, to follow conventions.
* argv[1] contains the fd string as argument to jspawnhelper
*/
hlpargs[0] = (char*)helperpath;
hlpargs[1] = buf1;
hlpargs[2] = NULL;

/* Following items are sent down the pipe to the helper
* after it is spawned.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
;DESCRIPTION 'WINDOWSACCESSBRIDGE.DLL'
EXPORTS

addJavaEventNotification
removeJavaEventNotification
addAccessibilityEventNotification
removeAccessibilityEventNotification

Windows_run

getAccessibleTableInfo
Expand Down
2 changes: 2 additions & 0 deletions src/jdk.compiler/share/classes/com/sun/tools/javac/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
* compiler, javac.
* See the <a href="{@docRoot}/jdk.compiler/module-summary.html">{@code jdk.compiler}</a>
* module for details on replacement APIs.
*
* @since 1.5
*/
public class Main {
/**
Expand Down
68 changes: 46 additions & 22 deletions src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
Original file line number Diff line number Diff line change
Expand Up @@ -1447,12 +1447,7 @@ public void visitBlock(JCBlock tree) {
public void visitDoLoop(JCDoWhileLoop tree) {
attribStat(tree.body, env.dup(tree));
attribExpr(tree.cond, env, syms.booleanType);
if (!breaksOutOf(tree, tree.body)) {
//include condition's body when false after the while, if cannot get out of the loop
MatchBindings condBindings = matchBindings;
condBindings.bindingsWhenFalse.forEach(env.info.scope::enter);
condBindings.bindingsWhenFalse.forEach(BindingSymbol::preserveBinding);
}
handleLoopConditionBindings(matchBindings, tree, tree.body);
result = null;
}

Expand All @@ -1466,19 +1461,10 @@ public void visitWhileLoop(JCWhileLoop tree) {
} finally {
whileEnv.info.scope.leave();
}
if (!breaksOutOf(tree, tree.body)) {
//include condition's bindings when false after the while, if cannot get out of the loop
condBindings.bindingsWhenFalse.forEach(env.info.scope::enter);
condBindings.bindingsWhenFalse.forEach(BindingSymbol::preserveBinding);
}
handleLoopConditionBindings(condBindings, tree, tree.body);
result = null;
}

private boolean breaksOutOf(JCTree loop, JCTree body) {
preFlow(body);
return flow.breaksOutOf(env, loop, body, make);
}

public void visitForLoop(JCForLoop tree) {
Env<AttrContext> loopEnv =
env.dup(env.tree, env.info.dup(env.info.scope.dup()));
Expand All @@ -1503,11 +1489,50 @@ public void visitForLoop(JCForLoop tree) {
finally {
loopEnv.info.scope.leave();
}
if (!breaksOutOf(tree, tree.body)) {
//include condition's body when false after the while, if cannot get out of the loop
condBindings.bindingsWhenFalse.forEach(env.info.scope::enter);
condBindings.bindingsWhenFalse.forEach(BindingSymbol::preserveBinding);
handleLoopConditionBindings(condBindings, tree, tree.body);
}

/**
* Include condition's bindings when false after the loop, if cannot get out of the loop
*/
private void handleLoopConditionBindings(MatchBindings condBindings,
JCStatement loop,
JCStatement loopBody) {
if (condBindings.bindingsWhenFalse.nonEmpty() &&
!breaksTo(env, loop, loopBody)) {
addBindings2Scope(loop, condBindings.bindingsWhenFalse);
}
}

private boolean breaksTo(Env<AttrContext> env, JCTree loop, JCTree body) {
preFlow(body);
return flow.breaksToTree(env, loop, body, make);
}

/**
* Add given bindings to the current scope, unless there's a break to
* an immediately enclosing labeled statement.
*/
private void addBindings2Scope(JCStatement introducingStatement,
List<BindingSymbol> bindings) {
if (bindings.isEmpty()) {
return ;
}

var searchEnv = env;
while (searchEnv.tree instanceof JCLabeledStatement labeled &&
labeled.body == introducingStatement) {
if (breaksTo(env, labeled, labeled.body)) {
//breaking to an immediately enclosing labeled statement
return ;
}
searchEnv = searchEnv.next;
introducingStatement = labeled;
}

//include condition's body when false after the while, if cannot get out of the loop
bindings.forEach(env.info.scope::enter);
bindings.forEach(BindingSymbol::preserveBinding);
}

public void visitForeachLoop(JCEnhancedForLoop tree) {
Expand Down Expand Up @@ -2242,8 +2267,7 @@ public void visitIf(JCIf tree) {
afterIfBindings = condBindings.bindingsWhenFalse;
}

afterIfBindings.forEach(env.info.scope::enter);
afterIfBindings.forEach(BindingSymbol::preserveBinding);
addBindings2Scope(tree, afterIfBindings);

result = null;
}
Expand Down
Loading

0 comments on commit 335cca2

Please sign in to comment.