Skip to content

Commit 3f09cef

Browse files
committed
Merging master HEAD into openj9-staging
2 parents 33a37d7 + 38fff43 commit 3f09cef

File tree

106 files changed

+6729
-1040
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+6729
-1040
lines changed

make/CompileCommands.gmk

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -45,11 +45,6 @@ $(OUTPUTDIR)/compile_commands.json: $(wildcard $(MAKESUPPORT_OUTPUTDIR)/compile-
4545
$(RM) $@
4646
$(FIND) $(MAKESUPPORT_OUTPUTDIR)/compile-commands/ -name \*.json | \
4747
$(SORT) | $(XARGS) $(CAT) >> [email protected]
48-
$(if $(FIXPATH),$(FIXPATH) $(AWK) 'BEGIN { \
49-
tmpfile = substr(ARGV[2],2); \
50-
cmd = "$(CP) " "\047" tmpfile "\047" " [email protected]"; \
51-
system(cmd); \
52-
5348
$(SED) -e '1s/^/[\$(NEWLINE)/' -e '$(DOLLAR)s/,\s\{0,\}$(DOLLAR)/\$(NEWLINE)]/' [email protected] > $@
5449
5550

make/RunTestsPrebuiltSpec.gmk

-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ LN := ln
153153
MIG := mig
154154
MKDIR := mkdir
155155
MV := mv
156-
NAWK := nawk
157156
NICE := nice
158157
PATCH := patch
159158
PRINTF := printf

make/autoconf/basic_tools.m4

+1-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
5757
UTIL_REQUIRE_PROGS(MKDIR, [gmkdir mkdir])
5858
UTIL_REQUIRE_PROGS(MKTEMP, mktemp)
5959
UTIL_REQUIRE_PROGS(MV, mv)
60-
UTIL_REQUIRE_PROGS(NAWK, [nawk gawk awk])
60+
UTIL_REQUIRE_PROGS(AWK, [gawk nawk awk])
6161
UTIL_REQUIRE_PROGS(PRINTF, printf)
6262
UTIL_REQUIRE_PROGS(READLINK, [greadlink readlink])
6363
UTIL_REQUIRE_PROGS(RM, rm)
@@ -75,7 +75,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
7575
UTIL_REQUIRE_PROGS(XARGS, xargs)
7676
7777
# Then required tools that require some special treatment.
78-
UTIL_REQUIRE_SPECIAL(AWK, [AC_PROG_AWK])
7978
UTIL_REQUIRE_SPECIAL(GREP, [AC_PROG_GREP])
8079
UTIL_REQUIRE_SPECIAL(EGREP, [AC_PROG_EGREP])
8180
UTIL_REQUIRE_SPECIAL(FGREP, [AC_PROG_FGREP])

make/autoconf/compare.sh.in

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
#
3-
# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
3+
# Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
44
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
#
66
# This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,6 @@ export LDD="@LDD@"
5353
export LN="@LN@"
5454
export MKDIR="@MKDIR@"
5555
export MV="@MV@"
56-
export NAWK="@NAWK@"
5756
export NM="@GNM@"
5857
export OBJDUMP="@OBJDUMP@"
5958
export OTOOL="@OTOOL@"

make/autoconf/spec.gmk.in

-1
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,6 @@ LN:=@LN@
707707
MIG:=@MIG@
708708
MKDIR:=@MKDIR@
709709
MV:=@MV@
710-
NAWK:=@NAWK@
711710
NICE:=@NICE@
712711
PANDOC:=@FIXPATH@ @PANDOC@
713712
PATCH:=@PATCH@

make/common/MakeBase.gmk

+7-3
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,18 @@ BUILDTIMESDIR=$(OUTPUTDIR)/make-support/build-times
8989

9090
# Record starting time for build of a sub repository.
9191
define RecordStartTime
92-
$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$(strip $1) && \
92+
$(DATE) '+%Y %m %d %H %M %S' | $(AWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$(strip $1) && \
9393
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$(strip $1)_human_readable
9494
endef
9595

9696
# Record ending time and calculate the difference and store it in a
9797
# easy to read format. Handles builds that cross midnight. Expects
9898
# that a build will never take 24 hours or more.
9999
define RecordEndTime
100-
$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$(strip $1)
100+
$(DATE) '+%Y %m %d %H %M %S' | $(AWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$(strip $1)
101101
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$(strip $1)_human_readable
102102
$(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$(strip $1)` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$(strip $1)` $1 | \
103-
$(NAWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \
103+
$(AWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \
104104
M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \
105105
> $(BUILDTIMESDIR)/build_time_diff_$(strip $1)
106106
endef
@@ -439,6 +439,8 @@ endif
439439
# This is normally not needed since we use the FIXPATH prefix for command lines,
440440
# but might be needed in certain circumstances.
441441
ifeq ($(call isTargetOs, windows), true)
442+
FixPathArgs = \
443+
$(shell $(FIXPATH) cmd /c echo $1)
442444
ifeq ($(call isBuildOsEnv, windows.wsl), true)
443445
FixPath = \
444446
$(shell $(WSLPATH) -m $1)
@@ -447,6 +449,8 @@ ifeq ($(call isTargetOs, windows), true)
447449
$(shell $(CYGPATH) -m $1)
448450
endif
449451
else
452+
FixPathArgs = \
453+
$1
450454
FixPath = \
451455
$1
452456
endif

make/common/Modules.gmk

+2-2
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ $(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
338338
$(RM) $@
339339
$(foreach m, $(MODULE_INFOS), \
340340
( $(PRINTF) "DEPS_$(call GetModuleNameFromModuleInfo, $m) :=" && \
341-
$(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
341+
$(AWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
342342
BEGIN { if (MODULE != "java.base") printf(" java.base"); } \
343343
/^ *requires/ { sub(/;/, ""); \
344344
sub(/requires /, " "); \
@@ -352,7 +352,7 @@ $(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
352352
printf(" %s", $$0) } \
353353
END { printf("\n") }' $m && \
354354
$(PRINTF) "TRANSITIVE_MODULES_$(call GetModuleNameFromModuleInfo, $m) :=" && \
355-
$(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
355+
$(AWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
356356
BEGIN { if (MODULE != "java.base") printf(" java.base"); } \
357357
/^ *requires *transitive/ { \
358358
sub(/;/, ""); \

make/common/NativeCompilation.gmk

+11-6
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ define WriteCompileCommandsFragment
7676
$(call LogInfo, Creating compile commands fragment for $(notdir $3))
7777
$(call MakeDir, $(dir $1))
7878
$(call WriteFile,{ \
79-
"directory": "$(strip $2)"$(COMMA) \
80-
"file": "$(strip $3)"$(COMMA) \
79+
"directory": "$(strip $(call FixPathArgs, $2))"$(COMMA) \
80+
"file": "$(strip $(call FixPathArgs, $3))"$(COMMA) \
8181
"command": "$(strip $(subst $(DQUOTE),\$(DQUOTE),$(subst \,\\,\
82-
$(subst $(FIXPATH),,$4))))" \
82+
$(subst $(FIXPATH),,$(call FixPathArgs, $4)))))" \
8383
}$(COMMA), \
8484
$1)
8585
endef
@@ -241,10 +241,15 @@ ifeq ($(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT)-$(FILE_MACRO_CFLAGS), false-)
241241
) \
242242
)
243243

244-
# When compiling with relative paths, the deps file comes out with relative
245-
# paths.
244+
# When compiling with relative paths, the deps file may come out with relative
245+
# paths, and that path may start with './'. First remove any leading ./, then
246+
# add WORKSPACE_ROOT to any line not starting with /, while allowing for
247+
# leading spaces.
246248
define fix-deps-file
247-
$(SED) -e 's|^\([ ]*\)|\1$(WORKSPACE_ROOT)|' $1.tmp > $1
249+
$(SED) \
250+
-e 's|^\([ ]*\)\./|\1|' \
251+
-e '/^[ ]*[^/ ]/s|^\([ ]*\)|\1$(WORKSPACE_ROOT)/|' \
252+
$1.tmp > $1
248253
endef
249254
else
250255
# By default the MakeCommandRelative macro does nothing.

make/common/TextFileProcessing.gmk

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -177,7 +177,7 @@ define SetupTextFileProcessingBody
177177
$1_INCLUDES_PARTIAL_AWK := $$(subst $$(SPACE);,,$$(subst $$(SPACE)=>$$(SPACE),"$$(RIGHT_PAREN)$$(RIGHT_PAREN) \
178178
{ include$$(LEFT_PAREN)",$$(subst $$(SPACE);$$(SPACE),"$$(RIGHT_PAREN) } \
179179
else if $$(LEFT_PAREN)matches$$(LEFT_PAREN)",$$(strip $$($1_INCLUDES)))))
180-
$1_INCLUDES_COMMAND_LINE := $(NAWK) '$$($1_INCLUDES_HEADER_AWK) \
180+
$1_INCLUDES_COMMAND_LINE := $(AWK) '$$($1_INCLUDES_HEADER_AWK) \
181181
{ if (matches("$$($1_INCLUDES_PARTIAL_AWK)") } else print }'
182182
else
183183
# We don't have any includes, just pipe the file through cat.

make/hotspot/gensrc/GensrcAdlc.gmk

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ ifeq ($(call check-jvm-feature, compiler2), true)
168168
$(SINGLE_AD_SRCFILE): $(AD_SRC_FILES)
169169
$(call LogInfo, Preprocessing adlc files $(^F))
170170
$(call MakeDir, $(@D))
171-
$(NAWK) $(INSERT_FILENAME_AWK_SCRIPT) $^ > $@
171+
$(AWK) $(INSERT_FILENAME_AWK_SCRIPT) $^ > $@
172172

173173
##############################################################################
174174
# Run the adlc tool on the single concatenated ad source file, and store the
@@ -205,7 +205,7 @@ ifeq ($(call check-jvm-feature, compiler2), true)
205205
$(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles/%: $(adlc_run_TARGET)
206206
$(call LogInfo, Postprocessing adlc file $*)
207207
$(call MakeDir, $(@D))
208-
$(NAWK) \
208+
$(AWK) \
209209
'BEGIN { print "#line 1 \"$*\""; } \
210210
/^#line 999999$$/ {print "#line " (NR+1) " \"$*\""; next} \
211211
$(if $(call equals, $(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT), false), \

make/hotspot/lib/JvmMapfile.gmk

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ endif
114114
$(JVM_OUTPUTDIR)/symbols-objects: $(BUILD_LIBJVM_ALL_OBJS)
115115
$(call LogInfo, Generating symbol list from object files)
116116
$(CD) $(JVM_OUTPUTDIR)/objs && \
117-
$(DUMP_SYMBOLS_CMD) | $(NAWK) $(FILTER_SYMBOLS_AWK_SCRIPT) | $(SORT) -u > $@
117+
$(DUMP_SYMBOLS_CMD) | $(AWK) $(FILTER_SYMBOLS_AWK_SCRIPT) | $(SORT) -u > $@
118118

119119
SYMBOLS_SRC += $(JVM_OUTPUTDIR)/symbols-objects
120120

make/modules/java.base/gensrc/GensrcExceptions.gmk

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ $(GENSRC_EXCEPTIONS_DST)/_the.%.marker: $(GENSRC_EXCEPTIONS_SRC)/%/exceptions \
3636
$(GENSRC_EXCEPTIONS_CMD)
3737
$(call LogInfo, Generating exceptions java.nio $*)
3838
$(call MakeDir, $(@D)/$*)
39-
SCRIPTS="$(TOPDIR)/make/scripts" NAWK="$(NAWK)" SH="$(SH)" $(SH) \
39+
SCRIPTS="$(TOPDIR)/make/scripts" AWK="$(AWK)" SH="$(SH)" $(SH) \
4040
$(GENSRC_EXCEPTIONS_CMD) $< $(@D)/$* $(LOG_DEBUG)
4141
$(TOUCH) $@
4242

make/modules/java.base/gensrc/GensrcMisc.gmk

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ endif
7878
define generate-preproc-src
7979
$(call MakeDir, $(@D))
8080
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_$(@F), \
81-
( $(NAWK) '/@@END_COPYRIGHT@@/{exit}1' $< && \
81+
( $(AWK) '/@@END_COPYRIGHT@@/{exit}1' $< && \
8282
$(CPP) $(CPP_FLAGS) $(SYSROOT_CFLAGS) $(CFLAGS_JDKLIB) $(CPP_FILEPREFIX) $< \
8383
2> >($(GREP) -v '^$(<F)$$' >&2) \
84-
| $(NAWK) '/@@START_HERE@@/,0' \
84+
| $(AWK) '/@@START_HERE@@/,0' \
8585
| $(SED) -e 's/@@START_HERE@@/\/\/ AUTOMATICALLY GENERATED FILE - DO NOT EDIT/' \
8686
-e 's/PREFIX_//' -e 's/^#.*//' \
8787
) > $@ \

make/modules/jdk.internal.vm.compiler.management/Gensrc.gmk

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ $(GENSRC_DIR)/module-info.java.extra: $(GENSRC_DIR)/_gensrc_proc_done
6868
($(CD) $(GENSRC_DIR)/META-INF/providers && \
6969
p=""; \
7070
impl=""; \
71-
for i in $$($(NAWK) '$$0=FILENAME" "$$0' * | $(SORT) -k 2 | $(SED) 's/ .*//'); do \
71+
for i in $$($(AWK) '$$0=FILENAME" "$$0' * | $(SORT) -k 2 | $(SED) 's/ .*//'); do \
7272
c=$$($(CAT) $$i | $(TR) -d '\n\r'); \
7373
if test x$$p != x$$c; then \
7474
if test x$$p != x; then \

make/scripts/addNotices.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
#
3-
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
3+
# Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
44
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
#
66
# This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,6 @@ if [ "x$COPYRIGHT_YEARS" != x ]; then
4040
__END__
4141
fi
4242

43-
$NAWK ' /^#.*Copyright.*Oracle/ { next }
43+
$AWK ' /^#.*Copyright.*Oracle/ { next }
4444
/^#([^!]|$)/ { sub(/^#/, " *"); print }
4545
/^$/ { print " */"; exit } ' $0

src/java.base/share/classes/java/lang/AbstractStringBuilder.java

+16-12
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ int compareTo(AbstractStringBuilder another) {
157157
return 0;
158158
}
159159

160-
byte val1[] = value;
161-
byte val2[] = another.value;
160+
byte[] val1 = value;
161+
byte[] val2 = another.value;
162162
int count1 = this.count;
163163
int count2 = another.count;
164164

@@ -734,7 +734,7 @@ public AbstractStringBuilder append(char[] str) {
734734
* if {@code offset < 0} or {@code len < 0}
735735
* or {@code offset+len > str.length}
736736
*/
737-
public AbstractStringBuilder append(char str[], int offset, int len) {
737+
public AbstractStringBuilder append(char[] str, int offset, int len) {
738738
int end = offset + len;
739739
checkRange(offset, end, str.length);
740740
ensureCapacityInternal(count + len);
@@ -1238,9 +1238,6 @@ public AbstractStringBuilder insert(int dstOffset, CharSequence s) {
12381238
if (s == null) {
12391239
s = "null";
12401240
}
1241-
if (s instanceof String) {
1242-
return this.insert(dstOffset, (String)s);
1243-
}
12441241
return this.insert(dstOffset, s, 0, s.length());
12451242
}
12461243

@@ -1300,7 +1297,11 @@ public AbstractStringBuilder insert(int dstOffset, CharSequence s,
13001297
ensureCapacityInternal(count + len);
13011298
shift(dstOffset, len);
13021299
count += len;
1303-
putCharsAt(dstOffset, s, start, end);
1300+
if (s instanceof String) {
1301+
putStringAt(dstOffset, (String) s, start, end);
1302+
} else {
1303+
putCharsAt(dstOffset, s, start, end);
1304+
}
13041305
return this;
13051306
}
13061307

@@ -1558,9 +1559,8 @@ public int lastIndexOf(String str, int fromIndex) {
15581559
public AbstractStringBuilder reverse() {
15591560
byte[] val = this.value;
15601561
int count = this.count;
1561-
int coder = this.coder;
15621562
int n = count - 1;
1563-
if (COMPACT_STRINGS && coder == LATIN1) {
1563+
if (isLatin1()) {
15641564
for (int j = (n-1) >> 1; j >= 0; j--) {
15651565
int k = n - j;
15661566
byte cj = val[j];
@@ -1648,7 +1648,7 @@ final byte[] getValue() {
16481648
* @param dstBegin the char index, not offset of byte[]
16491649
* @param coder the coder of dst[]
16501650
*/
1651-
void getBytes(byte dst[], int dstBegin, byte coder) {
1651+
void getBytes(byte[] dst, int dstBegin, byte coder) {
16521652
if (this.coder == coder) {
16531653
System.arraycopy(value, 0, dst, dstBegin << coder, count << coder);
16541654
} else { // this.coder == LATIN && coder == UTF16
@@ -1713,11 +1713,15 @@ private final void putCharsAt(int index, CharSequence s, int off, int end) {
17131713
}
17141714
}
17151715

1716-
private final void putStringAt(int index, String str) {
1716+
private void putStringAt(int index, String str, int off, int end) {
17171717
if (getCoder() != str.coder()) {
17181718
inflate();
17191719
}
1720-
str.getBytes(value, index, coder);
1720+
str.getBytes(value, off, index, coder, end);
1721+
}
1722+
1723+
private void putStringAt(int index, String str) {
1724+
putStringAt(index, str, 0, str.length());
17211725
}
17221726

17231727
private final void appendChars(char[] s, int off, int end) {

src/java.base/share/classes/java/lang/String.java

+21-1
Original file line numberDiff line numberDiff line change
@@ -3599,14 +3599,34 @@ public String repeat(int count) {
35993599
* @param dstBegin the char index, not offset of byte[]
36003600
* @param coder the coder of dst[]
36013601
*/
3602-
void getBytes(byte dst[], int dstBegin, byte coder) {
3602+
void getBytes(byte[] dst, int dstBegin, byte coder) {
36033603
if (coder() == coder) {
36043604
System.arraycopy(value, 0, dst, dstBegin << coder, value.length);
36053605
} else { // this.coder == LATIN && coder == UTF16
36063606
StringLatin1.inflate(value, 0, dst, dstBegin, value.length);
36073607
}
36083608
}
36093609

3610+
/**
3611+
* Copy character bytes from this string into dst starting at dstBegin.
3612+
* This method doesn't perform any range checking.
3613+
*
3614+
* Invoker guarantees: dst is in UTF16 (inflate itself for asb), if two
3615+
* coders are different, and dst is big enough (range check)
3616+
*
3617+
* @param srcPos the char index, not offset of byte[]
3618+
* @param dstBegin the char index to start from
3619+
* @param coder the coder of dst[]
3620+
* @param length the amount of copied chars
3621+
*/
3622+
void getBytes(byte[] dst, int srcPos, int dstBegin, byte coder, int length) {
3623+
if (coder() == coder) {
3624+
System.arraycopy(value, srcPos, dst, dstBegin << coder, length << coder());
3625+
} else { // this.coder == LATIN && coder == UTF16
3626+
StringLatin1.inflate(value, srcPos, dst, dstBegin, length);
3627+
}
3628+
}
3629+
36103630
/*
36113631
* Package private constructor. Trailing Void argument is there for
36123632
* disambiguating it against other (public) constructors.

0 commit comments

Comments
 (0)