mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-16 06:19:40 +01:00
Compare commits
367 Commits
kb/add-int
...
jb17_0_1-b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f79ec4c83 | ||
|
|
be4f3f3ff0 | ||
|
|
fa57732a35 | ||
|
|
95e36fdb3e | ||
|
|
e03b7a2236 | ||
|
|
cac4286e9a | ||
|
|
8cbf335af5 | ||
|
|
cb0046448d | ||
|
|
ca66b6645d | ||
|
|
4840321b0c | ||
|
|
ec632e453e | ||
|
|
3d9f976c05 | ||
|
|
668b5e61a7 | ||
|
|
9b3b62c537 | ||
|
|
af0671c256 | ||
|
|
f387dadfd0 | ||
|
|
cdf43d1bce | ||
|
|
370160359a | ||
|
|
2673a19531 | ||
|
|
91ed209ff5 | ||
|
|
6dabc1d093 | ||
|
|
0c4071976a | ||
|
|
f0473a3ef5 | ||
|
|
3ce7a0bd4f | ||
|
|
b75a562ff8 | ||
|
|
d38b7a4fb6 | ||
|
|
1b17ad8a4f | ||
|
|
21a727050b | ||
|
|
6c60fbd526 | ||
|
|
ac6b25efc3 | ||
|
|
4a611b8029 | ||
|
|
5e98388f45 | ||
|
|
7a6804050c | ||
|
|
7595a0eec0 | ||
|
|
e91fd16ea9 | ||
|
|
7086be404a | ||
|
|
d5247e4d44 | ||
|
|
dd7f29e795 | ||
|
|
7c30655586 | ||
|
|
d46546786f | ||
|
|
c9cb16a1ac | ||
|
|
eed60806e9 | ||
|
|
302c46ac5c | ||
|
|
8dd8fd965c | ||
|
|
29c106553a | ||
|
|
5777c3e396 | ||
|
|
7d85a80a21 | ||
|
|
a95140a472 | ||
|
|
af383254c8 | ||
|
|
9f0205cdde | ||
|
|
c8c44493ea | ||
|
|
71c1be1294 | ||
|
|
3078c3af7f | ||
|
|
bbbf611d27 | ||
|
|
b8b9b19ac8 | ||
|
|
e71989f3a9 | ||
|
|
3a957c9a22 | ||
|
|
9126908ce5 | ||
|
|
d35fa1e213 | ||
|
|
3fc89dd994 | ||
|
|
150f33c504 | ||
|
|
328ab6d735 | ||
|
|
e0328cad49 | ||
|
|
846c82fad7 | ||
|
|
fae30bf211 | ||
|
|
df8d72d906 | ||
|
|
f9bd9b89fa | ||
|
|
fc9f5ea1b6 | ||
|
|
61ad2bafc8 | ||
|
|
520e549b95 | ||
|
|
0cb289dc30 | ||
|
|
db1f6b8596 | ||
|
|
e620dbe34d | ||
|
|
7f8fe85246 | ||
|
|
81d6cb56b4 | ||
|
|
9e8983dcad | ||
|
|
d36db07a49 | ||
|
|
2f402b3110 | ||
|
|
63cbe0f7d4 | ||
|
|
dae7789134 | ||
|
|
b594360025 | ||
|
|
e50c0c4c75 | ||
|
|
0ef7c8d994 | ||
|
|
d15f506237 | ||
|
|
710eb3803f | ||
|
|
c2f04cfc3c | ||
|
|
089a999788 | ||
|
|
56bee0fbf9 | ||
|
|
f15cc94385 | ||
|
|
3e37acb6df | ||
|
|
8c02370578 | ||
|
|
e03c9e94f1 | ||
|
|
5d577ee34a | ||
|
|
fd2d2ff807 | ||
|
|
4e522193ba | ||
|
|
5c0be81952 | ||
|
|
73a0668498 | ||
|
|
eb182cf842 | ||
|
|
85b3867ea1 | ||
|
|
eec1c98633 | ||
|
|
d0e91ca215 | ||
|
|
f8a44a45b2 | ||
|
|
830a8e05c7 | ||
|
|
7cbf090a23 | ||
|
|
41b513581b | ||
|
|
bfe36fbd97 | ||
|
|
d88d88de64 | ||
|
|
52deca6e33 | ||
|
|
3fb566f74c | ||
|
|
8d5f8cc616 | ||
|
|
8aedad5a18 | ||
|
|
3fc8144518 | ||
|
|
ea1e3eb65e | ||
|
|
f9efe73cca | ||
|
|
33cbbc93a2 | ||
|
|
a7fe8314c9 | ||
|
|
7f0b79f784 | ||
|
|
058ffb4d96 | ||
|
|
72e5f5608b | ||
|
|
80d7413cf6 | ||
|
|
5cbe479352 | ||
|
|
db6a423d81 | ||
|
|
6c363536ec | ||
|
|
95aa58e4b5 | ||
|
|
e22c51cfae | ||
|
|
14992ed589 | ||
|
|
03c69551c2 | ||
|
|
afe91a54d0 | ||
|
|
12538dbbaa | ||
|
|
f774679acc | ||
|
|
630310b95f | ||
|
|
4e06424e21 | ||
|
|
ddcc03d82e | ||
|
|
1ed5570fdf | ||
|
|
f470131e71 | ||
|
|
0e30bc051b | ||
|
|
f728f6907a | ||
|
|
89fb69eeb3 | ||
|
|
2dddbcb2a5 | ||
|
|
a90894e3ec | ||
|
|
d42edafc53 | ||
|
|
f2d444419f | ||
|
|
c8a73fb1ee | ||
|
|
1e9343b8c3 | ||
|
|
8467464e90 | ||
|
|
9692ff7029 | ||
|
|
b4ab5c7fbb | ||
|
|
0d21d0254d | ||
|
|
916ad88bad | ||
|
|
2ab43336e9 | ||
|
|
019718427a | ||
|
|
463f78d3ad | ||
|
|
f0f68d5f53 | ||
|
|
9f92bd7e71 | ||
|
|
c887656201 | ||
|
|
0da15c7e0b | ||
|
|
ee8b415782 | ||
|
|
26203c9f15 | ||
|
|
9ae56e5346 | ||
|
|
4cc56ae833 | ||
|
|
af35ecd095 | ||
|
|
d1ee981bfe | ||
|
|
a17c403fed | ||
|
|
9523069e18 | ||
|
|
74e34db93c | ||
|
|
b84540021a | ||
|
|
4bed95cfc9 | ||
|
|
315289e8ea | ||
|
|
4d56d43b46 | ||
|
|
3f81fbc7fc | ||
|
|
18456fe5e3 | ||
|
|
c75b322ec9 | ||
|
|
56e70a00a0 | ||
|
|
2bd28cebe9 | ||
|
|
d5140ad777 | ||
|
|
4d65d05219 | ||
|
|
20ead54385 | ||
|
|
5cd5abeab5 | ||
|
|
3dd5be8ced | ||
|
|
a5aa2cd338 | ||
|
|
b6d15137a7 | ||
|
|
023ec4f8b8 | ||
|
|
18f1bf217c | ||
|
|
ca039d2898 | ||
|
|
1207508966 | ||
|
|
8d50912069 | ||
|
|
6ba92a41ff | ||
|
|
2ed5c0bef4 | ||
|
|
e14969c809 | ||
|
|
91a9eb4dab | ||
|
|
b1590880b8 | ||
|
|
18fad7ea4c | ||
|
|
6851f1f155 | ||
|
|
e22142ea20 | ||
|
|
3f89b5be73 | ||
|
|
dc13081035 | ||
|
|
7c96e77b84 | ||
|
|
ab08a604d2 | ||
|
|
78a8e5f18a | ||
|
|
a15929c0f1 | ||
|
|
68536091d0 | ||
|
|
d555ac6e7f | ||
|
|
3293adbf85 | ||
|
|
33d16e89a0 | ||
|
|
46e77c6b17 | ||
|
|
483faa47de | ||
|
|
690d787ddf | ||
|
|
493f00a836 | ||
|
|
4a4e8ab7f4 | ||
|
|
25f752e09b | ||
|
|
0618a623cd | ||
|
|
c766593701 | ||
|
|
1800cf9888 | ||
|
|
0aafc8f18b | ||
|
|
ed81efe429 | ||
|
|
4f446abcea | ||
|
|
0311690d21 | ||
|
|
43f4fc9446 | ||
|
|
123391c0a5 | ||
|
|
e0c5ca26a9 | ||
|
|
a21ac513b7 | ||
|
|
d7dc1c259c | ||
|
|
33e4314e7e | ||
|
|
4fe107cf2b | ||
|
|
608468e22b | ||
|
|
ad672fc295 | ||
|
|
84045dfd6f | ||
|
|
592962b83a | ||
|
|
cd02648075 | ||
|
|
4b0920b9bc | ||
|
|
345996b232 | ||
|
|
7f6b04fd9b | ||
|
|
04d9cd0763 | ||
|
|
600726407a | ||
|
|
1666213261 | ||
|
|
181bc3724c | ||
|
|
0237d7203b | ||
|
|
a260d47055 | ||
|
|
881a58a7cf | ||
|
|
ae1683f0d0 | ||
|
|
0f4769ef7e | ||
|
|
e232180775 | ||
|
|
4cfc633a1d | ||
|
|
38a4a5c1e0 | ||
|
|
9de2d7ffe3 | ||
|
|
03b4246a89 | ||
|
|
75e68d4668 | ||
|
|
32e4662c18 | ||
|
|
6fd3988d5e | ||
|
|
a6dcbf9838 | ||
|
|
6738453f14 | ||
|
|
9f33d85c70 | ||
|
|
bcfca50c56 | ||
|
|
e4ff2b249b | ||
|
|
590d97c3dc | ||
|
|
cd7fef0c81 | ||
|
|
b189470c02 | ||
|
|
8faf2c3a2d | ||
|
|
034f68d311 | ||
|
|
69a9ce7d59 | ||
|
|
312a959175 | ||
|
|
8480ef824f | ||
|
|
9ddb0efd54 | ||
|
|
1dfe053ab9 | ||
|
|
9819eff7f7 | ||
|
|
14e7ceff4d | ||
|
|
9d94ebd03a | ||
|
|
9529a8308b | ||
|
|
6457cd4256 | ||
|
|
0e28e652b4 | ||
|
|
d79b8b58f3 | ||
|
|
89d339abf9 | ||
|
|
06966680e3 | ||
|
|
a2c420f140 | ||
|
|
bf394b22c3 | ||
|
|
bc3d6f0bee | ||
|
|
218600dd30 | ||
|
|
4e879b85a0 | ||
|
|
ce229cdd79 | ||
|
|
924542b50d | ||
|
|
31bee7c1a9 | ||
|
|
eb9e7cf1d0 | ||
|
|
ca6926b553 | ||
|
|
a50edf1d80 | ||
|
|
60917b1470 | ||
|
|
4f7f0c1305 | ||
|
|
d5ecf925b4 | ||
|
|
dbe91627b6 | ||
|
|
6b01fc6e74 | ||
|
|
abaef9f34e | ||
|
|
3cc9da00c6 | ||
|
|
12df856731 | ||
|
|
1d75f3af45 | ||
|
|
9a101d25a6 | ||
|
|
7388f8ec6f | ||
|
|
8c3d1304de | ||
|
|
7d0e6f25b6 | ||
|
|
75cbd7b32b | ||
|
|
97ff3b3265 | ||
|
|
dee4a0656a | ||
|
|
e863821277 | ||
|
|
30b6a38e1b | ||
|
|
118e23733f | ||
|
|
68066bf7d7 | ||
|
|
792ae5cb54 | ||
|
|
987f43197b | ||
|
|
8d396cc10c | ||
|
|
c08cf4299b | ||
|
|
9a190e934a | ||
|
|
6d77fc6f4c | ||
|
|
4d91294c60 | ||
|
|
9dec371008 | ||
|
|
60bd24fe71 | ||
|
|
1feb50639a | ||
|
|
a39155ce63 | ||
|
|
ea9625aa72 | ||
|
|
6b7f29116d | ||
|
|
bd8f12e43c | ||
|
|
194c78c1a8 | ||
|
|
dbebe800e0 | ||
|
|
027f9c923d | ||
|
|
05ce460650 | ||
|
|
5e1c304434 | ||
|
|
06d89fbd53 | ||
|
|
a3aa80159e | ||
|
|
e5aca5a9e2 | ||
|
|
1285f4a6bb | ||
|
|
7120270832 | ||
|
|
e6b763ae0d | ||
|
|
1b275d50fe | ||
|
|
8a34caa36e | ||
|
|
16c0fc89e0 | ||
|
|
4e2f9b81ba | ||
|
|
1ad58a0859 | ||
|
|
7a5bca9e12 | ||
|
|
9abe5bcad8 | ||
|
|
ff1dfdd259 | ||
|
|
57b698887d | ||
|
|
005cbda5f5 | ||
|
|
f06b35f6a8 | ||
|
|
89d3b2aefb | ||
|
|
3d0e40a565 | ||
|
|
18e4ccab05 | ||
|
|
934e84f36f | ||
|
|
634843464e | ||
|
|
98584cf099 | ||
|
|
f995c7394a | ||
|
|
a7d37895d8 | ||
|
|
bc2d1a78b1 | ||
|
|
4585ae39f1 | ||
|
|
9ddfa1bb1f | ||
|
|
c88621a216 | ||
|
|
43cd44b9d9 | ||
|
|
5b3f86143d | ||
|
|
e57f6ee2f7 | ||
|
|
6cbf3967ee | ||
|
|
387d5618ba | ||
|
|
24361596a5 | ||
|
|
3d56803493 | ||
|
|
4b824870df | ||
|
|
69bbd5497e | ||
|
|
2e682c08df | ||
|
|
92d493b044 | ||
|
|
1e5733e022 | ||
|
|
66515e47df | ||
|
|
6ba3393035 | ||
|
|
2afc7d6c54 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -16,3 +16,5 @@ NashornProfile.txt
|
||||
**/JTreport/**
|
||||
**/JTwork/**
|
||||
/src/utils/LogCompilation/target/
|
||||
*.class
|
||||
.idea/workspace.xml
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
[](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
|
||||
|
||||
# Welcome to the JDK!
|
||||
|
||||
For build instructions please see the
|
||||
|
||||
90
bin/idea.sh
90
bin/idea.sh
@@ -25,17 +25,20 @@
|
||||
# Shell script for generating an IDEA project from a given list of modules
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 [-h|--help] [-q|--quiet] [-a|--absolute-paths] [-o|--output <path>] [modules...]"
|
||||
echo "Usage: $0 [-h|--help] [-q|--quiet] [-a|--absolute-paths] [-r|--root <path>] [-o|--output <path>] [modules...]"
|
||||
echo " -h | --help"
|
||||
echo " -q | --quiet
|
||||
No stdout output"
|
||||
echo " -a | --absolute-paths
|
||||
Use absolute paths to this jdk, so that generated .idea
|
||||
project files can be moved independently of jdk sources"
|
||||
echo " -r | --root <path>
|
||||
Project content root
|
||||
Default: $TOPLEVEL_DIR"
|
||||
echo " -o | --output <path>
|
||||
Where .idea directory with project files will be generated
|
||||
(e.g. using '-o .' will place project files in './.idea')
|
||||
Default: $TOPLEVEL_DIR"
|
||||
Default: same as --root"
|
||||
echo " [modules...]
|
||||
Generate project modules for specific java modules
|
||||
(e.g. 'java.base java.desktop')
|
||||
@@ -47,10 +50,11 @@ SCRIPT_DIR=`dirname $0`
|
||||
#assume TOP is the dir from which the script has been called
|
||||
TOP=`pwd`
|
||||
cd $SCRIPT_DIR; SCRIPT_DIR=`pwd`
|
||||
cd .. ; TOPLEVEL_DIR=`pwd`
|
||||
if [ "x$TOPLEVEL_DIR" = "x" ] ; then
|
||||
cd .. ; TOPLEVEL_DIR=`pwd`
|
||||
fi
|
||||
cd $TOP;
|
||||
|
||||
IDEA_OUTPUT=$TOPLEVEL_DIR/.idea
|
||||
VERBOSE=true
|
||||
ABSOLUTE_PATHS=false
|
||||
while [ $# -gt 0 ]
|
||||
@@ -68,8 +72,13 @@ do
|
||||
ABSOLUTE_PATHS=true
|
||||
;;
|
||||
|
||||
-r | --root )
|
||||
TOPLEVEL_DIR="$2"
|
||||
shift
|
||||
;;
|
||||
|
||||
-o | --output )
|
||||
IDEA_OUTPUT=$2/.idea
|
||||
IDEA_OUTPUT="$2/.idea"
|
||||
shift
|
||||
;;
|
||||
|
||||
@@ -84,14 +93,20 @@ do
|
||||
shift
|
||||
done
|
||||
|
||||
mkdir -p $IDEA_OUTPUT || exit 1
|
||||
cd $IDEA_OUTPUT; IDEA_OUTPUT=`pwd`
|
||||
cd ..; IDEA_OUTPUT_PARENT=`pwd`
|
||||
if [ "x$IDEA_OUTPUT" = "x" ] ; then
|
||||
IDEA_OUTPUT="$TOPLEVEL_DIR/.idea"
|
||||
fi
|
||||
|
||||
MAKE_DIR="$TOPLEVEL_DIR/make"
|
||||
IDEA_MAKE="$MAKE_DIR/ide/idea/jdk"
|
||||
mkdir -p $IDEA_OUTPUT || exit 1
|
||||
cd "$TOP" ; cd $TOPLEVEL_DIR; TOPLEVEL_DIR=`pwd`
|
||||
cd "$TOP" ; cd $IDEA_OUTPUT; IDEA_OUTPUT=`pwd`
|
||||
cd ..; IDEA_OUTPUT_PARENT=`pwd`
|
||||
cd "$SCRIPT_DIR/.." ; OPENJDK_DIR=`pwd`
|
||||
|
||||
IDEA_MAKE="$OPENJDK_DIR/make/ide/idea/jdk"
|
||||
IDEA_TEMPLATE="$IDEA_MAKE/template"
|
||||
|
||||
cp -rn "$TOPLEVEL_DIR/jb/project/idea-project-files"/* "$IDEA_OUTPUT"
|
||||
cp -rn "$IDEA_TEMPLATE"/* "$IDEA_OUTPUT"
|
||||
|
||||
#override template
|
||||
@@ -105,7 +120,7 @@ if [ "$VERBOSE" = true ] ; then
|
||||
echo "Will generate IDEA project files in \"$IDEA_OUTPUT\" for project \"$TOPLEVEL_DIR\""
|
||||
fi
|
||||
|
||||
cd $TOP ; make -f "$IDEA_MAKE/idea.gmk" -I "$TOPLEVEL_DIR" idea \
|
||||
cd $TOP ; make -f "$IDEA_MAKE/idea.gmk" -I "$OPENJDK_DIR" idea TOPLEVEL_DIR="$TOPLEVEL_DIR" \
|
||||
MAKEOVERRIDES= IDEA_OUTPUT_PARENT="$IDEA_OUTPUT_PARENT" OUT="$IDEA_OUTPUT/env.cfg" MODULES="$*" || exit 1
|
||||
cd $SCRIPT_DIR
|
||||
|
||||
@@ -138,21 +153,35 @@ fi
|
||||
|
||||
if [ "$ABSOLUTE_PATHS" = true ] ; then
|
||||
if [ "x$PATHTOOL" != "x" ]; then
|
||||
PROJECT_DIR="`$PATHTOOL -am $TOPLEVEL_DIR`"
|
||||
PROJECT_DIR="`$PATHTOOL -am $OPENJDK_DIR`"
|
||||
TOPLEVEL_PROJECT_DIR="`$PATHTOOL -am $TOPLEVEL_DIR`"
|
||||
else
|
||||
PROJECT_DIR="$TOPLEVEL_DIR"
|
||||
PROJECT_DIR="$OPENJDK_DIR"
|
||||
TOPLEVEL_PROJECT_DIR="$TOPLEVEL_DIR"
|
||||
fi
|
||||
MODULE_DIR="$PROJECT_DIR"
|
||||
cd "$TOPLEVEL_DIR" && cd "$RELATIVE_BUILD_DIR" && BUILD_DIR="`pwd`"
|
||||
TOPLEVEL_MODULE_DIR="$TOPLEVEL_PROJECT_DIR"
|
||||
cd "$IDEA_OUTPUT_PARENT" && cd "$RELATIVE_BUILD_DIR" && BUILD_DIR="`pwd`"
|
||||
CLION_SCRIPT_TOPDIR="$OPENJDK_DIR"
|
||||
CLION_PROJECT_DIR="$PROJECT_DIR"
|
||||
else
|
||||
if [ "$RELATIVE_PROJECT_DIR" = "." ] ; then
|
||||
PROJECT_DIR=""
|
||||
else
|
||||
PROJECT_DIR="/$RELATIVE_PROJECT_DIR"
|
||||
fi
|
||||
if [ "$RELATIVE_TOPLEVEL_PROJECT_DIR" = "." ] ; then
|
||||
TOPLEVEL_PROJECT_DIR=""
|
||||
else
|
||||
TOPLEVEL_PROJECT_DIR="/$RELATIVE_TOPLEVEL_PROJECT_DIR"
|
||||
fi
|
||||
MODULE_DIR="\$MODULE_DIR\$$PROJECT_DIR"
|
||||
PROJECT_DIR="\$PROJECT_DIR\$$PROJECT_DIR"
|
||||
TOPLEVEL_MODULE_DIR="\$MODULE_DIR\$$TOPLEVEL_PROJECT_DIR"
|
||||
TOPLEVEL_PROJECT_DIR="\$PROJECT_DIR\$$TOPLEVEL_PROJECT_DIR"
|
||||
BUILD_DIR="\$PROJECT_DIR\$/$RELATIVE_BUILD_DIR"
|
||||
CLION_SCRIPT_TOPDIR="$CLION_RELATIVE_PROJECT_DIR"
|
||||
CLION_PROJECT_DIR="\$PROJECT_DIR\$/$CLION_SCRIPT_TOPDIR"
|
||||
fi
|
||||
if [ "$VERBOSE" = true ] ; then
|
||||
echo "Project root: $PROJECT_DIR"
|
||||
@@ -182,11 +211,17 @@ add_replacement() {
|
||||
eval TO$NUM_REPLACEMENTS='$2'
|
||||
}
|
||||
|
||||
add_replacement "###PATHTOOL###" "$PATHTOOL"
|
||||
add_replacement "###CLION_SCRIPT_TOPDIR###" "$CLION_SCRIPT_TOPDIR"
|
||||
add_replacement "###CLION_PROJECT_DIR###" "$CLION_PROJECT_DIR"
|
||||
add_replacement "###PROJECT_DIR###" "$PROJECT_DIR"
|
||||
add_replacement "###MODULE_DIR###" "$MODULE_DIR"
|
||||
add_replacement "###TOPLEVEL_PROJECT_DIR###" "$TOPLEVEL_PROJECT_DIR"
|
||||
add_replacement "###TOPLEVEL_MODULE_DIR###" "$TOPLEVEL_MODULE_DIR"
|
||||
add_replacement "###MODULE_NAMES###" "$MODULE_NAMES"
|
||||
add_replacement "###VCS_TYPE###" "$VCS_TYPE"
|
||||
add_replacement "###BUILD_DIR###" "$BUILD_DIR"
|
||||
add_replacement "###RELATIVE_BUILD_DIR###" "$RELATIVE_BUILD_DIR"
|
||||
if [ "x$PATHTOOL" != "x" ]; then
|
||||
add_replacement "###BASH_RUNNER_PREFIX###" "\$PROJECT_DIR\$/.idea/bash.bat"
|
||||
else
|
||||
@@ -227,15 +262,20 @@ for value in $MODULES; do
|
||||
if [ "$VERBOSE" = true ] ; then
|
||||
echo " $module"
|
||||
fi
|
||||
add_replacement "###MODULE_CONTENT###" "src/$module"
|
||||
SOURCE_DIRS=""
|
||||
MAIN_SOURCE_DIRS=""
|
||||
CONTENT_ROOTS=""
|
||||
IFS=' '
|
||||
for dir in $moduleSrcDirs; do
|
||||
case $dir in # Exclude generated sources to avoid module-info conflicts, see https://youtrack.jetbrains.com/issue/IDEA-185108
|
||||
"src/"*) SOURCE_DIRS="$SOURCE_DIRS<sourceFolder url=\"file://$MODULE_DIR/$dir\" isTestSource=\"false\" /> "
|
||||
case $dir in # See https://youtrack.jetbrains.com/issue/IDEA-185108
|
||||
"src/"*) MAIN_SOURCE_DIRS="$MAIN_SOURCE_DIRS <sourceFolder url=\"file://$MODULE_DIR/$dir\" isTestSource=\"false\" />" ;;
|
||||
*) CONTENT_ROOTS="$CONTENT_ROOTS <content url=\"file://$MODULE_DIR/$dir\">\
|
||||
<sourceFolder url=\"file://$MODULE_DIR/$dir\" isTestSource=\"false\" generated=\"true\" /></content>" ;;
|
||||
esac
|
||||
done
|
||||
add_replacement "###SOURCE_DIRS###" "$SOURCE_DIRS"
|
||||
if [ "x$MAIN_SOURCE_DIRS" != "x" ] ; then
|
||||
CONTENT_ROOTS="<content url=\"file://$MODULE_DIR/src/$module\">$MAIN_SOURCE_DIRS</content>$CONTENT_ROOTS"
|
||||
fi
|
||||
add_replacement "###MODULE_CONTENT_ROOTS###" "$CONTENT_ROOTS"
|
||||
DEPENDENCIES=""
|
||||
for dep in $moduleDependencies; do
|
||||
case $MODULE_NAMES in # Exclude skipped modules from dependencies
|
||||
@@ -261,3 +301,15 @@ if [ "x$PATHTOOL" != "x" ]; then
|
||||
echo "$WINENV_ROOT\bin\bash.exe -l -c \"cd %CD:\=/%/ && %*\"" >> "$IDEA_OUTPUT/bash.bat"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ "$VERBOSE" = true ] ; then
|
||||
IDEA_PROJECT_DIR="`dirname $IDEA_OUTPUT`"
|
||||
if [ "x$PATHTOOL" != "x" ]; then
|
||||
IDEA_PROJECT_DIR="`$PATHTOOL -am $IDEA_PROJECT_DIR`"
|
||||
fi
|
||||
echo "
|
||||
Now you can open \"$IDEA_PROJECT_DIR\" as IDEA project
|
||||
You can also run 'bash \"$IDEA_OUTPUT/jdk-clion/update-project.sh\"' to generate Clion project"
|
||||
fi
|
||||
13
jb/project/docker/Dockerfile
Normal file
13
jb/project/docker/Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
||||
# jetbrains/runtime:jbr15env
|
||||
FROM centos:7
|
||||
RUN yum -y install centos-release-scl
|
||||
RUN yum -y install devtoolset-8
|
||||
RUN yum -y install zip bzip2 unzip tar wget make autoconf automake libtool gcc gcc-c++ libstdc++-devel alsa-devel cups-devel xorg-x11-devel libjpeg62-devel giflib-devel freetype-devel file which libXtst-devel libXt-devel libXrender-devel alsa-lib-devel fontconfig-devel libXrandr-devel libXi-devel git
|
||||
# Install Java 16
|
||||
RUN wget https://cdn.azul.com/zulu/bin/zulu16.28.11-ca-jdk16.0.0-linux_x64.tar.gz \
|
||||
-O - | tar xz -C /
|
||||
RUN mv /zulu16.28.11-ca-jdk16.0.0-linux_x64 /jdk16.0.0
|
||||
ENV PATH /opt/rh/devtoolset-8/root/usr/bin:$PATH
|
||||
RUN mkdir .git
|
||||
RUN git config user.email "builduser@jetbrains.com"
|
||||
RUN git config user.name "builduser"
|
||||
9
jb/project/idea-project-files/copyright/JetBrains.xml
Normal file
9
jb/project/idea-project-files/copyright/JetBrains.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<component name="CopyrightManager">
|
||||
<copyright>
|
||||
<option name="notice" value="Copyright 2000-&#36;today.year JetBrains s.r.o. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." />
|
||||
<option name="keyword" value="Copyright" />
|
||||
<option name="allowReplaceKeyword" value="JetBrains" />
|
||||
<option name="myName" value="JetBrains" />
|
||||
<option name="myLocal" value="true" />
|
||||
</copyright>
|
||||
</component>
|
||||
@@ -0,0 +1,3 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="JetBrains" />
|
||||
</component>
|
||||
1
jb/project/idea-project-files/jdk-clion/.idea/.name
generated
Normal file
1
jb/project/idea-project-files/jdk-clion/.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
||||
JetBrainsRuntime
|
||||
9
jb/project/idea-project-files/jdk-clion/.idea/copyright/JetBrains.xml
generated
Normal file
9
jb/project/idea-project-files/jdk-clion/.idea/copyright/JetBrains.xml
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
<component name="CopyrightManager">
|
||||
<copyright>
|
||||
<option name="notice" value="Copyright 2000-&#36;today.year JetBrains s.r.o. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." />
|
||||
<option name="keyword" value="Copyright" />
|
||||
<option name="allowReplaceKeyword" value="JetBrains" />
|
||||
<option name="myName" value="JetBrains" />
|
||||
<option name="myLocal" value="true" />
|
||||
</copyright>
|
||||
</component>
|
||||
3
jb/project/idea-project-files/jdk-clion/.idea/copyright/profiles_settings.xml
generated
Normal file
3
jb/project/idea-project-files/jdk-clion/.idea/copyright/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,3 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="JetBrains" />
|
||||
</component>
|
||||
20
jb/project/idea-project-files/jdk-clion/.idea/vcs.xml
generated
Normal file
20
jb/project/idea-project-files/jdk-clion/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="IssueNavigationConfiguration">
|
||||
<option name="links">
|
||||
<list>
|
||||
<IssueNavigationLink>
|
||||
<option name="issueRegexp" value="(?:^|\s|\p{Punct})([A-Z]+\-\d+)(?=$|\s|\p{Punct})" />
|
||||
<option name="linkRegexp" value="https://youtrack.jetbrains.com/issue/$1" />
|
||||
</IssueNavigationLink>
|
||||
<IssueNavigationLink>
|
||||
<option name="issueRegexp" value="(?:^|\s|\p{Punct})(?:JDK-)?(\d{7})(?=$|\s|\p{Punct})" />
|
||||
<option name="linkRegexp" value="https://bugs.openjdk.java.net/browse/JDK-$1" />
|
||||
</IssueNavigationLink>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
20
jb/project/idea-project-files/vcs.xml
Normal file
20
jb/project/idea-project-files/vcs.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="IssueNavigationConfiguration">
|
||||
<option name="links">
|
||||
<list>
|
||||
<IssueNavigationLink>
|
||||
<option name="issueRegexp" value="(?:^|\s|\p{Punct})([A-Z]+\-\d+)(?=$|\s|\p{Punct})" />
|
||||
<option name="linkRegexp" value="https://youtrack.jetbrains.com/issue/$1" />
|
||||
</IssueNavigationLink>
|
||||
<IssueNavigationLink>
|
||||
<option name="issueRegexp" value="(?:^|\s|\p{Punct})(?:JDK-)?(\d{7})(?=$|\s|\p{Punct})" />
|
||||
<option name="linkRegexp" value="https://bugs.openjdk.java.net/browse/JDK-$1" />
|
||||
</IssueNavigationLink>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
135
jb/project/java-gradle/build.gradle
Normal file
135
jb/project/java-gradle/build.gradle
Normal file
@@ -0,0 +1,135 @@
|
||||
apply plugin: 'java'
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
def test_jvm = {
|
||||
if (project.hasProperty('jbsdkhome')) {
|
||||
file(jbsdkhome + (OperatingSystem.current().isWindows()?"/bin/java.exe" : "/bin/java")).absolutePath
|
||||
} else {
|
||||
if (OperatingSystem.current().isMacOsX()) {
|
||||
file('../../../build/macosx-x86_64-normal-server-release/images/jdk-bundle/jdk-11.0.4.jdk/Contents/Home/bin/java').absolutePath
|
||||
} else if (OperatingSystem.current().isLinux()) {
|
||||
file('../../../build/linux-x86_64-normal-server-release/images/jdk/bin/java').absolutePath
|
||||
} else {
|
||||
file('../../../build/windows-x86_64-normal-server-release/images/jdk/bin/java.exe').absolutePath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testCompile('junit:junit:4.12'){
|
||||
exclude group: 'org.hamcrest'
|
||||
}
|
||||
testCompile 'org.hamcrest:hamcrest-library:1.3'
|
||||
testCompile 'net.java.dev.jna:jna:4.4.0'
|
||||
testCompile 'com.twelvemonkeys.imageio:imageio-tiff:3.3.2'
|
||||
testCompile 'org.apache.commons:commons-lang3:3.0'
|
||||
}
|
||||
|
||||
def jdk_modules = ["java.base", "java.logging", "java.prefs",
|
||||
"java.se.ee", "java.sql", "java.datatransfer",
|
||||
"java.management", "java.rmi", "java.security.jgss",
|
||||
"java.sql.rowset", "java.desktop", "java.management.rmi",
|
||||
"java.scripting", "java.security.sasl", "java.transaction",
|
||||
"java.instrument", "java.naming", "java.se",
|
||||
"java.smartcardio", "java.xml.crypto"]
|
||||
|
||||
def jdk_class_dirs = []
|
||||
|
||||
jdk_modules.collect(jdk_class_dirs) {
|
||||
new File("../../../src/" + it + "/share/classes")
|
||||
}
|
||||
|
||||
if (OperatingSystem.current().isMacOsX())
|
||||
jdk_modules.collect(jdk_class_dirs) {
|
||||
"../../../src/" + it + "/macosx/classes"
|
||||
}
|
||||
else if (OperatingSystem.current().isLinux()) {
|
||||
jdk_modules.collect(jdk_class_dirs) {
|
||||
"../../../src/" + it + "/solaris/classes"
|
||||
}
|
||||
jdk_modules.collect(jdk_class_dirs) {
|
||||
"../../../src/" + it + "/unix/classes"
|
||||
}
|
||||
} else
|
||||
jdk_modules.collect(jdk_class_dirs) {
|
||||
"../../../src/" + it + "/windows/classes"
|
||||
}
|
||||
|
||||
sourceSets.main.java.srcDirs = jdk_class_dirs
|
||||
|
||||
sourceSets {
|
||||
test {
|
||||
java {
|
||||
srcDir "../../../test/jdk/jbu"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test.dependsOn.clear()
|
||||
|
||||
test.dependsOn tasks.compileTestJava
|
||||
|
||||
test {
|
||||
systemProperty "jb.java2d.metal", "true"
|
||||
systemProperty "testdata", file('../../../test/jdk/jbu/testdata').absolutePath
|
||||
|
||||
// Generate golden images for DroidFontTest and MixedTextTest
|
||||
// systemProperty "gentestdata", ""
|
||||
|
||||
// Enable Java2D logging (https://confluence.jetbrains.com/display/JRE/Java2D+Rendering+Logging)
|
||||
// systemProperty "sun.java2d.trace", "log"
|
||||
// systemProperty "sun.java2d.trace", "log,pimpl"
|
||||
|
||||
outputs.upToDateWhen { false }
|
||||
executable = test_jvm()
|
||||
|
||||
// Enable async/dtrace profiler
|
||||
jvmArgs "-XX:+PreserveFramePointer"
|
||||
// Enable native J2D logging (only in debug build)
|
||||
// Can be turned on for J2D by adding "#define DEBUG 1" into jdk/src/share/native/sun/java2d/Trace.h
|
||||
|
||||
// environment 'J2D_TRACE_LEVEL', '4'
|
||||
}
|
||||
|
||||
def buildDir = project.buildscript.sourceFile.parentFile.parentFile.parentFile.parentFile
|
||||
|
||||
def make_cmd = "make"
|
||||
if (OperatingSystem.current().isWindows()) {
|
||||
def cyg_make_cmd = new File("c:/cygwin64/bin/make.exe")
|
||||
if (cyg_make_cmd.exists()) make_cmd = cyg_make_cmd.absolutePath
|
||||
}
|
||||
def test_run = false
|
||||
task make_images {
|
||||
doLast {
|
||||
if (!test_run) {
|
||||
def pb = new ProcessBuilder().command(make_cmd.toString(), "-C", buildDir.absolutePath, "images")
|
||||
def proc = pb.redirectErrorStream(true).start()
|
||||
proc.inputStream.eachLine { println it }
|
||||
assert proc.waitFor() == 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task make_clean {
|
||||
doLast {
|
||||
def pb = new ProcessBuilder().command(make_cmd.toString(), "-C", buildDir.absolutePath, "clean")
|
||||
def proc = pb.redirectErrorStream(true).start()
|
||||
proc.inputStream.eachLine { println it }
|
||||
assert proc.waitFor() == 0
|
||||
}
|
||||
}
|
||||
|
||||
task run_test {
|
||||
doLast {
|
||||
test_run = true
|
||||
}
|
||||
}
|
||||
|
||||
tasks.cleanTest.dependsOn tasks.run_test
|
||||
classes.dependsOn.clear()
|
||||
classes.dependsOn tasks.make_images
|
||||
tasks.cleanClasses.dependsOn tasks.make_clean
|
||||
54
jb/project/tools/common/scripts/common.sh
Normal file
54
jb/project/tools/common/scripts/common.sh
Normal file
@@ -0,0 +1,54 @@
|
||||
VENDOR_NAME="JetBrains s.r.o."
|
||||
VENDOR_VERSION_STRING="JBR-${JBSDK_VERSION_WITH_DOTS}.${JDK_BUILD_NUMBER}-${build_number}"
|
||||
[ -z "$bundle_type" ] || VENDOR_VERSION_STRING="${VENDOR_VERSION_STRING}-${bundle_type}"
|
||||
|
||||
do_reset_changes=0
|
||||
do_reset_dcevm=0
|
||||
HEAD_REVISION=0
|
||||
|
||||
function do_exit() {
|
||||
exit_code=$1
|
||||
[ $do_reset_changes -eq 1 ] && git checkout HEAD modules.list src/java.desktop/share/classes/module-info.java
|
||||
if [ $do_reset_dcevm -eq 1 ]; then
|
||||
[ ! -z $HEAD_REVISION ] && git reset --hard $HEAD_REVISION
|
||||
fi
|
||||
exit "$exit_code"
|
||||
}
|
||||
|
||||
function update_jsdk_mods() {
|
||||
__jsdk=$1
|
||||
__jcef_mods=$2
|
||||
__orig_jsdk_mods=$3
|
||||
__updated_jsdk_mods=$4
|
||||
|
||||
# re-create java.desktop.jmod with updated module-info.class
|
||||
tmp=.java.desktop.$$.tmp
|
||||
mkdir "$tmp" || exit $?
|
||||
"$__jsdk"/bin/jmod extract --dir "$tmp" "$__orig_jsdk_mods"/java.desktop.jmod || exit $?
|
||||
"$__jsdk"/bin/javac \
|
||||
--patch-module java.desktop="$__orig_jsdk_mods"/java.desktop.jmod \
|
||||
--module-path "$__jcef_mods" -d "$tmp"/classes src/java.desktop/share/classes/module-info.java || exit $?
|
||||
"$__jsdk"/bin/jmod \
|
||||
create --class-path "$tmp"/classes --config "$tmp"/conf --header-files "$tmp"/include --legal-notice "$tmp"/legal --libs "$tmp"/lib \
|
||||
java.desktop.jmod || exit $?
|
||||
mv java.desktop.jmod "$__updated_jsdk_mods" || exit $?
|
||||
rm -rf "$tmp"
|
||||
|
||||
# re-create java.base.jmod with updated hashes
|
||||
tmp=.java.base.$$.tmp
|
||||
mkdir "$tmp" || exit $?
|
||||
hash_modules=$("$JSDK"/bin/jmod describe "$__orig_jsdk_mods"/java.base.jmod | grep hashes | awk '{print $2}' | tr '\n' '|' | sed s/\|$//) || exit $?
|
||||
"$__jsdk"/bin/jmod extract --dir "$tmp" "$__orig_jsdk_mods"/java.base.jmod || exit $?
|
||||
rm "$__updated_jsdk_mods"/java.base.jmod || exit $? # temp exclude from path
|
||||
"$__jsdk"/bin/jmod \
|
||||
create --module-path "$__updated_jsdk_mods" --hash-modules "$hash_modules" \
|
||||
--class-path "$tmp"/classes --cmds "$tmp"/bin --config "$tmp"/conf --header-files "$tmp"/include --legal-notice "$tmp"/legal --libs "$tmp"/lib \
|
||||
java.base.jmod || exit $?
|
||||
mv java.base.jmod "$__updated_jsdk_mods" || exit $?
|
||||
rm -rf "$tmp"
|
||||
}
|
||||
|
||||
function get_mods_list() {
|
||||
__mods=$1
|
||||
echo $(ls $__mods) | sed s/\.jmod/,/g | sed s/,$//g | sed s/' '//g
|
||||
}
|
||||
83
jb/project/tools/linux/scripts/mkimages_aarch64.sh
Executable file
83
jb/project/tools/linux/scripts/mkimages_aarch64.sh
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# JBSDK_VERSION - specifies the current version of OpenJDK e.g. 11_0_6
|
||||
# JDK_BUILD_NUMBER - specifies the number of OpenJDK build or the value of --with-version-build argument to configure
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
#
|
||||
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
#
|
||||
# $ ./java --version
|
||||
# openjdk 11.0.6 2020-01-14
|
||||
# OpenJDK Runtime Environment (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number})
|
||||
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
|
||||
#
|
||||
|
||||
JBSDK_VERSION=$1
|
||||
JDK_BUILD_NUMBER=$2
|
||||
build_number=$3
|
||||
|
||||
JBSDK_VERSION_WITH_DOTS=$(echo $JBSDK_VERSION | sed 's/_/\./g')
|
||||
|
||||
source jb/project/tools/common/scripts/common.sh
|
||||
|
||||
JBRSDK_BASE_NAME=jbrsdk-${JBSDK_VERSION}
|
||||
|
||||
[ -z "$bundle_type" ] && (git apply -p0 < jb/project/tools/patches/exclude_jcef_module.patch || exit $?)
|
||||
|
||||
sh configure \
|
||||
--with-debug-level=release \
|
||||
--with-vendor-name="${VENDOR_NAME}" \
|
||||
--with-vendor-version-string="${VENDOR_VERSION_STRING}" \
|
||||
--with-version-pre= \
|
||||
--with-version-build=${JDK_BUILD_NUMBER} \
|
||||
--with-version-opt=b${build_number} \
|
||||
--with-boot-jdk=${BOOT_JDK} \
|
||||
--enable-cds=yes || 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}
|
||||
BASE_DIR=build/linux-aarch64-server-release/images
|
||||
JSDK=${BASE_DIR}/jdk
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
|
||||
echo Fixing permissions
|
||||
chmod -R a+r $JSDK
|
||||
|
||||
rm -rf $BASE_DIR/$JBRSDK_BUNDLE
|
||||
cp -r $JSDK $BASE_DIR/$JBRSDK_BUNDLE || exit $?
|
||||
|
||||
echo Creating $JBSDK.tar.gz ...
|
||||
sed 's/JBR/JBRSDK/g' ${BASE_DIR}/${JBRSDK_BUNDLE}/release > release
|
||||
mv release ${BASE_DIR}/${JBRSDK_BUNDLE}/release
|
||||
|
||||
tar -pcf $JBSDK.tar \
|
||||
--exclude=*.debuginfo --exclude=demo --exclude=sample --exclude=man \
|
||||
-C $BASE_DIR ${JBRSDK_BUNDLE} || exit $?
|
||||
gzip $JBSDK.tar || exit $?
|
||||
|
||||
JBR_BUNDLE=jbr
|
||||
JBR_BASE_NAME=jbr-$JBSDK_VERSION
|
||||
rm -rf $BASE_DIR/$JBR_BUNDLE
|
||||
|
||||
JBR=$JBR_BASE_NAME-linux-aarch64-b$build_number
|
||||
grep -v javafx modules.list | grep -v "jdk.internal.vm\|jdk.aot\|jcef" > modules.list.aarch64
|
||||
echo Running jlink....
|
||||
${JSDK}/bin/jlink \
|
||||
--module-path ${JSDK}/jmods --no-man-pages --compress=2 \
|
||||
--add-modules $(xargs < modules.list.aarch64 | sed s/" "//g | sed s/,$//g) \
|
||||
--output ${BASE_DIR}/${JBR_BUNDLE} || exit $?
|
||||
|
||||
echo Modifying release info ...
|
||||
grep -v \"^JAVA_VERSION\" ${JSDK}/release | grep -v \"^MODULES\" >> ${BASE_DIR}/${JBR_BUNDLE}/release
|
||||
|
||||
echo Creating $JBR.tar.gz ...
|
||||
tar -pcf $JBR.tar -C $BASE_DIR ${JBR_BUNDLE} || exit $?
|
||||
gzip $JBR.tar || exit $?
|
||||
|
||||
JBRSDK_TEST=$JBRSDK_BASE_NAME-linux-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 $?
|
||||
136
jb/project/tools/linux/scripts/mkimages_x64.sh
Executable file
136
jb/project/tools/linux/scripts/mkimages_x64.sh
Executable file
@@ -0,0 +1,136 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# JBSDK_VERSION - specifies major version of OpenJDK e.g. 11_0_6 (instead of dots '.' underbars "_" are used)
|
||||
# JDK_BUILD_NUMBER - specifies update release of OpenJDK build or the value of --with-version-build argument to configure
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to be built; possible values:
|
||||
# <empty> or nomod - the release bundles without any additional modules (jcef)
|
||||
# jcef - the release bundles with jcef
|
||||
# fd - the fastdebug bundles which also include the jcef module
|
||||
#
|
||||
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
#
|
||||
# $ ./java --version
|
||||
# openjdk 11.0.6 2020-01-14
|
||||
# OpenJDK Runtime Environment (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number})
|
||||
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
|
||||
#
|
||||
# Environment variables:
|
||||
# JCEF_PATH - specifies the path to the directory with JCEF binaries.
|
||||
# By default JCEF binaries should be located in ./jcef_linux_x64
|
||||
|
||||
JBSDK_VERSION=$1
|
||||
JDK_BUILD_NUMBER=$2
|
||||
build_number=$3
|
||||
bundle_type=$4
|
||||
JBSDK_VERSION_WITH_DOTS=$(echo $JBSDK_VERSION | sed 's/_/\./g')
|
||||
JCEF_PATH=${JCEF_PATH:=./jcef_linux_x64}
|
||||
|
||||
source jb/project/tools/common/scripts/common.sh
|
||||
|
||||
function create_image_bundle {
|
||||
__bundle_name=$1
|
||||
__arch_name=$2
|
||||
__modules_path=$3
|
||||
__modules=$4
|
||||
|
||||
[ "$bundle_type" == "fd" ] && fastdebug_infix="fastdebug-"
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-linux-x64-${fastdebug_infix}b${build_number}
|
||||
|
||||
echo Running jlink....
|
||||
[ -d "$IMAGES_DIR"/"$__arch_name" ] && rm -rf "${IMAGES_DIR:?}"/"$__arch_name"
|
||||
$JSDK/bin/jlink \
|
||||
--module-path "$__modules_path" --no-man-pages --compress=2 \
|
||||
--add-modules "$__modules" --output "$IMAGES_DIR"/"$__arch_name"
|
||||
|
||||
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> "$IMAGES_DIR"/"$__arch_name"/release
|
||||
if [ "$__bundle_name" == "$JBRSDK_BUNDLE" ]; then
|
||||
sed 's/JBR/JBRSDK/g' "$IMAGES_DIR"/"$__arch_name"/release > release
|
||||
mv release "$IMAGES_DIR"/"$__arch_name"/release
|
||||
fi
|
||||
|
||||
# jmod does not preserve file permissions (JDK-8173610)
|
||||
[ -f "$IMAGES_DIR"/"$__arch_name"/lib/jcef_helper ] && chmod a+x "$IMAGES_DIR"/"$__arch_name"/lib/jcef_helper
|
||||
|
||||
echo Creating "$JBR".tar.gz ...
|
||||
tar -pcf "$JBR".tar -C "$IMAGES_DIR" "$__arch_name" || do_exit $?
|
||||
[ -f "$JBR".tar.gz ] && rm "$JBR.tar.gz"
|
||||
gzip "$JBR".tar || do_exit $?
|
||||
rm -rf "${IMAGES_DIR:?}"/"$__arch_name"
|
||||
}
|
||||
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=release"
|
||||
RELEASE_NAME=linux-x86_64-server-release
|
||||
|
||||
case "$bundle_type" in
|
||||
"jcef")
|
||||
do_reset_changes=1
|
||||
;;
|
||||
"dcevm")
|
||||
HEAD_REVISION=$(git rev-parse HEAD)
|
||||
git am jb/project/tools/patches/dcevm/*.patch || do_exit $?
|
||||
do_reset_dcevm=1
|
||||
do_reset_changes=1
|
||||
;;
|
||||
"nomod" | "")
|
||||
bundle_type=""
|
||||
;;
|
||||
"fd")
|
||||
do_reset_changes=1
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=fastdebug"
|
||||
RELEASE_NAME=linux-x86_64-server-fastdebug
|
||||
;;
|
||||
esac
|
||||
|
||||
sh configure \
|
||||
$WITH_DEBUG_LEVEL \
|
||||
--with-vendor-name="$VENDOR_NAME" \
|
||||
--with-vendor-version-string="$VENDOR_VERSION_STRING" \
|
||||
--with-version-pre= \
|
||||
--with-version-build="$JDK_BUILD_NUMBER" \
|
||||
--with-version-opt=b"$build_number" \
|
||||
--with-boot-jdk="$BOOT_JDK" \
|
||||
--enable-cds=yes || do_exit $?
|
||||
|
||||
make clean CONF=$RELEASE_NAME || exit $?
|
||||
make images CONF=$RELEASE_NAME || do_exit $?
|
||||
|
||||
IMAGES_DIR=build/$RELEASE_NAME/images
|
||||
JSDK=$IMAGES_DIR/jdk
|
||||
JSDK_MODS_DIR=$IMAGES_DIR/jmods
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
|
||||
echo Fixing permissions
|
||||
chmod -R a+r $JSDK
|
||||
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "dcevm" ] || [ "$bundle_type" == "fd" ]; then
|
||||
git apply -p0 < jb/project/tools/patches/add_jcef_module.patch || do_exit $?
|
||||
update_jsdk_mods $JSDK $JCEF_PATH/jmods $JSDK/jmods $JSDK_MODS_DIR || do_exit $?
|
||||
cp $JCEF_PATH/jmods/* $JSDK_MODS_DIR # $JSDK/jmods is not changed
|
||||
|
||||
jbr_name_postfix="_${bundle_type}"
|
||||
fi
|
||||
|
||||
# create runtime image bundle
|
||||
modules=$(xargs < modules.list | sed s/" "//g) || do_exit $?
|
||||
create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" || do_exit $?
|
||||
|
||||
# create sdk image bundle
|
||||
modules=$(cat $JSDK/release | grep MODULES | sed s/MODULES=//g | sed s/' '/,/g | sed s/\"//g | sed s/\\n//g) || do_exit $?
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "dcevm" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "$JBRSDK_BUNDLE" ]; then
|
||||
modules=${modules},$(get_mods_list "$JCEF_PATH"/jmods)
|
||||
fi
|
||||
create_image_bundle $JBRSDK_BUNDLE $JBRSDK_BUNDLE $JSDK_MODS_DIR "$modules" || do_exit $?
|
||||
|
||||
if [ -z "$bundle_type" ]; then
|
||||
JBRSDK_TEST=${JBRSDK_BUNDLE}-${JBSDK_VERSION}-linux-test-x64-b${build_number}
|
||||
echo Creating "$JBRSDK_TEST" ...
|
||||
make test-image CONF=$RELEASE_NAME || do_exit $?
|
||||
tar -pcf "$JBRSDK_TEST".tar -C $IMAGES_DIR --exclude='test/jdk/demos' test || do_exit $?
|
||||
[ -f "$JBRSDK_TEST.tar.gz" ] && rm "$JBRSDK_TEST.tar.gz"
|
||||
gzip "$JBRSDK_TEST".tar || do_exit $?
|
||||
fi
|
||||
|
||||
do_exit 0
|
||||
80
jb/project/tools/linux/scripts/mkimages_x86.sh
Executable file
80
jb/project/tools/linux/scripts/mkimages_x86.sh
Executable file
@@ -0,0 +1,80 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# JBSDK_VERSION - specifies the current version of OpenJDK e.g. 11_0_6
|
||||
# JDK_BUILD_NUMBER - specifies the number of OpenJDK build or the value of --with-version-build argument to configure
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
#
|
||||
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
#
|
||||
# $ ./java --version
|
||||
# openjdk 11.0.6 2020-01-14
|
||||
# OpenJDK Runtime Environment (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number})
|
||||
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
|
||||
#
|
||||
|
||||
JBSDK_VERSION=$1
|
||||
JDK_BUILD_NUMBER=$2
|
||||
build_number=$3
|
||||
|
||||
JBSDK_VERSION_WITH_DOTS=$(echo $JBSDK_VERSION | sed 's/_/\./g')
|
||||
|
||||
source jb/project/tools/common/scripts/common.sh
|
||||
|
||||
JBRSDK_BASE_NAME=jbrsdk-${JBSDK_VERSION}
|
||||
|
||||
[ -z "$bundle_type" ] && (git apply -p0 < jb/project/tools/patches/exclude_jcef_module.patch || exit $?)
|
||||
|
||||
linux32 bash configure \
|
||||
--with-debug-level=release \
|
||||
--with-vendor-name="${VENDOR_NAME}" \
|
||||
--with-vendor-version-string="${VENDOR_VERSION_STRING}" \
|
||||
--with-version-pre= \
|
||||
--with-version-build=$JDK_BUILD_NUMBER \
|
||||
--with-version-opt=b${build_number} \
|
||||
--with-boot-jdk=${BOOT_JDK} \
|
||||
--enable-cds=yes || exit $?
|
||||
make clean CONF=linux-x86-server-release || exit $?
|
||||
make images CONF=linux-x86-server-release test-image || exit $?
|
||||
|
||||
JBSDK=${JBRSDK_BASE_NAME}-linux-x86-b${build_number}
|
||||
BASE_DIR=build/linux-x86-server-release/images
|
||||
JSDK=${BASE_DIR}/jdk
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
|
||||
echo Fixing permissions
|
||||
chmod -R a+r $JSDK
|
||||
|
||||
rm -rf $BASE_DIR/$JBRSDK_BUNDLE
|
||||
cp -r $JSDK $BASE_DIR/$JBRSDK_BUNDLE || exit $?
|
||||
|
||||
echo Creating $JBSDK.tar.gz ...
|
||||
sed 's/JBR/JBRSDK/g' ${BASE_DIR}/${JBRSDK_BUNDLE}/release > release
|
||||
mv release ${BASE_DIR}/${JBRSDK_BUNDLE}/release
|
||||
|
||||
tar -pcf $JBSDK.tar --exclude=*.debuginfo --exclude=demo --exclude=sample --exclude=man -C $BASE_DIR ${JBRSDK_BUNDLE} || exit $?
|
||||
gzip $JBSDK.tar || exit $?
|
||||
|
||||
JBR_BUNDLE=jbr
|
||||
JBR_BASE_NAME=jbr-$JBSDK_VERSION
|
||||
rm -rf $BASE_DIR/$JBR_BUNDLE
|
||||
|
||||
JBR=$JBR_BASE_NAME-linux-x86-b$build_number
|
||||
grep -v javafx modules.list | grep -v "jdk.internal.vm\|jdk.aot\|jcef" > modules.list.x86
|
||||
echo Running jlink....
|
||||
${JSDK}/bin/jlink \
|
||||
--module-path ${JSDK}/jmods --no-man-pages --compress=2 \
|
||||
--add-modules $(xargs < modules.list.x86 | sed s/" "//g | sed s/,$//g) --output ${BASE_DIR}/${JBR_BUNDLE} || exit $?
|
||||
|
||||
echo Modifying release info ...
|
||||
grep -v \"^JAVA_VERSION\" ${JSDK}/release | grep -v \"^MODULES\" >> ${BASE_DIR}/${JBR_BUNDLE}/release
|
||||
|
||||
echo Creating $JBR.tar.gz ...
|
||||
tar -pcf $JBR.tar -C $BASE_DIR $JBR_BUNDLE || exit $?
|
||||
gzip $JBR.tar || exit $?
|
||||
|
||||
JBRSDK_TEST=$JBRSDK_BASE_NAME-linux-test-x86-b$build_number
|
||||
echo Creating $JBRSDK_TEST.tar.gz ...
|
||||
tar -pcf $JBRSDK_TEST.tar -C $BASE_DIR --exclude='test/jdk/demos' --exclude='test/hotspot/gtest' test || exit $?
|
||||
gzip $JBRSDK_TEST.tar || exit $?
|
||||
16
jb/project/tools/mac/scripts/entitlements.xml
Normal file
16
jb/project/tools/mac/scripts/entitlements.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.cs.allow-jit</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.disable-library-validation</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.disable-executable-page-protection</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
175
jb/project/tools/mac/scripts/mkimages.sh
Executable file
175
jb/project/tools/mac/scripts/mkimages.sh
Executable file
@@ -0,0 +1,175 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# JBSDK_VERSION - specifies major version of OpenJDK e.g. 11_0_6 (instead of dots '.' underbars "_" are used)
|
||||
# JDK_BUILD_NUMBER - specifies update release of OpenJDK build or the value of --with-version-build argument to configure
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to be built; possible values:
|
||||
# <empty> or nomod - the release bundles without any additional modules (jcef)
|
||||
# jcef - the release bundles with jcef
|
||||
# fd - the fastdebug bundles which also include the jcef module
|
||||
#
|
||||
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
#
|
||||
# $ ./java --version
|
||||
# openjdk 11.0.6 2020-01-14
|
||||
# OpenJDK Runtime Environment (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number})
|
||||
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
|
||||
#
|
||||
# Environment variables:
|
||||
# JCEF_PATH - specifies the path to the directory with JCEF binaries.
|
||||
# By default JCEF binaries should be located in ./jcef_mac
|
||||
|
||||
JBSDK_VERSION=$1
|
||||
JDK_BUILD_NUMBER=$2
|
||||
build_number=$3
|
||||
bundle_type=$4
|
||||
architecture=$5 # aarch64 or x64
|
||||
enable_aot=$6 # temporary param for building test jre with aot under aarch64
|
||||
JBSDK_VERSION_WITH_DOTS=$(echo $JBSDK_VERSION | sed 's/_/\./g')
|
||||
WITH_IMPORT_MODULES="--with-import-modules=${MODULAR_SDK_PATH:=./modular-sdk}"
|
||||
JCEF_PATH=${JCEF_PATH:=./jcef_mac}
|
||||
architecture=${architecture:=x64}
|
||||
MAJOR_JBSDK_VERSION=$(echo "$JBSDK_VERSION_WITH_DOTS" | awk -F "." '{print $1}')
|
||||
BOOT_JDK=${BOOT_JDK:=$(/usr/libexec/java_home -v 16)}
|
||||
|
||||
source jb/project/tools/common/scripts/common.sh
|
||||
|
||||
function copyJNF {
|
||||
__contents_dir=$1
|
||||
mkdir -p ${__contents_dir}/Frameworks
|
||||
cp -Rp Frameworks/JavaNativeFoundation.framework ${__contents_dir}/Frameworks
|
||||
}
|
||||
|
||||
function create_image_bundle {
|
||||
__bundle_name=$1
|
||||
__arch_name=$2
|
||||
__modules_path=$3
|
||||
__modules=$4
|
||||
|
||||
tmp=.bundle.$$.tmp
|
||||
mkdir "$tmp" || do_exit $?
|
||||
|
||||
[ "$bundle_type" == "fd" ] && fastdebug_infix="fastdebug-"
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-osx-${architecture}-${fastdebug_infix}b${build_number}
|
||||
|
||||
JRE_CONTENTS=$tmp/$__arch_name/Contents
|
||||
mkdir -p "$JRE_CONTENTS" || do_exit $?
|
||||
|
||||
echo Running jlink...
|
||||
"$JSDK"/bin/jlink \
|
||||
--module-path "$__modules_path" --no-man-pages --compress=2 \
|
||||
--add-modules "$__modules" --output "$JRE_CONTENTS/Home" || do_exit $?
|
||||
|
||||
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> "$JRE_CONTENTS/Home/release"
|
||||
if [ "$__bundle_name" == "$JBRSDK_BUNDLE" ]; then
|
||||
sed 's/JBR/JBRSDK/g' $JRE_CONTENTS/Home/release > release
|
||||
mv release $JRE_CONTENTS/Home/release
|
||||
fi
|
||||
|
||||
cp -R "$JSDK"/../MacOS "$JRE_CONTENTS"
|
||||
cp "$JSDK"/../Info.plist "$JRE_CONTENTS"
|
||||
|
||||
if [[ "${architecture}" == *aarch64* ]]; then
|
||||
# we can't notarize this library as usual framework (with headers and tbd-file)
|
||||
# but single library notarizes correctly
|
||||
copyJNF $JRE_CONTENTS
|
||||
fi
|
||||
|
||||
[ -n "$bundle_type" ] && (cp -a $JCEF_PATH/Frameworks "$JRE_CONTENTS" || do_exit $?)
|
||||
|
||||
echo Creating "$JBR".tar.gz ...
|
||||
COPYFILE_DISABLE=1 tar -pczf "$JBR".tar.gz --exclude='*.dSYM' --exclude='man' -C "$tmp" "$__arch_name" || do_exit $?
|
||||
rm -rf "$tmp"
|
||||
}
|
||||
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=release"
|
||||
CONF_ARCHITECTURE=x86_64
|
||||
if [[ "${architecture}" == *aarch64* ]]; then
|
||||
CONF_ARCHITECTURE=aarch64
|
||||
fi
|
||||
RELEASE_NAME=macosx-${CONF_ARCHITECTURE}-server-release
|
||||
|
||||
case "$bundle_type" in
|
||||
"jcef")
|
||||
do_reset_changes=1
|
||||
;;
|
||||
"dcevm")
|
||||
HEAD_REVISION=$(git rev-parse HEAD)
|
||||
git am jb/project/tools/patches/dcevm/*.patch || do_exit $?
|
||||
do_reset_dcevm=1
|
||||
do_reset_changes=1
|
||||
;;
|
||||
"nomod" | "")
|
||||
bundle_type=""
|
||||
;;
|
||||
"fd")
|
||||
do_reset_changes=1
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=fastdebug"
|
||||
RELEASE_NAME=macosx-${CONF_ARCHITECTURE}-server-fastdebug
|
||||
JBSDK=macosx-${architecture}-server-release
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "${architecture}" == *aarch64* ]]; then
|
||||
sh configure \
|
||||
$WITH_DEBUG_LEVEL \
|
||||
--with-vendor-name="${VENDOR_NAME}" \
|
||||
--with-vendor-version-string="${VENDOR_VERSION_STRING}" \
|
||||
--with-version-pre= \
|
||||
--with-version-build="${JDK_BUILD_NUMBER}" \
|
||||
--with-version-opt=b"${build_number}" \
|
||||
--with-boot-jdk="$BOOT_JDK" \
|
||||
--disable-hotspot-gtest --disable-javac-server --disable-full-docs --disable-manpages \
|
||||
--enable-cds=no \
|
||||
--with-extra-cflags="-F$(pwd)/Frameworks" \
|
||||
--with-extra-cxxflags="-F$(pwd)/Frameworks" \
|
||||
--with-extra-ldflags="-F$(pwd)/Frameworks" || do_exit $?
|
||||
else
|
||||
sh configure \
|
||||
$WITH_DEBUG_LEVEL \
|
||||
--with-vendor-name="$VENDOR_NAME" \
|
||||
--with-vendor-version-string="$VENDOR_VERSION_STRING" \
|
||||
--with-version-pre= \
|
||||
--with-version-build="$JDK_BUILD_NUMBER" \
|
||||
--with-version-opt=b"$build_number" \
|
||||
--with-boot-jdk="$BOOT_JDK" \
|
||||
--enable-cds=yes || do_exit $?
|
||||
fi
|
||||
make clean CONF=$RELEASE_NAME || do_exit $?
|
||||
make images CONF=$RELEASE_NAME || do_exit $?
|
||||
|
||||
IMAGES_DIR=build/$RELEASE_NAME/images
|
||||
JSDK=$IMAGES_DIR/jdk-bundle/jdk-$MAJOR_JBSDK_VERSION.jdk/Contents/Home
|
||||
JSDK_MODS_DIR=$IMAGES_DIR/jmods
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "dcevm" ] || [ "$bundle_type" == "fd" ]; then
|
||||
git apply -p0 < jb/project/tools/patches/add_jcef_module.patch || do_exit $?
|
||||
update_jsdk_mods "$JSDK" "$JCEF_PATH"/jmods "$JSDK"/jmods "$JSDK_MODS_DIR" || do_exit $?
|
||||
cp $JCEF_PATH/jmods/* $JSDK_MODS_DIR # $JSDK/jmods is not changed
|
||||
|
||||
jbr_name_postfix="_${bundle_type}"
|
||||
fi
|
||||
|
||||
# create runtime image bundle
|
||||
modules=$(xargs < modules.list | sed s/" "//g) || do_exit $?
|
||||
create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" || do_exit $?
|
||||
|
||||
# create sdk image bundle
|
||||
modules=$(cat "$JSDK"/release | grep MODULES | sed s/MODULES=//g | sed s/' '/,/g | sed s/\"//g | sed s/\\n//g) || do_exit $?
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "dcevm" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "$JBRSDK_BUNDLE" ]; then
|
||||
modules=${modules},$(get_mods_list "$JCEF_PATH"/jmods)
|
||||
fi
|
||||
create_image_bundle "$JBRSDK_BUNDLE" "$JBRSDK_BUNDLE" "$JSDK_MODS_DIR" "$modules" || do_exit $?
|
||||
|
||||
if [ -z "$bundle_type" ]; then
|
||||
JBRSDK_TEST=${JBRSDK_BUNDLE}-${JBSDK_VERSION}-osx-test-${architecture}-b${build_number}
|
||||
echo Creating "$JBRSDK_TEST" ...
|
||||
make test-image CONF=$RELEASE_NAME || do_exit $?
|
||||
[ -f "$JBRSDK_TEST.tar.gz" ] && rm "$JBRSDK_TEST.tar.gz"
|
||||
COPYFILE_DISABLE=1 tar -pczf "$JBRSDK_TEST".tar.gz -C $IMAGES_DIR --exclude='test/jdk/demos' test || do_exit $?
|
||||
fi
|
||||
|
||||
do_exit 0
|
||||
120
jb/project/tools/mac/scripts/notarize.sh
Executable file
120
jb/project/tools/mac/scripts/notarize.sh
Executable file
@@ -0,0 +1,120 @@
|
||||
#!/bin/bash
|
||||
|
||||
APP_DIRECTORY=$1
|
||||
APPL_USER=$2
|
||||
APPL_PASSWORD=$3
|
||||
APP_NAME=$4
|
||||
BUNDLE_ID=$5
|
||||
FAKE_ROOT="${6:-fake-root}"
|
||||
|
||||
if [[ -z "$APP_DIRECTORY" ]] || [[ -z "$APPL_USER" ]] || [[ -z "$APPL_PASSWORD" ]]; then
|
||||
echo "Usage: $0 AppDirectory Username Password"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "$APP_DIRECTORY" ]]; then
|
||||
echo "AppDirectory '$APP_DIRECTORY' does not exist or not a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function log() {
|
||||
echo "$(date '+[%H:%M:%S]') $*"
|
||||
}
|
||||
|
||||
function publish-log() {
|
||||
id=$1
|
||||
file=$2
|
||||
curl -T "$file" "$ARTIFACTORY_URL/$id" || true
|
||||
}
|
||||
|
||||
function altool-upload() {
|
||||
# Since altool uses same file for upload token we have to trick it into using different folders for token file location
|
||||
# Also it copies zip into TMPDIR so we override it too, to simplify cleanup
|
||||
OLD_HOME="$HOME"
|
||||
export HOME="$FAKE_ROOT/home"
|
||||
export TMPDIR="$FAKE_ROOT/tmp"
|
||||
mkdir -p "$HOME"
|
||||
mkdir -p "$TMPDIR"
|
||||
export _JAVA_OPTIONS="-Duser.home=$HOME -Djava.io.tmpdir=$TMPDIR"
|
||||
# Reduce amount of downloads, cache transporter libraries
|
||||
shared_itmstransporter="$OLD_HOME/shared-itmstransporter"
|
||||
if [[ -f "$shared_itmstransporter" ]]; then
|
||||
cp -r "$shared_itmstransporter" "$HOME/.itmstransporter"
|
||||
fi
|
||||
# For some reason altool prints everything to stderr, not stdout
|
||||
set +e
|
||||
xcrun altool --notarize-app \
|
||||
--username "$APPL_USER" --password "$APPL_PASSWORD" \
|
||||
--primary-bundle-id "$BUNDLE_ID" \
|
||||
--asc-provider JetBrainssro --file "$1" 2>&1 | tee "altool.init.out"
|
||||
unset TMPDIR
|
||||
export HOME="$OLD_HOME"
|
||||
set -e
|
||||
}
|
||||
|
||||
#immediately exit script with an error if a command fails
|
||||
set -euo pipefail
|
||||
|
||||
file="$APP_NAME.zip"
|
||||
|
||||
log "Zipping $file..."
|
||||
rm -rf "$file"
|
||||
ditto -c -k --sequesterRsrc --keepParent "$APP_DIRECTORY/Contents" "$file"
|
||||
|
||||
log "Notarizing $file..."
|
||||
rm -rf "altool.init.out" "altool.check.out"
|
||||
altool-upload "$file"
|
||||
|
||||
rm -rf "$file"
|
||||
|
||||
notarization_info="$(grep -e "RequestUUID" "altool.init.out" | grep -oE '([0-9a-f-]{36})')"
|
||||
|
||||
if [ -z "$notarization_info" ]; then
|
||||
log "Faile to read RequestUUID from altool.init.out"
|
||||
exit 10
|
||||
fi
|
||||
|
||||
PATH="$PATH:/usr/local/bin/"
|
||||
|
||||
log "Notarization request sent, awaiting response"
|
||||
spent=0
|
||||
|
||||
while true; do
|
||||
# For some reason altool prints everything to stderr, not stdout
|
||||
xcrun altool --username "$APPL_USER" --notarization-info "$notarization_info" --password "$APPL_PASSWORD" >"altool.check.out" 2>&1 || true
|
||||
status="$(grep -oe 'Status: .*' "altool.check.out" | cut -c 9- || true)"
|
||||
log "Current status: $status"
|
||||
if [ "$status" = "invalid" ]; then
|
||||
log "Notarization failed"
|
||||
ec=1
|
||||
elif [ "$status" = "success" ]; then
|
||||
log "Notarization succeeded"
|
||||
ec=0
|
||||
else
|
||||
if [ "$status" != "in progress" ]; then
|
||||
log "Unknown notarization status, waiting more, altool output:"
|
||||
cat "altool.check.out"
|
||||
fi
|
||||
if [[ $spent -gt 60 ]]; then
|
||||
log "Waiting time out (apx 60 minutes)"
|
||||
ec=2
|
||||
break
|
||||
fi
|
||||
sleep 60
|
||||
((spent += 1))
|
||||
continue
|
||||
fi
|
||||
developer_log="developer_log.json"
|
||||
log "Fetching $developer_log"
|
||||
# TODO: Replace cut with trim or something better
|
||||
url="$(grep -oe 'LogFileURL: .*' "altool.check.out" | cut -c 13-)"
|
||||
wget "$url" -O "$developer_log" && cat "$developer_log" || true
|
||||
if [ $ec != 0 ]; then
|
||||
log "Publishing $developer_log"
|
||||
publish-log "$notarization_info" "$developer_log"
|
||||
fi
|
||||
break
|
||||
done
|
||||
cat "altool.check.out"
|
||||
|
||||
rm -rf "altool.init.out" "altool.check.out"
|
||||
exit $ec
|
||||
107
jb/project/tools/mac/scripts/sign.sh
Executable file
107
jb/project/tools/mac/scripts/sign.sh
Executable file
@@ -0,0 +1,107 @@
|
||||
#!/bin/bash
|
||||
|
||||
APP_DIRECTORY=$1
|
||||
JB_CERT=$2
|
||||
|
||||
if [[ -z "$APP_DIRECTORY" ]] || [[ -z "$JB_CERT" ]]; then
|
||||
echo "Usage: $0 AppDirectory CertificateID"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "$APP_DIRECTORY" ]]; then
|
||||
echo "AppDirectory '$APP_DIRECTORY' does not exist or not a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function log() {
|
||||
echo "$(date '+[%H:%M:%S]') $*"
|
||||
}
|
||||
|
||||
#immediately exit script with an error if a command fails
|
||||
set -euo pipefail
|
||||
|
||||
# Cleanup files left from previous sign attempt (if any)
|
||||
find "$APP_DIRECTORY" -name '*.cstemp' -exec rm '{}' \;
|
||||
|
||||
log "Signing libraries and executables..."
|
||||
# -perm +111 searches for executables
|
||||
for f in \
|
||||
"Contents/Home/bin" \
|
||||
"Contents/Home/lib"; do
|
||||
if [ -d "$APP_DIRECTORY/$f" ]; then
|
||||
find "$APP_DIRECTORY/$f" \
|
||||
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" -o -perm +111 \) \
|
||||
-exec codesign --timestamp --force \
|
||||
-v -s "$JB_CERT" --options=runtime \
|
||||
--entitlements entitlements.xml {} \;
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -d "$APP_DIRECTORY/Contents/Frameworks" ]; then
|
||||
log "Signing frameworks..."
|
||||
for f in $APP_DIRECTORY/Contents/Frameworks/*; do
|
||||
find "$f" \
|
||||
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" \) \
|
||||
-exec codesign --timestamp --force \
|
||||
-v -s "$JB_CERT" \
|
||||
--entitlements entitlements.xml {} \;
|
||||
codesign --timestamp --force \
|
||||
-v -s "$JB_CERT" --options=runtime \
|
||||
--entitlements entitlements.xml "$f"
|
||||
done
|
||||
fi
|
||||
|
||||
log "Signing libraries in jars in $PWD"
|
||||
|
||||
# todo: add set -euo pipefail; into the inner sh -c
|
||||
# `-e` prevents `grep -q && printf` loginc
|
||||
# with `-o pipefail` there's no input for 'while' loop
|
||||
find "$APP_DIRECTORY" -name '*.jar' \
|
||||
-exec sh -c "set -u; unzip -l \"\$0\" | grep -q -e '\.dylib\$' -e '\.jnilib\$' -e '\.so\$' -e '^jattach\$' && printf \"\$0\0\" " {} \; |
|
||||
while IFS= read -r -d $'\0' file; do
|
||||
log "Processing libraries in $file"
|
||||
|
||||
rm -rf jarfolder jar.jar
|
||||
mkdir jarfolder
|
||||
filename="${file##*/}"
|
||||
log "Filename: $filename"
|
||||
cp "$file" jarfolder && (cd jarfolder && jar xf "$filename" && rm "$filename")
|
||||
|
||||
find jarfolder \
|
||||
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" -o -name "jattach" \) \
|
||||
-exec codesign --timestamp --force \
|
||||
-v -s "$JB_CERT" --options=runtime \
|
||||
--entitlements entitlements.xml {} \;
|
||||
|
||||
(cd jarfolder; zip -q -r -o ../jar.jar .)
|
||||
mv jar.jar "$file"
|
||||
done
|
||||
|
||||
rm -rf jarfolder jar.jar
|
||||
|
||||
log "Signing other files..."
|
||||
for f in \
|
||||
"Contents/MacOS"; do
|
||||
if [ -d "$APP_DIRECTORY/$f" ]; then
|
||||
find "$APP_DIRECTORY/$f" \
|
||||
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" -o -perm +111 \) \
|
||||
-exec codesign --timestamp --force \
|
||||
-v -s "$JB_CERT" --options=runtime \
|
||||
--entitlements entitlements.xml {} \;
|
||||
fi
|
||||
done
|
||||
|
||||
#log "Signing executable..."
|
||||
#codesign --timestamp \
|
||||
# -v -s "$JB_CERT" --options=runtime \
|
||||
# --force \
|
||||
# --entitlements entitlements.xml "$APP_DIRECTORY/Contents/MacOS/idea"
|
||||
|
||||
log "Signing whole app..."
|
||||
codesign --timestamp \
|
||||
-v -s "$JB_CERT" --options=runtime \
|
||||
--force \
|
||||
--entitlements entitlements.xml "$APP_DIRECTORY"
|
||||
|
||||
log "Verifying java is not broken"
|
||||
find "$APP_DIRECTORY" \
|
||||
-type f -name 'java' -perm +111 -exec {} -version \;
|
||||
134
jb/project/tools/mac/scripts/signapp.sh
Executable file
134
jb/project/tools/mac/scripts/signapp.sh
Executable file
@@ -0,0 +1,134 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
#immediately exit script with an error if a command fails
|
||||
set -euo pipefail
|
||||
|
||||
export COPY_EXTENDED_ATTRIBUTES_DISABLE=true
|
||||
export COPYFILE_DISABLE=true
|
||||
|
||||
INPUT_FILE=$1
|
||||
EXPLODED=$2.exploded
|
||||
BACKUP_JMODS=$2.backup
|
||||
USERNAME=$3
|
||||
PASSWORD=$4
|
||||
CODESIGN_STRING=$5
|
||||
NOTARIZE=$6
|
||||
BUNDLE_ID=$7
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
function log() {
|
||||
echo "$(date '+[%H:%M:%S]') $*"
|
||||
}
|
||||
|
||||
log "Deleting $EXPLODED ..."
|
||||
if test -d "$EXPLODED"; then
|
||||
find "$EXPLODED" -mindepth 1 -maxdepth 1 -exec chmod -R u+wx '{}' \;
|
||||
fi
|
||||
rm -rf "$EXPLODED"
|
||||
mkdir "$EXPLODED"
|
||||
rm -rf "$BACKUP_JMODS"
|
||||
mkdir "$BACKUP_JMODS"
|
||||
|
||||
log "Unzipping $INPUT_FILE to $EXPLODED ..."
|
||||
tar -xzvf "$INPUT_FILE" --directory $EXPLODED
|
||||
BUILD_NAME="$(ls "$EXPLODED")"
|
||||
sed -i '' s/BNDL/APPL/ $EXPLODED/$BUILD_NAME/Contents/Info.plist
|
||||
rm -f $EXPLODED/$BUILD_NAME/Contents/CodeResources
|
||||
rm "$INPUT_FILE"
|
||||
if test -d $EXPLODED/$BUILD_NAME/Contents/Home/jmods; then
|
||||
mv $EXPLODED/$BUILD_NAME/Contents/Home/jmods $BACKUP_JMODS
|
||||
fi
|
||||
|
||||
log "$INPUT_FILE extracted and removed"
|
||||
|
||||
APPLICATION_PATH="$EXPLODED/$BUILD_NAME"
|
||||
|
||||
find "$APPLICATION_PATH/Contents/Home/bin" \
|
||||
-maxdepth 1 -type f -name '*.jnilib' -print0 |
|
||||
while IFS= read -r -d $'\0' file; do
|
||||
if [ -f "$file" ]; then
|
||||
log "Linking $file"
|
||||
b="$(basename "$file" .jnilib)"
|
||||
ln -sf "$b.jnilib" "$(dirname "$file")/$b.dylib"
|
||||
fi
|
||||
done
|
||||
|
||||
find "$APPLICATION_PATH/Contents/" \
|
||||
-maxdepth 1 -type f -name '*.txt' -print0 |
|
||||
while IFS= read -r -d $'\0' file; do
|
||||
if [ -f "$file" ]; then
|
||||
log "Moving $file"
|
||||
mv "$file" "$APPLICATION_PATH/Contents/Resources"
|
||||
fi
|
||||
done
|
||||
|
||||
non_plist=$(find "$APPLICATION_PATH/Contents/" -maxdepth 1 -type f -and -not -name 'Info.plist' | wc -l)
|
||||
if [[ $non_plist -gt 0 ]]; then
|
||||
log "Only Info.plist file is allowed in Contents directory but found $non_plist file(s):"
|
||||
log "$(find "$APPLICATION_PATH/Contents/" -maxdepth 1 -type f -and -not -name 'Info.plist')"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Unlocking keychain..."
|
||||
# Make sure *.p12 is imported into local KeyChain
|
||||
security unlock-keychain -p "$PASSWORD" "/Users/$USERNAME/Library/Keychains/login.keychain"
|
||||
|
||||
attempt=1
|
||||
limit=3
|
||||
set +e
|
||||
while [[ $attempt -le $limit ]]; do
|
||||
log "Signing (attempt $attempt) $APPLICATION_PATH ..."
|
||||
./sign.sh "$APPLICATION_PATH" "$CODESIGN_STRING"
|
||||
ec=$?
|
||||
if [[ $ec -ne 0 ]]; then
|
||||
((attempt += 1))
|
||||
if [ $attempt -eq $limit ]; then
|
||||
set -e
|
||||
fi
|
||||
log "Signing failed, wait for 30 sec and try to sign again"
|
||||
sleep 30
|
||||
else
|
||||
log "Signing done"
|
||||
codesign -v "$APPLICATION_PATH" -vvvvv
|
||||
log "Check sign done"
|
||||
((attempt += limit))
|
||||
fi
|
||||
done
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$NOTARIZE" = "yes" ]; then
|
||||
log "Notarizing..."
|
||||
# shellcheck disable=SC1090
|
||||
source "$HOME/.notarize_token"
|
||||
APP_NAME=$(echo ${INPUT_FILE} | awk -F"." '{ print $1 }')
|
||||
# Since notarization tool uses same file for upload token we have to trick it into using different folders, hence fake root
|
||||
# Also it leaves copy of zip file in TMPDIR, so notarize.sh overrides it and uses FAKE_ROOT as location for temp TMPDIR
|
||||
FAKE_ROOT="$(pwd)/fake-root"
|
||||
mkdir -p "$FAKE_ROOT"
|
||||
echo "Notarization will use fake root: $FAKE_ROOT"
|
||||
./notarize.sh "$APPLICATION_PATH" "$APPLE_USERNAME" "$APPLE_PASSWORD" "$APP_NAME" "$BUNDLE_ID" "$FAKE_ROOT"
|
||||
rm -rf "$FAKE_ROOT"
|
||||
|
||||
set +e
|
||||
log "Stapling..."
|
||||
xcrun stapler staple "$APPLICATION_PATH"
|
||||
else
|
||||
log "Notarization disabled"
|
||||
log "Stapling disabled"
|
||||
fi
|
||||
|
||||
log "Zipping $BUILD_NAME to $INPUT_FILE ..."
|
||||
(
|
||||
#cd "$EXPLODED"
|
||||
#ditto -c -k --sequesterRsrc --keepParent "$BUILD_NAME" "../$INPUT_FILE"
|
||||
if test -d $BACKUP_JMODS/jmods; then
|
||||
mv $BACKUP_JMODS/jmods $EXPLODED/$BUILD_NAME/Contents/Home
|
||||
fi
|
||||
|
||||
tar -pczvf $INPUT_FILE --exclude='*.dSYM' --exclude='man' -C $EXPLODED $BUILD_NAME
|
||||
log "Finished zipping"
|
||||
)
|
||||
rm -rf "$EXPLODED"
|
||||
log "Done"
|
||||
30
jb/project/tools/patches/add_jcef_module.patch
Normal file
30
jb/project/tools/patches/add_jcef_module.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
diff --git modules.list modules.list
|
||||
index 7c4b3e9cb6d..5ed60349ca7 100644
|
||||
--- modules.list
|
||||
+++ modules.list
|
||||
@@ -53,4 +53,7 @@ jdk.security.jgss,
|
||||
jdk.unsupported,
|
||||
jdk.xml.dom,
|
||||
jdk.zipfs,
|
||||
-jdk.hotspot.agent
|
||||
+jdk.hotspot.agent,
|
||||
+jcef,
|
||||
+gluegen.rt,
|
||||
+jogl.all
|
||||
diff --git src/java.desktop/share/classes/module-info.java src/java.desktop/share/classes/module-info.java
|
||||
index b663b382f52..3e9acdc0c27 100644
|
||||
--- src/java.desktop/share/classes/module-info.java
|
||||
+++ src/java.desktop/share/classes/module-info.java
|
||||
@@ -109,7 +109,11 @@ module java.desktop {
|
||||
// see make/GensrcModuleInfo.gmk
|
||||
exports sun.awt to
|
||||
jdk.accessibility,
|
||||
- jdk.unsupported.desktop;
|
||||
+ jdk.unsupported.desktop,
|
||||
+ jcef,
|
||||
+ jogl.all;
|
||||
+
|
||||
+ exports java.awt.peer to jcef;
|
||||
|
||||
exports java.awt.dnd.peer to jdk.unsupported.desktop;
|
||||
exports sun.awt.dnd to jdk.unsupported.desktop;
|
||||
8834
jb/project/tools/patches/dcevm/0001-Apply-basic-dcevm11-patch.patch
Normal file
8834
jb/project/tools/patches/dcevm/0001-Apply-basic-dcevm11-patch.patch
Normal file
File diff suppressed because it is too large
Load Diff
5615
jb/project/tools/patches/dcevm/0002-dcevm11-fixes.patch
Normal file
5615
jb/project/tools/patches/dcevm/0002-dcevm11-fixes.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
From f6743d4a97aba7d6a8ea6c698d1a6fcfe3e5ec51 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Wed, 11 Mar 2020 14:19:34 +0100
|
||||
Subject: [PATCH 03/35] Fix class cast exception on redefinition of class A,
|
||||
that is superclass of B that has anonymous class C
|
||||
|
||||
---
|
||||
src/hotspot/share/oops/instanceKlass.cpp | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
index 9327652d8fe..c18a5822939 100644
|
||||
--- a/src/hotspot/share/oops/instanceKlass.cpp
|
||||
+++ b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
@@ -908,7 +908,10 @@ bool InstanceKlass::link_class_impl(TRAPS) {
|
||||
|
||||
if (!is_linked()) {
|
||||
if (!is_rewritten()) {
|
||||
- {
|
||||
+ // (DCEVM): If class A is being redefined and class B->A (B is extended from A) and B is host class of anonymous class C
|
||||
+ // then second redefinition fails with cannot cast klass exception. So we currently turn off bytecode verification
|
||||
+ // on redefinition.
|
||||
+ if (!AllowEnhancedClassRedefinition || !newest_version()->is_redefining()) {
|
||||
bool verify_ok = verify_code(THREAD);
|
||||
if (!verify_ok) {
|
||||
return false;
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
From 2d721006256225a126e4f74b34e42c17c3642c71 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 4 Oct 2020 21:12:12 +0200
|
||||
Subject: [PATCH 04/35] Support for Lambda class redefinition
|
||||
|
||||
---
|
||||
.../share/classfile/classLoaderData.cpp | 9 +++
|
||||
.../share/classfile/classLoaderData.hpp | 2 +-
|
||||
.../share/classfile/systemDictionary.cpp | 10 ++-
|
||||
.../prims/jvmtiEnhancedRedefineClasses.cpp | 65 +++++++++++++++++--
|
||||
.../prims/jvmtiEnhancedRedefineClasses.hpp | 1 +
|
||||
.../share/prims/resolvedMethodTable.cpp | 2 +
|
||||
6 files changed, 80 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/classfile/classLoaderData.cpp b/src/hotspot/share/classfile/classLoaderData.cpp
|
||||
index 897f61e0e44..66963dc0892 100644
|
||||
--- a/src/hotspot/share/classfile/classLoaderData.cpp
|
||||
+++ b/src/hotspot/share/classfile/classLoaderData.cpp
|
||||
@@ -599,6 +599,15 @@ Dictionary* ClassLoaderData::create_dictionary() {
|
||||
return new Dictionary(this, size, resizable);
|
||||
}
|
||||
|
||||
+void ClassLoaderData::exchange_holders(ClassLoaderData* cld) {
|
||||
+ oop holder_oop = _holder.peek();
|
||||
+ _holder.replace(cld->_holder.peek());
|
||||
+ cld->_holder.replace(holder_oop);
|
||||
+ WeakHandle<vm_class_loader_data> exchange = _holder;
|
||||
+ _holder = cld->_holder;
|
||||
+ cld->_holder = exchange;
|
||||
+}
|
||||
+
|
||||
// Tell the GC to keep this klass alive while iterating ClassLoaderDataGraph
|
||||
oop ClassLoaderData::holder_phantom() const {
|
||||
// A klass that was previously considered dead can be looked up in the
|
||||
diff --git a/src/hotspot/share/classfile/classLoaderData.hpp b/src/hotspot/share/classfile/classLoaderData.hpp
|
||||
index 5a81ab90ca3..bda39f3e353 100644
|
||||
--- a/src/hotspot/share/classfile/classLoaderData.hpp
|
||||
+++ b/src/hotspot/share/classfile/classLoaderData.hpp
|
||||
@@ -175,7 +175,7 @@ class ClassLoaderData : public CHeapObj<mtClass> {
|
||||
|
||||
oop holder_no_keepalive() const;
|
||||
oop holder_phantom() const;
|
||||
-
|
||||
+ void exchange_holders(ClassLoaderData* cld);
|
||||
private:
|
||||
void unload();
|
||||
bool keep_alive() const { return _keep_alive > 0; }
|
||||
diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
index 2bfd9cb802f..cea614a574f 100644
|
||||
--- a/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
+++ b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
@@ -825,10 +825,14 @@ InstanceKlass* SystemDictionary::resolve_hidden_class_from_stream(
|
||||
Symbol* class_name,
|
||||
Handle class_loader,
|
||||
const ClassLoadInfo& cl_info,
|
||||
+ InstanceKlass* old_klass,
|
||||
TRAPS) {
|
||||
|
||||
EventClassLoad class_load_start_event;
|
||||
ClassLoaderData* loader_data;
|
||||
+
|
||||
+ bool is_redefining = (old_klass != NULL);
|
||||
+
|
||||
|
||||
// - for hidden classes that are not strong: create a new CLD that has a class holder and
|
||||
// whose loader is the Lookup class's loader.
|
||||
@@ -845,9 +849,13 @@ InstanceKlass* SystemDictionary::resolve_hidden_class_from_stream(
|
||||
class_name,
|
||||
loader_data,
|
||||
cl_info,
|
||||
- false, // pick_newest
|
||||
+ is_redefining, // pick_newest
|
||||
CHECK_NULL);
|
||||
assert(k != NULL, "no klass created");
|
||||
+ if (is_redefining && k != NULL) {
|
||||
+ k->set_redefining(true);
|
||||
+ k->set_old_version(old_klass);
|
||||
+ }
|
||||
|
||||
// Hidden classes that are not strong must update ClassLoaderData holder
|
||||
// so that they can be unloaded when the mirror is no longer referenced.
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 5551d3ca123..bf31819479d 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -492,6 +492,8 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
ClassLoaderDataGraph::classes_do(&clear_cpool_cache);
|
||||
|
||||
|
||||
+ // SystemDictionary::methods_do(fix_invoke_method);
|
||||
+
|
||||
// JSR-292 support
|
||||
if (_any_class_has_resolved_methods) {
|
||||
bool trace_name_printed = false;
|
||||
@@ -754,12 +756,34 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
// load hook event.
|
||||
state->set_class_being_redefined(the_class, _class_load_kind);
|
||||
|
||||
- InstanceKlass* k = SystemDictionary::resolve_from_stream(the_class_sym,
|
||||
- the_class_loader,
|
||||
- protection_domain,
|
||||
- &st,
|
||||
- the_class,
|
||||
- THREAD);
|
||||
+ InstanceKlass* k;
|
||||
+
|
||||
+ if (InstanceKlass::cast(the_class)->is_anonymous()) {
|
||||
+ const InstanceKlass* host_class = the_class->host_klass();
|
||||
+
|
||||
+ // Make sure it's the real host class, not another anonymous class.
|
||||
+ while (host_class != NULL && host_class->is_anonymous()) {
|
||||
+ host_class = host_class->host_klass();
|
||||
+ }
|
||||
+
|
||||
+ k = SystemDictionary::parse_stream(the_class_sym,
|
||||
+ the_class_loader,
|
||||
+ protection_domain,
|
||||
+ &st,
|
||||
+ host_class,
|
||||
+ the_class,
|
||||
+ NULL,
|
||||
+ THREAD);
|
||||
+ k->class_loader_data()->exchange_holders(the_class->class_loader_data());
|
||||
+ the_class->class_loader_data()->inc_keep_alive();
|
||||
+ } else {
|
||||
+ k = SystemDictionary::resolve_from_stream(the_class_sym,
|
||||
+ the_class_loader,
|
||||
+ protection_domain,
|
||||
+ &st,
|
||||
+ the_class,
|
||||
+ THREAD);
|
||||
+ }
|
||||
// Clear class_being_redefined just to be sure.
|
||||
state->clear_class_being_redefined();
|
||||
|
||||
@@ -1440,6 +1464,30 @@ void VM_EnhancedRedefineClasses::MethodDataCleaner::do_klass(Klass* k) {
|
||||
}
|
||||
}
|
||||
|
||||
+void VM_EnhancedRedefineClasses::fix_invoke_method(Method* method) {
|
||||
+
|
||||
+ constantPoolHandle other_cp = constantPoolHandle(method->constants());
|
||||
+
|
||||
+ for (int i = 0; i < other_cp->length(); i++) {
|
||||
+ if (other_cp->tag_at(i).is_klass()) {
|
||||
+ Klass* klass = other_cp->resolved_klass_at(i);
|
||||
+ if (klass->new_version() != NULL) {
|
||||
+ // Constant pool entry points to redefined class -- update to the new version
|
||||
+ other_cp->klass_at_put(i, klass->newest_version());
|
||||
+ }
|
||||
+ assert(other_cp->resolved_klass_at(i)->new_version() == NULL, "Must be new klass!");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ ConstantPoolCache* cp_cache = other_cp->cache();
|
||||
+ if (cp_cache != NULL) {
|
||||
+ cp_cache->clear_entries();
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
void VM_EnhancedRedefineClasses::update_jmethod_ids() {
|
||||
for (int j = 0; j < _matching_methods_length; ++j) {
|
||||
Method* old_method = _matching_old_methods[j];
|
||||
@@ -1977,7 +2025,10 @@ jvmtiError VM_EnhancedRedefineClasses::find_sorted_affected_classes(TRAPS) {
|
||||
// Find classes not directly redefined, but affected by a redefinition (because one of its supertypes is redefined)
|
||||
AffectedKlassClosure closure(_affected_klasses);
|
||||
// Updated in j10, from original SystemDictionary::classes_do
|
||||
- ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
+
|
||||
+ ClassLoaderDataGraph::classes_do(&closure);
|
||||
+ //ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
+
|
||||
log_trace(redefine, class, load)("%d classes affected", _affected_klasses->length());
|
||||
|
||||
// Sort the affected klasses such that a supertype is always on a smaller array index than its subtype.
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
index 60b62c3170a..d8a11b51fe9 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -116,6 +116,7 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
void rollback();
|
||||
static void mark_as_scavengable(nmethod* nm);
|
||||
static void unpatch_bytecode(Method* method);
|
||||
+ static void fix_invoke_method(Method* method);
|
||||
|
||||
// Figure out which new methods match old methods in name and signature,
|
||||
// which methods have been added, and which are no longer present
|
||||
diff --git a/src/hotspot/share/prims/resolvedMethodTable.cpp b/src/hotspot/share/prims/resolvedMethodTable.cpp
|
||||
index 6a8128e844f..8644937dbbb 100644
|
||||
--- a/src/hotspot/share/prims/resolvedMethodTable.cpp
|
||||
+++ b/src/hotspot/share/prims/resolvedMethodTable.cpp
|
||||
@@ -409,6 +409,8 @@ void ResolvedMethodTable::adjust_method_entries_dcevm(bool * trace_name_printed)
|
||||
InstanceKlass* newer_klass = InstanceKlass::cast(old_method->method_holder()->new_version());
|
||||
Method* newer_method = newer_klass->method_with_idnum(old_method->orig_method_idnum());
|
||||
|
||||
+ log_info(redefine, class, load, exceptions)("Adjusting method: '%s' of new class %s", newer_method->name_and_sig_as_C_string(), newer_klass->name()->as_C_string());
|
||||
+
|
||||
assert(newer_klass == newer_method->method_holder(), "call after swapping redefined guts");
|
||||
assert(newer_method != NULL, "method_with_idnum() should not be NULL");
|
||||
assert(old_method != newer_method, "sanity check");
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
From ae77bee90c987416e100bbd341a786d7cfa712fe Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sat, 23 May 2020 10:02:15 +0200
|
||||
Subject: [PATCH 05/35] Fix "no original bytecode found" error if method with
|
||||
bkp is missing
|
||||
|
||||
Sometimes IDE can deploy class with erroneous method, such method has
|
||||
n bytecode, but breakpoint position can still exist.
|
||||
---
|
||||
src/hotspot/share/interpreter/bytecodes.cpp | 2 +-
|
||||
.../share/interpreter/interpreterRuntime.cpp | 2 +-
|
||||
src/hotspot/share/oops/method.cpp | 8 ++++----
|
||||
src/hotspot/share/oops/method.hpp | 4 ++--
|
||||
.../prims/jvmtiEnhancedRedefineClasses.cpp | 18 ++++++++++--------
|
||||
5 files changed, 18 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/interpreter/bytecodes.cpp b/src/hotspot/share/interpreter/bytecodes.cpp
|
||||
index 6711ba735db..4f0b655265a 100644
|
||||
--- a/src/hotspot/share/interpreter/bytecodes.cpp
|
||||
+++ b/src/hotspot/share/interpreter/bytecodes.cpp
|
||||
@@ -84,7 +84,7 @@ Bytecodes::Code Bytecodes::code_at(Method* method, int bci) {
|
||||
Bytecodes::Code Bytecodes::non_breakpoint_code_at(const Method* method, address bcp) {
|
||||
assert(method != NULL, "must have the method for breakpoint conversion");
|
||||
assert(method->contains(bcp), "must be valid bcp in method");
|
||||
- return method->orig_bytecode_at(method->bci_from(bcp));
|
||||
+ return method->orig_bytecode_at(method->bci_from(bcp), false);
|
||||
}
|
||||
|
||||
int Bytecodes::special_length_at(Bytecodes::Code code, address bcp, address end) {
|
||||
diff --git a/src/hotspot/share/interpreter/interpreterRuntime.cpp b/src/hotspot/share/interpreter/interpreterRuntime.cpp
|
||||
index d66ed24d862..9bfcd9eb479 100644
|
||||
--- a/src/hotspot/share/interpreter/interpreterRuntime.cpp
|
||||
+++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp
|
||||
@@ -788,7 +788,7 @@ JRT_END
|
||||
// Invokes
|
||||
|
||||
JRT_ENTRY(Bytecodes::Code, InterpreterRuntime::get_original_bytecode_at(JavaThread* current, Method* method, address bcp))
|
||||
- return method->orig_bytecode_at(method->bci_from(bcp));
|
||||
+ return method->orig_bytecode_at(method->bci_from(bcp), false);
|
||||
JRT_END
|
||||
|
||||
JRT_ENTRY(void, InterpreterRuntime::set_original_bytecode_at(JavaThread* current, Method* method, address bcp, Bytecodes::Code new_code))
|
||||
diff --git a/src/hotspot/share/oops/method.cpp b/src/hotspot/share/oops/method.cpp
|
||||
index 613c10a9d8c..a5a12599997 100644
|
||||
--- a/src/hotspot/share/oops/method.cpp
|
||||
+++ b/src/hotspot/share/oops/method.cpp
|
||||
@@ -1853,14 +1853,14 @@ bool CompressedLineNumberReadStream::read_pair() {
|
||||
|
||||
#if INCLUDE_JVMTI
|
||||
|
||||
-Bytecodes::Code Method::orig_bytecode_at(int bci) const {
|
||||
+Bytecodes::Code Method::orig_bytecode_at(int bci, bool no_fatal) const {
|
||||
BreakpointInfo* bp = method_holder()->breakpoints();
|
||||
for (; bp != NULL; bp = bp->next()) {
|
||||
if (bp->match(this, bci)) {
|
||||
return bp->orig_bytecode();
|
||||
}
|
||||
}
|
||||
- {
|
||||
+ if (!no_fatal) {
|
||||
ResourceMark rm;
|
||||
fatal("no original bytecode found in %s at bci %d", name_and_sig_as_C_string(), bci);
|
||||
}
|
||||
@@ -1998,7 +1998,7 @@ BreakpointInfo::BreakpointInfo(Method* m, int bci) {
|
||||
_signature_index = m->signature_index();
|
||||
_orig_bytecode = (Bytecodes::Code) *m->bcp_from(_bci);
|
||||
if (_orig_bytecode == Bytecodes::_breakpoint)
|
||||
- _orig_bytecode = m->orig_bytecode_at(_bci);
|
||||
+ _orig_bytecode = m->orig_bytecode_at(_bci, false);
|
||||
_next = NULL;
|
||||
}
|
||||
|
||||
@@ -2007,7 +2007,7 @@ void BreakpointInfo::set(Method* method) {
|
||||
{
|
||||
Bytecodes::Code code = (Bytecodes::Code) *method->bcp_from(_bci);
|
||||
if (code == Bytecodes::_breakpoint)
|
||||
- code = method->orig_bytecode_at(_bci);
|
||||
+ code = method->orig_bytecode_at(_bci, false);
|
||||
assert(orig_bytecode() == code, "original bytecode must be the same");
|
||||
}
|
||||
#endif
|
||||
diff --git a/src/hotspot/share/oops/method.hpp b/src/hotspot/share/oops/method.hpp
|
||||
index 030ddd1f675..a8d6507ff6c 100644
|
||||
--- a/src/hotspot/share/oops/method.hpp
|
||||
+++ b/src/hotspot/share/oops/method.hpp
|
||||
@@ -226,7 +226,7 @@ class Method : public Metadata {
|
||||
|
||||
// JVMTI breakpoints
|
||||
#if !INCLUDE_JVMTI
|
||||
- Bytecodes::Code orig_bytecode_at(int bci) const {
|
||||
+ Bytecodes::Code orig_bytecode_at(int bci, bool no_fatal) const {
|
||||
ShouldNotReachHere();
|
||||
return Bytecodes::_shouldnotreachhere;
|
||||
}
|
||||
@@ -235,7 +235,7 @@ class Method : public Metadata {
|
||||
};
|
||||
u2 number_of_breakpoints() const {return 0;}
|
||||
#else // !INCLUDE_JVMTI
|
||||
- Bytecodes::Code orig_bytecode_at(int bci) const;
|
||||
+ Bytecodes::Code orig_bytecode_at(int bci, bool no_fatal) const;
|
||||
void set_orig_bytecode_at(int bci, Bytecodes::Code code);
|
||||
void set_breakpoint(int bci);
|
||||
void clear_breakpoint(int bci);
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index bf31819479d..07935bd0ada 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -1360,14 +1360,16 @@ void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method) {
|
||||
|
||||
if (code == Bytecodes::_breakpoint) {
|
||||
int bci = method->bci_from(bcp);
|
||||
- code = method->orig_bytecode_at(bci);
|
||||
- java_code = Bytecodes::java_code(code);
|
||||
- if (code != java_code &&
|
||||
- (java_code == Bytecodes::_getfield ||
|
||||
- java_code == Bytecodes::_putfield ||
|
||||
- java_code == Bytecodes::_aload_0)) {
|
||||
- // Let breakpoint table handling unpatch bytecode
|
||||
- method->set_orig_bytecode_at(bci, java_code);
|
||||
+ code = method->orig_bytecode_at(bci, true);
|
||||
+ if (code != Bytecodes::_shouldnotreachhere) {
|
||||
+ java_code = Bytecodes::java_code(code);
|
||||
+ if (code != java_code &&
|
||||
+ (java_code == Bytecodes::_getfield ||
|
||||
+ java_code == Bytecodes::_putfield ||
|
||||
+ java_code == Bytecodes::_aload_0)) {
|
||||
+ // Let breakpoint table handling unpatch bytecode
|
||||
+ method->set_orig_bytecode_at(bci, java_code);
|
||||
+ }
|
||||
}
|
||||
} else {
|
||||
java_code = Bytecodes::java_code(code);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
From 2cabfcf6406bbeb9b8d47f115563819d8e351356 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 24 May 2020 12:07:42 +0200
|
||||
Subject: [PATCH 06/35] Replace deleted method with
|
||||
Universe::throw_no_such_method_error
|
||||
|
||||
+ Change log level in advanced redefinition
|
||||
- Change log level for "Comparing different class ver.." to debug
|
||||
- Fix adjust_method_entries_dcevm logging levels and severity
|
||||
---
|
||||
.../prims/jvmtiEnhancedRedefineClasses.cpp | 2 +-
|
||||
.../share/prims/resolvedMethodTable.cpp | 30 +++++++++----------
|
||||
2 files changed, 16 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 07935bd0ada..3c86e8c68ac 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -881,7 +881,7 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
// Calculated the difference between new and old class (field change, method change, supertype change, ...).
|
||||
int VM_EnhancedRedefineClasses::calculate_redefinition_flags(InstanceKlass* new_class) {
|
||||
int result = Klass::NoRedefinition;
|
||||
- log_info(redefine, class, load)("Comparing different class versions of class %s",new_class->name()->as_C_string());
|
||||
+ log_debug(redefine, class, load)("Comparing different class versions of class %s",new_class->name()->as_C_string());
|
||||
|
||||
assert(new_class->old_version() != NULL, "must have old version");
|
||||
InstanceKlass* the_class = InstanceKlass::cast(new_class->old_version());
|
||||
diff --git a/src/hotspot/share/prims/resolvedMethodTable.cpp b/src/hotspot/share/prims/resolvedMethodTable.cpp
|
||||
index 8644937dbbb..b8d039adff6 100644
|
||||
--- a/src/hotspot/share/prims/resolvedMethodTable.cpp
|
||||
+++ b/src/hotspot/share/prims/resolvedMethodTable.cpp
|
||||
@@ -399,25 +399,25 @@ void ResolvedMethodTable::adjust_method_entries_dcevm(bool * trace_name_printed)
|
||||
|
||||
if (old_method->is_old()) {
|
||||
|
||||
+ InstanceKlass* newer_klass = InstanceKlass::cast(old_method->method_holder()->new_version());
|
||||
+ Method* newer_method;
|
||||
+
|
||||
// Method* new_method;
|
||||
if (old_method->is_deleted()) {
|
||||
- // FIXME:(DCEVM) - check if exception can be thrown
|
||||
- // new_method = Universe::throw_no_such_method_error();
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- InstanceKlass* newer_klass = InstanceKlass::cast(old_method->method_holder()->new_version());
|
||||
- Method* newer_method = newer_klass->method_with_idnum(old_method->orig_method_idnum());
|
||||
+ newer_method = Universe::throw_no_such_method_error();
|
||||
+ } else {
|
||||
+ newer_method = newer_klass->method_with_idnum(old_method->orig_method_idnum());
|
||||
|
||||
- log_info(redefine, class, load, exceptions)("Adjusting method: '%s' of new class %s", newer_method->name_and_sig_as_C_string(), newer_klass->name()->as_C_string());
|
||||
+ log_debug(redefine, class, update)("Adjusting method: '%s' of new class %s", newer_method->name_and_sig_as_C_string(), newer_klass->name()->as_C_string());
|
||||
|
||||
- assert(newer_klass == newer_method->method_holder(), "call after swapping redefined guts");
|
||||
- assert(newer_method != NULL, "method_with_idnum() should not be NULL");
|
||||
- assert(old_method != newer_method, "sanity check");
|
||||
+ assert(newer_klass == newer_method->method_holder(), "call after swapping redefined guts");
|
||||
+ assert(newer_method != NULL, "method_with_idnum() should not be NULL");
|
||||
+ assert(old_method != newer_method, "sanity check");
|
||||
|
||||
- if (_the_table->lookup(newer_method) != NULL) {
|
||||
- // old method was already adjusted if new method exists in _the_table
|
||||
- continue;
|
||||
+ if (_the_table->lookup(newer_method) != NULL) {
|
||||
+ // old method was already adjusted if new method exists in _the_table
|
||||
+ continue;
|
||||
+ }
|
||||
}
|
||||
|
||||
java_lang_invoke_ResolvedMethodName::set_vmtarget(mem_name, newer_method);
|
||||
@@ -428,7 +428,7 @@ void ResolvedMethodTable::adjust_method_entries_dcevm(bool * trace_name_printed)
|
||||
|
||||
ResourceMark rm;
|
||||
if (!(*trace_name_printed)) {
|
||||
- log_info(redefine, class, update)("adjust: name=%s", old_method->method_holder()->external_name());
|
||||
+ log_debug(redefine, class, update)("adjust: name=%s", old_method->method_holder()->external_name());
|
||||
*trace_name_printed = true;
|
||||
}
|
||||
log_debug(redefine, class, update, constantpool)
|
||||
--
|
||||
2.23.0
|
||||
|
||||
1315
jb/project/tools/patches/dcevm/0007-Support-for-G1-gc.patch
Normal file
1315
jb/project/tools/patches/dcevm/0007-Support-for-G1-gc.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,26 @@
|
||||
From 417a51aedb2667a365632f2fcc150f50366f793c Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Tue, 6 Oct 2020 22:15:31 +0200
|
||||
Subject: [PATCH 08/35] AllowEnhancedClassRedefinition is false (disabled) by
|
||||
default
|
||||
|
||||
---
|
||||
src/hotspot/share/runtime/globals.hpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
|
||||
index 2fcb02fcf49..7051b634a9b 100644
|
||||
--- a/src/hotspot/share/runtime/globals.hpp
|
||||
+++ b/src/hotspot/share/runtime/globals.hpp
|
||||
@@ -2088,7 +2088,7 @@ const intx ObjectAlignmentInBytes = 8;
|
||||
develop(bool, TraceOptimizedUpcallStubs, false, \
|
||||
"Trace optimized upcall stub generation") \
|
||||
\
|
||||
- product(bool, AllowEnhancedClassRedefinition, true, \
|
||||
+ product(bool, AllowEnhancedClassRedefinition, false, \
|
||||
"Allow enhanced class redefinition beyond swapping method " \
|
||||
"bodies")
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
From 5d756ecfd63ead17aab079b87e81554464f6904f Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Mon, 19 Oct 2020 20:00:04 +0200
|
||||
Subject: [PATCH 09/35] Set HOTSPOT_VM_DISTRO=Dynamic Code Evolution
|
||||
|
||||
---
|
||||
make/autoconf/version-numbers | 55 +++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 55 insertions(+)
|
||||
create mode 100644 make/autoconf/version-numbers
|
||||
|
||||
diff --git a/make/autoconf/version-numbers b/make/autoconf/version-numbers
|
||||
new file mode 100644
|
||||
index 00000000000..df8025a2e84
|
||||
--- /dev/null
|
||||
+++ b/make/autoconf/version-numbers
|
||||
@@ -0,0 +1,55 @@
|
||||
+#
|
||||
+# Copyright (c) 2011, 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.
|
||||
+#
|
||||
+
|
||||
+# Default version, product, and vendor information to use,
|
||||
+# unless overridden by configure
|
||||
+
|
||||
+DEFAULT_VERSION_FEATURE=15
|
||||
+DEFAULT_VERSION_INTERIM=0
|
||||
+DEFAULT_VERSION_UPDATE=0
|
||||
+DEFAULT_VERSION_PATCH=0
|
||||
+DEFAULT_VERSION_EXTRA1=0
|
||||
+DEFAULT_VERSION_EXTRA2=0
|
||||
+DEFAULT_VERSION_EXTRA3=0
|
||||
+DEFAULT_VERSION_DATE=2020-09-15
|
||||
+DEFAULT_VERSION_CLASSFILE_MAJOR=59 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
|
||||
+DEFAULT_VERSION_CLASSFILE_MINOR=0
|
||||
+DEFAULT_ACCEPTABLE_BOOT_VERSIONS="14 15"
|
||||
+DEFAULT_JDK_SOURCE_TARGET_VERSION=15
|
||||
+DEFAULT_PROMOTED_VERSION_PRE=
|
||||
+
|
||||
+LAUNCHER_NAME=openjdk
|
||||
+PRODUCT_NAME=OpenJDK
|
||||
+PRODUCT_SUFFIX="Runtime Environment"
|
||||
+JDK_RC_PLATFORM_NAME=Platform
|
||||
+COMPANY_NAME=N/A
|
||||
+HOTSPOT_VM_DISTRO="Dynamic Code Evolution"
|
||||
+VENDOR_URL=https://openjdk.java.net/
|
||||
+VENDOR_URL_BUG=https://bugreport.java.com/bugreport/
|
||||
+VENDOR_URL_VM_BUG=https://bugreport.java.com/bugreport/crash.jsp
|
||||
+
|
||||
+# Might need better names for these
|
||||
+MACOSX_BUNDLE_NAME_BASE="OpenJDK"
|
||||
+MACOSX_BUNDLE_ID_BASE="net.java.openjdk"
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
From b2c6f763d4f5932111e8f0952b5428609b431dd7 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Fri, 23 Oct 2020 10:20:26 +0200
|
||||
Subject: [PATCH 10/35] Clear dcevm code separation
|
||||
|
||||
---
|
||||
src/hotspot/share/classfile/systemDictionary.cpp | 3 +--
|
||||
src/hotspot/share/gc/serial/genMarkSweep.cpp | 8 +++++---
|
||||
src/hotspot/share/interpreter/linkResolver.cpp | 14 ++++++++++----
|
||||
.../instrumentation/jfrEventClassTransformer.cpp | 2 +-
|
||||
src/hotspot/share/oops/cpCache.hpp | 8 +++++---
|
||||
src/hotspot/share/oops/instanceKlass.cpp | 6 +++---
|
||||
src/hotspot/share/oops/method.cpp | 2 +-
|
||||
src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp | 2 +-
|
||||
src/hotspot/share/runtime/reflection.cpp | 2 +-
|
||||
9 files changed, 28 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
index cea614a574f..98e2541c79b 100644
|
||||
--- a/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
+++ b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
@@ -830,9 +830,8 @@ InstanceKlass* SystemDictionary::resolve_hidden_class_from_stream(
|
||||
|
||||
EventClassLoad class_load_start_event;
|
||||
ClassLoaderData* loader_data;
|
||||
-
|
||||
+
|
||||
bool is_redefining = (old_klass != NULL);
|
||||
-
|
||||
|
||||
// - for hidden classes that are not strong: create a new CLD that has a class holder and
|
||||
// whose loader is the Lookup class's loader.
|
||||
diff --git a/src/hotspot/share/gc/serial/genMarkSweep.cpp b/src/hotspot/share/gc/serial/genMarkSweep.cpp
|
||||
index bbb2c02f2b2..00b8e44078e 100644
|
||||
--- a/src/hotspot/share/gc/serial/genMarkSweep.cpp
|
||||
+++ b/src/hotspot/share/gc/serial/genMarkSweep.cpp
|
||||
@@ -316,7 +316,9 @@ void GenMarkSweep::mark_sweep_phase4() {
|
||||
|
||||
GenCompactClosure blk;
|
||||
gch->generation_iterate(&blk, true);
|
||||
- DcevmSharedGC::copy_rescued_objects_back(MarkSweep::_rescued_oops, true);
|
||||
- DcevmSharedGC::clear_rescued_objects_resource(MarkSweep::_rescued_oops);
|
||||
- MarkSweep::_rescued_oops = NULL;
|
||||
+ if (AllowEnhancedClassRedefinition) {
|
||||
+ DcevmSharedGC::copy_rescued_objects_back(MarkSweep::_rescued_oops, true);
|
||||
+ DcevmSharedGC::clear_rescued_objects_resource(MarkSweep::_rescued_oops);
|
||||
+ MarkSweep::_rescued_oops = NULL;
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/hotspot/share/interpreter/linkResolver.cpp b/src/hotspot/share/interpreter/linkResolver.cpp
|
||||
index 8fb336762df..9edc021b5cb 100644
|
||||
--- a/src/hotspot/share/interpreter/linkResolver.cpp
|
||||
+++ b/src/hotspot/share/interpreter/linkResolver.cpp
|
||||
@@ -287,9 +287,14 @@ void LinkResolver::check_klass_accessibility(Klass* ref_klass, Klass* sel_klass,
|
||||
if (!base_klass->is_instance_klass()) {
|
||||
return; // no relevant check to do
|
||||
}
|
||||
-
|
||||
+ Klass* refKlassNewest = ref_klass;
|
||||
+ Klass* baseKlassNewest = base_klass;
|
||||
+ if (AllowEnhancedClassRedefinition) {
|
||||
+ refKlassNewest = ref_klass->newest_version();
|
||||
+ baseKlassNewest = base_klass->newest_version();
|
||||
+ }
|
||||
Reflection::VerifyClassAccessResults vca_result =
|
||||
- Reflection::verify_class_access(ref_klass->newest_version(), InstanceKlass::cast(base_klass->newest_version()), true);
|
||||
+ Reflection::verify_class_access(refKlassNewest, InstanceKlass::cast(baseKlassNewest), true);
|
||||
if (vca_result != Reflection::ACCESS_OK) {
|
||||
ResourceMark rm(THREAD);
|
||||
char* msg = Reflection::verify_class_access_msg(ref_klass,
|
||||
@@ -551,7 +556,8 @@ void LinkResolver::check_method_accessability(Klass* ref_klass,
|
||||
// We'll check for the method name first, as that's most likely
|
||||
// to be false (so we'll short-circuit out of these tests).
|
||||
if (sel_method->name() == vmSymbols::clone_name() &&
|
||||
- sel_klass->newest_version() == vmClasses::Object_klass()->newest_version() &&
|
||||
+ ( (!AllowEnhancedClassRedefinition && sel_klass == vmClasses::Object_klass()) ||
|
||||
+ (AllowEnhancedClassRedefinition && sel_klass->newest_version() == vmClasses::Object_klass()->newest_version()) ) &&
|
||||
resolved_klass->is_array_klass()) {
|
||||
// We need to change "protected" to "public".
|
||||
assert(flags.is_protected(), "clone not protected?");
|
||||
@@ -997,7 +1003,7 @@ void LinkResolver::resolve_field(fieldDescriptor& fd,
|
||||
// or by the <init> method (in case of an instance field).
|
||||
if (is_put && fd.access_flags().is_final()) {
|
||||
|
||||
- if (sel_klass != current_klass && sel_klass != current_klass->active_version()) {
|
||||
+ if (sel_klass != current_klass && (!AllowEnhancedClassRedefinition || sel_klass != current_klass->active_version())) {
|
||||
ResourceMark rm(THREAD);
|
||||
stringStream ss;
|
||||
ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class",
|
||||
diff --git a/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp b/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp
|
||||
index 88e520ec475..73832251f3f 100644
|
||||
--- a/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp
|
||||
+++ b/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp
|
||||
@@ -1475,7 +1475,7 @@ static InstanceKlass* create_new_instance_klass(InstanceKlass* ik, ClassFileStre
|
||||
cld,
|
||||
&cl_info,
|
||||
ClassFileParser::INTERNAL, // internal visibility
|
||||
- false,
|
||||
+ false,
|
||||
THREAD);
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
log_pending_exception(PENDING_EXCEPTION);
|
||||
diff --git a/src/hotspot/share/oops/cpCache.hpp b/src/hotspot/share/oops/cpCache.hpp
|
||||
index b934302f422..d7ae5edc7b3 100644
|
||||
--- a/src/hotspot/share/oops/cpCache.hpp
|
||||
+++ b/src/hotspot/share/oops/cpCache.hpp
|
||||
@@ -148,13 +148,13 @@ class ConstantPoolCacheEntry {
|
||||
void set_bytecode_2(Bytecodes::Code code);
|
||||
void set_f1(Metadata* f1) {
|
||||
Metadata* existing_f1 = _f1; // read once
|
||||
- //assert(existing_f1 == NULL || existing_f1 == f1, "illegal field change");
|
||||
+ assert(AllowEnhancedClassRedefinition || existing_f1 == NULL || existing_f1 == f1, "illegal field change");
|
||||
_f1 = f1;
|
||||
}
|
||||
void release_set_f1(Metadata* f1);
|
||||
void set_f2(intx f2) {
|
||||
intx existing_f2 = _f2; // read once
|
||||
- //assert(existing_f2 == 0 || existing_f2 == f2, "illegal field change");
|
||||
+ assert(AllowEnhancedClassRedefinition || existing_f2 == 0 || existing_f2 == f2, "illegal field change");
|
||||
_f2 = f2;
|
||||
}
|
||||
void set_f2_as_vfinal_method(Method* f2) {
|
||||
@@ -215,7 +215,9 @@ class ConstantPoolCacheEntry {
|
||||
void initialize_resolved_reference_index(int ref_index) {
|
||||
assert(_f2 == 0, "set once"); // note: ref_index might be zero also
|
||||
_f2 = ref_index;
|
||||
- _flags = 1 << is_resolved_ref_shift;
|
||||
+ if (AllowEnhancedClassRedefinition) {
|
||||
+ _flags = 1 << is_resolved_ref_shift;
|
||||
+ }
|
||||
}
|
||||
|
||||
void set_field( // sets entry to resolved field state
|
||||
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
index c18a5822939..994f6bf266f 100644
|
||||
--- a/src/hotspot/share/oops/instanceKlass.cpp
|
||||
+++ b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
@@ -968,7 +968,7 @@ bool InstanceKlass::link_class_impl(TRAPS) {
|
||||
set_init_state(linked);
|
||||
}
|
||||
// (DCEVM) Must check for old version in order to prevent infinite loops.
|
||||
- if (JvmtiExport::should_post_class_prepare() && old_version() == NULL /* JVMTI deadlock otherwise */) {
|
||||
+ if (JvmtiExport::should_post_class_prepare() && (!AllowEnhancedClassRedefinition || old_version() == NULL /* JVMTI deadlock otherwise */) {
|
||||
JvmtiExport::post_class_prepare(THREAD, this);
|
||||
}
|
||||
}
|
||||
@@ -1046,7 +1046,7 @@ void InstanceKlass::initialize_impl(TRAPS) {
|
||||
// we might end up throwing IE from link/symbol resolution sites
|
||||
// that aren't expected to throw. This would wreak havoc. See 6320309.
|
||||
while ((is_being_initialized() && !is_reentrant_initialization(jt))
|
||||
- || (old_version() != NULL && InstanceKlass::cast(old_version())->is_being_initialized())) {
|
||||
+ || (AllowEnhancedClassRedefinition && old_version() != NULL && InstanceKlass::cast(old_version())->is_being_initialized())) {
|
||||
wait = true;
|
||||
jt->set_class_to_be_initialized(this);
|
||||
ol.wait_uninterruptibly(jt);
|
||||
@@ -3796,7 +3796,7 @@ void InstanceKlass::verify_on(outputStream* st) {
|
||||
|
||||
guarantee(sib->is_klass(), "should be klass");
|
||||
// TODO: (DCEVM) explain
|
||||
- guarantee(sib->super() == super || super->newest_version() == SystemDictionary::Object_klass(), "siblings should have same superklass");
|
||||
+ guarantee(sib->super() == super || AllowEnhancedClassRedefinition && super->newest_version() == SystemDictionary::Object_klass(), "siblings should have same superklass");
|
||||
}
|
||||
|
||||
// Verify local interfaces
|
||||
diff --git a/src/hotspot/share/oops/method.cpp b/src/hotspot/share/oops/method.cpp
|
||||
index a5a12599997..4426f03fd40 100644
|
||||
--- a/src/hotspot/share/oops/method.cpp
|
||||
+++ b/src/hotspot/share/oops/method.cpp
|
||||
@@ -2199,7 +2199,7 @@ void Method::ensure_jmethod_ids(ClassLoaderData* loader_data, int capacity) {
|
||||
// Add a method id to the jmethod_ids
|
||||
jmethodID Method::make_jmethod_id(ClassLoaderData* loader_data, Method* m) {
|
||||
// FIXME: (DCEVM) ???
|
||||
- if (m != m->newest_version()) {
|
||||
+ if (AllowEnhancedClassRedefinition && m != m->newest_version()) {
|
||||
m = m->newest_version();
|
||||
}
|
||||
ClassLoaderData* cld = loader_data;
|
||||
diff --git a/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp b/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp
|
||||
index 42e72c67879..c860ee24f80 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
// the new version (SystemDictionary stores only new versions). But the LoadedClassesClosure's functionality was
|
||||
// changed in java8 where jvmtiLoadedClasses collects all classes from all classloaders, therefore we
|
||||
// must use new versions only.
|
||||
- if (k->new_version()==NULL) {
|
||||
+ if (AllowEnhancedClassRedefinition && k->new_version()==NULL) {
|
||||
_classStack.push((jclass) _env->jni_reference(Handle(_cur_thread, k->java_mirror())));
|
||||
if (_dictionary_walk) {
|
||||
// Collect array classes this way when walking the dictionary (because array classes are
|
||||
diff --git a/src/hotspot/share/runtime/reflection.cpp b/src/hotspot/share/runtime/reflection.cpp
|
||||
index cc58f913ed5..21104c18423 100644
|
||||
--- a/src/hotspot/share/runtime/reflection.cpp
|
||||
+++ b/src/hotspot/share/runtime/reflection.cpp
|
||||
@@ -608,7 +608,7 @@ bool Reflection::verify_member_access(const Klass* current_class,
|
||||
TRAPS) {
|
||||
|
||||
// (DCEVM) Decide accessibility based on active version
|
||||
- if (current_class != NULL) {
|
||||
+ if (AllowEnhancedClassRedefinition && current_class != NULL) {
|
||||
current_class = current_class->active_version();
|
||||
}
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 0b0f1c7ad0fe5f4d3806110e5acb7f017e6679af Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Wed, 11 Nov 2020 18:45:15 +0100
|
||||
Subject: [PATCH 11/35] Fix LoadedClassesClosure - fixes problems with remote
|
||||
debugging
|
||||
|
||||
---
|
||||
src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp b/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp
|
||||
index c860ee24f80..dfe0bb8d96a 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
// the new version (SystemDictionary stores only new versions). But the LoadedClassesClosure's functionality was
|
||||
// changed in java8 where jvmtiLoadedClasses collects all classes from all classloaders, therefore we
|
||||
// must use new versions only.
|
||||
- if (AllowEnhancedClassRedefinition && k->new_version()==NULL) {
|
||||
+ if (!AllowEnhancedClassRedefinition || k->new_version()==NULL) {
|
||||
_classStack.push((jclass) _env->jni_reference(Handle(_cur_thread, k->java_mirror())));
|
||||
if (_dictionary_walk) {
|
||||
// Collect array classes this way when walking the dictionary (because array classes are
|
||||
--
|
||||
2.23.0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,43 @@
|
||||
From 622aa65a83cfcb3567a0fb8829f6dc4c0d2f0137 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 22 Nov 2020 19:51:46 +0100
|
||||
Subject: [PATCH 13/35] dcevm15 - add ClassLoaderDataGraph_lock on
|
||||
ClassLoaderDataGraph::classes_do
|
||||
|
||||
ClassLoaderDataGraph::classes_do and need safepoint or lock,
|
||||
find_sorted_affected_classes is not in safepoint therefore it must be
|
||||
locked
|
||||
ClassLoaderDataGraph::rollback_redefinition need safepoint too
|
||||
---
|
||||
src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index efaf11e1666..9f42d14ce98 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -1380,7 +1380,9 @@ void VM_EnhancedRedefineClasses::calculate_instance_update_information(Klass* ne
|
||||
// Rollback all changes - clear new classes from the system dictionary, return old classes to directory, free memory.
|
||||
void VM_EnhancedRedefineClasses::rollback() {
|
||||
log_info(redefine, class, load)("Rolling back redefinition, result=%d", _res);
|
||||
+ ClassLoaderDataGraph_lock->lock();
|
||||
ClassLoaderDataGraph::rollback_redefinition();
|
||||
+ ClassLoaderDataGraph_lock->unlock();
|
||||
|
||||
for (int i = 0; i < _new_classes->length(); i++) {
|
||||
SystemDictionary::remove_from_hierarchy(_new_classes->at(i));
|
||||
@@ -2063,7 +2065,10 @@ jvmtiError VM_EnhancedRedefineClasses::find_sorted_affected_classes(TRAPS) {
|
||||
AffectedKlassClosure closure(_affected_klasses);
|
||||
// Updated in j10, from original SystemDictionary::classes_do
|
||||
|
||||
- ClassLoaderDataGraph::classes_do(&closure);
|
||||
+ {
|
||||
+ MutexLocker mcld(ClassLoaderDataGraph_lock);
|
||||
+ ClassLoaderDataGraph::classes_do(&closure);
|
||||
+ }
|
||||
//ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
|
||||
log_trace(redefine, class, load)("%d classes affected", _affected_klasses->length());
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
From 40a7d805fcfa2d27ebac560b07d136af31f82acf Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 22 Nov 2020 12:05:50 +0100
|
||||
Subject: [PATCH 14/35] dcevm15 - fix Universe::root_oops_do
|
||||
|
||||
Removed ClassLoaderDataGraph::cld_do was cause of crashes due multiple
|
||||
oop patching. ClassLoaderDataGraph::cld_do replaced in dcevm15
|
||||
previously used and removed SystemDictionary:oops_do
|
||||
---
|
||||
src/hotspot/share/memory/universe.cpp | 45 +++++++++++----------------
|
||||
1 file changed, 19 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/memory/universe.cpp b/src/hotspot/share/memory/universe.cpp
|
||||
index 9fcbb6c41b3..247f2b3e8c0 100644
|
||||
--- a/src/hotspot/share/memory/universe.cpp
|
||||
+++ b/src/hotspot/share/memory/universe.cpp
|
||||
@@ -44,6 +44,8 @@
|
||||
#include "gc/shared/oopStorageSet.hpp"
|
||||
#include "gc/shared/stringdedup/stringDedup.hpp"
|
||||
#include "gc/shared/tlab_globals.hpp"
|
||||
+#include "gc/shared/weakProcessor.hpp"
|
||||
+#include "interpreter/interpreter.hpp"
|
||||
#include "logging/log.hpp"
|
||||
#include "logging/logStream.hpp"
|
||||
#include "memory/metadataFactory.hpp"
|
||||
@@ -71,6 +73,8 @@
|
||||
#include "runtime/jniHandles.hpp"
|
||||
#include "runtime/thread.inline.hpp"
|
||||
#include "runtime/timerTrace.hpp"
|
||||
+#include "runtime/vmOperations.hpp"
|
||||
+#include "services/management.hpp"
|
||||
#include "services/memoryService.hpp"
|
||||
#include "utilities/align.hpp"
|
||||
#include "utilities/autoRestore.hpp"
|
||||
@@ -209,45 +213,34 @@ void Universe::basic_type_classes_do(KlassClosure *closure) {
|
||||
|
||||
// FIXME: (DCEVM) This method should iterate all pointers that are not within heap objects.
|
||||
void Universe::root_oops_do(OopClosure *oopClosure) {
|
||||
-
|
||||
- class AlwaysTrueClosure: public BoolObjectClosure {
|
||||
- public:
|
||||
- void do_object(oop p) { ShouldNotReachHere(); }
|
||||
- bool do_object_b(oop p) { return true; }
|
||||
- };
|
||||
- AlwaysTrueClosure always_true;
|
||||
-
|
||||
Universe::oops_do(oopClosure);
|
||||
// ReferenceProcessor::oops_do(oopClosure); (tw) check why no longer there
|
||||
JNIHandles::oops_do(oopClosure); // Global (strong) JNI handles
|
||||
Threads::oops_do(oopClosure, NULL);
|
||||
ObjectSynchronizer::oops_do(oopClosure);
|
||||
- // TODO: review, flat profiler was removed in j10
|
||||
- // FlatProfiler::oops_do(oopClosure);
|
||||
- JvmtiExport::oops_do(oopClosure);
|
||||
+ // (DCEVM) TODO: Check if this is correct?
|
||||
+ Management::oops_do(oopClosure);
|
||||
+ OopStorageSet::vm_global()->oops_do(oopClosure);
|
||||
+ // CLDToOopClosure cld_closure(oopClosure, ClassLoaderData::_claim_none);
|
||||
+ // ClassLoaderDataGraph::cld_do(&cld_closure);
|
||||
|
||||
// Now adjust pointers in remaining weak roots. (All of which should
|
||||
// have been cleared if they pointed to non-surviving objects.)
|
||||
// Global (weak) JNI handles
|
||||
- JNIHandles::weak_oops_do(&always_true, oopClosure);
|
||||
+ WeakProcessor::oops_do(oopClosure);
|
||||
+
|
||||
+ JvmtiExport::oops_do(oopClosure);
|
||||
|
||||
CodeBlobToOopClosure blobClosure(oopClosure, CodeBlobToOopClosure::FixRelocations);
|
||||
CodeCache::blobs_do(&blobClosure);
|
||||
- StringTable::oops_do(oopClosure);
|
||||
+
|
||||
+ AOT_ONLY(AOTLoader::oops_do(oopClosure);)
|
||||
+
|
||||
+ // StringTable::oops_do was removed in j15
|
||||
+ // StringTable::oops_do(oopClosure);
|
||||
+
|
||||
+ // OopStorageSet::vm_global()->oops_do(oopClosure);
|
||||
|
||||
- // (DCEVM) TODO: Check if this is correct?
|
||||
- //CodeCache::scavenge_root_nmethods_oops_do(oopClosure);
|
||||
- //Management::oops_do(oopClosure);
|
||||
- //ref_processor()->weak_oops_do(&oopClosure);
|
||||
- //PSScavenge::reference_processor()->weak_oops_do(&oopClosure);
|
||||
-
|
||||
-#if INCLUDE_AOT
|
||||
- if (UseAOT) {
|
||||
- AOTLoader::oops_do(oopClosure);
|
||||
- }
|
||||
-#endif
|
||||
- // SO_AllClasses
|
||||
- SystemDictionary::oops_do(oopClosure);
|
||||
}
|
||||
|
||||
void Universe::oops_do(OopClosure* f) {
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From a7b16f084e2a0ff24b7c5431515c976d6e8612b0 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sat, 28 Nov 2020 19:29:42 +0100
|
||||
Subject: [PATCH 15/35] dcevm15 - check if has_nestmate_access_to has newest
|
||||
host class
|
||||
|
||||
---
|
||||
src/hotspot/share/oops/instanceKlass.cpp | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
index ef0091fe288..b4d09e92830 100644
|
||||
--- a/src/hotspot/share/oops/instanceKlass.cpp
|
||||
+++ b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
@@ -398,6 +398,11 @@ bool InstanceKlass::has_nestmate_access_to(InstanceKlass* k, TRAPS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+ if (AllowEnhancedClassRedefinition) {
|
||||
+ // TODO: (DCEVM) check if it correct. It fix problems with lambdas (hidden)
|
||||
+ cur_host = InstanceKlass::cast(cur_host->newest_version());
|
||||
+ }
|
||||
+
|
||||
Klass* k_nest_host = k->nest_host(CHECK_false);
|
||||
if (k_nest_host == NULL) {
|
||||
return false;
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
From 4a3688d5ba4c4ce47a6ad447744a5b0a68a2c188 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 29 Nov 2020 17:18:16 +0100
|
||||
Subject: [PATCH 16/35] dcevm15 - mark_as_scavengable only alive methods
|
||||
|
||||
---
|
||||
.../share/prims/jvmtiEnhancedRedefineClasses.cpp | 14 ++++++++------
|
||||
1 file changed, 8 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 9f42d14ce98..db5fb1c472b 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -223,19 +223,21 @@ class FieldCopier : public FieldClosure {
|
||||
|
||||
// TODO: review...
|
||||
void VM_EnhancedRedefineClasses::mark_as_scavengable(nmethod* nm) {
|
||||
- ScavengableNMethods::register_nmethod(nm);
|
||||
+ if (nm->is_alive()) {
|
||||
+ ScavengableNMethods::register_nmethod(nm);
|
||||
+ }
|
||||
}
|
||||
|
||||
void VM_EnhancedRedefineClasses::unregister_nmethod_g1(nmethod* nm) {
|
||||
// It should work not only for G1 but also for another GCs, but this way is safer now
|
||||
- if (!nm->is_zombie() && !nm->is_unloaded()) {
|
||||
+ if (nm->is_alive()) {
|
||||
Universe::heap()->unregister_nmethod(nm);
|
||||
}
|
||||
}
|
||||
|
||||
void VM_EnhancedRedefineClasses::register_nmethod_g1(nmethod* nm) {
|
||||
// It should work not only for G1 but also for another GCs, but this way is safer now
|
||||
- if (!nm->is_zombie() && !nm->is_unloaded()) {
|
||||
+ if (nm->is_alive()) {
|
||||
Universe::heap()->register_nmethod(nm);
|
||||
}
|
||||
}
|
||||
@@ -511,9 +513,9 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
flush_dependent_code(thread);
|
||||
// }
|
||||
|
||||
- // Adjust constantpool caches for all classes that reference methods of the evolved class.
|
||||
- ClearCpoolCacheAndUnpatch clear_cpool_cache(thread);
|
||||
- ClassLoaderDataGraph::classes_do(&clear_cpool_cache);
|
||||
+ // Adjust constantpool caches for all classes that reference methods of the evolved class.
|
||||
+ ClearCpoolCacheAndUnpatch clear_cpool_cache(thread);
|
||||
+ ClassLoaderDataGraph::classes_do(&clear_cpool_cache);
|
||||
|
||||
// JSR-292 support
|
||||
if (_any_class_has_resolved_methods) {
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
From 1566bf6d88ded69b0946b65518f23b47a316417d Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 29 Nov 2020 20:05:03 +0100
|
||||
Subject: [PATCH 17/35] dcevm15 - fix hidded classes
|
||||
|
||||
---
|
||||
.../prims/jvmtiEnhancedRedefineClasses.cpp | 41 ++++++++++++++-----
|
||||
1 file changed, 30 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index db5fb1c472b..590f7fdfafe 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -722,7 +722,8 @@ bool VM_EnhancedRedefineClasses::is_modifiable_class(oop klass_mirror) {
|
||||
}
|
||||
|
||||
// Cannot redefine or retransform an anonymous class.
|
||||
- if (InstanceKlass::cast(k)->is_unsafe_anonymous()) {
|
||||
+ // TODO: check if is correct in j15
|
||||
+ if (InstanceKlass::cast(k)->is_unsafe_anonymous() || InstanceKlass::cast(k)->is_hidden()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -808,21 +809,27 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
|
||||
InstanceKlass* k;
|
||||
|
||||
- if (InstanceKlass::cast(the_class)->is_unsafe_anonymous()) {
|
||||
- const InstanceKlass* host_class = the_class->unsafe_anonymous_host();
|
||||
+ if (the_class->is_unsafe_anonymous() || the_class->is_hidden()) {
|
||||
+ InstanceKlass* dynamic_host_class = NULL;
|
||||
+ InstanceKlass* unsafe_anonymous_host = NULL;
|
||||
|
||||
- // Make sure it's the real host class, not another anonymous class.
|
||||
- while (host_class != NULL && host_class->is_unsafe_anonymous()) {
|
||||
- host_class = host_class->unsafe_anonymous_host();
|
||||
+ if (the_class->is_hidden()) {
|
||||
+ log_debug(redefine, class, load)("loading hidden class %s", the_class->name()->as_C_string());
|
||||
+ dynamic_host_class = the_class->nest_host(THREAD);
|
||||
+ }
|
||||
+
|
||||
+ if (the_class->is_unsafe_anonymous()) {
|
||||
+ log_debug(redefine, class, load)("loading usafe anonymous %s", the_class->name()->as_C_string());
|
||||
+ unsafe_anonymous_host = the_class->unsafe_anonymous_host();
|
||||
}
|
||||
|
||||
ClassLoadInfo cl_info(protection_domain,
|
||||
- host_class,
|
||||
- NULL, // dynamic_nest_host
|
||||
+ unsafe_anonymous_host,
|
||||
NULL, // cp_patches
|
||||
+ dynamic_host_class, // dynamic_nest_host
|
||||
Handle(), // classData
|
||||
- false, // is_hidden
|
||||
- false, // is_strong_hidden
|
||||
+ the_class->is_hidden(), // is_hidden
|
||||
+ !the_class->is_non_strong_hidden(), // is_strong_hidden
|
||||
true); // FIXME: check if correct. can_access_vm_annotations
|
||||
|
||||
k = SystemDictionary::parse_stream(the_class_sym,
|
||||
@@ -833,7 +840,17 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
THREAD);
|
||||
|
||||
k->class_loader_data()->exchange_holders(the_class->class_loader_data());
|
||||
- the_class->class_loader_data()->inc_keep_alive();
|
||||
+
|
||||
+ if (the_class->is_hidden()) {
|
||||
+ // from jvm_lookup_define_class() (jvm.cpp):
|
||||
+ // The hidden class loader data has been artificially been kept alive to
|
||||
+ // this point. The mirror and any instances of this class have to keep
|
||||
+ // it alive afterwards.
|
||||
+ the_class->class_loader_data()->dec_keep_alive();
|
||||
+ } else {
|
||||
+ the_class->class_loader_data()->inc_keep_alive();
|
||||
+ }
|
||||
+
|
||||
} else {
|
||||
k = SystemDictionary::resolve_from_stream(the_class_sym,
|
||||
the_class_loader,
|
||||
@@ -1475,6 +1492,8 @@ void VM_EnhancedRedefineClasses::ClearCpoolCacheAndUnpatch::do_klass(Klass* k) {
|
||||
ik->set_unsafe_anonymous_host(InstanceKlass::cast(ik->unsafe_anonymous_host()->newest_version()));
|
||||
}
|
||||
|
||||
+ // FIXME: check new nest_host for hidden
|
||||
+
|
||||
// Update implementor if there is only one, in this case implementor() can reference old class
|
||||
if (ik->is_interface()) {
|
||||
Klass* implKlass = ik->implementor();
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From b56ea34367c9e3bc529499bb962fe7360aca17c9 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 29 Nov 2020 20:08:57 +0100
|
||||
Subject: [PATCH 18/35] dcevm15 - DON'T clear F2 in CP cache after indy
|
||||
unevolving
|
||||
|
||||
It's not clear why it was cleared in dcevm7-11
|
||||
---
|
||||
src/hotspot/share/oops/cpCache.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hotspot/share/oops/cpCache.cpp b/src/hotspot/share/oops/cpCache.cpp
|
||||
index 167cb274661..7e72641ec5a 100644
|
||||
--- a/src/hotspot/share/oops/cpCache.cpp
|
||||
+++ b/src/hotspot/share/oops/cpCache.cpp
|
||||
@@ -654,7 +654,7 @@ void ConstantPoolCacheEntry::clear_entry() {
|
||||
|
||||
if (clearData) {
|
||||
if (!is_resolved_reference()) {
|
||||
- _f2 = 0;
|
||||
+ // _f2 = 0;
|
||||
}
|
||||
// FIXME: (DCEVM) we want to clear flags, but parameter size is actually used
|
||||
// after we return from the method, before entry is re-initialized. So let's
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
From 05937d6de243f534cd1b30f15940cb90b49dc02f Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 22 Nov 2020 12:03:32 +0100
|
||||
Subject: [PATCH 19/35] Cleanup and review comments
|
||||
|
||||
---
|
||||
src/hotspot/share/classfile/classLoaderDataGraph.hpp | 2 +-
|
||||
src/hotspot/share/gc/shared/gcConfig.cpp | 2 +-
|
||||
src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp | 1 +
|
||||
src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp | 2 +-
|
||||
4 files changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/classfile/classLoaderDataGraph.hpp b/src/hotspot/share/classfile/classLoaderDataGraph.hpp
|
||||
index 5f8913001b0..c3bcc7271e6 100644
|
||||
--- a/src/hotspot/share/classfile/classLoaderDataGraph.hpp
|
||||
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.hpp
|
||||
@@ -105,7 +105,7 @@ class ClassLoaderDataGraph : public AllStatic {
|
||||
|
||||
static void dictionary_classes_do(KlassClosure* klass_closure);
|
||||
|
||||
- // Enhanced class redefinition
|
||||
+ // (DCEVM) Enhanced class redefinition
|
||||
static void rollback_redefinition();
|
||||
|
||||
// VM_CounterDecay iteration support
|
||||
diff --git a/src/hotspot/share/gc/shared/gcConfig.cpp b/src/hotspot/share/gc/shared/gcConfig.cpp
|
||||
index 26a2b67b8e9..8e78696bef5 100644
|
||||
--- a/src/hotspot/share/gc/shared/gcConfig.cpp
|
||||
+++ b/src/hotspot/share/gc/shared/gcConfig.cpp
|
||||
@@ -97,7 +97,7 @@ void GCConfig::fail_if_non_included_gc_is_selected() {
|
||||
|
||||
void GCConfig::select_gc_ergonomically() {
|
||||
if (AllowEnhancedClassRedefinition && !UseG1GC) {
|
||||
- // Enhanced class redefinition only supports serial GC at the moment
|
||||
+ // (DCEVM) Enhanced class redefinition only supports serial GC at the moment
|
||||
FLAG_SET_ERGO(UseSerialGC, true);
|
||||
} else if (os::is_server_class_machine()) {
|
||||
#if INCLUDE_G1GC
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 590f7fdfafe..2a7dd35bdd1 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -842,6 +842,7 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
k->class_loader_data()->exchange_holders(the_class->class_loader_data());
|
||||
|
||||
if (the_class->is_hidden()) {
|
||||
+ // TODO: (DCEVM) review if is correct
|
||||
// from jvm_lookup_define_class() (jvm.cpp):
|
||||
// The hidden class loader data has been artificially been kept alive to
|
||||
// this point. The mirror and any instances of this class have to keep
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
index bd5e7d153be..5de375fb888 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -78,7 +78,7 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
// have any entries.
|
||||
bool _any_class_has_resolved_methods;
|
||||
|
||||
- // Enhanced class redefinition, affected klasses contain all classes which should be redefined
|
||||
+ // (DCEVM) Enhanced class redefinition, affected klasses contain all classes which should be redefined
|
||||
// either because of redefine, class hierarchy or interface change
|
||||
GrowableArray<Klass*>* _affected_klasses;
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From ef2989bd507aad0c4668a3bcd418265ffcbe2305 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Fri, 12 Feb 2021 10:11:10 +0100
|
||||
Subject: [PATCH 20/35] Disable AllowEnhancedClassRedefinition in flight
|
||||
recorder
|
||||
|
||||
---
|
||||
src/hotspot/share/runtime/arguments.cpp | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
|
||||
index 567803b70b7..cbcd8f91c66 100644
|
||||
--- a/src/hotspot/share/runtime/arguments.cpp
|
||||
+++ b/src/hotspot/share/runtime/arguments.cpp
|
||||
@@ -3994,6 +3994,13 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
|
||||
// Set object alignment values.
|
||||
set_object_alignment();
|
||||
|
||||
+ if (FlightRecorder) {
|
||||
+ if (AllowEnhancedClassRedefinition) {
|
||||
+ warning("EnhancedClassRedefinition was disabled, it is not allowed in FlightRecorder.");
|
||||
+ AllowEnhancedClassRedefinition = false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
#if !INCLUDE_CDS
|
||||
if (DumpSharedSpaces || RequireSharedSpaces) {
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,695 @@
|
||||
From d594e77d3f8e4fd9823593b3f34b9cc0401eca5a Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Fri, 12 Feb 2021 09:44:28 +0100
|
||||
Subject: [PATCH 21/35] dcevm17 - fix compilation issues
|
||||
|
||||
---
|
||||
.../share/classfile/classLoaderData.cpp | 2 +-
|
||||
src/hotspot/share/classfile/javaClasses.cpp | 4 +-
|
||||
src/hotspot/share/classfile/javaClasses.hpp | 4 +-
|
||||
.../share/classfile/lambdaFormInvokers.cpp | 152 ++++++++++++++++++
|
||||
.../share/classfile/systemDictionary.cpp | 5 +-
|
||||
.../share/classfile/systemDictionary.hpp | 6 +
|
||||
src/hotspot/share/classfile/vmClassMacros.hpp | 2 +
|
||||
.../share/gc/g1/g1FullGCCompactTask.cpp | 9 +-
|
||||
.../share/gc/g1/g1FullGCCompactionPoint.cpp | 12 +-
|
||||
src/hotspot/share/gc/shared/dcevmSharedGC.cpp | 2 +-
|
||||
src/hotspot/share/gc/shared/space.inline.hpp | 2 +-
|
||||
src/hotspot/share/memory/universe.cpp | 71 --------
|
||||
src/hotspot/share/memory/universe.hpp | 7 -
|
||||
src/hotspot/share/oops/instanceKlass.cpp | 4 +-
|
||||
.../prims/jvmtiEnhancedRedefineClasses.cpp | 47 ++++--
|
||||
.../prims/jvmtiEnhancedRedefineClasses.hpp | 2 +
|
||||
.../share/prims/resolvedMethodTable.cpp | 5 +-
|
||||
src/hotspot/share/runtime/arguments.hpp | 2 +
|
||||
18 files changed, 221 insertions(+), 117 deletions(-)
|
||||
create mode 100644 src/hotspot/share/classfile/lambdaFormInvokers.cpp
|
||||
|
||||
diff --git a/src/hotspot/share/classfile/classLoaderData.cpp b/src/hotspot/share/classfile/classLoaderData.cpp
|
||||
index 63089614e84..975a41c534f 100644
|
||||
--- a/src/hotspot/share/classfile/classLoaderData.cpp
|
||||
+++ b/src/hotspot/share/classfile/classLoaderData.cpp
|
||||
@@ -603,7 +603,7 @@ void ClassLoaderData::exchange_holders(ClassLoaderData* cld) {
|
||||
oop holder_oop = _holder.peek();
|
||||
_holder.replace(cld->_holder.peek());
|
||||
cld->_holder.replace(holder_oop);
|
||||
- WeakHandle<vm_weak_data> exchange = _holder;
|
||||
+ WeakHandle exchange = _holder;
|
||||
_holder = cld->_holder;
|
||||
cld->_holder = exchange;
|
||||
}
|
||||
diff --git a/src/hotspot/share/classfile/javaClasses.cpp b/src/hotspot/share/classfile/javaClasses.cpp
|
||||
index dc800debea4..66ff72b2f02 100644
|
||||
--- a/src/hotspot/share/classfile/javaClasses.cpp
|
||||
+++ b/src/hotspot/share/classfile/javaClasses.cpp
|
||||
@@ -3827,7 +3827,7 @@ void java_lang_invoke_DirectMethodHandle_StaticAccessor::set_static_offset(oop d
|
||||
macro(_static_offset_offset, k, vmSymbols::static_offset_name(), long_signature, false)
|
||||
|
||||
void java_lang_invoke_DirectMethodHandle_StaticAccessor::compute_offsets() {
|
||||
- InstanceKlass* k = SystemDictionary::DirectMethodHandle_StaticAccessor_klass();
|
||||
+ InstanceKlass* k = vmClasses::DirectMethodHandle_StaticAccessor_klass();
|
||||
DIRECTMETHODHANDLE_STATIC_ACCESSOR_FIELDS_DO(FIELD_COMPUTE_OFFSET);
|
||||
}
|
||||
|
||||
@@ -3855,7 +3855,7 @@ void java_lang_invoke_DirectMethodHandle_Accessor::set_field_offset(oop dmh, int
|
||||
macro(_field_offset_offset, k, vmSymbols::field_offset_name(), int_signature, false)
|
||||
|
||||
void java_lang_invoke_DirectMethodHandle_Accessor::compute_offsets() {
|
||||
- InstanceKlass* k = SystemDictionary::DirectMethodHandle_Accessor_klass();
|
||||
+ InstanceKlass* k = vmClasses::DirectMethodHandle_Accessor_klass();
|
||||
DIRECTMETHODHANDLE_ACCESSOR_FIELDS_DO(FIELD_COMPUTE_OFFSET);
|
||||
}
|
||||
|
||||
diff --git a/src/hotspot/share/classfile/javaClasses.hpp b/src/hotspot/share/classfile/javaClasses.hpp
|
||||
index 32348c90ef9..f7dc5ccbd8c 100644
|
||||
--- a/src/hotspot/share/classfile/javaClasses.hpp
|
||||
+++ b/src/hotspot/share/classfile/javaClasses.hpp
|
||||
@@ -1029,7 +1029,7 @@ class java_lang_invoke_DirectMethodHandle_StaticAccessor: AllStatic {
|
||||
|
||||
// Testers
|
||||
static bool is_subclass(Klass* klass) {
|
||||
- return klass->is_subclass_of(SystemDictionary::DirectMethodHandle_StaticAccessor_klass());
|
||||
+ return klass->is_subclass_of(vmClasses::DirectMethodHandle_StaticAccessor_klass());
|
||||
}
|
||||
static bool is_instance(oop obj);
|
||||
|
||||
@@ -1053,7 +1053,7 @@ class java_lang_invoke_DirectMethodHandle_Accessor: AllStatic {
|
||||
|
||||
// Testers
|
||||
static bool is_subclass(Klass* klass) {
|
||||
- return klass->is_subclass_of(SystemDictionary::DirectMethodHandle_Accessor_klass());
|
||||
+ return klass->is_subclass_of(vmClasses::DirectMethodHandle_Accessor_klass());
|
||||
}
|
||||
static bool is_instance(oop obj);
|
||||
|
||||
diff --git a/src/hotspot/share/classfile/lambdaFormInvokers.cpp b/src/hotspot/share/classfile/lambdaFormInvokers.cpp
|
||||
new file mode 100644
|
||||
index 00000000000..281de58b482
|
||||
--- /dev/null
|
||||
+++ b/src/hotspot/share/classfile/lambdaFormInvokers.cpp
|
||||
@@ -0,0 +1,152 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2020, 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.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include "precompiled.hpp"
|
||||
+#include "classfile/classLoadInfo.hpp"
|
||||
+#include "classfile/classFileStream.hpp"
|
||||
+#include "classfile/javaClasses.inline.hpp"
|
||||
+#include "classfile/klassFactory.hpp"
|
||||
+#include "classfile/lambdaFormInvokers.hpp"
|
||||
+#include "classfile/symbolTable.hpp"
|
||||
+#include "classfile/systemDictionary.hpp"
|
||||
+#include "classfile/systemDictionaryShared.hpp"
|
||||
+#include "classfile/vmClasses.hpp"
|
||||
+#include "classfile/vmSymbols.hpp"
|
||||
+#include "logging/log.hpp"
|
||||
+#include "memory/oopFactory.hpp"
|
||||
+#include "memory/metaspaceShared.hpp"
|
||||
+#include "memory/resourceArea.hpp"
|
||||
+#include "oops/instanceKlass.hpp"
|
||||
+#include "oops/klass.hpp"
|
||||
+#include "oops/objArrayKlass.hpp"
|
||||
+#include "oops/objArrayOop.hpp"
|
||||
+#include "oops/oop.inline.hpp"
|
||||
+#include "oops/typeArrayOop.inline.hpp"
|
||||
+#include "runtime/handles.inline.hpp"
|
||||
+#include "runtime/javaCalls.hpp"
|
||||
+
|
||||
+GrowableArray<char*>* LambdaFormInvokers::_lambdaform_lines = NULL;
|
||||
+
|
||||
+void LambdaFormInvokers::append(char* line) {
|
||||
+ if (_lambdaform_lines == NULL) {
|
||||
+ _lambdaform_lines = new GrowableArray<char*>(100);
|
||||
+ }
|
||||
+ _lambdaform_lines->append(line);
|
||||
+}
|
||||
+
|
||||
+void LambdaFormInvokers::regenerate_holder_classes(TRAPS) {
|
||||
+ assert(_lambdaform_lines != NULL, "Bad List");
|
||||
+ ResourceMark rm(THREAD);
|
||||
+
|
||||
+ Symbol* cds_name = vmSymbols::jdk_internal_misc_CDS();
|
||||
+ Klass* cds_klass = SystemDictionary::resolve_or_null(cds_name, THREAD);
|
||||
+ guarantee(cds_klass != NULL, "jdk/internal/misc/CDS must exist!");
|
||||
+
|
||||
+ int len = _lambdaform_lines->length();
|
||||
+ objArrayHandle list_lines = oopFactory::new_objArray_handle(vmClasses::String_klass(), len, CHECK);
|
||||
+ for (int i = 0; i < len; i++) {
|
||||
+ Handle h_line = java_lang_String::create_from_str(_lambdaform_lines->at(i), CHECK);
|
||||
+ list_lines->obj_at_put(i, h_line());
|
||||
+ }
|
||||
+
|
||||
+ //
|
||||
+ // Object[] CDS.generateLambdaFormHolderClasses(String[] lines)
|
||||
+ // the returned Object[] layout:
|
||||
+ // name, byte[], name, byte[] ....
|
||||
+ Symbol* method = vmSymbols::generateLambdaFormHolderClasses();
|
||||
+ Symbol* signrs = vmSymbols::generateLambdaFormHolderClasses_signature();
|
||||
+
|
||||
+ JavaValue result(T_OBJECT);
|
||||
+ JavaCalls::call_static(&result, cds_klass, method, signrs, list_lines, THREAD);
|
||||
+
|
||||
+ if (HAS_PENDING_EXCEPTION) {
|
||||
+ log_info(cds)("%s: %s", THREAD->pending_exception()->klass()->external_name(),
|
||||
+ java_lang_String::as_utf8_string(java_lang_Throwable::message(THREAD->pending_exception())));
|
||||
+ CLEAR_PENDING_EXCEPTION;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ objArrayHandle h_array(THREAD, (objArrayOop)result.get_oop());
|
||||
+ int sz = h_array->length();
|
||||
+ assert(sz % 2 == 0 && sz >= 2, "Must be even size of length");
|
||||
+ for (int i = 0; i < sz; i+= 2) {
|
||||
+ Handle h_name(THREAD, h_array->obj_at(i));
|
||||
+ typeArrayHandle h_bytes(THREAD, (typeArrayOop)h_array->obj_at(i+1));
|
||||
+ assert(h_name != NULL, "Class name is NULL");
|
||||
+ assert(h_bytes != NULL, "Class bytes is NULL");
|
||||
+
|
||||
+ char *class_name = java_lang_String::as_utf8_string(h_name());
|
||||
+ int len = h_bytes->length();
|
||||
+ // make a copy of class bytes so GC will not affect us.
|
||||
+ char *buf = resource_allocate_bytes(THREAD, len);
|
||||
+ memcpy(buf, (char*)h_bytes->byte_at_addr(0), len);
|
||||
+ ClassFileStream st((u1*)buf, len, NULL, ClassFileStream::verify);
|
||||
+
|
||||
+ reload_class(class_name, st, THREAD);
|
||||
+ // free buf
|
||||
+ resource_free_bytes(buf, len);
|
||||
+
|
||||
+ if (HAS_PENDING_EXCEPTION) {
|
||||
+ log_info(cds)("Exception happened: %s", PENDING_EXCEPTION->klass()->name()->as_C_string());
|
||||
+ log_info(cds)("Could not create InstanceKlass for class %s", class_name);
|
||||
+ CLEAR_PENDING_EXCEPTION;
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+// class_handle - the class name, bytes_handle - the class bytes
|
||||
+void LambdaFormInvokers::reload_class(char* name, ClassFileStream& st, TRAPS) {
|
||||
+ Symbol* class_name = SymbolTable::new_symbol((const char*)name);
|
||||
+ // the class must exist
|
||||
+ Klass* klass = SystemDictionary::resolve_or_null(class_name, THREAD);
|
||||
+ if (klass == NULL) {
|
||||
+ log_info(cds)("Class %s not present, skip", name);
|
||||
+ return;
|
||||
+ }
|
||||
+ assert(klass->is_instance_klass(), "Should be");
|
||||
+
|
||||
+ ClassLoaderData* cld = ClassLoaderData::the_null_class_loader_data();
|
||||
+ Handle protection_domain;
|
||||
+ ClassLoadInfo cl_info(protection_domain);
|
||||
+
|
||||
+ InstanceKlass* result = KlassFactory::create_from_stream(&st,
|
||||
+ class_name,
|
||||
+ cld,
|
||||
+ cl_info,
|
||||
+ false,
|
||||
+ CHECK);
|
||||
+
|
||||
+ {
|
||||
+ MutexLocker mu_r(THREAD, Compile_lock); // add_to_hierarchy asserts this.
|
||||
+ SystemDictionary::add_to_hierarchy(result);
|
||||
+ }
|
||||
+ // new class not linked yet.
|
||||
+ MetaspaceShared::try_link_class(THREAD, result);
|
||||
+ assert(!HAS_PENDING_EXCEPTION, "Invariant");
|
||||
+
|
||||
+ // exclude the existing class from dump
|
||||
+ SystemDictionaryShared::set_excluded(InstanceKlass::cast(klass));
|
||||
+ log_info(cds, lambda)("Replaced class %s, old: %p new: %p", name, klass, result);
|
||||
+}
|
||||
diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
index 98e2541c79b..63de2e2f099 100644
|
||||
--- a/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
+++ b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
@@ -963,11 +963,12 @@ InstanceKlass* SystemDictionary::resolve_from_stream(ClassFileStream* st,
|
||||
Symbol* class_name,
|
||||
Handle class_loader,
|
||||
const ClassLoadInfo& cl_info,
|
||||
+ InstanceKlass* old_klass,
|
||||
TRAPS) {
|
||||
if (cl_info.is_hidden()) {
|
||||
- return resolve_hidden_class_from_stream(st, class_name, class_loader, cl_info, CHECK_NULL);
|
||||
+ return resolve_hidden_class_from_stream(st, class_name, class_loader, cl_info, old_klass, CHECK_NULL);
|
||||
} else {
|
||||
- return resolve_class_from_stream(st, class_name, class_loader, cl_info, CHECK_NULL);
|
||||
+ return resolve_class_from_stream(st, class_name, class_loader, cl_info, old_klass, CHECK_NULL);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/hotspot/share/classfile/systemDictionary.hpp b/src/hotspot/share/classfile/systemDictionary.hpp
|
||||
index 0c774dfeb51..65185a29b10 100644
|
||||
--- a/src/hotspot/share/classfile/systemDictionary.hpp
|
||||
+++ b/src/hotspot/share/classfile/systemDictionary.hpp
|
||||
@@ -124,6 +124,7 @@ class SystemDictionary : AllStatic {
|
||||
Symbol* class_name,
|
||||
Handle class_loader,
|
||||
const ClassLoadInfo& cl_info,
|
||||
+ InstanceKlass* old_klass,
|
||||
TRAPS);
|
||||
|
||||
// Resolve a class from stream (called by jni_DefineClass and JVM_DefineClass)
|
||||
@@ -132,6 +133,7 @@ class SystemDictionary : AllStatic {
|
||||
Symbol* class_name,
|
||||
Handle class_loader,
|
||||
const ClassLoadInfo& cl_info,
|
||||
+ InstanceKlass* old_klass,
|
||||
TRAPS);
|
||||
|
||||
public:
|
||||
@@ -203,6 +205,10 @@ class SystemDictionary : AllStatic {
|
||||
// Initialization
|
||||
static void initialize(TRAPS);
|
||||
|
||||
+ // (DCEVM) Enhanced class redefinition
|
||||
+ static void remove_from_hierarchy(InstanceKlass* k);
|
||||
+ static void update_constraints_after_redefinition();
|
||||
+
|
||||
protected:
|
||||
// Returns the class loader data to be used when looking up/updating the
|
||||
// system dictionary.
|
||||
diff --git a/src/hotspot/share/classfile/vmClassMacros.hpp b/src/hotspot/share/classfile/vmClassMacros.hpp
|
||||
index a4f55641b51..fb205721a39 100644
|
||||
--- a/src/hotspot/share/classfile/vmClassMacros.hpp
|
||||
+++ b/src/hotspot/share/classfile/vmClassMacros.hpp
|
||||
@@ -109,6 +109,8 @@
|
||||
\
|
||||
/* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \
|
||||
do_klass(DirectMethodHandle_klass, java_lang_invoke_DirectMethodHandle ) \
|
||||
+ do_klass(DirectMethodHandle_StaticAccessor_klass, java_lang_invoke_DirectMethodHandle_StaticAccessor ) \
|
||||
+ do_klass(DirectMethodHandle_Accessor_klass, java_lang_invoke_DirectMethodHandle_Accessor ) \
|
||||
do_klass(MethodHandle_klass, java_lang_invoke_MethodHandle ) \
|
||||
do_klass(VarHandle_klass, java_lang_invoke_VarHandle ) \
|
||||
do_klass(MemberName_klass, java_lang_invoke_MemberName ) \
|
||||
diff --git a/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp b/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp
|
||||
index 54edc9dffb5..058dea90828 100644
|
||||
--- a/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp
|
||||
+++ b/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp
|
||||
@@ -141,7 +141,10 @@ void G1FullGCCompactTask::compact_region_dcevm(HeapRegion* hr, GrowableArray<Hea
|
||||
// Once all objects have been moved the liveness information
|
||||
// needs be cleared.
|
||||
collector()->mark_bitmap()->clear_region(hr);
|
||||
- hr->complete_compaction();
|
||||
+ if (G1VerifyBitmaps) {
|
||||
+ collector()->mark_bitmap()->clear_region(hr);
|
||||
+ }
|
||||
+ hr->reset_compacted_after_full_gc();
|
||||
}
|
||||
|
||||
void G1FullGCCompactTask::serial_compaction_dcevm() {
|
||||
@@ -184,13 +187,13 @@ size_t G1FullGCCompactTask::G1CompactRegionClosureDcevm::apply(oop obj) {
|
||||
} else {
|
||||
DcevmSharedGC::update_fields(obj, oop(destination));
|
||||
}
|
||||
- oop(destination)->init_mark_raw();
|
||||
+ oop(destination)->init_mark();
|
||||
assert(oop(destination)->klass() != NULL, "should have a class");
|
||||
return size;
|
||||
}
|
||||
|
||||
Copy::aligned_conjoint_words(obj_addr, destination, size);
|
||||
- oop(destination)->init_mark_raw();
|
||||
+ oop(destination)->init_mark();
|
||||
assert(oop(destination)->klass() != NULL, "should have a class");
|
||||
|
||||
return size;
|
||||
diff --git a/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp b/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp
|
||||
index 71a46b88f9e..87b1977128a 100644
|
||||
--- a/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp
|
||||
+++ b/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp
|
||||
@@ -36,8 +36,8 @@ G1FullGCCompactionPoint::G1FullGCCompactionPoint() :
|
||||
{
|
||||
_compaction_regions = new (ResourceObj::C_HEAP, mtGC) GrowableArray<HeapRegion*>(32, mtGC);
|
||||
_compaction_region_iterator = _compaction_regions->begin();
|
||||
- _rescued_oops = new (ResourceObj::C_HEAP, mtGC) GrowableArray<HeapWord*>(128, true, mtGC);
|
||||
- _rescued_oops_values = new (ResourceObj::C_HEAP, mtGC) GrowableArray<HeapWord*>(128, true, mtGC);
|
||||
+ _rescued_oops = new (ResourceObj::C_HEAP, mtGC) GrowableArray<HeapWord*>(128, mtGC);
|
||||
+ _rescued_oops_values = new (ResourceObj::C_HEAP, mtGC) GrowableArray<HeapWord*>(128, mtGC);
|
||||
}
|
||||
|
||||
G1FullGCCompactionPoint::~G1FullGCCompactionPoint() {
|
||||
@@ -180,15 +180,15 @@ void G1FullGCCompactionPoint::forward_dcevm(oop object, size_t size, bool force_
|
||||
// with BiasedLocking, in this case forwardee() will return NULL
|
||||
// even if the mark-word is used. This is no problem since
|
||||
// forwardee() will return NULL in the compaction phase as well.
|
||||
- object->init_mark_raw();
|
||||
+ object->init_mark();
|
||||
} else {
|
||||
// Make sure object has the correct mark-word set or that it will be
|
||||
// fixed when restoring the preserved marks.
|
||||
- assert(object->mark_raw() == markWord::prototype_for_klass(object->klass()) || // Correct mark
|
||||
+ assert(object->mark() == markWord::prototype_for_klass(object->klass()) || // Correct mark
|
||||
object->mark_must_be_preserved() || // Will be restored by PreservedMarksSet
|
||||
- (UseBiasedLocking && object->has_bias_pattern_raw()), // Will be restored by BiasedLocking
|
||||
+ (UseBiasedLocking && object->has_bias_pattern()), // Will be restored by BiasedLocking
|
||||
"should have correct prototype obj: " PTR_FORMAT " mark: " PTR_FORMAT " prototype: " PTR_FORMAT,
|
||||
- p2i(object), object->mark_raw().value(), markWord::prototype_for_klass(object->klass()).value());
|
||||
+ p2i(object), object->mark().value(), markWord::prototype_for_klass(object->klass()).value());
|
||||
}
|
||||
assert(object->forwardee() == NULL, "should be forwarded to NULL");
|
||||
}
|
||||
diff --git a/src/hotspot/share/gc/shared/dcevmSharedGC.cpp b/src/hotspot/share/gc/shared/dcevmSharedGC.cpp
|
||||
index 3dee097f1d3..edc19a3077d 100644
|
||||
--- a/src/hotspot/share/gc/shared/dcevmSharedGC.cpp
|
||||
+++ b/src/hotspot/share/gc/shared/dcevmSharedGC.cpp
|
||||
@@ -64,7 +64,7 @@ void DcevmSharedGC::copy_rescued_objects_back(GrowableArray<HeapWord*>* rescued_
|
||||
Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(rescued_obj), cast_from_oop<HeapWord*>(new_obj), size);
|
||||
}
|
||||
|
||||
- new_obj->init_mark_raw();
|
||||
+ new_obj->init_mark();
|
||||
assert(oopDesc::is_oop(new_obj), "must be a valid oop");
|
||||
}
|
||||
}
|
||||
diff --git a/src/hotspot/share/gc/shared/space.inline.hpp b/src/hotspot/share/gc/shared/space.inline.hpp
|
||||
index e3a37280268..cafa2503ef4 100644
|
||||
--- a/src/hotspot/share/gc/shared/space.inline.hpp
|
||||
+++ b/src/hotspot/share/gc/shared/space.inline.hpp
|
||||
@@ -371,7 +371,7 @@ inline void CompactibleSpace::scan_and_compact(SpaceType* space, bool redefiniti
|
||||
} else {
|
||||
DcevmSharedGC::update_fields(oop(cur_obj), oop(compaction_top));
|
||||
}
|
||||
- oop(compaction_top)->init_mark_raw();
|
||||
+ oop(compaction_top)->init_mark();
|
||||
assert(oop(compaction_top)->klass() != NULL, "should have a class");
|
||||
|
||||
debug_only(prev_obj = cur_obj);
|
||||
diff --git a/src/hotspot/share/memory/universe.cpp b/src/hotspot/share/memory/universe.cpp
|
||||
index 247f2b3e8c0..4ae3b382b67 100644
|
||||
--- a/src/hotspot/share/memory/universe.cpp
|
||||
+++ b/src/hotspot/share/memory/universe.cpp
|
||||
@@ -44,8 +44,6 @@
|
||||
#include "gc/shared/oopStorageSet.hpp"
|
||||
#include "gc/shared/stringdedup/stringDedup.hpp"
|
||||
#include "gc/shared/tlab_globals.hpp"
|
||||
-#include "gc/shared/weakProcessor.hpp"
|
||||
-#include "interpreter/interpreter.hpp"
|
||||
#include "logging/log.hpp"
|
||||
#include "logging/logStream.hpp"
|
||||
#include "memory/metadataFactory.hpp"
|
||||
@@ -73,8 +71,6 @@
|
||||
#include "runtime/jniHandles.hpp"
|
||||
#include "runtime/thread.inline.hpp"
|
||||
#include "runtime/timerTrace.hpp"
|
||||
-#include "runtime/vmOperations.hpp"
|
||||
-#include "services/management.hpp"
|
||||
#include "services/memoryService.hpp"
|
||||
#include "utilities/align.hpp"
|
||||
#include "utilities/autoRestore.hpp"
|
||||
@@ -208,73 +204,6 @@ void Universe::basic_type_classes_do(KlassClosure *closure) {
|
||||
}
|
||||
}
|
||||
|
||||
-#define DO_PRIMITIVE_MIRROR(m) \
|
||||
- f->do_oop((oop*) &m);
|
||||
-
|
||||
-// FIXME: (DCEVM) This method should iterate all pointers that are not within heap objects.
|
||||
-void Universe::root_oops_do(OopClosure *oopClosure) {
|
||||
- Universe::oops_do(oopClosure);
|
||||
-// ReferenceProcessor::oops_do(oopClosure); (tw) check why no longer there
|
||||
- JNIHandles::oops_do(oopClosure); // Global (strong) JNI handles
|
||||
- Threads::oops_do(oopClosure, NULL);
|
||||
- ObjectSynchronizer::oops_do(oopClosure);
|
||||
- // (DCEVM) TODO: Check if this is correct?
|
||||
- Management::oops_do(oopClosure);
|
||||
- OopStorageSet::vm_global()->oops_do(oopClosure);
|
||||
- // CLDToOopClosure cld_closure(oopClosure, ClassLoaderData::_claim_none);
|
||||
- // ClassLoaderDataGraph::cld_do(&cld_closure);
|
||||
-
|
||||
- // Now adjust pointers in remaining weak roots. (All of which should
|
||||
- // have been cleared if they pointed to non-surviving objects.)
|
||||
- // Global (weak) JNI handles
|
||||
- WeakProcessor::oops_do(oopClosure);
|
||||
-
|
||||
- JvmtiExport::oops_do(oopClosure);
|
||||
-
|
||||
- CodeBlobToOopClosure blobClosure(oopClosure, CodeBlobToOopClosure::FixRelocations);
|
||||
- CodeCache::blobs_do(&blobClosure);
|
||||
-
|
||||
- AOT_ONLY(AOTLoader::oops_do(oopClosure);)
|
||||
-
|
||||
- // StringTable::oops_do was removed in j15
|
||||
- // StringTable::oops_do(oopClosure);
|
||||
-
|
||||
- // OopStorageSet::vm_global()->oops_do(oopClosure);
|
||||
-
|
||||
-}
|
||||
-
|
||||
-void Universe::oops_do(OopClosure* f) {
|
||||
- PRIMITIVE_MIRRORS_DO(DO_PRIMITIVE_MIRROR);
|
||||
-
|
||||
- for (int i = T_BOOLEAN; i < T_VOID+1; i++) {
|
||||
- f->do_oop((oop*) &_mirrors[i]);
|
||||
- }
|
||||
- assert(_mirrors[0] == NULL && _mirrors[T_BOOLEAN - 1] == NULL, "checking");
|
||||
-
|
||||
- f->do_oop((oop*)&_the_empty_class_array);
|
||||
- f->do_oop((oop*)&_the_null_sentinel);
|
||||
- f->do_oop((oop*)&_the_null_string);
|
||||
- f->do_oop((oop*)&_the_min_jint_string);
|
||||
- f->do_oop((oop*)&out_of_memory_errors()->obj_at(_oom_java_heap));
|
||||
- f->do_oop((oop*)&out_of_memory_errors()->obj_at(_oom_c_heap));
|
||||
- f->do_oop((oop*)&out_of_memory_errors()->obj_at(_oom_metaspace));
|
||||
- f->do_oop((oop*)&out_of_memory_errors()->obj_at(_oom_class_metaspace));
|
||||
- f->do_oop((oop*)&out_of_memory_errors()->obj_at(_oom_array_size));
|
||||
- f->do_oop((oop*)&out_of_memory_errors()->obj_at(_oom_gc_overhead_limit));
|
||||
- f->do_oop((oop*)&out_of_memory_errors()->obj_at(_oom_realloc_objects));
|
||||
- f->do_oop((oop*)&out_of_memory_errors()->obj_at(_oom_retry));
|
||||
- f->do_oop((oop*)&_delayed_stack_overflow_error_message);
|
||||
- f->do_oop((oop*)&_preallocated_out_of_memory_error_array);
|
||||
- f->do_oop((oop*)&_null_ptr_exception_instance);
|
||||
- f->do_oop((oop*)&_arithmetic_exception_instance);
|
||||
- f->do_oop((oop*)&_virtual_machine_error_instance);
|
||||
- f->do_oop((oop*)&_main_thread_group);
|
||||
- f->do_oop((oop*)&_system_thread_group);
|
||||
- f->do_oop((oop*)&_reference_pending_list);
|
||||
- debug_only(f->do_oop((oop*)&_fullgc_alot_dummy_array);)
|
||||
- ThreadsSMRSupport::exiting_threads_oops_do(f);
|
||||
-}
|
||||
-
|
||||
void LatestMethodCache::metaspace_pointers_do(MetaspaceClosure* it) {
|
||||
it->push(&_klass);
|
||||
}
|
||||
diff --git a/src/hotspot/share/memory/universe.hpp b/src/hotspot/share/memory/universe.hpp
|
||||
index cb320076a55..4b2211c415e 100644
|
||||
--- a/src/hotspot/share/memory/universe.hpp
|
||||
+++ b/src/hotspot/share/memory/universe.hpp
|
||||
@@ -326,13 +326,6 @@ class Universe: AllStatic {
|
||||
static bool should_fill_in_stack_trace(Handle throwable);
|
||||
static void check_alignment(uintx size, uintx alignment, const char* name);
|
||||
|
||||
- // Iteration
|
||||
-
|
||||
- static void root_oops_do(OopClosure *oopClosure); // FIXME: kill...
|
||||
- // Apply "f" to the addresses of all the direct heap pointers maintained
|
||||
- // as static fields of "Universe".
|
||||
- static void oops_do(OopClosure* f);
|
||||
-
|
||||
// CDS support
|
||||
static void serialize(SerializeClosure* f);
|
||||
|
||||
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
index b4d09e92830..c2de2bec7d4 100644
|
||||
--- a/src/hotspot/share/oops/instanceKlass.cpp
|
||||
+++ b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
@@ -1286,7 +1286,7 @@ void InstanceKlass::init_implementor() {
|
||||
// (DCEVM) - init_implementor() for dcevm
|
||||
void InstanceKlass::init_implementor_from_redefine() {
|
||||
assert(is_interface(), "not interface");
|
||||
- Klass* volatile* addr = adr_implementor();
|
||||
+ InstanceKlass* volatile* addr = adr_implementor();
|
||||
assert(addr != NULL, "null addr");
|
||||
if (addr != NULL) {
|
||||
*addr = NULL;
|
||||
@@ -3816,7 +3816,7 @@ void InstanceKlass::verify_on(outputStream* st) {
|
||||
|
||||
guarantee(sib->is_klass(), "should be klass");
|
||||
// TODO: (DCEVM) explain
|
||||
- guarantee(sib->super() == super || AllowEnhancedClassRedefinition && super->newest_version() == SystemDictionary::Object_klass(), "siblings should have same superklass");
|
||||
+ guarantee(sib->super() == super || AllowEnhancedClassRedefinition && super->newest_version() == vmClasses::Object_klass(), "siblings should have same superklass");
|
||||
}
|
||||
|
||||
// Verify local interfaces
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 2a7dd35bdd1..071dbc6d6ad 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -26,8 +26,10 @@
|
||||
#include "aot/aotLoader.hpp"
|
||||
#include "classfile/classFileParser.hpp"
|
||||
#include "classfile/classFileStream.hpp"
|
||||
+#include "classfile/classLoadInfo.hpp"
|
||||
#include "classfile/metadataOnStackMark.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
+#include "classfile/symbolTable.hpp"
|
||||
#include "classfile/verifier.hpp"
|
||||
#include "classfile/dictionary.hpp"
|
||||
#include "classfile/classLoaderDataGraph.hpp"
|
||||
@@ -198,8 +200,8 @@ class FieldCopier : public FieldClosure {
|
||||
if (found && result.is_static()) {
|
||||
log_trace(redefine, class, obsolete, metadata)("Copying static field value for field %s old_offset=%d new_offset=%d",
|
||||
fd->name()->as_C_string(), result.offset(), fd->offset());
|
||||
- memcpy(cur_oop->obj_field_addr_raw<HeapWord>(fd->offset()),
|
||||
- old_oop->obj_field_addr_raw<HeapWord>(result.offset()),
|
||||
+ memcpy(cur_oop->obj_field_addr<HeapWord>(fd->offset()),
|
||||
+ old_oop->obj_field_addr<HeapWord>(result.offset()),
|
||||
type2aelembytes(fd->field_type()));
|
||||
|
||||
// Static fields may have references to java.lang.Class
|
||||
@@ -242,6 +244,17 @@ void VM_EnhancedRedefineClasses::register_nmethod_g1(nmethod* nm) {
|
||||
}
|
||||
}
|
||||
|
||||
+void VM_EnhancedRedefineClasses::root_oops_do(OopClosure *oopClosure) {
|
||||
+ Universe::vm_global()->oops_do(oopClosure);
|
||||
+
|
||||
+ Threads::oops_do(oopClosure, NULL);
|
||||
+ AOT_ONLY(AOTLoader::oops_do(oopClosure);)
|
||||
+ OopStorageSet::strong_oops_do(oopClosure);
|
||||
+
|
||||
+ CodeBlobToOopClosure blobClosure(oopClosure, CodeBlobToOopClosure::FixRelocations);
|
||||
+ CodeCache::blobs_do(&blobClosure);
|
||||
+}
|
||||
+
|
||||
// TODO comment
|
||||
struct StoreBarrier {
|
||||
// TODO: j10 review change ::oop_store -> HeapAccess<>::oop_store
|
||||
@@ -558,7 +571,7 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
_timer_heap_iterate.stop();
|
||||
}
|
||||
|
||||
- Universe::root_oops_do(&oopClosureNoBarrier);
|
||||
+ root_oops_do(&oopClosureNoBarrier);
|
||||
|
||||
if (UseG1GC) {
|
||||
// this should work also for other GCs
|
||||
@@ -737,8 +750,8 @@ bool VM_EnhancedRedefineClasses::is_modifiable_class(oop klass_mirror) {
|
||||
// - link new classes
|
||||
jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
|
||||
- _affected_klasses = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Klass*>(_class_count, true);
|
||||
- _new_classes = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<InstanceKlass*>(_class_count, true);
|
||||
+ _affected_klasses = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Klass*>(_class_count);
|
||||
+ _new_classes = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<InstanceKlass*>(_class_count);
|
||||
|
||||
ResourceMark rm(THREAD);
|
||||
|
||||
@@ -832,12 +845,12 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
!the_class->is_non_strong_hidden(), // is_strong_hidden
|
||||
true); // FIXME: check if correct. can_access_vm_annotations
|
||||
|
||||
- k = SystemDictionary::parse_stream(the_class_sym,
|
||||
- the_class_loader,
|
||||
- &st,
|
||||
- cl_info,
|
||||
- the_class,
|
||||
- THREAD);
|
||||
+ k = SystemDictionary::resolve_from_stream(&st,
|
||||
+ the_class_sym,
|
||||
+ the_class_loader,
|
||||
+ cl_info,
|
||||
+ the_class,
|
||||
+ THREAD);
|
||||
|
||||
k->class_loader_data()->exchange_holders(the_class->class_loader_data());
|
||||
|
||||
@@ -853,12 +866,12 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
}
|
||||
|
||||
} else {
|
||||
- k = SystemDictionary::resolve_from_stream(the_class_sym,
|
||||
- the_class_loader,
|
||||
- protection_domain,
|
||||
- &st,
|
||||
- the_class,
|
||||
- THREAD);
|
||||
+ k = SystemDictionary::resolve_from_stream(&st,
|
||||
+ the_class_sym,
|
||||
+ the_class_loader,
|
||||
+ protection_domain,
|
||||
+ the_class,
|
||||
+ THREAD);
|
||||
}
|
||||
// Clear class_being_redefined just to be sure.
|
||||
state->clear_class_being_redefined();
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
index 5de375fb888..9be70039e32 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -124,6 +124,8 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
static void register_nmethod_g1(nmethod* nm);
|
||||
static void unpatch_bytecode(Method* method, TRAPS);
|
||||
|
||||
+ void root_oops_do(OopClosure *oopClosure);
|
||||
+
|
||||
// Figure out which new methods match old methods in name and signature,
|
||||
// which methods have been added, and which are no longer present
|
||||
void compute_added_deleted_matching_methods();
|
||||
diff --git a/src/hotspot/share/prims/resolvedMethodTable.cpp b/src/hotspot/share/prims/resolvedMethodTable.cpp
|
||||
index 3c29eda4da0..a1eadc2958a 100644
|
||||
--- a/src/hotspot/share/prims/resolvedMethodTable.cpp
|
||||
+++ b/src/hotspot/share/prims/resolvedMethodTable.cpp
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "oops/access.inline.hpp"
|
||||
#include "oops/method.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
+#include "oops/klass.inline.hpp"
|
||||
#include "oops/weakHandle.inline.hpp"
|
||||
#include "prims/resolvedMethodTable.hpp"
|
||||
#include "runtime/atomic.hpp"
|
||||
@@ -375,7 +376,7 @@ class AdjustMethodEntriesDcevm : public StackObj {
|
||||
GrowableArray<oop>* _oops_to_add;
|
||||
public:
|
||||
AdjustMethodEntriesDcevm(GrowableArray<oop>* oops_to_add, bool* trace_name_printed) : _trace_name_printed(trace_name_printed), _oops_to_add(oops_to_add) {};
|
||||
- bool operator()(WeakHandle<vm_resolved_method_table_data>* entry) {
|
||||
+ bool operator()(WeakHandle* entry) {
|
||||
oop mem_name = entry->peek();
|
||||
if (mem_name == NULL) {
|
||||
// Removed
|
||||
@@ -460,7 +461,7 @@ void ResolvedMethodTable::adjust_method_entries_dcevm(bool * trace_name_printed)
|
||||
if (_local_table->get(thread, lookup, rmg)) {
|
||||
break;
|
||||
}
|
||||
- WeakHandle<vm_resolved_method_table_data> wh = WeakHandle<vm_resolved_method_table_data>::create(Handle(thread, mem_name));
|
||||
+ WeakHandle wh(_oop_storage, mem_name);
|
||||
// The hash table takes ownership of the WeakHandle, even if it's not inserted.
|
||||
if (_local_table->insert(thread, lookup, wh)) {
|
||||
log_insert(method);
|
||||
diff --git a/src/hotspot/share/runtime/arguments.hpp b/src/hotspot/share/runtime/arguments.hpp
|
||||
index 1b7f8fe9f47..6a8ceb7fa8a 100644
|
||||
--- a/src/hotspot/share/runtime/arguments.hpp
|
||||
+++ b/src/hotspot/share/runtime/arguments.hpp
|
||||
@@ -482,6 +482,8 @@ class Arguments : AllStatic {
|
||||
// Adjusts the arguments after the OS have adjusted the arguments
|
||||
static jint adjust_after_os();
|
||||
|
||||
+ // Check for consistency in the selection of the garbage collector.
|
||||
+ static bool check_gc_consistency(); // Check user-selected gc
|
||||
// Check consistency or otherwise of VM argument settings
|
||||
static bool check_vm_args_consistency();
|
||||
// Used by os_solaris
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From 04f83f04ace679676decdf626a3ebefddaf56d7a Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Fri, 12 Feb 2021 11:38:48 +0100
|
||||
Subject: [PATCH 22/35] Fix crash on GrowableArray allocation in C_HEAP
|
||||
|
||||
---
|
||||
src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 071dbc6d6ad..a5264077bfe 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -750,8 +750,8 @@ bool VM_EnhancedRedefineClasses::is_modifiable_class(oop klass_mirror) {
|
||||
// - link new classes
|
||||
jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
|
||||
- _affected_klasses = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Klass*>(_class_count);
|
||||
- _new_classes = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<InstanceKlass*>(_class_count);
|
||||
+ _affected_klasses = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Klass*>(_class_count, mtInternal);
|
||||
+ _new_classes = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<InstanceKlass*>(_class_count, mtInternal);
|
||||
|
||||
ResourceMark rm(THREAD);
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
From 14d8fd053cb52a45c450afa0a1ae7bd9d6572314 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Fri, 12 Feb 2021 11:39:05 +0100
|
||||
Subject: [PATCH 23/35] Rename confusing method name old_if_redefined to
|
||||
old_if_redefining
|
||||
|
||||
---
|
||||
src/hotspot/share/classfile/dictionary.cpp | 4 ++--
|
||||
src/hotspot/share/classfile/dictionary.hpp | 2 +-
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/classfile/dictionary.cpp b/src/hotspot/share/classfile/dictionary.cpp
|
||||
index 223b9e1e7a9..2b236a7724e 100644
|
||||
--- a/src/hotspot/share/classfile/dictionary.cpp
|
||||
+++ b/src/hotspot/share/classfile/dictionary.cpp
|
||||
@@ -359,7 +359,7 @@ InstanceKlass* Dictionary::find(unsigned int hash, Symbol* name,
|
||||
int index = hash_to_index(hash);
|
||||
DictionaryEntry* entry = get_entry(index, hash, name);
|
||||
if (entry != NULL && entry->is_valid_protection_domain(protection_domain)) {
|
||||
- return old_if_redefined(entry->instance_klass());
|
||||
+ return old_if_redefining(entry->instance_klass());
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
@@ -373,7 +373,7 @@ InstanceKlass* Dictionary::find_class(unsigned int hash,
|
||||
assert (index == index_for(name), "incorrect index?");
|
||||
|
||||
DictionaryEntry* entry = get_entry(index, hash, name);
|
||||
- return old_if_redefined((entry != NULL) ? entry->instance_klass() : NULL);
|
||||
+ return old_if_redefining((entry != NULL) ? entry->instance_klass() : NULL);
|
||||
}
|
||||
|
||||
void Dictionary::add_protection_domain(int index, unsigned int hash,
|
||||
diff --git a/src/hotspot/share/classfile/dictionary.hpp b/src/hotspot/share/classfile/dictionary.hpp
|
||||
index bdfef5c8663..e997cfdcabd 100644
|
||||
--- a/src/hotspot/share/classfile/dictionary.hpp
|
||||
+++ b/src/hotspot/share/classfile/dictionary.hpp
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
Handle protection_domain);
|
||||
|
||||
// (DCEVM) return old class if redefining in AllowEnhancedClassRedefinition, otherwise return "k"
|
||||
- static InstanceKlass* old_if_redefined(InstanceKlass* k) {
|
||||
+ static InstanceKlass* old_if_redefining(InstanceKlass* k) {
|
||||
return (k != NULL && k->is_redefining()) ? ((InstanceKlass* )k->old_version()) : k;
|
||||
}
|
||||
};
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From 368ef171123b1216a87441f19792b0e1be18bc42 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Fri, 12 Feb 2021 12:33:47 +0100
|
||||
Subject: [PATCH 24/35] Check InstanceKlass::has_nestmate_access_to with active
|
||||
classes
|
||||
|
||||
Dcevm can leave old host in nested class if nested class is not
|
||||
redefined together with host class
|
||||
---
|
||||
src/hotspot/share/oops/instanceKlass.cpp | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
index c2de2bec7d4..3cc96f98f41 100644
|
||||
--- a/src/hotspot/share/oops/instanceKlass.cpp
|
||||
+++ b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
@@ -398,9 +398,9 @@ bool InstanceKlass::has_nestmate_access_to(InstanceKlass* k, TRAPS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+ // (DCEVM) cur_host can be old, decide accessibility based on active version
|
||||
if (AllowEnhancedClassRedefinition) {
|
||||
- // TODO: (DCEVM) check if it correct. It fix problems with lambdas (hidden)
|
||||
- cur_host = InstanceKlass::cast(cur_host->newest_version());
|
||||
+ cur_host = InstanceKlass::cast(cur_host->active_version());
|
||||
}
|
||||
|
||||
Klass* k_nest_host = k->nest_host(CHECK_false);
|
||||
@@ -408,6 +408,11 @@ bool InstanceKlass::has_nestmate_access_to(InstanceKlass* k, TRAPS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+ // (DCEVM) k_nest_host can be old, decide accessibility based on active version
|
||||
+ if (AllowEnhancedClassRedefinition) {
|
||||
+ k_nest_host = InstanceKlass::cast(k_nest_host->active_version());
|
||||
+ }
|
||||
+
|
||||
bool access = (cur_host == k_nest_host);
|
||||
|
||||
ResourceMark rm(THREAD);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
From 15d82ad614483a47ede9d712101b6750ba46f469 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sat, 13 Feb 2021 20:47:52 +0100
|
||||
Subject: [PATCH 25/35] JBR-3111 Update class in all dictionaries where it was
|
||||
already defined
|
||||
|
||||
This patch keeps compatibility with std redefinition, that does not
|
||||
create a new Klass, but modifies it, then it is modified in all
|
||||
dictionaries containing this class.
|
||||
---
|
||||
src/hotspot/share/classfile/classLoaderDataGraph.cpp | 9 +++++++++
|
||||
src/hotspot/share/classfile/classLoaderDataGraph.hpp | 3 +++
|
||||
src/hotspot/share/classfile/dictionary.cpp | 2 +-
|
||||
src/hotspot/share/classfile/dictionary.hpp | 2 +-
|
||||
src/hotspot/share/classfile/systemDictionary.cpp | 4 +++-
|
||||
5 files changed, 17 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/classfile/classLoaderDataGraph.cpp b/src/hotspot/share/classfile/classLoaderDataGraph.cpp
|
||||
index fda5d2eb1ba..67ade5709f6 100644
|
||||
--- a/src/hotspot/share/classfile/classLoaderDataGraph.cpp
|
||||
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.cpp
|
||||
@@ -455,6 +455,15 @@ void ClassLoaderDataGraph::rollback_redefinition() {
|
||||
}
|
||||
}
|
||||
|
||||
+// (DCEVM) - iterate over all classes in all dictionaries
|
||||
+bool ClassLoaderDataGraph::dictionary_classes_do_update_klass(Symbol* name, InstanceKlass* k, InstanceKlass* old_klass) {
|
||||
+ bool ok = false;
|
||||
+ FOR_ALL_DICTIONARY(cld) {
|
||||
+ ok = cld->dictionary()->update_klass(name, k, old_klass) || ok;
|
||||
+ }
|
||||
+ return ok;
|
||||
+}
|
||||
+
|
||||
void ClassLoaderDataGraph::verify_dictionary() {
|
||||
FOR_ALL_DICTIONARY(cld) {
|
||||
cld->dictionary()->verify();
|
||||
diff --git a/src/hotspot/share/classfile/classLoaderDataGraph.hpp b/src/hotspot/share/classfile/classLoaderDataGraph.hpp
|
||||
index c3bcc7271e6..ebdb0bc2c8c 100644
|
||||
--- a/src/hotspot/share/classfile/classLoaderDataGraph.hpp
|
||||
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.hpp
|
||||
@@ -108,6 +108,9 @@ class ClassLoaderDataGraph : public AllStatic {
|
||||
// (DCEVM) Enhanced class redefinition
|
||||
static void rollback_redefinition();
|
||||
|
||||
+ // Enhanced class redefinition
|
||||
+ static bool dictionary_classes_do_update_klass(Symbol* name, InstanceKlass* k, InstanceKlass* old_klass);
|
||||
+
|
||||
// VM_CounterDecay iteration support
|
||||
static InstanceKlass* try_get_next_class();
|
||||
static void adjust_saved_class(ClassLoaderData* cld);
|
||||
diff --git a/src/hotspot/share/classfile/dictionary.cpp b/src/hotspot/share/classfile/dictionary.cpp
|
||||
index 2b236a7724e..bb1d09fa7a2 100644
|
||||
--- a/src/hotspot/share/classfile/dictionary.cpp
|
||||
+++ b/src/hotspot/share/classfile/dictionary.cpp
|
||||
@@ -322,7 +322,7 @@ DictionaryEntry* Dictionary::get_entry(int index, unsigned int hash,
|
||||
}
|
||||
|
||||
// (DCEVM) replace old_class by new class in dictionary
|
||||
-bool Dictionary::update_klass(unsigned int hash, Symbol* name, ClassLoaderData* loader_data, InstanceKlass* k, InstanceKlass* old_klass) {
|
||||
+bool Dictionary::update_klass(Symbol* name, InstanceKlass* k, InstanceKlass* old_klass) {
|
||||
// There are several entries for the same class in the dictionary: One extra entry for each parent classloader of the classloader of the class.
|
||||
bool found = false;
|
||||
for (int index = 0; index < table_size(); index++) {
|
||||
diff --git a/src/hotspot/share/classfile/dictionary.hpp b/src/hotspot/share/classfile/dictionary.hpp
|
||||
index e997cfdcabd..7f8d8e35fc3 100644
|
||||
--- a/src/hotspot/share/classfile/dictionary.hpp
|
||||
+++ b/src/hotspot/share/classfile/dictionary.hpp
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
void verify();
|
||||
|
||||
// (DCEVM) Enhanced class redefinition
|
||||
- bool update_klass(unsigned int hash, Symbol* name, ClassLoaderData* loader_data, InstanceKlass* k, InstanceKlass* old_klass);
|
||||
+ bool update_klass(Symbol* name, InstanceKlass* k, InstanceKlass* old_klass);
|
||||
|
||||
void rollback_redefinition();
|
||||
|
||||
diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
index 63de2e2f099..35e2f376870 100644
|
||||
--- a/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
+++ b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
@@ -1441,7 +1441,9 @@ void SystemDictionary::define_instance_class(InstanceKlass* k, InstanceKlass* ol
|
||||
|
||||
unsigned int name_hash = dictionary->compute_hash(name_h);
|
||||
if (is_redefining) {
|
||||
- bool ok = dictionary->update_klass(name_hash, name_h, loader_data, k, old_klass);
|
||||
+ // Update all dictionaries containing old_class to new_class
|
||||
+ // outcome must be same as result of standard redefinition, that does not create a new Klass
|
||||
+ bool ok = ClassLoaderDataGraph::dictionary_classes_do_update_klass(name_h, k, old_klass);
|
||||
assert (ok, "must have found old class and updated!");
|
||||
}
|
||||
check_constraints(name_hash, k, class_loader, !is_redefining, CHECK);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From b92e8983225e426ba8bb047329b7e0761afb4b89 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sat, 20 Feb 2021 15:47:47 +0100
|
||||
Subject: [PATCH 26/35] Add ClassLoaderDataGraph_lock to define new class in
|
||||
enhanced redefiniton
|
||||
|
||||
ClassLoaderDataGraph locking for introduced in redefinition in
|
||||
java.version>11
|
||||
---
|
||||
src/hotspot/share/classfile/systemDictionary.cpp | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
index 35e2f376870..c628cb9da83 100644
|
||||
--- a/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
+++ b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
@@ -1443,7 +1443,9 @@ void SystemDictionary::define_instance_class(InstanceKlass* k, InstanceKlass* ol
|
||||
if (is_redefining) {
|
||||
// Update all dictionaries containing old_class to new_class
|
||||
// outcome must be same as result of standard redefinition, that does not create a new Klass
|
||||
+ ClassLoaderDataGraph_lock->lock();
|
||||
bool ok = ClassLoaderDataGraph::dictionary_classes_do_update_klass(name_h, k, old_klass);
|
||||
+ ClassLoaderDataGraph_lock->unlock();
|
||||
assert (ok, "must have found old class and updated!");
|
||||
}
|
||||
check_constraints(name_hash, k, class_loader, !is_redefining, CHECK);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
From 336e72bf03ad52206536fe29070ab427784d1453 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Thu, 18 Jun 2020 18:40:11 +0200
|
||||
Subject: [PATCH 27/35] JBR-3140 - support for modularized HotswapAgent
|
||||
|
||||
Add -XX:HotswapAgent=[disabled,fatjar.core]
|
||||
---
|
||||
src/hotspot/share/runtime/arguments.cpp | 77 +++++++++++++++++++
|
||||
src/hotspot/share/runtime/arguments.hpp | 4 +
|
||||
.../flags/jvmFlagConstraintsRuntime.cpp | 9 +++
|
||||
.../flags/jvmFlagConstraintsRuntime.hpp | 3 +-
|
||||
src/hotspot/share/runtime/globals.hpp | 11 ++-
|
||||
5 files changed, 102 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
|
||||
index cbcd8f91c66..4f9cfde9323 100644
|
||||
--- a/src/hotspot/share/runtime/arguments.cpp
|
||||
+++ b/src/hotspot/share/runtime/arguments.cpp
|
||||
@@ -4001,6 +4001,8 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
|
||||
}
|
||||
}
|
||||
|
||||
+ setup_hotswap_agent();
|
||||
+
|
||||
#if !INCLUDE_CDS
|
||||
if (DumpSharedSpaces || RequireSharedSpaces) {
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
@@ -4357,3 +4359,78 @@ bool Arguments::copy_expand_pid(const char* src, size_t srclen,
|
||||
*b = '\0';
|
||||
return (p == src_end); // return false if not all of the source was copied
|
||||
}
|
||||
+
|
||||
+void Arguments::setup_hotswap_agent() {
|
||||
+
|
||||
+ if (DumpSharedSpaces)
|
||||
+ return;
|
||||
+
|
||||
+ if (HotswapAgent == NULL || strcmp(HotswapAgent, "disabled") == 0)
|
||||
+ return;
|
||||
+
|
||||
+ // Force AllowEnhancedClassRedefinition if HA is enabled
|
||||
+ AllowEnhancedClassRedefinition = true;
|
||||
+
|
||||
+ bool ha_fatjar = strcmp(HotswapAgent, "fatjar") == 0;
|
||||
+ bool ha_core = strcmp(HotswapAgent, "core") == 0;
|
||||
+
|
||||
+ // Set HotswapAgent
|
||||
+ if (ha_fatjar || ha_core) {
|
||||
+
|
||||
+ char ext_path_str[JVM_MAXPATHLEN];
|
||||
+
|
||||
+ os::jvm_path(ext_path_str, sizeof(ext_path_str));
|
||||
+ for (int i = 0; i < 3; i++) {
|
||||
+ char *end = strrchr(ext_path_str, *os::file_separator());
|
||||
+ if (end != NULL) *end = '\0';
|
||||
+ }
|
||||
+ size_t ext_path_length = strlen(ext_path_str);
|
||||
+ if (ext_path_length >= 3) {
|
||||
+ if (strcmp(ext_path_str + ext_path_length - 3, "lib") != 0) {
|
||||
+ if (ext_path_length < JVM_MAXPATHLEN - 4) {
|
||||
+ jio_snprintf(ext_path_str + ext_path_length, sizeof(ext_path_str) - ext_path_length, "%slib", os::file_separator());
|
||||
+ ext_path_length += 4;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (ext_path_length < JVM_MAXPATHLEN - 10) {
|
||||
+ if (ha_fatjar) {
|
||||
+ jio_snprintf(ext_path_str + ext_path_length, sizeof(ext_path_str) - ext_path_length,
|
||||
+ "%shotswap%shotswap-agent.jar", os::file_separator(), os::file_separator());
|
||||
+ } else {
|
||||
+ jio_snprintf(ext_path_str + ext_path_length, sizeof(ext_path_str) - ext_path_length,
|
||||
+ "%shotswap%shotswap-agent-core.jar", os::file_separator(), os::file_separator());
|
||||
+ }
|
||||
+ int fd = ::open(ext_path_str, O_RDONLY);
|
||||
+ if (fd >= 0) {
|
||||
+ os::close(fd);
|
||||
+ size_t length = strlen(ext_path_str) + 1;
|
||||
+ char *options = NEW_C_HEAP_ARRAY(char, length, mtArguments);
|
||||
+ jio_snprintf(options, length, "%s", ext_path_str);
|
||||
+ add_init_agent("instrument", ext_path_str, false);
|
||||
+ jio_fprintf(defaultStream::output_stream(), "Starting HotswapAgent '%s'\n", ext_path_str);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ jio_fprintf(defaultStream::error_stream(), "HotswapAgent not found on path:'%s'!\n", ext_path_str);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // TODO: open it only for org.hotswap.agent module
|
||||
+ // Use to access java.lang.reflect.Proxy/proxyCache
|
||||
+ create_numbered_module_property("jdk.module.addopens", "java.base/java.lang=ALL-UNNAMED", addopens_count++);
|
||||
+ // Class of field java.lang.reflect.Proxy/proxyCache
|
||||
+ create_numbered_module_property("jdk.module.addopens", "java.base/jdk.internal.loader=ALL-UNNAMED", addopens_count++);
|
||||
+ // Use to access java.io.Reader, java.io.InputStream, java.io.FileInputStream
|
||||
+ create_numbered_module_property("jdk.module.addopens", "java.base/java.io=ALL-UNNAMED", addopens_count++);
|
||||
+ // java.beans.Introspector access
|
||||
+ create_numbered_module_property("jdk.module.addopens", "java.desktop/java.beans=ALL-UNNAMED", addopens_count++);
|
||||
+ // java.beans.Introspector access
|
||||
+ create_numbered_module_property("jdk.module.addopens", "java.desktop/com.sun.beans=ALL-UNNAMED", addopens_count++);
|
||||
+ // com.sun.beans.introspect.ClassInfo access
|
||||
+ create_numbered_module_property("jdk.module.addopens", "java.desktop/com.sun.beans.introspect=ALL-UNNAMED", addopens_count++);
|
||||
+ // com.sun.beans.introspect.util.Cache access
|
||||
+ create_numbered_module_property("jdk.module.addopens", "java.desktop/com.sun.beans.util=ALL-UNNAMED", addopens_count++);
|
||||
+
|
||||
+}
|
||||
diff --git a/src/hotspot/share/runtime/arguments.hpp b/src/hotspot/share/runtime/arguments.hpp
|
||||
index 6a8ceb7fa8a..7669a283375 100644
|
||||
--- a/src/hotspot/share/runtime/arguments.hpp
|
||||
+++ b/src/hotspot/share/runtime/arguments.hpp
|
||||
@@ -491,6 +491,10 @@ class Arguments : AllStatic {
|
||||
|
||||
static size_t conservative_max_heap_alignment() { return _conservative_max_heap_alignment; }
|
||||
|
||||
+
|
||||
+ // Initialize HotswapAgent
|
||||
+ static void setup_hotswap_agent();
|
||||
+
|
||||
// Return the maximum size a heap with compressed oops can take
|
||||
static size_t max_heap_for_compressed_oops();
|
||||
|
||||
diff --git a/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.cpp b/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.cpp
|
||||
index 5b09758e089..e55b68e63a6 100644
|
||||
--- a/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.cpp
|
||||
+++ b/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.cpp
|
||||
@@ -158,6 +158,15 @@ JVMFlag::Error NUMAInterleaveGranularityConstraintFunc(size_t value, bool verbos
|
||||
" ... " UINTX_FORMAT " ]\n", value, min, max);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
+ return JVMFlag::SUCCESS;
|
||||
+}
|
||||
|
||||
+JVMFlag::Error HotswapAgentConstraintFunc(ccstr value, bool verbose) {
|
||||
+ if (value != NULL) {
|
||||
+ if (strcmp("disabled", value) != 0 && strcmp("fatjar", value) != 0 && strcmp("core", value) != 0 && strcmp("external", value) != 0) {
|
||||
+ JVMFlag::printError(verbose, "HotswapAgent(%s) must be one of disabled,fatjar,core or external.\n", value);
|
||||
+ return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
+ }
|
||||
+ }
|
||||
return JVMFlag::SUCCESS;
|
||||
}
|
||||
diff --git a/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.hpp b/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.hpp
|
||||
index 8bc3a9a1548..c5f58fd16ee 100644
|
||||
--- a/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.hpp
|
||||
+++ b/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.hpp
|
||||
@@ -42,7 +42,8 @@
|
||||
f(intx, BiasedLockingDecayTimeFunc) \
|
||||
f(intx, PerfDataSamplingIntervalFunc) \
|
||||
f(uintx, VMPageSizeConstraintFunc) \
|
||||
- f(size_t, NUMAInterleaveGranularityConstraintFunc)
|
||||
+ f(size_t, NUMAInterleaveGranularityConstraintFunc) \
|
||||
+ f(ccstr, HotswapAgentConstraintFunc)
|
||||
|
||||
RUNTIME_CONSTRAINTS(DECLARE_CONSTRAINT)
|
||||
|
||||
diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
|
||||
index 7051b634a9b..d23e43407e1 100644
|
||||
--- a/src/hotspot/share/runtime/globals.hpp
|
||||
+++ b/src/hotspot/share/runtime/globals.hpp
|
||||
@@ -2090,7 +2090,16 @@ const intx ObjectAlignmentInBytes = 8;
|
||||
\
|
||||
product(bool, AllowEnhancedClassRedefinition, false, \
|
||||
"Allow enhanced class redefinition beyond swapping method " \
|
||||
- "bodies")
|
||||
+ "bodies") \
|
||||
+ \
|
||||
+ product(ccstr, HotswapAgent, "disabled", \
|
||||
+ "Specify HotswapAgent image to be used." \
|
||||
+ "disabled: hotswap agent is disabled (default)" \
|
||||
+ "fatjar: full HA. Use integrated hotswap-agent.jar" \
|
||||
+ "core: core HA. Use integrated hotswap-agent-core.jar" \
|
||||
+ "external: external HA. use external HA, open required JDK " \
|
||||
+ "modules.") \
|
||||
+ constraint(HotswapAgentConstraintFunc, AfterErgo)
|
||||
|
||||
|
||||
// end of RUNTIME_FLAGS
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,347 @@
|
||||
From 5b4ef31b94d652e2b73be3b11c563f7be72ed4a0 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 7 Mar 2021 20:22:54 +0100
|
||||
Subject: [PATCH 28/35] Support for redefinition of Well Known classses
|
||||
(java.*,jdk.*, sun.*)
|
||||
|
||||
---
|
||||
src/hotspot/share/ci/ciKlass.hpp | 1 +
|
||||
src/hotspot/share/ci/ciObjectFactory.cpp | 34 ++++++++++
|
||||
src/hotspot/share/ci/ciObjectFactory.hpp | 6 ++
|
||||
src/hotspot/share/classfile/vmClasses.cpp | 10 +++
|
||||
src/hotspot/share/classfile/vmClasses.hpp | 4 ++
|
||||
src/hotspot/share/classfile/vmSymbols.hpp | 2 +
|
||||
src/hotspot/share/compiler/compileBroker.cpp | 11 ++++
|
||||
src/hotspot/share/memory/universe.cpp | 8 +++
|
||||
src/hotspot/share/memory/universe.hpp | 2 +
|
||||
.../prims/jvmtiEnhancedRedefineClasses.cpp | 63 ++++++++++++++++++-
|
||||
.../prims/jvmtiEnhancedRedefineClasses.hpp | 2 +
|
||||
11 files changed, 142 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hotspot/share/ci/ciKlass.hpp b/src/hotspot/share/ci/ciKlass.hpp
|
||||
index 467284b7cde..644993a7513 100644
|
||||
--- a/src/hotspot/share/ci/ciKlass.hpp
|
||||
+++ b/src/hotspot/share/ci/ciKlass.hpp
|
||||
@@ -129,6 +129,7 @@ public:
|
||||
void print_name_on(outputStream* st);
|
||||
|
||||
const char* external_name() const;
|
||||
+ Klass* new_version() { return get_Klass()->new_version(); }
|
||||
};
|
||||
|
||||
#endif // SHARE_CI_CIKLASS_HPP
|
||||
diff --git a/src/hotspot/share/ci/ciObjectFactory.cpp b/src/hotspot/share/ci/ciObjectFactory.cpp
|
||||
index 664062a0f74..e9cb49be3ff 100644
|
||||
--- a/src/hotspot/share/ci/ciObjectFactory.cpp
|
||||
+++ b/src/hotspot/share/ci/ciObjectFactory.cpp
|
||||
@@ -74,7 +74,10 @@ GrowableArray<ciMetadata*>* ciObjectFactory::_shared_ci_metadata = NULL;
|
||||
ciSymbol* ciObjectFactory::_shared_ci_symbols[vmSymbols::number_of_symbols()];
|
||||
int ciObjectFactory::_shared_ident_limit = 0;
|
||||
volatile bool ciObjectFactory::_initialized = false;
|
||||
+volatile bool ciObjectFactory::_reinitialize_vm_klasses = false;
|
||||
|
||||
+// TODO: review...
|
||||
+Arena* ciObjectFactory::_initial_arena = NULL;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciObjectFactory::ciObjectFactory
|
||||
@@ -110,6 +113,7 @@ void ciObjectFactory::initialize() {
|
||||
// compiler thread that initializes the initial ciObjectFactory which
|
||||
// creates the shared ciObjects that all later ciObjectFactories use.
|
||||
Arena* arena = new (mtCompiler) Arena(mtCompiler);
|
||||
+ ciObjectFactory::_initial_arena = arena;
|
||||
ciEnv initial(arena);
|
||||
ciEnv* env = ciEnv::current();
|
||||
env->_factory->init_shared_objects();
|
||||
@@ -118,6 +122,36 @@ void ciObjectFactory::initialize() {
|
||||
|
||||
}
|
||||
|
||||
+// (DCEVM) vm classes could be modified
|
||||
+void ciObjectFactory::reinitialize_vm_classes() {
|
||||
+ ASSERT_IN_VM;
|
||||
+ JavaThread* thread = JavaThread::current();
|
||||
+ HandleMark handle_mark(thread);
|
||||
+
|
||||
+ // This Arena is long lived and exists in the resource mark of the
|
||||
+ // compiler thread that initializes the initial ciObjectFactory which
|
||||
+ // creates the shared ciObjects that all later ciObjectFactories use.
|
||||
+ // Arena* arena = new (mtCompiler) Arena(mtCompiler);
|
||||
+ ciEnv initial(ciObjectFactory::_initial_arena);
|
||||
+ ciEnv* env = ciEnv::current();
|
||||
+ env->_factory->do_reinitialize_vm_classes();
|
||||
+ _reinitialize_vm_klasses = false;
|
||||
+}
|
||||
+
|
||||
+// (DCEVM) vm classes could be modified
|
||||
+void ciObjectFactory::do_reinitialize_vm_classes() {
|
||||
+#define VM_CLASS_DEFN(name, ignore_s) \
|
||||
+ if (ciEnv::_##name != NULL && ciEnv::_##name->new_version() != NULL) { \
|
||||
+ int old_ident = ciEnv::_##name->ident(); \
|
||||
+ ciEnv::_##name = get_metadata(vmClasses::name())->as_instance_klass(); \
|
||||
+ ciEnv::_##name->compute_nonstatic_fields(); \
|
||||
+ ciEnv::_##name->set_ident(old_ident); \
|
||||
+ }
|
||||
+
|
||||
+ VM_CLASSES_DO(VM_CLASS_DEFN)
|
||||
+#undef VM_CLASS_DEFN
|
||||
+}
|
||||
+
|
||||
void ciObjectFactory::init_shared_objects() {
|
||||
|
||||
_next_ident = 1; // start numbering CI objects at 1
|
||||
diff --git a/src/hotspot/share/ci/ciObjectFactory.hpp b/src/hotspot/share/ci/ciObjectFactory.hpp
|
||||
index fdefc8e3b92..1ed8732cb40 100644
|
||||
--- a/src/hotspot/share/ci/ciObjectFactory.hpp
|
||||
+++ b/src/hotspot/share/ci/ciObjectFactory.hpp
|
||||
@@ -42,9 +42,11 @@ class ciObjectFactory : public ResourceObj {
|
||||
|
||||
private:
|
||||
static volatile bool _initialized;
|
||||
+ static volatile bool _reinitialize_vm_klasses;
|
||||
static GrowableArray<ciMetadata*>* _shared_ci_metadata;
|
||||
static ciSymbol* _shared_ci_symbols[];
|
||||
static int _shared_ident_limit;
|
||||
+ static Arena* _initial_arena;
|
||||
|
||||
Arena* _arena;
|
||||
GrowableArray<ciMetadata*> _ci_metadata;
|
||||
@@ -90,10 +92,14 @@ private:
|
||||
ciInstance* get_unloaded_instance(ciInstanceKlass* klass);
|
||||
|
||||
static int compare_cimetadata(ciMetadata** a, ciMetadata** b);
|
||||
+ void do_reinitialize_vm_classes();
|
||||
public:
|
||||
static bool is_initialized() { return _initialized; }
|
||||
+ static bool is_reinitialize_vm_klasses() { return _reinitialize_vm_klasses; }
|
||||
+ static void set_reinitialize_vm_klasses() { _reinitialize_vm_klasses = true; }
|
||||
|
||||
static void initialize();
|
||||
+ static void reinitialize_vm_classes();
|
||||
void init_shared_objects();
|
||||
void remove_symbols();
|
||||
|
||||
diff --git a/src/hotspot/share/classfile/vmClasses.cpp b/src/hotspot/share/classfile/vmClasses.cpp
|
||||
index 2bd1ca65cc0..3ec13d952d8 100644
|
||||
--- a/src/hotspot/share/classfile/vmClasses.cpp
|
||||
+++ b/src/hotspot/share/classfile/vmClasses.cpp
|
||||
@@ -259,3 +259,13 @@ BasicType vmClasses::box_klass_type(Klass* k) {
|
||||
}
|
||||
return T_OBJECT;
|
||||
}
|
||||
+
|
||||
+bool vmClasses::update_vm_klass(InstanceKlass* old_klass, InstanceKlass* new_klass) {
|
||||
+ for (int id = static_cast<int>(vmClassID::FIRST); id < static_cast<int>(vmClassID::LIMIT); id++) {
|
||||
+ if (_klasses[id] == old_klass) {
|
||||
+ _klasses[id] = new_klass;
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
diff --git a/src/hotspot/share/classfile/vmClasses.hpp b/src/hotspot/share/classfile/vmClasses.hpp
|
||||
index 364014a2514..b637ff0ae3d 100644
|
||||
--- a/src/hotspot/share/classfile/vmClasses.hpp
|
||||
+++ b/src/hotspot/share/classfile/vmClasses.hpp
|
||||
@@ -110,6 +110,10 @@ public:
|
||||
static bool Cloneable_klass_loaded() { return is_loaded(VM_CLASS_AT(Cloneable_klass)); }
|
||||
static bool Parameter_klass_loaded() { return is_loaded(VM_CLASS_AT(reflect_Parameter_klass)); }
|
||||
static bool ClassLoader_klass_loaded() { return is_loaded(VM_CLASS_AT(ClassLoader_klass)); }
|
||||
+
|
||||
+ // (DCEVM) vmClasses could be modified
|
||||
+ static bool update_vm_klass(InstanceKlass* new_klass, InstanceKlass* old_klass);
|
||||
+
|
||||
};
|
||||
|
||||
#endif // SHARE_CLASSFILE_VMCLASSES_HPP
|
||||
diff --git a/src/hotspot/share/classfile/vmSymbols.hpp b/src/hotspot/share/classfile/vmSymbols.hpp
|
||||
index dad94005f5c..82fd593224a 100644
|
||||
--- a/src/hotspot/share/classfile/vmSymbols.hpp
|
||||
+++ b/src/hotspot/share/classfile/vmSymbols.hpp
|
||||
@@ -380,6 +380,8 @@
|
||||
template(exit_method_name, "exit") \
|
||||
template(add_method_name, "add") \
|
||||
template(remove_method_name, "remove") \
|
||||
+ template(registerNatives_method_name, "registerNatives") \
|
||||
+ template(initIDs_method_name, "initIDs") \
|
||||
template(parent_name, "parent") \
|
||||
template(threads_name, "threads") \
|
||||
template(groups_name, "groups") \
|
||||
diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp
|
||||
index cc1dff089e8..aaf8e4b1f1e 100644
|
||||
--- a/src/hotspot/share/compiler/compileBroker.cpp
|
||||
+++ b/src/hotspot/share/compiler/compileBroker.cpp
|
||||
@@ -1982,6 +1982,17 @@ void CompileBroker::compiler_thread_loop() {
|
||||
if (method()->number_of_breakpoints() == 0) {
|
||||
// Compile the method.
|
||||
if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) {
|
||||
+
|
||||
+ // TODO: review usage of CompileThread_lock (DCEVM)
|
||||
+ if (ciObjectFactory::is_reinitialize_vm_klasses())
|
||||
+ {
|
||||
+ ASSERT_IN_VM;
|
||||
+ MutexLocker only_one(CompileThread_lock);
|
||||
+ if (ciObjectFactory::is_reinitialize_vm_klasses()) {
|
||||
+ ciObjectFactory::reinitialize_vm_classes();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
invoke_compiler_on_method(task);
|
||||
thread->start_idle_timer();
|
||||
} else {
|
||||
diff --git a/src/hotspot/share/memory/universe.cpp b/src/hotspot/share/memory/universe.cpp
|
||||
index 4ae3b382b67..92da9bbe5f9 100644
|
||||
--- a/src/hotspot/share/memory/universe.cpp
|
||||
+++ b/src/hotspot/share/memory/universe.cpp
|
||||
@@ -924,6 +924,14 @@ void Universe::initialize_known_methods(TRAPS) {
|
||||
vmSymbols::doStackWalk_signature(), false, CHECK);
|
||||
}
|
||||
|
||||
+void Universe::reinitialize_loader_addClass_method(TRAPS) {
|
||||
+ // Set up method for registering loaded classes in class loader vector
|
||||
+ initialize_known_method(_loader_addClass_cache,
|
||||
+ vmClasses::ClassLoader_klass(),
|
||||
+ "addClass",
|
||||
+ vmSymbols::class_void_signature(), false, CHECK);
|
||||
+}
|
||||
+
|
||||
void universe2_init() {
|
||||
EXCEPTION_MARK;
|
||||
Universe::genesis(CATCH);
|
||||
diff --git a/src/hotspot/share/memory/universe.hpp b/src/hotspot/share/memory/universe.hpp
|
||||
index 4b2211c415e..4d4c444220e 100644
|
||||
--- a/src/hotspot/share/memory/universe.hpp
|
||||
+++ b/src/hotspot/share/memory/universe.hpp
|
||||
@@ -268,6 +268,8 @@ class Universe: AllStatic {
|
||||
// Function to initialize these
|
||||
static void initialize_known_methods(TRAPS);
|
||||
|
||||
+ static void reinitialize_loader_addClass_method(TRAPS);
|
||||
+
|
||||
static void create_preallocated_out_of_memory_errors(TRAPS);
|
||||
|
||||
// Reference pending list manipulation. Access is protected by
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index a5264077bfe..e00f0e19e20 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "prims/resolvedMethodTable.hpp"
|
||||
#include "prims/methodHandles.hpp"
|
||||
#include "runtime/deoptimization.hpp"
|
||||
+#include "runtime/javaCalls.hpp"
|
||||
#include "runtime/jniHandles.inline.hpp"
|
||||
#include "runtime/relocator.hpp"
|
||||
#include "runtime/fieldDescriptor.hpp"
|
||||
@@ -66,6 +67,7 @@
|
||||
#include "gc/g1/g1CollectedHeap.hpp"
|
||||
#include "gc/shared/dcevmSharedGC.hpp"
|
||||
#include "gc/shared/scavengableNMethods.hpp"
|
||||
+#include "gc/shared/oopStorageSet.inline.hpp"
|
||||
#include "ci/ciObjectFactory.hpp"
|
||||
|
||||
Array<Method*>* VM_EnhancedRedefineClasses::_old_methods = NULL;
|
||||
@@ -521,6 +523,16 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
redefine_single_class(_new_classes->at(i), thread);
|
||||
}
|
||||
|
||||
+ // Update possible redefinition of vm classes (like ClassLoader)
|
||||
+ for (int i = 0; i < _new_classes->length(); i++) {
|
||||
+ InstanceKlass* cur = _new_classes->at(i);
|
||||
+ if (cur->old_version() != NULL && vmClasses::update_vm_klass(InstanceKlass::cast(cur->old_version()), cur))
|
||||
+ {
|
||||
+ log_trace(redefine, class, obsolete, metadata)("Well known class updated %s", cur->external_name());
|
||||
+ ciObjectFactory::set_reinitialize_vm_klasses();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
// Deoptimize all compiled code that depends on this class (do only once, because it clears whole cache)
|
||||
// if (_max_redefinition_flags > Klass::ModifyClass) {
|
||||
flush_dependent_code(thread);
|
||||
@@ -688,12 +700,56 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
_timer_vm_op_doit.stop();
|
||||
}
|
||||
|
||||
+void VM_EnhancedRedefineClasses::reinitializeJDKClasses() {
|
||||
+ if (!_new_classes->is_empty()) {
|
||||
+ ResourceMark rm(Thread::current());
|
||||
+
|
||||
+ for (int i = 0; i < _new_classes->length(); i++) {
|
||||
+ InstanceKlass* cur = _new_classes->at(i);
|
||||
+
|
||||
+ if (cur->name()->starts_with("java/") || cur->name()->starts_with("jdk/") || cur->name()->starts_with("sun/")) {
|
||||
+
|
||||
+ if (cur == vmClasses::ClassLoader_klass()) {
|
||||
+ // ClassLoader.addClass method is cached in Universe, we must redefine
|
||||
+ Universe::reinitialize_loader_addClass_method(Thread::current());
|
||||
+ log_trace(redefine, class, obsolete, metadata)("Reinitialize ClassLoade addClass method cache.");
|
||||
+ }
|
||||
+
|
||||
+ // naive assumptions that only JDK classes has native static "registerNative" and "initIDs" methods
|
||||
+ int end;
|
||||
+ Symbol* signature = vmSymbols::registerNatives_method_name();
|
||||
+ int midx = cur->find_method_by_name(signature, &end);
|
||||
+ if (midx == -1) {
|
||||
+ signature = vmSymbols::initIDs_method_name();
|
||||
+ midx = cur->find_method_by_name(signature, &end);
|
||||
+ }
|
||||
+ Method* m = NULL;
|
||||
+ if (midx != -1) {
|
||||
+ m = cur->methods()->at(midx);
|
||||
+ }
|
||||
+ if (m != NULL && m->is_static() && m->is_native()) {
|
||||
+ // call static registerNative if present
|
||||
+ JavaValue result(T_VOID);
|
||||
+ JavaCalls::call_static(&result,
|
||||
+ cur,
|
||||
+ signature,
|
||||
+ vmSymbols::void_method_signature(),
|
||||
+ Thread::current());
|
||||
+ log_trace(redefine, class, obsolete, metadata)("Reregister natives of JDK class %s", cur->external_name());
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
// Cleanup - runs in JVM thread
|
||||
// - free used memory
|
||||
// - end GC
|
||||
void VM_EnhancedRedefineClasses::doit_epilogue() {
|
||||
VM_GC_Operation::doit_epilogue();
|
||||
|
||||
+ reinitializeJDKClasses();
|
||||
+
|
||||
if (_new_classes != NULL) {
|
||||
delete _new_classes;
|
||||
}
|
||||
@@ -1623,7 +1679,12 @@ void VM_EnhancedRedefineClasses::check_methods_and_mark_as_obsolete() {
|
||||
|
||||
// obsolete methods need a unique idnum so they become new entries in
|
||||
// the jmethodID cache in InstanceKlass
|
||||
- assert(old_method->method_idnum() == new_method->method_idnum(), "must match");
|
||||
+ if (old_method->method_idnum() != new_method->method_idnum()) {
|
||||
+ log_error(redefine, class, normalize)
|
||||
+ ("Method not matched: %d != %d old: %s = new: %s", old_method->method_idnum(), new_method->method_idnum(),
|
||||
+ old_method->name_and_sig_as_C_string(), new_method->name_and_sig_as_C_string());
|
||||
+ // assert(old_method->method_idnum() == new_method->method_idnum(), "must match");
|
||||
+ }
|
||||
// u2 num = InstanceKlass::cast(_the_class_oop)->next_method_idnum();
|
||||
// if (num != ConstMethod::UNSET_IDNUM) {
|
||||
// old_method->set_method_idnum(num);
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
index 9be70039e32..673688dff84 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -150,6 +150,8 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
|
||||
u8 next_id();
|
||||
|
||||
+ void reinitializeJDKClasses();
|
||||
+
|
||||
static void check_class(InstanceKlass* k_oop, TRAPS);
|
||||
|
||||
static void dump_methods();
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
From 1c6b15e19a1938b4214dd82175208499654a1ec8 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sat, 15 May 2021 10:31:28 +0200
|
||||
Subject: [PATCH 29/35] Fix fastdebug compilation issues - cast_to_oop
|
||||
|
||||
---
|
||||
.../share/gc/g1/g1FullGCCompactTask.cpp | 12 +++++-----
|
||||
.../share/gc/g1/g1FullGCCompactionPoint.cpp | 10 ++++-----
|
||||
.../share/gc/g1/g1FullGCPrepareTask.cpp | 4 ++--
|
||||
src/hotspot/share/gc/shared/dcevmSharedGC.cpp | 6 ++---
|
||||
src/hotspot/share/gc/shared/space.cpp | 22 +++++++++----------
|
||||
src/hotspot/share/gc/shared/space.inline.hpp | 14 ++++++------
|
||||
.../prims/jvmtiEnhancedRedefineClasses.cpp | 2 +-
|
||||
7 files changed, 35 insertions(+), 35 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp b/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp
|
||||
index 058dea90828..765630a9826 100644
|
||||
--- a/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp
|
||||
+++ b/src/hotspot/share/gc/g1/g1FullGCCompactTask.cpp
|
||||
@@ -183,18 +183,18 @@ size_t G1FullGCCompactTask::G1CompactRegionClosureDcevm::apply(oop obj) {
|
||||
Klass* new_version = obj->klass()->new_version();
|
||||
if (new_version->update_information() == NULL) {
|
||||
Copy::aligned_conjoint_words(obj_addr, destination, size);
|
||||
- oop(destination)->set_klass(new_version);
|
||||
+ cast_to_oop(destination)->set_klass(new_version);
|
||||
} else {
|
||||
- DcevmSharedGC::update_fields(obj, oop(destination));
|
||||
+ DcevmSharedGC::update_fields(obj, cast_to_oop(destination));
|
||||
}
|
||||
- oop(destination)->init_mark();
|
||||
- assert(oop(destination)->klass() != NULL, "should have a class");
|
||||
+ cast_to_oop(destination)->init_mark();
|
||||
+ assert(cast_to_oop(destination)->klass() != NULL, "should have a class");
|
||||
return size;
|
||||
}
|
||||
|
||||
Copy::aligned_conjoint_words(obj_addr, destination, size);
|
||||
- oop(destination)->init_mark();
|
||||
- assert(oop(destination)->klass() != NULL, "should have a class");
|
||||
+ cast_to_oop(destination)->init_mark();
|
||||
+ assert(cast_to_oop(destination)->klass() != NULL, "should have a class");
|
||||
|
||||
return size;
|
||||
}
|
||||
diff --git a/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp b/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp
|
||||
index 87b1977128a..028c182e68f 100644
|
||||
--- a/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp
|
||||
+++ b/src/hotspot/share/gc/g1/g1FullGCCompactionPoint.cpp
|
||||
@@ -171,7 +171,7 @@ void G1FullGCCompactionPoint::forward_dcevm(oop object, size_t size, bool force_
|
||||
|
||||
// Store a forwarding pointer if the object should be moved.
|
||||
if (cast_from_oop<HeapWord*>(object) != _compaction_top || force_forward) {
|
||||
- object->forward_to(oop(_compaction_top));
|
||||
+ object->forward_to(cast_to_oop(_compaction_top));
|
||||
} else {
|
||||
if (object->forwardee() != NULL) {
|
||||
// Object should not move but mark-word is used so it looks like the
|
||||
@@ -208,17 +208,17 @@ void G1FullGCCompactionPoint::forward_rescued() {
|
||||
for (;i<rescued_oops()->length(); i++) {
|
||||
HeapWord* q = rescued_oops()->at(i);
|
||||
|
||||
- size_t size = oop(q)->size();
|
||||
+ size_t size = cast_to_oop(q)->size();
|
||||
|
||||
// (DCEVM) There is a new version of the class of q => different size
|
||||
- if (oop(q)->klass()->new_version() != NULL) {
|
||||
+ if (cast_to_oop(q)->klass()->new_version() != NULL) {
|
||||
// assert(size != new_size, "instances without changed size have to be updated prior to GC run");
|
||||
- size = oop(q)->size_given_klass(oop(q)->klass()->new_version());
|
||||
+ size = cast_to_oop(q)->size_given_klass(cast_to_oop(q)->klass()->new_version());
|
||||
}
|
||||
if (forward_compact_top(size) == NULL) {
|
||||
break;
|
||||
}
|
||||
- forward_dcevm(oop(q), size, true);
|
||||
+ forward_dcevm(cast_to_oop(q), size, true);
|
||||
}
|
||||
_last_rescued_oop = i;
|
||||
}
|
||||
diff --git a/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp b/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp
|
||||
index 05f0444cc7a..93c066383a1 100644
|
||||
--- a/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp
|
||||
+++ b/src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp
|
||||
@@ -297,7 +297,7 @@ size_t G1FullGCPrepareTask::G1PrepareCompactLiveClosureDcevm::apply(oop object)
|
||||
|
||||
HeapWord* compact_top = _cp->forward_compact_top(forward_size);
|
||||
|
||||
- if (compact_top == NULL || must_rescue(object, oop(compact_top))) {
|
||||
+ if (compact_top == NULL || must_rescue(object, cast_to_oop(compact_top))) {
|
||||
_cp->rescued_oops()->append(cast_from_oop<HeapWord*>(object));
|
||||
} else {
|
||||
_cp->forward_dcevm(object, forward_size, (size != forward_size));
|
||||
@@ -308,7 +308,7 @@ size_t G1FullGCPrepareTask::G1PrepareCompactLiveClosureDcevm::apply(oop object)
|
||||
|
||||
bool G1FullGCPrepareTask::G1PrepareCompactLiveClosureDcevm::must_rescue(oop old_obj, oop new_obj) {
|
||||
// Only redefined objects can have the need to be rescued.
|
||||
- if (oop(old_obj)->klass()->new_version() == NULL) {
|
||||
+ if (old_obj->klass()->new_version() == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
diff --git a/src/hotspot/share/gc/shared/dcevmSharedGC.cpp b/src/hotspot/share/gc/shared/dcevmSharedGC.cpp
|
||||
index edc19a3077d..de3d518b696 100644
|
||||
--- a/src/hotspot/share/gc/shared/dcevmSharedGC.cpp
|
||||
+++ b/src/hotspot/share/gc/shared/dcevmSharedGC.cpp
|
||||
@@ -46,7 +46,7 @@ void DcevmSharedGC::copy_rescued_objects_back(GrowableArray<HeapWord*>* rescued_
|
||||
if (rescued_oops != NULL) {
|
||||
for (int i=from; i < to; i++) {
|
||||
HeapWord* rescued_ptr = rescued_oops->at(i);
|
||||
- oop rescued_obj = (oop) rescued_ptr;
|
||||
+ oop rescued_obj = cast_to_oop(rescued_ptr);
|
||||
|
||||
int size = rescued_obj->size();
|
||||
oop new_obj = rescued_obj->forwardee();
|
||||
@@ -75,7 +75,7 @@ void DcevmSharedGC::clear_rescued_objects_resource(GrowableArray<HeapWord*>* res
|
||||
if (rescued_oops != NULL) {
|
||||
for (int i=0; i < rescued_oops->length(); i++) {
|
||||
HeapWord* rescued_ptr = rescued_oops->at(i);
|
||||
- int size = ((oop) rescued_ptr)->size();
|
||||
+ int size = cast_to_oop(rescued_ptr)->size();
|
||||
FREE_RESOURCE_ARRAY(HeapWord, rescued_ptr, size);
|
||||
}
|
||||
rescued_oops->clear();
|
||||
@@ -114,7 +114,7 @@ void DcevmSharedGC::update_fields(oop q, oop new_location) {
|
||||
if ((cast_from_oop<HeapWord*>(q) >= cast_from_oop<HeapWord*>(new_location) && cast_from_oop<HeapWord*>(q) < cast_from_oop<HeapWord*>(new_location) + new_size) ||
|
||||
(cast_from_oop<HeapWord*>(new_location) >= cast_from_oop<HeapWord*>(q) && cast_from_oop<HeapWord*>(new_location) < cast_from_oop<HeapWord*>(q) + size)) {
|
||||
tmp = NEW_RESOURCE_ARRAY(HeapWord, size);
|
||||
- q = (oop) tmp;
|
||||
+ q = cast_to_oop(tmp);
|
||||
Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(tmp_obj), cast_from_oop<HeapWord*>(q), size);
|
||||
}
|
||||
}
|
||||
diff --git a/src/hotspot/share/gc/shared/space.cpp b/src/hotspot/share/gc/shared/space.cpp
|
||||
index 29a81348d2d..000760744f7 100644
|
||||
--- a/src/hotspot/share/gc/shared/space.cpp
|
||||
+++ b/src/hotspot/share/gc/shared/space.cpp
|
||||
@@ -475,7 +475,7 @@ bool CompactibleSpace::must_rescue(oop old_obj, oop new_obj) {
|
||||
|
||||
int new_size = old_obj->size_given_klass(oop(old_obj)->klass()->new_version());
|
||||
int original_size = old_obj->size();
|
||||
-
|
||||
+
|
||||
Generation* tenured_gen = GenCollectedHeap::heap()->old_gen();
|
||||
bool old_in_tenured = tenured_gen->is_in_reserved(old_obj);
|
||||
bool new_in_tenured = tenured_gen->is_in_reserved(new_obj);
|
||||
@@ -513,9 +513,9 @@ bool CompactibleSpace::must_rescue(oop old_obj, oop new_obj) {
|
||||
}
|
||||
|
||||
HeapWord* CompactibleSpace::rescue(HeapWord* old_obj) {
|
||||
- assert(must_rescue(oop(old_obj), oop(old_obj)->forwardee()), "do not call otherwise");
|
||||
+ assert(must_rescue(cast_to_oop(old_obj), cast_to_oop(old_obj)->forwardee()), "do not call otherwise");
|
||||
|
||||
- int size = oop(old_obj)->size();
|
||||
+ int size = cast_to_oop(old_obj)->size();
|
||||
HeapWord* rescued_obj = NEW_RESOURCE_ARRAY(HeapWord, size);
|
||||
Copy::aligned_disjoint_words(old_obj, rescued_obj, size);
|
||||
|
||||
@@ -803,16 +803,16 @@ HeapWord* CompactibleSpace::forward_with_rescue(HeapWord* q, size_t size,
|
||||
size_t forward_size = size;
|
||||
|
||||
// (DCEVM) There is a new version of the class of q => different size
|
||||
- if (oop(q)->klass()->new_version() != NULL) {
|
||||
+ if (cast_to_oop(q)->klass()->new_version() != NULL) {
|
||||
|
||||
- size_t new_size = oop(q)->size_given_klass(oop(q)->klass()->new_version());
|
||||
+ size_t new_size = cast_to_oop(q)->size_given_klass(cast_to_oop(q)->klass()->new_version());
|
||||
// assert(size != new_size, "instances without changed size have to be updated prior to GC run");
|
||||
forward_size = new_size;
|
||||
}
|
||||
|
||||
compact_top = forward_compact_top(forward_size, cp, compact_top);
|
||||
|
||||
- if (must_rescue(oop(q), oop(compact_top))) {
|
||||
+ if (must_rescue(cast_to_oop(q), cast_to_oop(compact_top))) {
|
||||
if (MarkSweep::_rescued_oops == NULL) {
|
||||
MarkSweep::_rescued_oops = new GrowableArray<HeapWord*>(128);
|
||||
}
|
||||
@@ -820,7 +820,7 @@ HeapWord* CompactibleSpace::forward_with_rescue(HeapWord* q, size_t size,
|
||||
return compact_top;
|
||||
}
|
||||
|
||||
- return forward(oop(q), forward_size, cp, compact_top, force_forward);
|
||||
+ return forward(cast_to_oop(q), forward_size, cp, compact_top, force_forward);
|
||||
}
|
||||
|
||||
// Compute the forwarding addresses for the objects that need to be rescued.
|
||||
@@ -830,17 +830,17 @@ HeapWord* CompactibleSpace::forward_rescued(CompactPoint* cp, HeapWord* compact_
|
||||
for (int i=0; i<MarkSweep::_rescued_oops->length(); i++) {
|
||||
HeapWord* q = MarkSweep::_rescued_oops->at(i);
|
||||
|
||||
- /* size_t size = oop(q)->size(); changing this for cms for perm gen */
|
||||
+ /* size_t size = cast_to_oop(q)->size(); changing this for cms for perm gen */
|
||||
size_t size = block_size(q);
|
||||
|
||||
// (DCEVM) There is a new version of the class of q => different size
|
||||
- if (oop(q)->klass()->new_version() != NULL) {
|
||||
- size_t new_size = oop(q)->size_given_klass(oop(q)->klass()->new_version());
|
||||
+ if (cast_to_oop(q)->klass()->new_version() != NULL) {
|
||||
+ size_t new_size = cast_to_oop(q)->size_given_klass(cast_to_oop(q)->klass()->new_version());
|
||||
// assert(size != new_size, "instances without changed size have to be updated prior to GC run");
|
||||
size = new_size;
|
||||
}
|
||||
|
||||
- compact_top = cp->space->forward(oop(q), size, cp, compact_top, true);
|
||||
+ compact_top = cp->space->forward(cast_to_oop(q), size, cp, compact_top, true);
|
||||
assert(compact_top <= end(), "must not write over end of space!");
|
||||
}
|
||||
MarkSweep::_rescued_oops->clear();
|
||||
diff --git a/src/hotspot/share/gc/shared/space.inline.hpp b/src/hotspot/share/gc/shared/space.inline.hpp
|
||||
index cafa2503ef4..076ce6b0cce 100644
|
||||
--- a/src/hotspot/share/gc/shared/space.inline.hpp
|
||||
+++ b/src/hotspot/share/gc/shared/space.inline.hpp
|
||||
@@ -351,7 +351,7 @@ inline void CompactibleSpace::scan_and_compact(SpaceType* space, bool redefiniti
|
||||
size_t size = space->obj_size(cur_obj);
|
||||
HeapWord* compaction_top = cast_from_oop<HeapWord*>(cast_to_oop(cur_obj)->forwardee());
|
||||
|
||||
- if (redefinition_run && space->must_rescue(oop(cur_obj), oop(cur_obj)->forwardee())) {
|
||||
+ if (redefinition_run && space->must_rescue(cast_to_oop(cur_obj), cast_to_oop(cur_obj)->forwardee())) {
|
||||
space->rescue(cur_obj);
|
||||
debug_only(Copy::fill_to_words(cur_obj, size, 0));
|
||||
cur_obj += size;
|
||||
@@ -363,16 +363,16 @@ inline void CompactibleSpace::scan_and_compact(SpaceType* space, bool redefiniti
|
||||
|
||||
// copy object and reinit its mark
|
||||
assert(redefinition_run || cur_obj != compaction_top, "everything in this pass should be moving");
|
||||
- if (redefinition_run && oop(cur_obj)->klass()->new_version() != NULL) {
|
||||
- Klass* new_version = oop(cur_obj)->klass()->new_version();
|
||||
+ if (redefinition_run && cast_to_oop(cur_obj)->klass()->new_version() != NULL) {
|
||||
+ Klass* new_version = cast_to_oop(cur_obj)->klass()->new_version();
|
||||
if (new_version->update_information() == NULL) {
|
||||
Copy::aligned_conjoint_words(cur_obj, compaction_top, size);
|
||||
- oop(compaction_top)->set_klass(new_version);
|
||||
+ cast_to_oop(compaction_top)->set_klass(new_version);
|
||||
} else {
|
||||
- DcevmSharedGC::update_fields(oop(cur_obj), oop(compaction_top));
|
||||
+ DcevmSharedGC::update_fields(cast_to_oop(cur_obj), cast_to_oop(compaction_top));
|
||||
}
|
||||
- oop(compaction_top)->init_mark();
|
||||
- assert(oop(compaction_top)->klass() != NULL, "should have a class");
|
||||
+ cast_to_oop(compaction_top)->init_mark();
|
||||
+ assert(cast_to_oop(compaction_top)->klass() != NULL, "should have a class");
|
||||
|
||||
debug_only(prev_obj = cur_obj);
|
||||
cur_obj += size;
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index e00f0e19e20..62477b5ce10 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -439,7 +439,7 @@ public:
|
||||
int size = o->size();
|
||||
if (_tmp_obj_size < size) {
|
||||
_tmp_obj_size = size;
|
||||
- _tmp_obj = (oop)resource_allocate_bytes(size * HeapWordSize);
|
||||
+ _tmp_obj = cast_to_oop(resource_allocate_bytes(size * HeapWordSize));
|
||||
}
|
||||
Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(o), cast_from_oop<HeapWord*>(_tmp_obj), size);
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From 64943bd97e577a06eadc949e3acbdbef6c038391 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
|
||||
Date: Fri, 19 Mar 2021 19:13:38 +0100
|
||||
Subject: [PATCH 30/35] JBR-3458: Skip dynamic proxy classes based on
|
||||
com.sun.proxy
|
||||
|
||||
---
|
||||
src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 62477b5ce10..7bdbc861c1f 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -707,7 +707,8 @@ void VM_EnhancedRedefineClasses::reinitializeJDKClasses() {
|
||||
for (int i = 0; i < _new_classes->length(); i++) {
|
||||
InstanceKlass* cur = _new_classes->at(i);
|
||||
|
||||
- if (cur->name()->starts_with("java/") || cur->name()->starts_with("jdk/") || cur->name()->starts_with("sun/")) {
|
||||
+ if ((cur->name()->starts_with("java/") || cur->name()->starts_with("jdk/") || cur->name()->starts_with("sun/"))
|
||||
+ && cur->name()->index_of_at(0, "$$") == -1) { // skip dynamic proxies
|
||||
|
||||
if (cur == vmClasses::ClassLoader_klass()) {
|
||||
// ClassLoader.addClass method is cached in Universe, we must redefine
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
From d7894e556b48923c1da5e2f6aa72b8527f50d6c3 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
|
||||
Date: Sat, 20 Mar 2021 20:51:08 +0100
|
||||
Subject: [PATCH 31/35] JBR-3459: Fix race condition in
|
||||
ClassLoaderDataGraph::classes_do
|
||||
|
||||
InstanceKlass in ClassLoaderData can be uninitialized when
|
||||
ClassLoaderDataGraph::classes_do is called. Using
|
||||
ClassLoaderDataGraph::dictionary_classes_do is safe but problem is still
|
||||
persisting with anonymous classes.
|
||||
---
|
||||
.../share/classfile/classLoaderDataGraph.cpp | 10 ++++++++++
|
||||
.../share/classfile/classLoaderDataGraph.hpp | 4 ++++
|
||||
.../share/prims/jvmtiEnhancedRedefineClasses.cpp | 14 ++++++++++++--
|
||||
3 files changed, 26 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/classfile/classLoaderDataGraph.cpp b/src/hotspot/share/classfile/classLoaderDataGraph.cpp
|
||||
index 67ade5709f6..aa2a6bcec6b 100644
|
||||
--- a/src/hotspot/share/classfile/classLoaderDataGraph.cpp
|
||||
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.cpp
|
||||
@@ -361,6 +361,16 @@ void ClassLoaderDataGraph::classes_do(KlassClosure* klass_closure) {
|
||||
}
|
||||
}
|
||||
|
||||
+void ClassLoaderDataGraph::anonymous_or_hidden_classes_do(KlassClosure* klass_closure) {
|
||||
+ Thread* thread = Thread::current();
|
||||
+ for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
|
||||
+ if (cld->has_class_mirror_holder()) {
|
||||
+ Handle holder(thread, cld->holder_phantom());
|
||||
+ cld->classes_do(klass_closure);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void ClassLoaderDataGraph::classes_do(void f(Klass* const)) {
|
||||
ClassLoaderDataGraphIterator iter;
|
||||
while (ClassLoaderData* cld = iter.get_next()) {
|
||||
diff --git a/src/hotspot/share/classfile/classLoaderDataGraph.hpp b/src/hotspot/share/classfile/classLoaderDataGraph.hpp
|
||||
index ebdb0bc2c8c..da712eaf55f 100644
|
||||
--- a/src/hotspot/share/classfile/classLoaderDataGraph.hpp
|
||||
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.hpp
|
||||
@@ -78,6 +78,10 @@ class ClassLoaderDataGraph : public AllStatic {
|
||||
// for redefinition. These classes are removed during the next class unloading.
|
||||
// Walking the ClassLoaderDataGraph also includes hidden classes.
|
||||
static void classes_do(KlassClosure* klass_closure);
|
||||
+
|
||||
+ // Enhanced class redefinition
|
||||
+ static void anonymous_or_hidden_classes_do(KlassClosure* klass_closure);
|
||||
+
|
||||
static void classes_do(void f(Klass* const));
|
||||
static void methods_do(void f(Method*));
|
||||
static void modules_do(void f(ModuleEntry*));
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 7bdbc861c1f..4e8e7141e61 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -2164,9 +2164,19 @@ jvmtiError VM_EnhancedRedefineClasses::find_sorted_affected_classes(TRAPS) {
|
||||
|
||||
{
|
||||
MutexLocker mcld(ClassLoaderDataGraph_lock);
|
||||
- ClassLoaderDataGraph::classes_do(&closure);
|
||||
+
|
||||
+ // 0. we can't use ClassLoaderDataGraph::classes_do since classes can be uninitialized in cld,
|
||||
+ // fully initialized class is in system dictionary
|
||||
+ // ClassLoaderDataGraph::classes_do(&closure);
|
||||
+
|
||||
+ // 1. Scan over dictionaries
|
||||
+ ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
+
|
||||
+ // 2. Anonymous or hidden class is not in dictionary, we have to iterate anonymous cld directly, but there is race cond...
|
||||
+ // TODO: review ... anonymous class is added to cld before InstanceKlass initialization,
|
||||
+ // find out how to check if the InstanceKlass is initialized
|
||||
+ ClassLoaderDataGraph::anonymous_or_hidden_classes_do(&closure);
|
||||
}
|
||||
- //ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
|
||||
log_trace(redefine, class, load)("%d classes affected", _affected_klasses->length());
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From 0fd4ff50d64fab7f7a60d8038b9dbc2375527c9c Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sat, 15 May 2021 13:01:25 +0200
|
||||
Subject: [PATCH 32/35] Fix compilation problems
|
||||
|
||||
---
|
||||
src/hotspot/share/oops/instanceKlass.cpp | 2 +-
|
||||
src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
index 3cc96f98f41..c54b6b1bf46 100644
|
||||
--- a/src/hotspot/share/oops/instanceKlass.cpp
|
||||
+++ b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
@@ -978,7 +978,7 @@ bool InstanceKlass::link_class_impl(TRAPS) {
|
||||
set_init_state(linked);
|
||||
}
|
||||
// (DCEVM) Must check for old version in order to prevent infinite loops.
|
||||
- if (JvmtiExport::should_post_class_prepare() && (!AllowEnhancedClassRedefinition || old_version() == NULL /* JVMTI deadlock otherwise */) {
|
||||
+ if (JvmtiExport::should_post_class_prepare() && (!AllowEnhancedClassRedefinition || old_version() == NULL /* JVMTI deadlock otherwise */)) {
|
||||
JvmtiExport::post_class_prepare(THREAD, this);
|
||||
}
|
||||
}
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 4e8e7141e61..f6bef8262d3 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -708,7 +708,7 @@ void VM_EnhancedRedefineClasses::reinitializeJDKClasses() {
|
||||
InstanceKlass* cur = _new_classes->at(i);
|
||||
|
||||
if ((cur->name()->starts_with("java/") || cur->name()->starts_with("jdk/") || cur->name()->starts_with("sun/"))
|
||||
- && cur->name()->index_of_at(0, "$$") == -1) { // skip dynamic proxies
|
||||
+ && cur->name()->index_of_at(0, "$$", (int) strlen("$$")) == -1) { // skip dynamic proxies
|
||||
|
||||
if (cur == vmClasses::ClassLoader_klass()) {
|
||||
// ClassLoader.addClass method is cached in Universe, we must redefine
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,350 @@
|
||||
From 67c5602a0dd036d758026a5226d1c0301679219e Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 20 Jun 2021 19:11:16 +0200
|
||||
Subject: [PATCH 33/35] Fix dcevm issues related to refactorization of Thread
|
||||
to JavaThread
|
||||
|
||||
---
|
||||
src/hotspot/share/cds/lambdaFormInvokers.cpp | 1 +
|
||||
.../prims/jvmtiEnhancedRedefineClasses.cpp | 72 +++++++++----------
|
||||
.../prims/jvmtiEnhancedRedefineClasses.hpp | 12 ++--
|
||||
3 files changed, 39 insertions(+), 46 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/cds/lambdaFormInvokers.cpp b/src/hotspot/share/cds/lambdaFormInvokers.cpp
|
||||
index 5c058dc43ac..9de28f740ac 100644
|
||||
--- a/src/hotspot/share/cds/lambdaFormInvokers.cpp
|
||||
+++ b/src/hotspot/share/cds/lambdaFormInvokers.cpp
|
||||
@@ -178,6 +178,7 @@ void LambdaFormInvokers::reload_class(char* name, ClassFileStream& st, TRAPS) {
|
||||
class_name,
|
||||
cld,
|
||||
cl_info,
|
||||
+ false, // pick_newest
|
||||
CHECK);
|
||||
|
||||
{
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index f6bef8262d3..b662976afcb 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
-#include "aot/aotLoader.hpp"
|
||||
#include "classfile/classFileParser.hpp"
|
||||
#include "classfile/classFileStream.hpp"
|
||||
#include "classfile/classLoadInfo.hpp"
|
||||
@@ -38,7 +37,7 @@
|
||||
#include "interpreter/rewriter.hpp"
|
||||
#include "logging/logStream.hpp"
|
||||
#include "memory/metadataFactory.hpp"
|
||||
-#include "memory/metaspaceShared.hpp"
|
||||
+#include "cds/metaspaceShared.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "memory/iterator.inline.hpp"
|
||||
#include "oops/fieldStreams.hpp"
|
||||
@@ -156,7 +155,7 @@ bool VM_EnhancedRedefineClasses::doit_prologue() {
|
||||
|
||||
// We first load new class versions in the prologue, because somewhere down the
|
||||
// call chain it is required that the current thread is a Java thread.
|
||||
- _res = load_new_class_versions(Thread::current());
|
||||
+ _res = load_new_class_versions(JavaThread::current());
|
||||
|
||||
// prepare GC, lock heap
|
||||
if (_res == JVMTI_ERROR_NONE && !VM_GC_Operation::doit_prologue()) {
|
||||
@@ -250,7 +249,6 @@ void VM_EnhancedRedefineClasses::root_oops_do(OopClosure *oopClosure) {
|
||||
Universe::vm_global()->oops_do(oopClosure);
|
||||
|
||||
Threads::oops_do(oopClosure, NULL);
|
||||
- AOT_ONLY(AOTLoader::oops_do(oopClosure);)
|
||||
OopStorageSet::strong_oops_do(oopClosure);
|
||||
|
||||
CodeBlobToOopClosure blobClosure(oopClosure, CodeBlobToOopClosure::FixRelocations);
|
||||
@@ -520,7 +518,7 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
// before the stack walk again.
|
||||
|
||||
for (int i = 0; i < _new_classes->length(); i++) {
|
||||
- redefine_single_class(_new_classes->at(i), thread);
|
||||
+ redefine_single_class(thread, _new_classes->at(i));
|
||||
}
|
||||
|
||||
// Update possible redefinition of vm classes (like ClassLoader)
|
||||
@@ -535,7 +533,7 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
|
||||
// Deoptimize all compiled code that depends on this class (do only once, because it clears whole cache)
|
||||
// if (_max_redefinition_flags > Klass::ModifyClass) {
|
||||
- flush_dependent_code(thread);
|
||||
+ flush_dependent_code();
|
||||
// }
|
||||
|
||||
// Adjust constantpool caches for all classes that reference methods of the evolved class.
|
||||
@@ -692,7 +690,7 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
assert(new_version->super() == NULL || new_version->super()->new_version() == NULL, "Super class must be newest version");
|
||||
}
|
||||
log_trace(redefine, class, obsolete, metadata)("calling check_class");
|
||||
- ClassLoaderData::the_null_class_loader_data()->dictionary()->classes_do(check_class, thread);
|
||||
+ ClassLoaderData::the_null_class_loader_data()->dictionary()->classes_do(check_class);
|
||||
#ifdef PRODUCT
|
||||
}
|
||||
#endif
|
||||
@@ -702,7 +700,7 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
|
||||
void VM_EnhancedRedefineClasses::reinitializeJDKClasses() {
|
||||
if (!_new_classes->is_empty()) {
|
||||
- ResourceMark rm(Thread::current());
|
||||
+ ResourceMark rm(JavaThread::current());
|
||||
|
||||
for (int i = 0; i < _new_classes->length(); i++) {
|
||||
InstanceKlass* cur = _new_classes->at(i);
|
||||
@@ -712,7 +710,7 @@ void VM_EnhancedRedefineClasses::reinitializeJDKClasses() {
|
||||
|
||||
if (cur == vmClasses::ClassLoader_klass()) {
|
||||
// ClassLoader.addClass method is cached in Universe, we must redefine
|
||||
- Universe::reinitialize_loader_addClass_method(Thread::current());
|
||||
+ Universe::reinitialize_loader_addClass_method(JavaThread::current());
|
||||
log_trace(redefine, class, obsolete, metadata)("Reinitialize ClassLoade addClass method cache.");
|
||||
}
|
||||
|
||||
@@ -735,7 +733,7 @@ void VM_EnhancedRedefineClasses::reinitializeJDKClasses() {
|
||||
cur,
|
||||
signature,
|
||||
vmSymbols::void_method_signature(),
|
||||
- Thread::current());
|
||||
+ JavaThread::current());
|
||||
log_trace(redefine, class, obsolete, metadata)("Reregister natives of JDK class %s", cur->external_name());
|
||||
}
|
||||
}
|
||||
@@ -793,7 +791,7 @@ bool VM_EnhancedRedefineClasses::is_modifiable_class(oop klass_mirror) {
|
||||
|
||||
// Cannot redefine or retransform an anonymous class.
|
||||
// TODO: check if is correct in j15
|
||||
- if (InstanceKlass::cast(k)->is_unsafe_anonymous() || InstanceKlass::cast(k)->is_hidden()) {
|
||||
+ if (InstanceKlass::cast(k)->is_hidden()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -879,23 +877,15 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
|
||||
InstanceKlass* k;
|
||||
|
||||
- if (the_class->is_unsafe_anonymous() || the_class->is_hidden()) {
|
||||
+ if (the_class->is_hidden()) {
|
||||
InstanceKlass* dynamic_host_class = NULL;
|
||||
- InstanceKlass* unsafe_anonymous_host = NULL;
|
||||
|
||||
if (the_class->is_hidden()) {
|
||||
log_debug(redefine, class, load)("loading hidden class %s", the_class->name()->as_C_string());
|
||||
dynamic_host_class = the_class->nest_host(THREAD);
|
||||
}
|
||||
|
||||
- if (the_class->is_unsafe_anonymous()) {
|
||||
- log_debug(redefine, class, load)("loading usafe anonymous %s", the_class->name()->as_C_string());
|
||||
- unsafe_anonymous_host = the_class->unsafe_anonymous_host();
|
||||
- }
|
||||
-
|
||||
ClassLoadInfo cl_info(protection_domain,
|
||||
- unsafe_anonymous_host,
|
||||
- NULL, // cp_patches
|
||||
dynamic_host_class, // dynamic_nest_host
|
||||
Handle(), // classData
|
||||
the_class->is_hidden(), // is_hidden
|
||||
@@ -1143,7 +1133,7 @@ int VM_EnhancedRedefineClasses::calculate_redefinition_flags(InstanceKlass* new_
|
||||
Array<Method*>* k_new_methods(new_class->methods());
|
||||
int n_old_methods = k_old_methods->length();
|
||||
int n_new_methods = k_new_methods->length();
|
||||
- Thread* thread = Thread::current();
|
||||
+ JavaThread* thread = JavaThread::current();
|
||||
|
||||
int ni = 0;
|
||||
int oi = 0;
|
||||
@@ -1491,8 +1481,8 @@ void VM_EnhancedRedefineClasses::rollback() {
|
||||
// Rewrite faster byte-codes back to their slower equivalent. Undoes rewriting happening in templateTable_xxx.cpp
|
||||
// The reason is that once we zero cpool caches, we need to re-resolve all entries again. Faster bytecodes do not
|
||||
// do that, they assume that cache entry is resolved already.
|
||||
-void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method, TRAPS) {
|
||||
- RawBytecodeStream bcs(methodHandle(THREAD, method));
|
||||
+void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method) {
|
||||
+ RawBytecodeStream bcs(methodHandle(Thread::current(), method));
|
||||
Bytecodes::Code code;
|
||||
Bytecodes::Code java_code;
|
||||
while (!bcs.is_last_bytecode()) {
|
||||
@@ -1535,10 +1525,10 @@ void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method, TRAPS) {
|
||||
assert(code2 == Bytecodes::_fast_igetfield ||
|
||||
code2 == Bytecodes::_fast_agetfield ||
|
||||
code2 == Bytecodes::_fast_fgetfield, "");
|
||||
- *(bcp + 1) = Bytecodes::java_code(code2);
|
||||
- }
|
||||
+ *(bcp + 1) = Bytecodes::java_code(code2);
|
||||
}
|
||||
}
|
||||
+}
|
||||
|
||||
// Unevolving classes may point to old methods directly
|
||||
// from their constant pool caches, itables, and/or vtables. We
|
||||
@@ -1559,9 +1549,11 @@ void VM_EnhancedRedefineClasses::ClearCpoolCacheAndUnpatch::do_klass(Klass* k) {
|
||||
constantPoolHandle other_cp = constantPoolHandle(_thread, ik->constants());
|
||||
|
||||
// Update host klass of anonymous classes (for example, produced by lambdas) to newest version.
|
||||
+ /*
|
||||
if (ik->is_unsafe_anonymous() && ik->unsafe_anonymous_host()->new_version() != NULL) {
|
||||
ik->set_unsafe_anonymous_host(InstanceKlass::cast(ik->unsafe_anonymous_host()->newest_version()));
|
||||
}
|
||||
+ */
|
||||
|
||||
// FIXME: check new nest_host for hidden
|
||||
|
||||
@@ -1596,7 +1588,7 @@ void VM_EnhancedRedefineClasses::ClearCpoolCacheAndUnpatch::do_klass(Klass* k) {
|
||||
|
||||
// If bytecode rewriting is enabled, we also need to unpatch bytecode to force resolution of zeroed entries
|
||||
if (RewriteBytecodes) {
|
||||
- ik->methods_do(unpatch_bytecode, _thread);
|
||||
+ ik->methods_do(unpatch_bytecode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1628,7 +1620,7 @@ void VM_EnhancedRedefineClasses::MethodDataCleaner::do_klass(Klass* k) {
|
||||
}
|
||||
|
||||
|
||||
-void VM_EnhancedRedefineClasses::update_jmethod_ids(TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::update_jmethod_ids(Thread* current) {
|
||||
for (int j = 0; j < _matching_methods_length; ++j) {
|
||||
Method* old_method = _matching_old_methods[j];
|
||||
jmethodID jmid = old_method->find_jmethod_id_or_null();
|
||||
@@ -1639,10 +1631,10 @@ void VM_EnhancedRedefineClasses::update_jmethod_ids(TRAPS) {
|
||||
|
||||
if (jmid != NULL) {
|
||||
// There is a jmethodID, change it to point to the new method
|
||||
- methodHandle new_method_h(THREAD, _matching_new_methods[j]);
|
||||
+ methodHandle new_method_h(current, _matching_new_methods[j]);
|
||||
|
||||
if (old_method->new_version() == NULL) {
|
||||
- methodHandle old_method_h(THREAD, _matching_old_methods[j]);
|
||||
+ methodHandle old_method_h(current, _matching_old_methods[j]);
|
||||
jmethodID new_jmethod_id = Method::make_jmethod_id(old_method_h->method_holder()->class_loader_data(), old_method_h());
|
||||
bool result = InstanceKlass::cast(old_method_h->method_holder())->update_jmethod_id(old_method_h(), new_jmethod_id);
|
||||
} else {
|
||||
@@ -1864,7 +1856,7 @@ void VM_EnhancedRedefineClasses::mark_dependent_code(InstanceKlass* ik) {
|
||||
// subsequent calls to RedefineClasses need only throw away code
|
||||
// that depends on the class.
|
||||
//
|
||||
-void VM_EnhancedRedefineClasses::flush_dependent_code(TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::flush_dependent_code() {
|
||||
assert_locked_or_safepoint(Compile_lock);
|
||||
|
||||
// All dependencies have been recorded from startup or this is a second or
|
||||
@@ -1959,9 +1951,9 @@ void VM_EnhancedRedefineClasses::compute_added_deleted_matching_methods() {
|
||||
// a helper method to be specified. The interesting parameters
|
||||
// that we would like to pass to the helper method are saved in
|
||||
// static global fields in the VM operation.
|
||||
-void VM_EnhancedRedefineClasses::redefine_single_class(InstanceKlass* new_class_oop, TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::redefine_single_class(Thread* current, InstanceKlass* new_class_oop) {
|
||||
|
||||
- HandleMark hm(THREAD); // make sure handles from this call are freed
|
||||
+ HandleMark hm(current); // make sure handles from this call are freed
|
||||
|
||||
InstanceKlass* new_class = new_class_oop;
|
||||
InstanceKlass* the_class = InstanceKlass::cast(new_class_oop->old_version());
|
||||
@@ -1980,7 +1972,7 @@ void VM_EnhancedRedefineClasses::redefine_single_class(InstanceKlass* new_class_
|
||||
|
||||
// track number of methods that are EMCP for add_previous_version() call below
|
||||
check_methods_and_mark_as_obsolete();
|
||||
- update_jmethod_ids(THREAD);
|
||||
+ update_jmethod_ids(current);
|
||||
|
||||
_any_class_has_resolved_methods = the_class->has_resolved_methods() || _any_class_has_resolved_methods;
|
||||
|
||||
@@ -2002,14 +1994,14 @@ void VM_EnhancedRedefineClasses::redefine_single_class(InstanceKlass* new_class_
|
||||
*/
|
||||
|
||||
{
|
||||
- ResourceMark rm(THREAD);
|
||||
+ ResourceMark rm(current);
|
||||
// increment the classRedefinedCount field in the_class and in any
|
||||
// direct and indirect subclasses of the_class
|
||||
- increment_class_counter(new_class, THREAD);
|
||||
+ increment_class_counter(current, new_class);
|
||||
log_info(redefine, class, load)
|
||||
("redefined name=%s, count=%d (avail_mem=" UINT64_FORMAT "K)",
|
||||
new_class->external_name(), java_lang_Class::classRedefinedCount(new_class->java_mirror()), os::available_memory() >> 10);
|
||||
- Events::log_redefinition(THREAD, "redefined class name=%s, count=%d",
|
||||
+ Events::log_redefinition(current, "redefined class name=%s, count=%d",
|
||||
new_class->external_name(),
|
||||
java_lang_Class::classRedefinedCount(new_class->java_mirror()));
|
||||
}
|
||||
@@ -2018,21 +2010,21 @@ void VM_EnhancedRedefineClasses::redefine_single_class(InstanceKlass* new_class_
|
||||
|
||||
// Increment the classRedefinedCount field in the specific InstanceKlass
|
||||
// and in all direct and indirect subclasses.
|
||||
-void VM_EnhancedRedefineClasses::increment_class_counter(InstanceKlass *ik, TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::increment_class_counter(Thread* current, InstanceKlass *ik) {
|
||||
oop class_mirror = ik->old_version()->java_mirror();
|
||||
Klass* class_oop = java_lang_Class::as_Klass(class_mirror);
|
||||
int new_count = java_lang_Class::classRedefinedCount(class_mirror) + 1;
|
||||
java_lang_Class::set_classRedefinedCount(ik->java_mirror(), new_count);
|
||||
}
|
||||
|
||||
-void VM_EnhancedRedefineClasses::check_class(InstanceKlass* ik, TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::check_class(InstanceKlass* ik) {
|
||||
if (ik->is_instance_klass() && ik->old_version() != NULL) {
|
||||
- HandleMark hm(THREAD);
|
||||
+ HandleMark hm(Thread::current());
|
||||
|
||||
assert(ik->new_version() == NULL, "must be latest version in system dictionary");
|
||||
|
||||
if (ik->vtable_length() > 0) {
|
||||
- ResourceMark rm(THREAD);
|
||||
+ ResourceMark rm(Thread::current());
|
||||
assert(ik->vtable().check_no_old_or_obsolete_entries(), "old method found");
|
||||
ik->vtable().verify(tty, true);
|
||||
}
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
index 673688dff84..378e6f78582 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -122,7 +122,7 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
static void mark_as_scavengable(nmethod* nm);
|
||||
static void unregister_nmethod_g1(nmethod* nm);
|
||||
static void register_nmethod_g1(nmethod* nm);
|
||||
- static void unpatch_bytecode(Method* method, TRAPS);
|
||||
+ static void unpatch_bytecode(Method* method);
|
||||
|
||||
void root_oops_do(OopClosure *oopClosure);
|
||||
|
||||
@@ -131,28 +131,28 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
void compute_added_deleted_matching_methods();
|
||||
|
||||
// Change jmethodIDs to point to the new methods
|
||||
- void update_jmethod_ids(TRAPS);
|
||||
+ void update_jmethod_ids(Thread* current);
|
||||
|
||||
// marking methods as old and/or obsolete
|
||||
void check_methods_and_mark_as_obsolete();
|
||||
void transfer_old_native_function_registrations(InstanceKlass* the_class);
|
||||
|
||||
// Install the redefinition of a class
|
||||
- void redefine_single_class(InstanceKlass* new_class_oop, TRAPS);
|
||||
+ void redefine_single_class(Thread* current, InstanceKlass* new_class_oop);
|
||||
|
||||
// Increment the classRedefinedCount field in the specific InstanceKlass
|
||||
// and in all direct and indirect subclasses.
|
||||
- void increment_class_counter(InstanceKlass *ik, TRAPS);
|
||||
+ void increment_class_counter(Thread* current, InstanceKlass *ik);
|
||||
|
||||
void mark_dependent_code(InstanceKlass* ik);
|
||||
|
||||
- void flush_dependent_code(TRAPS);
|
||||
+ void flush_dependent_code();
|
||||
|
||||
u8 next_id();
|
||||
|
||||
void reinitializeJDKClasses();
|
||||
|
||||
- static void check_class(InstanceKlass* k_oop, TRAPS);
|
||||
+ static void check_class(InstanceKlass* k_oop);
|
||||
|
||||
static void dump_methods();
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
From 2329129c450c0de5be728d8e9c3eabeb0adcb6e1 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 20 Jun 2021 19:42:51 +0200
|
||||
Subject: [PATCH 34/35] Fix init_method_MemberName after Thread to JavaThread
|
||||
refactorization
|
||||
|
||||
---
|
||||
src/hotspot/share/interpreter/linkResolver.cpp | 14 ++++++++++----
|
||||
src/hotspot/share/interpreter/linkResolver.hpp | 3 ++-
|
||||
src/hotspot/share/oops/instanceKlass.cpp | 15 ---------------
|
||||
src/hotspot/share/oops/instanceKlass.hpp | 1 -
|
||||
.../share/prims/jvmtiEnhancedRedefineClasses.cpp | 11 +++++++++--
|
||||
5 files changed, 21 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/interpreter/linkResolver.cpp b/src/hotspot/share/interpreter/linkResolver.cpp
|
||||
index 08c441a6ecd..f4d440823d8 100644
|
||||
--- a/src/hotspot/share/interpreter/linkResolver.cpp
|
||||
+++ b/src/hotspot/share/interpreter/linkResolver.cpp
|
||||
@@ -131,14 +131,14 @@ void CallInfo::set_common(Klass* resolved_klass,
|
||||
}
|
||||
|
||||
// utility query for unreflecting a method
|
||||
-CallInfo::CallInfo(Method* resolved_method, Klass* resolved_klass, TRAPS) {
|
||||
+CallInfo::CallInfo(Method* resolved_method, Klass* resolved_klass, Thread* thread) {
|
||||
Klass* resolved_method_holder = resolved_method->method_holder();
|
||||
if (resolved_klass == NULL) { // 2nd argument defaults to holder of 1st
|
||||
resolved_klass = resolved_method_holder;
|
||||
}
|
||||
_resolved_klass = resolved_klass;
|
||||
- _resolved_method = methodHandle(THREAD, resolved_method);
|
||||
- _selected_method = methodHandle(THREAD, resolved_method);
|
||||
+ _resolved_method = methodHandle(thread, resolved_method);
|
||||
+ _selected_method = methodHandle(thread, resolved_method);
|
||||
// classify:
|
||||
CallKind kind = CallInfo::unknown_kind;
|
||||
int index = resolved_method->vtable_index();
|
||||
@@ -179,7 +179,9 @@ CallInfo::CallInfo(Method* resolved_method, Klass* resolved_klass, TRAPS) {
|
||||
_call_index = index;
|
||||
_resolved_appendix = Handle();
|
||||
// Find or create a ResolvedMethod instance for this Method*
|
||||
- set_resolved_method_name(CHECK);
|
||||
+ if (thread->is_Java_thread()) { // exclude DCEVM VM thread
|
||||
+ set_resolved_method_name(thread->as_Java_thread());
|
||||
+ }
|
||||
|
||||
DEBUG_ONLY(verify());
|
||||
}
|
||||
@@ -190,6 +192,10 @@ void CallInfo::set_resolved_method_name(TRAPS) {
|
||||
_resolved_method_name = Handle(THREAD, rmethod_name);
|
||||
}
|
||||
|
||||
+void CallInfo::set_resolved_method_name_dcevm(oop rmethod_name, Thread* thread) {
|
||||
+ _resolved_method_name = Handle(thread, rmethod_name);
|
||||
+}
|
||||
+
|
||||
#ifdef ASSERT
|
||||
void CallInfo::verify() {
|
||||
switch (call_kind()) { // the meaning and allowed value of index depends on kind
|
||||
diff --git a/src/hotspot/share/interpreter/linkResolver.hpp b/src/hotspot/share/interpreter/linkResolver.hpp
|
||||
index 9eeb10cc6fd..871eaab7464 100644
|
||||
--- a/src/hotspot/share/interpreter/linkResolver.hpp
|
||||
+++ b/src/hotspot/share/interpreter/linkResolver.hpp
|
||||
@@ -91,7 +91,7 @@ class CallInfo : public StackObj {
|
||||
// utility to extract an effective CallInfo from a method and an optional receiver limit
|
||||
// does not queue the method for compilation. This also creates a ResolvedMethodName
|
||||
// object for the resolved_method.
|
||||
- CallInfo(Method* resolved_method, Klass* resolved_klass, TRAPS);
|
||||
+ CallInfo(Method* resolved_method, Klass* resolved_klass, Thread* thread);
|
||||
|
||||
Klass* resolved_klass() const { return _resolved_klass; }
|
||||
Method* resolved_method() const { return _resolved_method(); }
|
||||
@@ -100,6 +100,7 @@ class CallInfo : public StackObj {
|
||||
Handle resolved_method_name() const { return _resolved_method_name; }
|
||||
// Materialize a java.lang.invoke.ResolvedMethodName for this resolved_method
|
||||
void set_resolved_method_name(TRAPS);
|
||||
+ void set_resolved_method_name_dcevm(oop rmethod_name, Thread* thread);
|
||||
|
||||
BasicType result_type() const { return selected_method()->result_type(); }
|
||||
CallKind call_kind() const { return _call_kind; }
|
||||
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
index c54b6b1bf46..8d259451032 100644
|
||||
--- a/src/hotspot/share/oops/instanceKlass.cpp
|
||||
+++ b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
@@ -1643,21 +1643,6 @@ void InstanceKlass::methods_do(void f(Method* method)) {
|
||||
}
|
||||
}
|
||||
|
||||
-void InstanceKlass::methods_do(void f(Method* method, TRAPS), TRAPS) {
|
||||
- // Methods aren't stable until they are loaded. This can be read outside
|
||||
- // a lock through the ClassLoaderData for profiling
|
||||
- if (!is_loaded()) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- int len = methods()->length();
|
||||
- for (int index = 0; index < len; index++) {
|
||||
- Method* m = methods()->at(index);
|
||||
- assert(m->is_method(), "must be method");
|
||||
- f(m, CHECK);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
// (DCEVM) Update information contains mapping of fields from old class to the new class.
|
||||
// Info is stored on HEAP, you need to call clear_update_information to free the space.
|
||||
void InstanceKlass::store_update_information(GrowableArray<int> &values) {
|
||||
diff --git a/src/hotspot/share/oops/instanceKlass.hpp b/src/hotspot/share/oops/instanceKlass.hpp
|
||||
index 317a006a4ec..36587031fec 100644
|
||||
--- a/src/hotspot/share/oops/instanceKlass.hpp
|
||||
+++ b/src/hotspot/share/oops/instanceKlass.hpp
|
||||
@@ -1017,7 +1017,6 @@ public:
|
||||
void clear_update_information();
|
||||
|
||||
void methods_do(void f(Method* method));
|
||||
- void methods_do(void f(Method* method, TRAPS), TRAPS);
|
||||
void array_klasses_do(void f(Klass* k));
|
||||
void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index b662976afcb..ff012383872 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -292,8 +292,15 @@ class ChangePointersOopClosure : public BasicOopIterateClosure {
|
||||
// Note: we might set NULL at this point, which should force AbstractMethodError at runtime
|
||||
Thread *thread = Thread::current();
|
||||
CallInfo info(new_method, newest, thread);
|
||||
- Handle objHandle(thread, obj);
|
||||
- MethodHandles::init_method_MemberName(objHandle, info);
|
||||
+ oop resolved_method = ResolvedMethodTable::find_method(info.resolved_method());
|
||||
+ if (resolved_method != NULL) {
|
||||
+ info.set_resolved_method_name_dcevm(resolved_method, thread);
|
||||
+ Handle objHandle(thread, obj);
|
||||
+ MethodHandles::init_method_MemberName(objHandle, info);
|
||||
+ } else {
|
||||
+ assert(0, "Must be resolved");
|
||||
+ java_lang_invoke_MemberName::set_method(obj, NULL);
|
||||
+ }
|
||||
} else {
|
||||
java_lang_invoke_MemberName::set_method(obj, NULL);
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
From 1cc270951c7de6b198f280dccadf4662bea33854 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Mon, 21 Jun 2021 20:44:17 +0200
|
||||
Subject: [PATCH 35/35] Fix "implicit conversion of NULL constant to 'bool'"
|
||||
|
||||
---
|
||||
src/hotspot/share/prims/jvmtiRedefineClasses.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp
|
||||
index 87b3b5f47ce..6915a09cf85 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp
|
||||
@@ -1390,7 +1390,7 @@ jvmtiError VM_RedefineClasses::load_new_class_versions() {
|
||||
the_class->name(),
|
||||
the_class->class_loader_data(),
|
||||
cl_info,
|
||||
- NULL,
|
||||
+ false,
|
||||
THREAD);
|
||||
|
||||
// Clear class_being_redefined just to be sure.
|
||||
--
|
||||
2.23.0
|
||||
|
||||
118
jb/project/tools/windows/scripts/mkimages_x64.sh
Executable file
118
jb/project/tools/windows/scripts/mkimages_x64.sh
Executable file
@@ -0,0 +1,118 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# JBSDK_VERSION - specifies major version of OpenJDK e.g. 11_0_6 (instead of dots '.' underbars "_" are used)
|
||||
# JDK_BUILD_NUMBER - specifies update release of OpenJDK build or the value of --with-version-build argument to configure
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to be built; possible values:
|
||||
# <empty> or nomod - the release bundles without any additional modules (jcef)
|
||||
# jcef - the release bundles with jcef
|
||||
# fd - the fastdebug bundles which also include the jcef module
|
||||
#
|
||||
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
#
|
||||
# $ ./java --version
|
||||
# openjdk 11.0.6 2020-01-14
|
||||
# OpenJDK Runtime Environment (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number})
|
||||
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
|
||||
#
|
||||
# Environment variables:
|
||||
# JCEF_PATH - specifies the path to the directory with JCEF binaries.
|
||||
# By default JCEF binaries should be located in ./jcef_win_x64
|
||||
|
||||
JBSDK_VERSION=$1
|
||||
JDK_BUILD_NUMBER=$2
|
||||
build_number=$3
|
||||
bundle_type=$4
|
||||
JBSDK_VERSION_WITH_DOTS=$(echo $JBSDK_VERSION | sed 's/_/\./g')
|
||||
WORK_DIR=$(pwd)
|
||||
JCEF_PATH=${JCEF_PATH:=$WORK_DIR/jcef_win_x64}
|
||||
|
||||
source jb/project/tools/common/scripts/common.sh
|
||||
|
||||
function create_image_bundle {
|
||||
__bundle_name=$1
|
||||
__modules_path=$2
|
||||
__modules=$3
|
||||
|
||||
[ -d $__bundle_name ] && rm -rf $__bundle_name
|
||||
|
||||
echo Running jlink ...
|
||||
${JSDK}/bin/jlink \
|
||||
--module-path $__modules_path --no-man-pages --compress=2 \
|
||||
--add-modules $__modules --output $__bundle_name || do_exit $?
|
||||
|
||||
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> $__bundle_name/release
|
||||
if [ "$__bundle_name" == "$JBRSDK_BUNDLE" ]; then
|
||||
sed 's/JBR/JBRSDK/g' $__bundle_name/release > release
|
||||
mv release $__bundle_name/release
|
||||
fi
|
||||
}
|
||||
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=release"
|
||||
RELEASE_NAME=windows-x86_64-server-release
|
||||
|
||||
case "$bundle_type" in
|
||||
"jcef")
|
||||
do_reset_changes=1
|
||||
;;
|
||||
"dcevm")
|
||||
HEAD_REVISION=$(git rev-parse HEAD)
|
||||
git am jb/project/tools/patches/dcevm/*.patch || do_exit $?
|
||||
do_reset_dcevm=1
|
||||
do_reset_changes=1
|
||||
;;
|
||||
"nomod" | "")
|
||||
bundle_type=""
|
||||
;;
|
||||
"fd")
|
||||
do_reset_changes=1
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=fastdebug"
|
||||
RELEASE_NAME=windows-x86_64-server-fastdebug
|
||||
;;
|
||||
esac
|
||||
|
||||
sh ./configure \
|
||||
$WITH_DEBUG_LEVEL \
|
||||
--with-vendor-name="$VENDOR_NAME" \
|
||||
--with-vendor-version-string="$VENDOR_VERSION_STRING" \
|
||||
--with-version-pre= \
|
||||
--with-version-build=$JDK_BUILD_NUMBER \
|
||||
--with-version-opt=b${build_number} \
|
||||
--with-toolchain-version=$TOOLCHAIN_VERSION \
|
||||
--with-boot-jdk=$BOOT_JDK \
|
||||
--disable-ccache \
|
||||
--enable-cds=yes || do_exit $?
|
||||
|
||||
if [ -z "$bundle_type" ]; then
|
||||
make LOG=info CONF=$RELEASE_NAME clean images test-image || do_exit $?
|
||||
else
|
||||
make LOG=info CONF=$RELEASE_NAME clean images || do_exit $?
|
||||
fi
|
||||
|
||||
IMAGES_DIR=build/$RELEASE_NAME/images
|
||||
JSDK=$IMAGES_DIR/jdk
|
||||
JSDK_MODS_DIR=$IMAGES_DIR/jmods
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "dcevm" ] || [ "$bundle_type" == "fd" ]; then
|
||||
git apply -p0 < jb/project/tools/patches/add_jcef_module.patch || do_exit $?
|
||||
update_jsdk_mods "$JSDK" "$JCEF_PATH"/jmods "$JSDK"/jmods "$JSDK_MODS_DIR" || do_exit $?
|
||||
cp $JCEF_PATH/jmods/* ${JSDK_MODS_DIR} # $JSDK/jmods is not unchanged
|
||||
|
||||
jbr_name_postfix="_${bundle_type}"
|
||||
fi
|
||||
|
||||
# create runtime image bundle
|
||||
modules=$(xargs < modules.list | sed s/" "//g) || do_exit $?
|
||||
create_image_bundle "jbr${jbr_name_postfix}" $JSDK_MODS_DIR "$modules" || do_exit $?
|
||||
|
||||
# create sdk image bundle
|
||||
modules=$(cat ${JSDK}/release | grep MODULES | sed s/MODULES=//g | sed s/' '/,/g | sed s/\"//g | sed s/\\r//g | sed s/\\n//g)
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "dcevm" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "$JBRSDK_BUNDLE" ]; then
|
||||
modules=${modules},$(get_mods_list "$JCEF_PATH"/jmods)
|
||||
fi
|
||||
create_image_bundle "$JBRSDK_BUNDLE" "$JSDK_MODS_DIR" "$modules" || do_exit $?
|
||||
|
||||
do_exit 0
|
||||
62
jb/project/tools/windows/scripts/mkimages_x86.sh
Executable file
62
jb/project/tools/windows/scripts/mkimages_x86.sh
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# JBSDK_VERSION - specifies the current version of OpenJDK e.g. 11_0_6
|
||||
# JDK_BUILD_NUMBER - specifies the number of OpenJDK build or the value of --with-version-build argument to configure
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
#
|
||||
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
#
|
||||
# $ ./java --version
|
||||
# openjdk 11.0.6 2020-01-14
|
||||
# OpenJDK Runtime Environment (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number})
|
||||
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
|
||||
#
|
||||
|
||||
JBSDK_VERSION=$1
|
||||
JDK_BUILD_NUMBER=$2
|
||||
build_number=$3
|
||||
|
||||
JBSDK_VERSION_WITH_DOTS=$(echo $JBSDK_VERSION | sed 's/_/\./g')
|
||||
|
||||
source jb/project/tools/common/scripts/common.sh
|
||||
|
||||
JBRSDK_BASE_NAME=jbrsdk-${JBSDK_VERSION}
|
||||
WORK_DIR=$(pwd)
|
||||
|
||||
[ -z "$bundle_type" ] && (git apply -p0 < jb/project/tools/patches/exclude_jcef_module.patch || exit $?)
|
||||
|
||||
PATH="/usr/local/bin:/usr/bin:${PATH}"
|
||||
./configure \
|
||||
--with-target-bits=32 \
|
||||
--with-vendor-name="${VENDOR_NAME}" \
|
||||
--with-vendor-version-string="${VENDOR_VERSION_STRING}" \
|
||||
--with-version-pre= \
|
||||
--with-version-build=${JDK_BUILD_NUMBER} \
|
||||
--with-version-opt=b${build_number} \
|
||||
--with-toolchain-version=${TOOLCHAIN_VERSION} \
|
||||
--with-boot-jdk=${BOOT_JDK} \
|
||||
--disable-ccache \
|
||||
--enable-cds=yes || exit 1
|
||||
make clean CONF=windows-x86-server-release || exit 1
|
||||
make LOG=info images CONF=windows-x86-server-release test-image || exit 1
|
||||
|
||||
JBSDK=${JBRSDK_BASE_NAME}-windows-x86-b${build_number}
|
||||
BASE_DIR=build/windows-x86-server-release/images
|
||||
JSDK=${BASE_DIR}/jdk
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
|
||||
rm -rf ${BASE_DIR}/${JBRSDK_BUNDLE} && rsync -a --exclude demo --exclude sample ${JSDK}/ ${JBRSDK_BUNDLE} || exit 1
|
||||
sed 's/JBR/JBRSDK/g' ${JSDK}/release > release
|
||||
mv release ${JBRSDK_BUNDLE}/release
|
||||
|
||||
JBR_BUNDLE=jbr
|
||||
rm -rf ${JBR_BUNDLE}
|
||||
grep -v javafx modules.list | grep -v "jdk.internal.vm\|jdk.aot\|jcef" > modules.list.x86
|
||||
${JSDK}/bin/jlink \
|
||||
--module-path ${JSDK}/jmods --no-man-pages --compress=2 \
|
||||
--add-modules $(xargs < modules.list.x86 | sed s/" "//g) --output ${JBR_BUNDLE} || exit $?
|
||||
|
||||
echo Modifying release info ...
|
||||
#grep -v \"^JAVA_VERSION\" ${JSDK}/release | grep -v \"^MODULES\" >> ${JBR_BUNDLE}/release
|
||||
77
jb/project/tools/windows/scripts/pack_x64.sh
Executable file
77
jb/project/tools/windows/scripts/pack_x64.sh
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# JBSDK_VERSION - specifies major version of OpenJDK e.g. 11_0_6 (instead of dots '.' underbars "_" are used)
|
||||
# JDK_BUILD_NUMBER - specifies udate release of OpenJDK build or the value of --with-version-build argument to configure
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to be built; possible values:
|
||||
# <empty> or nomod - the bundles without any additional modules (jcef)
|
||||
# jcef - the bundles with jcef
|
||||
# fd - the fastdebug bundles which also include the jcef module
|
||||
#
|
||||
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
#
|
||||
# $ ./java --version
|
||||
# openjdk 11.0.6 2020-01-14
|
||||
# OpenJDK Runtime Environment (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number})
|
||||
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
|
||||
#
|
||||
|
||||
source jb/project/tools/common/scripts/common.sh
|
||||
|
||||
JBSDK_VERSION=$1
|
||||
JDK_BUILD_NUMBER=$2
|
||||
build_number=$3
|
||||
bundle_type=$4
|
||||
|
||||
function pack_jbr {
|
||||
|
||||
if [ -z "${bundle_type}" ]; then
|
||||
JBR_BUNDLE=jbr
|
||||
else
|
||||
JBR_BUNDLE=jbr_${bundle_type}
|
||||
[ -d ${BASE_DIR}/jbr ] && rm -rf ${BASE_DIR}/jbr
|
||||
cp -R ${BASE_DIR}/${JBR_BUNDLE} ${BASE_DIR}/jbr
|
||||
fi
|
||||
JBR_BASE_NAME=${JBR_BUNDLE}-${JBSDK_VERSION}
|
||||
|
||||
JBR=$JBR_BASE_NAME-windows-x64-b$build_number
|
||||
echo Creating $JBR.tar.gz ...
|
||||
|
||||
/usr/bin/tar -czf $JBR.tar.gz -C $BASE_DIR jbr || do_exit $?
|
||||
}
|
||||
|
||||
JBRSDK_BASE_NAME=jbrsdk-$JBSDK_VERSION
|
||||
JBR_BASE_NAME=jbr-$JBSDK_VERSION
|
||||
RELEASE_NAME=windows-x86_64-server-release
|
||||
JBSDK=${JBRSDK_BASE_NAME}-osx-x64-b${build_number}
|
||||
case "$bundle_type" in
|
||||
"nomod" | "")
|
||||
bundle_type=""
|
||||
;;
|
||||
"fd")
|
||||
RELEASE_NAME=macosx-x86_64-server-fastdebug
|
||||
JBSDK=${JBRSDK_BASE_NAME}-osx-x64-fastdebug-b${build_number}
|
||||
;;
|
||||
esac
|
||||
|
||||
IMAGES_DIR=build/$RELEASE_NAME/images
|
||||
JSDK=$IMAGES_DIR/jdk
|
||||
JBSDK=$JBRSDK_BASE_NAME-windows-x64-b$build_number
|
||||
BASE_DIR=.
|
||||
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "dcevm" ] || [ "$bundle_type" == "fd" ]; then
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
echo Creating $JBSDK.tar.gz ...
|
||||
[ -f "$JBSDK.tar.gz" ] && rm "$JBSDK.tar.gz"
|
||||
/usr/bin/tar -czf $JBSDK.tar.gz $JBRSDK_BUNDLE || do_exit $?
|
||||
fi
|
||||
|
||||
pack_jbr $bundle_type
|
||||
|
||||
if [ -z "$bundle_type" ]; then
|
||||
JBRSDK_TEST=$JBRSDK_BASE_NAME-windows-test-x64-b$build_number
|
||||
echo Creating $JBRSDK_TEST.tar.gz ...
|
||||
/usr/bin/tar -czf $JBRSDK_TEST.tar.gz -C $IMAGES_DIR --exclude='test/jdk/demos' test || do_exit $?
|
||||
fi
|
||||
42
jb/project/tools/windows/scripts/pack_x86.sh
Executable file
42
jb/project/tools/windows/scripts/pack_x86.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# JBSDK_VERSION - specifies the current version of OpenJDK e.g. 11_0_6
|
||||
# JDK_BUILD_NUMBER - specifies the number of OpenJDK build or the value of --with-version-build argument to configure
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
#
|
||||
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
#
|
||||
# $ ./java --version
|
||||
# openjdk 11.0.6 2020-01-14
|
||||
# OpenJDK Runtime Environment (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number})
|
||||
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
|
||||
#
|
||||
|
||||
JBSDK_VERSION=$1
|
||||
JDK_BUILD_NUMBER=$2
|
||||
build_number=$3
|
||||
|
||||
JBRSDK_BASE_NAME=jbrsdk-$JBSDK_VERSION
|
||||
JBR_BASE_NAME=jbr-$JBSDK_VERSION
|
||||
|
||||
IMAGES_DIR=build/windows-x86-server-release/images
|
||||
JSDK=$IMAGES_DIR/jdk
|
||||
JBSDK=$JBRSDK_BASE_NAME-windows-x86-b$build_number
|
||||
BASE_DIR=.
|
||||
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
echo Creating $JBSDK.tar.gz ...
|
||||
/usr/bin/tar -czf $JBSDK.tar.gz $JBRSDK_BUNDLE || exit 1
|
||||
|
||||
JBR_BUNDLE=jbr
|
||||
JBR_BASE_NAME=jbr-${JBSDK_VERSION}
|
||||
|
||||
JBR=$JBR_BASE_NAME-windows-x86-b$build_number
|
||||
echo Creating $JBR.tar.gz ...
|
||||
/usr/bin/tar -czf $JBR.tar.gz -C $BASE_DIR ${JBR_BUNDLE} || exit 1
|
||||
|
||||
JBRSDK_TEST=$JBRSDK_BASE_NAME-windows-test-x86-b$build_number
|
||||
echo Creating $JBRSDK_TEST.tar.gz ...
|
||||
/usr/bin/tar -czf $JBRSDK_TEST.tar.gz -C $IMAGES_DIR --exclude='test/jdk/demos' test || exit 1
|
||||
@@ -789,6 +789,15 @@ define SetupRunJtregTestBody
|
||||
$1_JTREG_BASIC_OPTIONS += -ea -esa
|
||||
endif
|
||||
|
||||
ifeq ($$(ASAN_ENABLED), yes)
|
||||
$1_JTREG_BASIC_OPTIONS += -e:ASAN_OPTIONS=handle_segv=0:handle_sigfpe=0:detect_leaks=false
|
||||
$1_JTREG_BASIC_OPTIONS += -e:LD_PRELOAD=libasan.so.5
|
||||
endif
|
||||
|
||||
ifeq ($$(USAN_ENABLED), yes)
|
||||
$1_JTREG_BASIC_OPTIONS += -e:LD_PRELOAD=libubsan.so.1
|
||||
endif
|
||||
|
||||
ifneq ($$($1_JTREG_NATIVEPATH), )
|
||||
$1_JTREG_BASIC_OPTIONS += -nativepath:$$($1_JTREG_NATIVEPATH)
|
||||
endif
|
||||
|
||||
@@ -217,6 +217,9 @@ JDKOPT_SETUP_CODE_COVERAGE
|
||||
# AddressSanitizer
|
||||
JDKOPT_SETUP_ADDRESS_SANITIZER
|
||||
|
||||
# UndefinedBehaviorSanitizer
|
||||
JDKOPT_SETUP_UNDEFINED_BEHAVIOR_SANITIZER
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Check dependencies for external and internal libraries.
|
||||
|
||||
@@ -230,7 +230,7 @@ AC_DEFUN([FLAGS_SETUP_OPTIMIZATION],
|
||||
DISABLE_FORTIFY_CFLAGS="-U_FORTIFY_SOURCE"
|
||||
# ASan doesn't work well with _FORTIFY_SOURCE
|
||||
# See https://github.com/google/sanitizers/wiki/AddressSanitizer#faq
|
||||
if test "x$ASAN_ENABLED" = xyes; then
|
||||
if test "x$ASAN_ENABLED" = xyes || test "x$USAN_ENABLED" = xyes; then
|
||||
ENABLE_FORTIFY_CFLAGS="${DISABLE_FORTIFY_CFLAGS}"
|
||||
else
|
||||
ENABLE_FORTIFY_CFLAGS="-D_FORTIFY_SOURCE=2"
|
||||
|
||||
@@ -436,6 +436,45 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER],
|
||||
AC_SUBST(ASAN_ENABLED)
|
||||
])
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# UndefinedBehaviorSanitizer
|
||||
#
|
||||
AC_DEFUN_ONCE([JDKOPT_SETUP_UNDEFINED_BEHAVIOR_SANITIZER],
|
||||
[
|
||||
UTIL_ARG_ENABLE(NAME: usan, DEFAULT: false,
|
||||
DESC: [enable UndefinedBehaviorSanitizer],
|
||||
CHECK_AVAILABLE: [
|
||||
AC_MSG_CHECKING([if UndefinedBehaviorSanitizer (usan) is available])
|
||||
if test "x$TOOLCHAIN_TYPE" = "xgcc" ||
|
||||
test "x$TOOLCHAIN_TYPE" = "xclang"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AVAILABLE=false
|
||||
fi
|
||||
],
|
||||
IF_ENABLED: [
|
||||
USAN_FLAGS="-fsanitize=undefined"
|
||||
USAN_CFLAGS="$USAN_FLAGS -fno-omit-frame-pointer"
|
||||
USAN_LDFLAGS="$USAN_FLAGS"
|
||||
JVM_CFLAGS="$JVM_CFLAGS $USAN_CFLAGS"
|
||||
JVM_LDFLAGS="$JVM_LDFLAGS $USAN_LDFLAGS"
|
||||
CFLAGS_JDKLIB="$CFLAGS_JDKLIB $USAN_CFLAGS"
|
||||
CFLAGS_JDKEXE="$CFLAGS_JDKEXE $USAN_CFLAGS"
|
||||
CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $USAN_CFLAGS"
|
||||
CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $USAN_CFLAGS"
|
||||
LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $USAN_LDFLAGS"
|
||||
LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $USAN_LDFLAGS"
|
||||
USAN_ENABLED="yes"
|
||||
],
|
||||
IF_DISABLED: [
|
||||
USAN_ENABLED="no"
|
||||
])
|
||||
|
||||
AC_SUBST(USAN_ENABLED)
|
||||
])
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Static build support. When enabled will generate static
|
||||
|
||||
@@ -423,7 +423,16 @@ JCOV_FILTERS=@JCOV_FILTERS@
|
||||
export ASAN_ENABLED:=@ASAN_ENABLED@
|
||||
export DEVKIT_LIB_DIR:=@DEVKIT_LIB_DIR@
|
||||
ifeq ($(ASAN_ENABLED), yes)
|
||||
export ASAN_OPTIONS=handle_segv=0 detect_leaks=0
|
||||
export ASAN_OPTIONS=handle_segv=0:handle_sigfpe=0:detect_leaks=false
|
||||
ifneq ($(DEVKIT_LIB_DIR),)
|
||||
export LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH):$(DEVKIT_LIB_DIR)
|
||||
endif
|
||||
endif
|
||||
|
||||
# UndefinedBehaviorSanitizer
|
||||
export USAN_ENABLED:=@USAN_ENABLED@
|
||||
export DEVKIT_LIB_DIR:=@DEVKIT_LIB_DIR@
|
||||
ifeq ($(USAN_ENABLED), yes)
|
||||
ifneq ($(DEVKIT_LIB_DIR),)
|
||||
export LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH):$(DEVKIT_LIB_DIR)
|
||||
endif
|
||||
|
||||
@@ -52,7 +52,7 @@ allfonts.myanmar=Myanmar Text
|
||||
allfonts.dingbats=Wingdings
|
||||
allfonts.symbol=Symbol
|
||||
allfonts.symbols=Segoe UI Symbol
|
||||
allfonts.thai=DokChampa
|
||||
allfonts.thai=Tahoma
|
||||
allfonts.georgian=Sylfaen
|
||||
|
||||
serif.plain.alphabetic=Times New Roman
|
||||
@@ -60,140 +60,140 @@ serif.plain.chinese-ms950=MingLiU
|
||||
serif.plain.chinese-ms950-extb=MingLiU-ExtB
|
||||
serif.plain.hebrew=David
|
||||
serif.plain.japanese=MS Mincho
|
||||
serif.plain.korean=Batang
|
||||
serif.plain.korean=Malgun Gothic
|
||||
|
||||
serif.bold.alphabetic=Times New Roman Bold
|
||||
serif.bold.chinese-ms950=PMingLiU
|
||||
serif.bold.chinese-ms950-extb=PMingLiU-ExtB
|
||||
serif.bold.hebrew=David Bold
|
||||
serif.bold.japanese=MS Mincho
|
||||
serif.bold.korean=Batang
|
||||
serif.bold.korean=Malgun Gothic
|
||||
|
||||
serif.italic.alphabetic=Times New Roman Italic
|
||||
serif.italic.chinese-ms950=PMingLiU
|
||||
serif.italic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
serif.italic.hebrew=David
|
||||
serif.italic.japanese=MS Mincho
|
||||
serif.italic.korean=Batang
|
||||
serif.italic.korean=Malgun Gothic
|
||||
|
||||
serif.bolditalic.alphabetic=Times New Roman Bold Italic
|
||||
serif.bolditalic.chinese-ms950=PMingLiU
|
||||
serif.bolditalic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
serif.bolditalic.hebrew=David Bold
|
||||
serif.bolditalic.japanese=MS Mincho
|
||||
serif.bolditalic.korean=Batang
|
||||
serif.bolditalic.korean=Malgun Gothic
|
||||
|
||||
sansserif.plain.alphabetic=Arial
|
||||
sansserif.plain.chinese-ms950=MingLiU
|
||||
sansserif.plain.chinese-ms950-extb=MingLiU-ExtB
|
||||
sansserif.plain.hebrew=David
|
||||
sansserif.plain.japanese=MS Gothic
|
||||
sansserif.plain.korean=Gulim
|
||||
sansserif.plain.korean=Malgun Gothic
|
||||
|
||||
sansserif.bold.alphabetic=Arial Bold
|
||||
sansserif.bold.chinese-ms950=PMingLiU
|
||||
sansserif.bold.chinese-ms950-extb=PMingLiU-ExtB
|
||||
sansserif.bold.hebrew=David Bold
|
||||
sansserif.bold.japanese=MS Gothic
|
||||
sansserif.bold.korean=Gulim
|
||||
sansserif.bold.korean=Malgun Gothic
|
||||
|
||||
sansserif.italic.alphabetic=Arial Italic
|
||||
sansserif.italic.chinese-ms950=PMingLiU
|
||||
sansserif.italic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
sansserif.italic.hebrew=David
|
||||
sansserif.italic.japanese=MS Gothic
|
||||
sansserif.italic.korean=Gulim
|
||||
sansserif.italic.korean=Malgun Gothic
|
||||
|
||||
sansserif.bolditalic.alphabetic=Arial Bold Italic
|
||||
sansserif.bolditalic.chinese-ms950=PMingLiU
|
||||
sansserif.bolditalic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
sansserif.bolditalic.hebrew=David Bold
|
||||
sansserif.bolditalic.japanese=MS Gothic
|
||||
sansserif.bolditalic.korean=Gulim
|
||||
sansserif.bolditalic.korean=Malgun Gothic
|
||||
|
||||
monospaced.plain.alphabetic=Courier New
|
||||
monospaced.plain.chinese-ms950=MingLiU
|
||||
monospaced.plain.chinese-ms950-extb=MingLiU-ExtB
|
||||
monospaced.plain.hebrew=Courier New
|
||||
monospaced.plain.japanese=MS Gothic
|
||||
monospaced.plain.korean=GulimChe
|
||||
monospaced.plain.korean=Malgun Gothic
|
||||
|
||||
monospaced.bold.alphabetic=Courier New Bold
|
||||
monospaced.bold.chinese-ms950=PMingLiU
|
||||
monospaced.bold.chinese-ms950-extb=PMingLiU-ExtB
|
||||
monospaced.bold.hebrew=Courier New Bold
|
||||
monospaced.bold.japanese=MS Gothic
|
||||
monospaced.bold.korean=GulimChe
|
||||
monospaced.bold.korean=Malgun Gothic
|
||||
|
||||
monospaced.italic.alphabetic=Courier New Italic
|
||||
monospaced.italic.chinese-ms950=PMingLiU
|
||||
monospaced.italic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
monospaced.italic.hebrew=Courier New
|
||||
monospaced.italic.japanese=MS Gothic
|
||||
monospaced.italic.korean=GulimChe
|
||||
monospaced.italic.korean=Malgun Gothic
|
||||
|
||||
monospaced.bolditalic.alphabetic=Courier New Bold Italic
|
||||
monospaced.bolditalic.chinese-ms950=PMingLiU
|
||||
monospaced.bolditalic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
monospaced.bolditalic.hebrew=Courier New Bold
|
||||
monospaced.bolditalic.japanese=MS Gothic
|
||||
monospaced.bolditalic.korean=GulimChe
|
||||
monospaced.bolditalic.korean=Malgun Gothic
|
||||
|
||||
dialog.plain.alphabetic=Arial
|
||||
dialog.plain.chinese-ms950=MingLiU
|
||||
dialog.plain.chinese-ms950-extb=MingLiU-ExtB
|
||||
dialog.plain.hebrew=David
|
||||
dialog.plain.japanese=MS Gothic
|
||||
dialog.plain.korean=Gulim
|
||||
dialog.plain.korean=Malgun Gothic
|
||||
|
||||
dialog.bold.alphabetic=Arial Bold
|
||||
dialog.bold.chinese-ms950=PMingLiU
|
||||
dialog.bold.chinese-ms950-extb=PMingLiU-ExtB
|
||||
dialog.bold.hebrew=David Bold
|
||||
dialog.bold.japanese=MS Gothic
|
||||
dialog.bold.korean=Gulim
|
||||
dialog.bold.korean=Malgun Gothic
|
||||
|
||||
dialog.italic.alphabetic=Arial Italic
|
||||
dialog.italic.chinese-ms950=PMingLiU
|
||||
dialog.italic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
dialog.italic.hebrew=David
|
||||
dialog.italic.japanese=MS Gothic
|
||||
dialog.italic.korean=Gulim
|
||||
dialog.italic.korean=Malgun Gothic
|
||||
|
||||
dialog.bolditalic.alphabetic=Arial Bold Italic
|
||||
dialog.bolditalic.chinese-ms950=PMingLiU
|
||||
dialog.bolditalic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
dialog.bolditalic.hebrew=David Bold
|
||||
dialog.bolditalic.japanese=MS Gothic
|
||||
dialog.bolditalic.korean=Gulim
|
||||
dialog.bolditalic.korean=Malgun Gothic
|
||||
|
||||
dialoginput.plain.alphabetic=Courier New
|
||||
dialoginput.plain.chinese-ms950=MingLiU
|
||||
dialoginput.plain.chinese-ms950-extb=MingLiU-ExtB
|
||||
dialoginput.plain.hebrew=David
|
||||
dialoginput.plain.japanese=MS Gothic
|
||||
dialoginput.plain.korean=Gulim
|
||||
dialoginput.plain.korean=Malgun Gothic
|
||||
|
||||
dialoginput.bold.alphabetic=Courier New Bold
|
||||
dialoginput.bold.chinese-ms950=PMingLiU
|
||||
dialoginput.bold.chinese-ms950-extb=PMingLiU-ExtB
|
||||
dialoginput.bold.hebrew=David Bold
|
||||
dialoginput.bold.japanese=MS Gothic
|
||||
dialoginput.bold.korean=Gulim
|
||||
dialoginput.bold.korean=Malgun Gothic
|
||||
|
||||
dialoginput.italic.alphabetic=Courier New Italic
|
||||
dialoginput.italic.chinese-ms950=PMingLiU
|
||||
dialoginput.italic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
dialoginput.italic.hebrew=David
|
||||
dialoginput.italic.japanese=MS Gothic
|
||||
dialoginput.italic.korean=Gulim
|
||||
dialoginput.italic.korean=Malgun Gothic
|
||||
|
||||
dialoginput.bolditalic.alphabetic=Courier New Bold Italic
|
||||
dialoginput.bolditalic.chinese-ms950=PMingLiU
|
||||
dialoginput.bolditalic.chinese-ms950-extb=PMingLiU-ExtB
|
||||
dialoginput.bolditalic.hebrew=David Bold
|
||||
dialoginput.bolditalic.japanese=MS Gothic
|
||||
dialoginput.bolditalic.korean=Gulim
|
||||
dialoginput.bolditalic.korean=Malgun Gothic
|
||||
|
||||
# Search Sequences
|
||||
|
||||
@@ -230,7 +230,7 @@ sequence.dialog.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,dingbats
|
||||
sequence.dialoginput.x-MS950-HKSCS-XP=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol,chinese-ms950-extb
|
||||
|
||||
sequence.allfonts.UTF-8.hi=alphabetic/1252,devanagari,dingbats,symbol
|
||||
sequence.allfonts.UTF-8.ja=alphabetic,japanese,dingbats,symbol
|
||||
sequence.allfonts.UTF-8.ja=alphabetic,japanese,devanagari,dingbats,symbol
|
||||
|
||||
sequence.allfonts.windows-1255=hebrew,alphabetic/1252,dingbats,symbol
|
||||
|
||||
@@ -257,7 +257,7 @@ sequence.fallback=symbols,\
|
||||
|
||||
# Exclusion Ranges
|
||||
|
||||
exclusion.alphabetic=0700-1cff,1d80-1e9f,1f00-2017,2020-20ab,20ad-20b8,20bb-20bc,20be-f8ff
|
||||
exclusion.alphabetic=0700-1cff,1d80-1e9f,1f00-2017,2020-20ab,20ad-20b8,20bb-20bc,20be-24ff,2501-2501,2503-250b,250d-250f,2511-2513,2515-2517,2519-251b,251d-2523,2525-252b,252d-2533,2535-253b,253d-254f,256d-f8ff
|
||||
exclusion.chinese-gb18030=0390-03d6,2200-22ef,2701-27be
|
||||
exclusion.hebrew=0041-005a,0060-007a,007f-00ff,20ac-20ac
|
||||
|
||||
@@ -303,21 +303,18 @@ filename.MS_PMincho=MSMINCHO.TTC
|
||||
filename.MS_Gothic=MSGOTHIC.TTC
|
||||
filename.MS_PGothic=MSGOTHIC.TTC
|
||||
|
||||
filename.Gulim=gulim.TTC
|
||||
filename.Batang=batang.TTC
|
||||
filename.GulimChe=gulim.TTC
|
||||
|
||||
filename.Gautami=gautami.ttf
|
||||
filename.Iskoola_Pota=iskpota.ttf
|
||||
filename.Kalinga=kalinga.ttf
|
||||
filename.Kartika=kartika.ttf
|
||||
filename.Latha=latha.ttf
|
||||
filename.Malgun_Gothic=malgun.ttf
|
||||
filename.Mangal=MANGAL.TTF
|
||||
filename.Raavi=raavi.ttf
|
||||
filename.Shruti=shruti.ttf
|
||||
filename.Tahoma=tahoma.ttf
|
||||
filename.Tunga=TUNGA.TTF
|
||||
filename.Vrinda=vrinda.ttf
|
||||
filename.DokChampa=dokchamp.ttf
|
||||
filename.Khmer_UI=KhmerUI.ttf
|
||||
filename.Mongolian_Baiti=monbaiti.ttf
|
||||
filename.Myanmar_Text=mmrtext.ttf
|
||||
|
||||
@@ -272,12 +272,14 @@ XEvent.xclient 0
|
||||
XEvent.xcolormap 0
|
||||
XEvent.xconfigure 0
|
||||
XEvent.xconfigurerequest 0
|
||||
XEvent.xcookie 0
|
||||
XEvent.xcreatewindow 0
|
||||
XEvent.xcrossing 0
|
||||
XEvent.xdestroywindow 0
|
||||
XEvent.xerror 0
|
||||
XEvent.xexpose 0
|
||||
XEvent.xfocus 0
|
||||
XEvent.xgeneric 0
|
||||
XEvent.xgraphicsexpose 0
|
||||
XEvent.xgravity 0
|
||||
XEvent.xkey 0
|
||||
@@ -370,6 +372,22 @@ XGCValues.subwindow_mode 96
|
||||
XGCValues.tile 64
|
||||
XGCValues.ts_x_origin 80
|
||||
XGCValues.ts_y_origin 84
|
||||
XGenericEvent 40
|
||||
XGenericEventCookie 56
|
||||
XGenericEventCookie.cookie 40
|
||||
XGenericEventCookie.data 48
|
||||
XGenericEventCookie.display 24
|
||||
XGenericEventCookie.evtype 36
|
||||
XGenericEventCookie.extension 32
|
||||
XGenericEventCookie.send_event 16
|
||||
XGenericEventCookie.serial 8
|
||||
XGenericEventCookie.type 0
|
||||
XGenericEvent.display 24
|
||||
XGenericEvent.evtype 36
|
||||
XGenericEvent.extension 32
|
||||
XGenericEvent.send_event 16
|
||||
XGenericEvent.serial 8
|
||||
XGenericEvent.type 0
|
||||
XGraphicsExposeEvent 72
|
||||
XGraphicsExposeEvent.count 56
|
||||
XGraphicsExposeEvent.display 24
|
||||
@@ -396,6 +414,9 @@ XHostAddress 16
|
||||
XHostAddress.address 8
|
||||
XHostAddress.family 0
|
||||
XHostAddress.length 4
|
||||
XIButtonState 16
|
||||
XIButtonState.mask 8
|
||||
XIButtonState.mask_len 0
|
||||
XIconSize 24
|
||||
XIconSize.height_inc 20
|
||||
XIconSize.max_height 12
|
||||
@@ -403,6 +424,29 @@ XIconSize.max_width 8
|
||||
XIconSize.min_height 4
|
||||
XIconSize.min_width 0
|
||||
XIconSize.width_inc 16
|
||||
XIDeviceEvent 200
|
||||
XIDeviceEvent.buttons 128
|
||||
XIDeviceEvent.child 80
|
||||
XIDeviceEvent.detail 56
|
||||
XIDeviceEvent.deviceid 48
|
||||
XIDeviceEvent.display 24
|
||||
XIDeviceEvent.event 72
|
||||
XIDeviceEvent.event_x 104
|
||||
XIDeviceEvent.event_y 112
|
||||
XIDeviceEvent.evtype 36
|
||||
XIDeviceEvent.extension 32
|
||||
XIDeviceEvent.flags 120
|
||||
XIDeviceEvent.group 184
|
||||
XIDeviceEvent.mods 168
|
||||
XIDeviceEvent.root 64
|
||||
XIDeviceEvent.root_x 88
|
||||
XIDeviceEvent.root_y 96
|
||||
XIDeviceEvent.send_event 16
|
||||
XIDeviceEvent.serial 8
|
||||
XIDeviceEvent.sourceid 52
|
||||
XIDeviceEvent.time 40
|
||||
XIDeviceEvent.type 0
|
||||
XIDeviceEvent.valuators 144
|
||||
XImage 136
|
||||
XImage.bitmap_bit_order 32
|
||||
XImage.bitmap_pad 36
|
||||
@@ -436,6 +480,11 @@ XIMHotKeyTrigger.modifier_mask 12
|
||||
XIMHotKeyTriggers 16
|
||||
XIMHotKeyTriggers.key 8
|
||||
XIMHotKeyTriggers.num_hot_key 0
|
||||
XIModifierState 16
|
||||
XIModifierState.base 0
|
||||
XIModifierState.effective 12
|
||||
XIModifierState.latched 4
|
||||
XIModifierState.locked 8
|
||||
XIMPreeditCaretCallbackStruct 12
|
||||
XIMPreeditCaretCallbackStruct.direction 4
|
||||
XIMPreeditCaretCallbackStruct.position 0
|
||||
@@ -472,6 +521,10 @@ XIMText.string 24
|
||||
XIMValuesList 16
|
||||
XIMValuesList.count_values 0
|
||||
XIMValuesList.supported_values 8
|
||||
XIValuatorState 24
|
||||
XIValuatorState.mask 8
|
||||
XIValuatorState.mask_len 0
|
||||
XIValuatorState.values 16
|
||||
XkbAccessXNotifyEvent 64
|
||||
XkbAccessXNotifyEvent.debounce_delay 60
|
||||
XkbAccessXNotifyEvent.detail 48
|
||||
|
||||
@@ -127,6 +127,22 @@ XKeymapEvent
|
||||
display long
|
||||
window long
|
||||
key_vector array byte 32
|
||||
XGenericEvent
|
||||
type int
|
||||
serial long
|
||||
send_event Bool
|
||||
display long
|
||||
extension int
|
||||
evtype int
|
||||
XGenericEventCookie
|
||||
type int
|
||||
serial long
|
||||
send_event Bool
|
||||
display long
|
||||
extension int
|
||||
evtype int
|
||||
cookie int
|
||||
data pointer
|
||||
XDestroyWindowEvent
|
||||
type int
|
||||
serial long
|
||||
@@ -814,6 +830,8 @@ XEvent
|
||||
xmapping struct XMappingEvent
|
||||
xerror struct XErrorEvent
|
||||
xkeymap struct XKeymapEvent
|
||||
xgeneric struct XGenericEvent
|
||||
xcookie struct XGenericEventCookie
|
||||
pad array long 24
|
||||
|
||||
XkbAnyEvent
|
||||
@@ -1039,3 +1057,42 @@ XkbEvent
|
||||
accessx struct XkbAccessXNotifyEvent
|
||||
device struct XkbExtensionDeviceNotifyEvent
|
||||
core struct XEvent
|
||||
|
||||
XIButtonState
|
||||
mask_len int
|
||||
mask pointer byte
|
||||
|
||||
XIValuatorState
|
||||
mask_len int
|
||||
mask pointer byte
|
||||
values pointer double
|
||||
|
||||
XIModifierState
|
||||
base int
|
||||
latched int
|
||||
locked int
|
||||
effective int
|
||||
|
||||
XIDeviceEvent
|
||||
type int
|
||||
serial long
|
||||
send_event Bool
|
||||
display long
|
||||
extension int
|
||||
evtype int
|
||||
time ulong
|
||||
deviceid int
|
||||
sourceid int
|
||||
detail int
|
||||
root long
|
||||
event long
|
||||
child long
|
||||
root_x double
|
||||
root_y double
|
||||
event_x double
|
||||
event_y double
|
||||
flags int
|
||||
buttons struct XIButtonState
|
||||
valuators struct XIValuatorState
|
||||
mods struct XIModifierState
|
||||
group struct XIModifierState
|
||||
|
||||
@@ -52,8 +52,10 @@ else #with SPEC
|
||||
moduleDependencies='$(call FindTransitiveDepsForModule,$(mod))' \
|
||||
#)\"" > $(OUT)
|
||||
$(ECHO) "MODULE_NAMES=\"$(strip $(foreach mod, $(SEL_MODULES), $(mod)))\"" >> $(OUT)
|
||||
$(ECHO) "RELATIVE_TOPLEVEL_PROJECT_DIR=\"$(call RelativePath,$(TOPLEVEL_DIR),$(IDEA_OUTPUT_PARENT))\"" >> $(OUT)
|
||||
$(ECHO) "RELATIVE_PROJECT_DIR=\"$(call RelativePath,$(topdir),$(IDEA_OUTPUT_PARENT))\"" >> $(OUT)
|
||||
$(ECHO) "RELATIVE_BUILD_DIR=\"$(call RelativePath,$(OUTPUTDIR),$(IDEA_OUTPUT_PARENT))\"" >> $(OUT)
|
||||
$(ECHO) "CLION_RELATIVE_PROJECT_DIR=\"$(call RelativePath,$(topdir),$(IDEA_OUTPUT_PARENT)/.idea/jdk-clion)\"" >> $(OUT)
|
||||
$(ECHO) "PATHTOOL=\"$(PATHTOOL)\"" >> $(OUT)
|
||||
$(ECHO) "JT_HOME=\"$(JT_HOME)\"" >> $(OUT)
|
||||
$(ECHO) "WINENV_ROOT=\"$(WINENV_ROOT)\"" >> $(OUT)
|
||||
|
||||
25
make/ide/idea/jdk/template/jdk-clion/.idea/misc.xml
generated
Normal file
25
make/ide/idea/jdk/template/jdk-clion/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CidrRootsConfiguration">
|
||||
<excludeRoots>
|
||||
<file path="###CLION_PROJECT_DIR###/build" />
|
||||
<file path="###CLION_PROJECT_DIR###/make" />
|
||||
</excludeRoots>
|
||||
</component>
|
||||
<component name="CompDBSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<CompDBProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</CompDBProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
<component name="CompDBWorkspace" PROJECT_DIR="$PROJECT_DIR$">
|
||||
<contentRoot DIR="###CLION_PROJECT_DIR###" />
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
</project>
|
||||
16
make/ide/idea/jdk/template/jdk-clion/.idea/vcs.xml
generated
Normal file
16
make/ide/idea/jdk/template/jdk-clion/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="IssueNavigationConfiguration">
|
||||
<option name="links">
|
||||
<list>
|
||||
<IssueNavigationLink>
|
||||
<option name="issueRegexp" value="(?:^|\s|\p{Punct})(?:JDK-)?(\d{7})(?=$|\s|\p{Punct})" />
|
||||
<option name="linkRegexp" value="https://bugs.openjdk.java.net/browse/JDK-$1" />
|
||||
</IssueNavigationLink>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="###CLION_PROJECT_DIR###" vcs="###VCS_TYPE###" />
|
||||
</component>
|
||||
</project>
|
||||
55
make/ide/idea/jdk/template/jdk-clion/.idea/workspace.xml
generated
Normal file
55
make/ide/idea/jdk/template/jdk-clion/.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ClangdSettings">
|
||||
<option name="formatViaClangd" value="false" />
|
||||
</component>
|
||||
<component name="CompDBLocalSettings">
|
||||
<option name="availableProjects">
|
||||
<map>
|
||||
<entry>
|
||||
<key>
|
||||
<ExternalProjectPojo>
|
||||
<option name="name" value="jdk-clion" />
|
||||
<option name="path" value="$PROJECT_DIR$" />
|
||||
</ExternalProjectPojo>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<ExternalProjectPojo>
|
||||
<option name="name" value="jdk-clion" />
|
||||
<option name="path" value="$PROJECT_DIR$" />
|
||||
</ExternalProjectPojo>
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
<option name="projectSyncType">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$" value="RE_IMPORT" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ExternalProjectsData">
|
||||
<projectState path="$PROJECT_DIR$">
|
||||
<ProjectState />
|
||||
</projectState>
|
||||
</component>
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="RunOnceActivity.cidr.known.project.marker" value="true" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="cf.first.check.clang-format" value="false" />
|
||||
<property name="cidr.known.project.marker" value="true" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="settings.editor.selected.configurable" value="CPPToolchains" />
|
||||
</component>
|
||||
</project>
|
||||
29
make/ide/idea/jdk/template/jdk-clion/update-project.sh
Normal file
29
make/ide/idea/jdk/template/jdk-clion/update-project.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
TOPDIR="###CLION_SCRIPT_TOPDIR###"
|
||||
BUILD_DIR="###RELATIVE_BUILD_DIR###"
|
||||
PATHTOOL="###PATHTOOL###"
|
||||
|
||||
|
||||
|
||||
cd "`dirname $0`"
|
||||
SCRIPT_DIR="`pwd`"
|
||||
cd "$TOPDIR"
|
||||
|
||||
echo "Updating Clion project files in \"$SCRIPT_DIR\" for project \"`pwd`\""
|
||||
|
||||
set -o pipefail
|
||||
make compile-commands SPEC="$BUILD_DIR/spec.gmk" | sed 's/^/ /' || exit 1
|
||||
|
||||
if [ "x$PATHTOOL" != "x" ]; then
|
||||
CLION_PROJECT_DIR="`$PATHTOOL -am $SCRIPT_DIR`"
|
||||
sed "s/\\\\\\\\\\\\\\\\/\\\\\\\\/g" "$BUILD_DIR/compile_commands.json" > "$SCRIPT_DIR/compile_commands.json"
|
||||
else
|
||||
CLION_PROJECT_DIR="$SCRIPT_DIR"
|
||||
cp "$BUILD_DIR/compile_commands.json" "$SCRIPT_DIR"
|
||||
fi
|
||||
|
||||
echo "
|
||||
Now you can open \"$CLION_PROJECT_DIR\" as Clion project
|
||||
If Clion complains about missing files when loading a project, building it may help:
|
||||
cd \"`pwd`\" && make SPEC=\"$BUILD_DIR/spec.gmk\""
|
||||
@@ -2,7 +2,7 @@
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://###MODULE_DIR###">
|
||||
<content url="file://###TOPLEVEL_MODULE_DIR###">
|
||||
<excludeFolder url="file://###MODULE_DIR###/build" />
|
||||
<excludeFolder url="file://###MODULE_DIR###/make" />
|
||||
</content>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<jre alt="true" value="###BUILD_DIR###/images/jdk" />
|
||||
<options></options>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" assert-keyword="true" jdk-15="true">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" assert-keyword="true" jdk-15="true">
|
||||
<output url="file://###BUILD_DIR###/idea" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://###MODULE_DIR###/###MODULE_CONTENT###">
|
||||
###SOURCE_DIRS###
|
||||
</content>
|
||||
###MODULE_CONTENT_ROOTS###
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
###DEPENDENCIES###
|
||||
<orderEntry type="inheritedJdk" />
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://###MODULE_DIR###/test/jdk"></content>
|
||||
<orderEntry type="sourceFolder" forTests="true" />
|
||||
###TEST_MODULE_DEPENDENCIES###
|
||||
<orderEntry type="inheritedJdk" />
|
||||
</component>
|
||||
</module>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://###MODULE_DIR###/test/jdk"></content>
|
||||
<orderEntry type="sourceFolder" forTests="true" />
|
||||
###TEST_MODULE_DEPENDENCIES###
|
||||
<orderEntry type="inheritedJdk" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="IssueNavigationConfiguration">
|
||||
<option name="links">
|
||||
<list>
|
||||
<IssueNavigationLink>
|
||||
<option name="issueRegexp" value="(?:^|\s|\p{Punct})(?:JDK-)?(\d{7})(?=$|\s|\p{Punct})" />
|
||||
<option name="linkRegexp" value="https://bugs.openjdk.java.net/browse/JDK-$1" />
|
||||
</IssueNavigationLink>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="###PROJECT_DIR###" vcs="###VCS_TYPE###" />
|
||||
<mapping directory="###TOPLEVEL_PROJECT_DIR###" vcs="###VCS_TYPE###" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -1142,6 +1142,8 @@ public class WrapperGenerator {
|
||||
pw.println("/* This file is an automatically generated file, please do not edit this file, modify the XlibParser.java file instead !*/\n" );
|
||||
pw.println("#include <X11/Xlib.h>\n#include <X11/Xutil.h>\n#include <X11/Xos.h>\n#include <X11/Xatom.h>\n#include <stdio.h>\n");
|
||||
pw.println("#include <X11/extensions/Xdbe.h>");
|
||||
pw.println("#include <X11/extensions/XI2.h>");
|
||||
pw.println("#include <X11/extensions/XInput2.h>");
|
||||
pw.println("#include <X11/XKBlib.h>");
|
||||
pw.println("#include \"awt_p.h\"");
|
||||
pw.println("#include \"color.h\"");
|
||||
|
||||
@@ -82,3 +82,13 @@ $(eval $(call SetupCopyLegalFiles, COPY_LEGAL, \
|
||||
TARGETS += $(COPY_LEGAL)
|
||||
|
||||
################################################################################
|
||||
|
||||
FONTFILE_SRC_DIR := $(TOPDIR)/src/java.desktop/share
|
||||
FONTFILE_SRCS := $(wildcard $(FONTFILE_SRC_DIR)/fonts/*.ttf) $(FONTFILE_SRC_DIR)/fonts/fonts.dir $(FONTFILE_SRC_DIR)/fonts/font.conf
|
||||
FONTFILE_TARGET_FILES := $(subst $(FONTFILE_SRC_DIR),$(LIB_DST_DIR),$(FONTFILE_SRCS))
|
||||
|
||||
$(LIB_DST_DIR)/fonts/%: $(FONTFILE_SRC_DIR)/fonts/%
|
||||
$(call install-file)
|
||||
|
||||
|
||||
TARGETS += $(FONTFILE_TARGET_FILES)
|
||||
|
||||
@@ -73,6 +73,7 @@ ifeq ($(call isTargetOs, windows), true)
|
||||
$(TOPDIR)/src/$(MODULE)/share/native/common/font \
|
||||
$(TOPDIR)/src/$(MODULE)/share/native/common/java2d/opengl \
|
||||
$(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt/systemscale \
|
||||
$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/launcher \
|
||||
#
|
||||
endif
|
||||
|
||||
@@ -167,7 +168,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBAWT, \
|
||||
LIBS_windows := kernel32.lib user32.lib gdi32.lib winspool.lib \
|
||||
imm32.lib ole32.lib uuid.lib shell32.lib \
|
||||
comdlg32.lib winmm.lib comctl32.lib shlwapi.lib \
|
||||
delayimp.lib jvm.lib $(WIN_JAVA_LIB) advapi32.lib, \
|
||||
delayimp.lib jvm.lib $(WIN_JAVA_LIB) advapi32.lib dwmapi.lib, \
|
||||
VERSIONINFO_RESOURCE := $(LIBAWT_VERSIONINFO_RESOURCE), \
|
||||
EXTRA_RCFLAGS := $(LIBAWT_RCFLAGS), \
|
||||
))
|
||||
@@ -493,10 +494,12 @@ else ifeq ($(call isTargetOs, macosx), true)
|
||||
LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
|
||||
X11TextRenderer.c \
|
||||
fontpath.c \
|
||||
lcdglyph.c
|
||||
lcdglyph.c \
|
||||
lcdglyphDW.cpp
|
||||
else
|
||||
LIBFONTMANAGER_EXCLUDE_FILES += fontpath.c \
|
||||
lcdglyph.c
|
||||
lcdglyph.c \
|
||||
lcdglyphDW.cpp
|
||||
endif
|
||||
|
||||
LIBFONTMANAGER_CFLAGS += $(X_CFLAGS) -DLE_STANDALONE -DHEADLESS
|
||||
|
||||
@@ -88,6 +88,17 @@ else
|
||||
BUILD_JDK_JTREG_EXCLUDE += libTestDynamicStore.m
|
||||
endif
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
BUILD_JDK_JTREG_LIBRARIES_LIBS_libwindows_touch_robot := user32.lib
|
||||
BUILD_JDK_JTREG_EXCLUDE += libtouchscreen_device.c
|
||||
else
|
||||
ifeq ($(OPENJDK_TARGET_OS), linux)
|
||||
BUILD_JDK_JTREG_EXCLUDE += libwindows_touch_robot.c
|
||||
else
|
||||
BUILD_JDK_JTREG_EXCLUDE += libtouchscreen_device.c libwindows_touch_robot.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(call isTargetOs, linux), true)
|
||||
# Unconditionally compile with debug symbols and don't ever perform
|
||||
# stripping during the test libraries' build.
|
||||
|
||||
51
modules.list
Normal file
51
modules.list
Normal file
@@ -0,0 +1,51 @@
|
||||
java.base,
|
||||
java.compiler,
|
||||
java.datatransfer,
|
||||
java.desktop,
|
||||
java.instrument,
|
||||
java.logging,
|
||||
java.management,
|
||||
java.management.rmi,
|
||||
java.naming,
|
||||
java.net.http,
|
||||
java.prefs,
|
||||
java.rmi,
|
||||
java.scripting,
|
||||
java.se,
|
||||
java.security.jgss,
|
||||
java.security.sasl,
|
||||
java.smartcardio,
|
||||
java.sql,
|
||||
java.sql.rowset,
|
||||
java.transaction.xa,
|
||||
java.xml,
|
||||
java.xml.crypto,
|
||||
jdk.accessibility,
|
||||
jdk.attach,
|
||||
jdk.charsets,
|
||||
jdk.compiler,
|
||||
jdk.crypto.cryptoki,
|
||||
jdk.crypto.ec,
|
||||
jdk.dynalink,
|
||||
jdk.httpserver,
|
||||
jdk.internal.ed,
|
||||
jdk.internal.le,
|
||||
jdk.internal.vm.ci,
|
||||
jdk.jdi,
|
||||
jdk.jdwp.agent,
|
||||
jdk.jfr,
|
||||
jdk.jsobject,
|
||||
jdk.localedata,
|
||||
jdk.management,
|
||||
jdk.management.agent,
|
||||
jdk.management.jfr,
|
||||
jdk.naming.dns,
|
||||
jdk.naming.rmi,
|
||||
jdk.net,
|
||||
jdk.sctp,
|
||||
jdk.security.auth,
|
||||
jdk.security.jgss,
|
||||
jdk.unsupported,
|
||||
jdk.xml.dom,
|
||||
jdk.zipfs,
|
||||
jdk.hotspot.agent
|
||||
@@ -0,0 +1,320 @@
|
||||
package j2dbench.report;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.DirectoryIteratorException;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* The class reads J2DBench scores and reports them into output stream in format applicable for TeamCity charts.
|
||||
* The directory, where J2DBench result files placed, is specified via command line parameter like follows:
|
||||
* <p>
|
||||
* <code>-basexml | -b <xml file path></code>
|
||||
* </p>
|
||||
* This directory must contain one file with pattern <code>*{openjdk}*.{res}</code> which is considered as a container
|
||||
* of reference scores and several <code>*{jbsdk}*.{res}</code>.
|
||||
* <p>
|
||||
* <p> Names of these files have several mandatory fields separated by <code>"_"</code> and look like
|
||||
* <code>osName_jdkName_renderName_*.res</code>
|
||||
* </p>
|
||||
* <p>
|
||||
* If any of score is less than corresponding reference value by 5% then exit code <code>1</code> is returned otherwise
|
||||
* exit code <code>0</code> is returned.
|
||||
* <p>
|
||||
* Standard output will contain scores in format required for TeamCity charts.
|
||||
* <p>
|
||||
* Created by vprovodin on 13/02/2017.
|
||||
*/
|
||||
public class TCChartReporter {
|
||||
|
||||
private static boolean printTCValues = false;
|
||||
private static boolean printValues = false;
|
||||
|
||||
private static final DecimalFormat decimalFormat =
|
||||
new DecimalFormat("0.00");
|
||||
|
||||
private static FileSystem defaultFileSystem = FileSystems.getDefault();
|
||||
|
||||
private static double getMeasurementError(String testCaseName, String osName) {
|
||||
if (testCaseName.contains("text.Rendering.tests.drawString") && osName.toLowerCase().contains("lin") )
|
||||
return 0.18;
|
||||
return 0.1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Level at which tests are grouped to be displayed in summary
|
||||
*/
|
||||
private static final int LEVEL = 2;
|
||||
|
||||
/**
|
||||
* Holds the groups and corresponding group-display-names
|
||||
*/
|
||||
private static List<String> groups = new ArrayList<>();
|
||||
private static Map<String, Double> referenceValues = new HashMap<>();
|
||||
private static boolean testFailed = false;
|
||||
|
||||
private static void printUsage() {
|
||||
String usage =
|
||||
"\njava TCChartReporter [options] " +
|
||||
" \n\n" +
|
||||
"where options include: " +
|
||||
" \n" +
|
||||
" -basexml | -b <xml file path> " +
|
||||
"path to base-build result";
|
||||
System.out.println(usage);
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* String = getTestResultsTableForSummary()
|
||||
*/
|
||||
private static double generateTestCaseReport(
|
||||
Object key,
|
||||
Map<String, J2DAnalyzer.ResultHolder> testCaseResult,
|
||||
Map<String, Integer> testCaseResultCount) {
|
||||
|
||||
Integer curTestCountObj = testCaseResultCount.get(key.toString());
|
||||
int curTestCount = 0;
|
||||
if (curTestCountObj != null) {
|
||||
curTestCount = curTestCountObj;
|
||||
}
|
||||
|
||||
double totalScore = 0;
|
||||
|
||||
for (int i = 0; i < curTestCount; i++) {
|
||||
J2DAnalyzer.ResultHolder resultTCR = testCaseResult.get(key.toString() + "_" + i);
|
||||
totalScore = totalScore + resultTCR.getScore();
|
||||
}
|
||||
|
||||
return totalScore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Testcase Summary Report for TC - *.out
|
||||
*/
|
||||
private static void generateTestCaseSummaryReport(
|
||||
String OJRname,
|
||||
Map<String, Double> consoleResult,
|
||||
Map<String, J2DAnalyzer.ResultHolder> testCaseResult,
|
||||
Map<String, Integer> testCaseResultCount,
|
||||
boolean rememberReference) {
|
||||
|
||||
String curGroupName, curTestName;
|
||||
|
||||
Object[] groupNameArray = groups.toArray();
|
||||
|
||||
Object[] testCaseList = consoleResult.keySet().toArray();
|
||||
Arrays.sort(testCaseList);
|
||||
|
||||
for (Object aGroupNameArray : groupNameArray) {
|
||||
|
||||
double value;
|
||||
curGroupName = aGroupNameArray.toString();
|
||||
|
||||
for (Object aTestCaseList : testCaseList) {
|
||||
|
||||
curTestName = aTestCaseList.toString();
|
||||
|
||||
if (curTestName.contains(curGroupName)) {
|
||||
|
||||
value = generateTestCaseReport(curTestName, testCaseResult, testCaseResultCount);
|
||||
|
||||
if (printTCValues)
|
||||
System.out.println("##teamcity[buildStatisticValue key='" + (OJRname.isEmpty() ? "" : OJRname + ".") + curTestName
|
||||
+ "' value='" + decimalFormat.format(value) + "']");
|
||||
if (printValues)
|
||||
System.out.println((OJRname.isEmpty() ? "" : OJRname + ".") + curTestName + "," + decimalFormat.format(value));
|
||||
if (rememberReference) {
|
||||
referenceValues.put(curTestName, value);
|
||||
} else {
|
||||
double refValue = referenceValues.getOrDefault(curTestName, 0.);
|
||||
if (Math.abs(value/refValue - 1) >= getMeasurementError(curTestName, OJRname)) {
|
||||
System.err.println(OJRname);
|
||||
System.err.println(curTestName);
|
||||
System.err.println("\treferenceValue=" + refValue);
|
||||
System.err.println("\t actualValue=" + value);
|
||||
System.err.println("\t diff:" + ((value / refValue - 1) * 100));
|
||||
testFailed = (value < refValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* main
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
|
||||
String baseXML = null;
|
||||
int group = 2;
|
||||
|
||||
/* ---- Analysis Mode ----
|
||||
BEST = 1;
|
||||
WORST = 2;
|
||||
AVERAGE = 3;
|
||||
MIDAVG = 4;
|
||||
------------------------ */
|
||||
int analyzerMode = 4;
|
||||
|
||||
try {
|
||||
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
|
||||
if (args[i].startsWith("-basexml") ||
|
||||
args[i].startsWith("-b")) {
|
||||
i++;
|
||||
baseXML = args[i];
|
||||
} else if (args[i].startsWith("-tc")) {
|
||||
printTCValues = true;
|
||||
} else if (args[i].startsWith("-v"))
|
||||
printValues = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
printUsage();
|
||||
}
|
||||
|
||||
XMLHTMLReporter.setGroupLevel(group);
|
||||
J2DAnalyzer.setMode(analyzerMode);
|
||||
if (baseXML != null) {
|
||||
generateComparisonReport(defaultFileSystem.getPath(baseXML));
|
||||
} else {
|
||||
printUsage();
|
||||
}
|
||||
|
||||
if (testFailed)
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Test Group to the list
|
||||
*/
|
||||
private static void addGroup(String testName) {
|
||||
|
||||
String testNameSplit[] = testName.replace('.', '_').split("_");
|
||||
StringBuilder group = new StringBuilder(testNameSplit[0]);
|
||||
for (int i = 1; i < LEVEL; i++) {
|
||||
group.append(".").append(testNameSplit[i]);
|
||||
}
|
||||
|
||||
if (!groups.contains(group.toString()))
|
||||
groups.add(group.toString());
|
||||
}
|
||||
|
||||
private static List<Path> listResFiles(Path dir, String pattern) throws IOException {
|
||||
List<Path> result = new ArrayList<>();
|
||||
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, pattern)) {
|
||||
for (Path entry : stream) {
|
||||
result.add(entry);
|
||||
}
|
||||
} catch (DirectoryIteratorException ex) {
|
||||
throw ex.getCause();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the reports from the base & target result XML
|
||||
*/
|
||||
private static void generateComparisonReport(Path directoryToResFiles) {
|
||||
|
||||
if (directoryToResFiles.toFile().isDirectory()) {
|
||||
List<Path> jbsdkFiles, openjdkFiles;
|
||||
|
||||
try {
|
||||
jbsdkFiles = listResFiles(directoryToResFiles, "*{jbsdk,jbre}*.{res}");
|
||||
openjdkFiles = listResFiles(directoryToResFiles, "*{openjdk}*.{res}");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
readScores(openjdkFiles.get(0), true);
|
||||
|
||||
for (Path file : jbsdkFiles) {
|
||||
readScores(file, false);
|
||||
}
|
||||
} else {
|
||||
readScores(directoryToResFiles, true);
|
||||
}
|
||||
}
|
||||
|
||||
private static void readScores(Path file, boolean rememberReference) {
|
||||
String fileName = file.getName(file.getNameCount() - 1).toString();
|
||||
String osName="", jdkName="", renderName="";
|
||||
if (fileName.contains("win") || fileName.contains("linux") || fileName.contains("osx")) {
|
||||
String[] fileNameComponents = fileName.split("_");
|
||||
if (fileNameComponents.length > 0)
|
||||
osName = fileNameComponents[0];
|
||||
if (fileNameComponents.length > 1)
|
||||
jdkName = fileNameComponents[1];
|
||||
if (fileNameComponents.length > 2)
|
||||
renderName = fileNameComponents[2];
|
||||
}
|
||||
|
||||
String resultXMLFileName = file.toString();
|
||||
|
||||
J2DAnalyzer.results = new Vector();
|
||||
J2DAnalyzer.readResults(resultXMLFileName);
|
||||
J2DAnalyzer.SingleResultSetHolder baseSRSH =
|
||||
(J2DAnalyzer.SingleResultSetHolder) J2DAnalyzer.results.elementAt(0);
|
||||
Enumeration baseEnum_ = baseSRSH.getKeyEnumeration();
|
||||
Vector<String> baseKeyvector = new Vector<>();
|
||||
while (baseEnum_.hasMoreElements()) {
|
||||
baseKeyvector.add((String) baseEnum_.nextElement());
|
||||
}
|
||||
String baseKeys[] = new String[baseKeyvector.size()];
|
||||
baseKeyvector.copyInto(baseKeys);
|
||||
J2DAnalyzer.sort(baseKeys);
|
||||
|
||||
Map<String, Double> consoleBaseRes = new HashMap<>();
|
||||
|
||||
Map<String, J2DAnalyzer.ResultHolder> testCaseBaseResult = new HashMap<>();
|
||||
Map<String, Integer> testCaseResultCount = new HashMap<>();
|
||||
|
||||
for (String baseKey : baseKeys) {
|
||||
|
||||
J2DAnalyzer.ResultHolder baseTCR =
|
||||
baseSRSH.getResultByKey(baseKey);
|
||||
|
||||
Integer curTestCountObj = testCaseResultCount.get(baseTCR.getName());
|
||||
int curTestCount = 0;
|
||||
if (curTestCountObj != null) {
|
||||
curTestCount = curTestCountObj;
|
||||
}
|
||||
curTestCount++;
|
||||
testCaseBaseResult.put(baseTCR.getName() + "_" + (curTestCount - 1), baseTCR);
|
||||
testCaseResultCount.put(baseTCR.getName(), curTestCount);
|
||||
|
||||
addGroup(baseTCR.getName());
|
||||
|
||||
Double curTotalScoreObj = consoleBaseRes.get(baseTCR.getName());
|
||||
double curTotalScore = 0;
|
||||
if (curTotalScoreObj != null) {
|
||||
curTotalScore = curTotalScoreObj;
|
||||
}
|
||||
curTotalScore = curTotalScore + baseTCR.getScore();
|
||||
consoleBaseRes.put(baseTCR.getName(), curTotalScore);
|
||||
}
|
||||
|
||||
String OJRname = osName + "." + jdkName + "." + renderName;
|
||||
generateTestCaseSummaryReport((OJRname.length() == 2? "": OJRname),
|
||||
consoleBaseRes,
|
||||
testCaseBaseResult,
|
||||
testCaseResultCount,
|
||||
rememberReference);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1177,6 +1177,10 @@ void *os::dll_load(const char *filename, char *ebuf, int ebuflen) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void * os::dll_load_utf8(const char *filename, char *ebuf, int ebuflen) {
|
||||
return os::dll_load(filename, ebuf, ebuflen);
|
||||
}
|
||||
|
||||
void* os::dll_lookup(void* handle, const char* name) {
|
||||
void* res = dlsym(handle, name);
|
||||
return res;
|
||||
|
||||
@@ -1226,6 +1226,10 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
|
||||
}
|
||||
#endif // !__APPLE__
|
||||
|
||||
void * os::dll_load_utf8(const char *filename, char *ebuf, int ebuflen) {
|
||||
return os::dll_load(filename, ebuf, ebuflen);
|
||||
}
|
||||
|
||||
void* os::get_default_process_handle() {
|
||||
#ifdef __APPLE__
|
||||
// MacOS X needs to use RTLD_FIRST instead of RTLD_LAZY
|
||||
|
||||
@@ -1794,6 +1794,10 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void * os::dll_load_utf8(const char *filename, char *ebuf, int ebuflen) {
|
||||
return os::dll_load(filename, ebuf, ebuflen);
|
||||
}
|
||||
|
||||
void * os::Linux::dlopen_helper(const char *filename, char *ebuf,
|
||||
int ebuflen) {
|
||||
void * result = ::dlopen(filename, RTLD_LAZY);
|
||||
|
||||
@@ -1454,9 +1454,221 @@ static int _print_module(const char* fname, address base_address,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static errno_t convert_to_UTF16(char const* source_str, UINT source_encoding, LPWSTR* dest_utf16_str) {
|
||||
const int len_estimated = MultiByteToWideChar(source_encoding,
|
||||
MB_ERR_INVALID_CHARS,
|
||||
source_str,
|
||||
-1, // source is null-terminated
|
||||
NULL,
|
||||
0); // estimate characters count
|
||||
if (len_estimated == 0) {
|
||||
// Probably source_str contains characters that cannot be represented in the source_encoding given.
|
||||
*dest_utf16_str = NULL;
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
*dest_utf16_str = NEW_C_HEAP_ARRAY(WCHAR, len_estimated, mtInternal);
|
||||
|
||||
const int len_real = MultiByteToWideChar(source_encoding,
|
||||
MB_ERR_INVALID_CHARS,
|
||||
source_str,
|
||||
-1, // source is null-terminated
|
||||
*dest_utf16_str, len_estimated);
|
||||
assert(len_real == len_estimated, "length already checked above");
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
// Converts a string in the "platform" encoding to UTF16.
|
||||
static errno_t convert_to_UTF16(char const* platform_str, LPWSTR* utf16_str) {
|
||||
return convert_to_UTF16(platform_str, CP_ACP, utf16_str);
|
||||
}
|
||||
|
||||
static errno_t convert_UTF8_to_UTF16(char const* utf8_str, LPWSTR* utf16_str) {
|
||||
return convert_to_UTF16(utf8_str, CP_UTF8, utf16_str);
|
||||
}
|
||||
|
||||
// Converts a wide-character string in UTF-16 encoding to the 8-bit "platform" encoding.
|
||||
// Unless the platform encoding is UTF-8, not all characters in the source string can be represented in the dest string.
|
||||
// The function succeeds in this case anyway and just replaces these with a certain character.
|
||||
static errno_t convert_UTF16_to_platform(LPWSTR source_utf16_str, char*& dest_str) {
|
||||
const int len_estimated = WideCharToMultiByte(CP_ACP,
|
||||
0,
|
||||
source_utf16_str,
|
||||
-1, // source is null-terminated
|
||||
NULL,
|
||||
0, // estimate characters count
|
||||
NULL, NULL);
|
||||
if (len_estimated == 0) {
|
||||
dest_str = NULL;
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
dest_str = NEW_C_HEAP_ARRAY(CHAR, len_estimated, mtInternal);
|
||||
|
||||
const int len_real = WideCharToMultiByte(CP_ACP,
|
||||
0,
|
||||
source_utf16_str,
|
||||
-1, // source is null-terminated
|
||||
dest_str, len_estimated, NULL, NULL);
|
||||
assert(len_real == len_estimated, "length already checked above");
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
class MemoryReleaserW : public StackObj {
|
||||
private:
|
||||
WCHAR* _object_ptr;
|
||||
|
||||
public:
|
||||
MemoryReleaserW(WCHAR * object_ptr) : _object_ptr(object_ptr) {}
|
||||
~MemoryReleaserW() { if (_object_ptr != NULL) FREE_C_HEAP_ARRAY(WCHAR, _object_ptr); }
|
||||
};
|
||||
|
||||
class MemoryReleaser : public StackObj {
|
||||
private:
|
||||
CHAR* _object_ptr;
|
||||
|
||||
public:
|
||||
MemoryReleaser(CHAR * object_ptr) : _object_ptr(object_ptr) {}
|
||||
~MemoryReleaser() { if (_object_ptr != NULL) FREE_C_HEAP_ARRAY(CHAR, _object_ptr); }
|
||||
};
|
||||
|
||||
// Loads .dll/.so and
|
||||
// in case of error it checks if .dll/.so was built for the
|
||||
// same architecture as Hotspot is running on
|
||||
void * os::dll_load_utf8(const char *utf8_name, char *ebuf, int ebuflen) {
|
||||
LPWSTR utf16_name = NULL;
|
||||
errno_t err = convert_UTF8_to_UTF16(utf8_name, &utf16_name);
|
||||
MemoryReleaserW release_utf16_name(utf16_name);
|
||||
if (err != ERROR_SUCCESS) {
|
||||
errno = err;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char* platform_name = NULL; // name of the library converted to the "platform" encoding for use in log messages
|
||||
errno_t ignored_err = convert_UTF16_to_platform(utf16_name, platform_name);
|
||||
MemoryReleaser release_platform_name(platform_name);
|
||||
|
||||
log_info(os)("attempting shared library load of %s", platform_name);
|
||||
|
||||
void * result = LoadLibraryW(utf16_name);
|
||||
|
||||
if (result != NULL) {
|
||||
Events::log(NULL, "Loaded shared library %s", platform_name);
|
||||
// Recalculate pdb search path if a DLL was loaded successfully.
|
||||
SymbolEngine::recalc_search_path();
|
||||
log_info(os)("shared library load of %s was successful", platform_name);
|
||||
return result;
|
||||
}
|
||||
DWORD errcode = GetLastError();
|
||||
// Read system error message into ebuf
|
||||
// It may or may not be overwritten below (in the for loop and just above)
|
||||
lasterror(ebuf, (size_t) ebuflen);
|
||||
ebuf[ebuflen - 1] = '\0';
|
||||
Events::log(NULL, "Loading shared library %s failed, error code %lu", platform_name, errcode);
|
||||
log_info(os)("shared library load of %s failed, error code %lu", platform_name, errcode);
|
||||
|
||||
if (errcode == ERROR_MOD_NOT_FOUND) {
|
||||
strncpy(ebuf, "Can't find dependent libraries", ebuflen - 1);
|
||||
ebuf[ebuflen - 1] = '\0';
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Parsing dll below
|
||||
// If we can read dll-info and find that dll was built
|
||||
// for an architecture other than Hotspot is running in
|
||||
// - then print to buffer "DLL was built for a different architecture"
|
||||
// else call os::lasterror to obtain system error message
|
||||
int fd = ::wopen(utf16_name, O_RDONLY | O_BINARY, 0);
|
||||
if (fd < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint32_t signature_offset;
|
||||
uint16_t lib_arch = 0;
|
||||
bool failed_to_get_lib_arch =
|
||||
( // Go to position 3c in the dll
|
||||
(os::seek_to_file_offset(fd, IMAGE_FILE_PTR_TO_SIGNATURE) < 0)
|
||||
||
|
||||
// Read location of signature
|
||||
(sizeof(signature_offset) !=
|
||||
(os::read(fd, (void*)&signature_offset, sizeof(signature_offset))))
|
||||
||
|
||||
// Go to COFF File Header in dll
|
||||
// that is located after "signature" (4 bytes long)
|
||||
(os::seek_to_file_offset(fd,
|
||||
signature_offset + IMAGE_FILE_SIGNATURE_LENGTH) < 0)
|
||||
||
|
||||
// Read field that contains code of architecture
|
||||
// that dll was built for
|
||||
(sizeof(lib_arch) != (os::read(fd, (void*)&lib_arch, sizeof(lib_arch))))
|
||||
);
|
||||
|
||||
::close(fd);
|
||||
if (failed_to_get_lib_arch) {
|
||||
// file i/o error - report os::lasterror(...) msg
|
||||
return NULL;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
uint16_t arch_code;
|
||||
char* arch_name;
|
||||
} arch_t;
|
||||
|
||||
static const arch_t arch_array[] = {
|
||||
{IMAGE_FILE_MACHINE_I386, (char*)"IA 32"},
|
||||
{IMAGE_FILE_MACHINE_AMD64, (char*)"AMD 64"},
|
||||
{IMAGE_FILE_MACHINE_ARM64, (char*)"ARM 64"}
|
||||
};
|
||||
#if (defined _M_ARM64)
|
||||
static const uint16_t running_arch = IMAGE_FILE_MACHINE_ARM64;
|
||||
#elif (defined _M_AMD64)
|
||||
static const uint16_t running_arch = IMAGE_FILE_MACHINE_AMD64;
|
||||
#elif (defined _M_IX86)
|
||||
static const uint16_t running_arch = IMAGE_FILE_MACHINE_I386;
|
||||
#else
|
||||
#error Method os::dll_load requires that one of following \
|
||||
is defined :_M_AMD64 or _M_IX86 or _M_ARM64
|
||||
#endif
|
||||
|
||||
|
||||
// Obtain a string for printf operation
|
||||
// lib_arch_str shall contain string what platform this .dll was built for
|
||||
// running_arch_str shall string contain what platform Hotspot was built for
|
||||
char *running_arch_str = NULL, *lib_arch_str = NULL;
|
||||
for (unsigned int i = 0; i < ARRAY_SIZE(arch_array); i++) {
|
||||
if (lib_arch == arch_array[i].arch_code) {
|
||||
lib_arch_str = arch_array[i].arch_name;
|
||||
}
|
||||
if (running_arch == arch_array[i].arch_code) {
|
||||
running_arch_str = arch_array[i].arch_name;
|
||||
}
|
||||
}
|
||||
|
||||
assert(running_arch_str,
|
||||
"Didn't find running architecture code in arch_array");
|
||||
|
||||
// If the architecture is right
|
||||
// but some other error took place - report os::lasterror(...) msg
|
||||
if (lib_arch == running_arch) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (lib_arch_str != NULL) {
|
||||
::_snprintf(ebuf, ebuflen - 1,
|
||||
"Can't load %s-bit .dll on a %s-bit platform",
|
||||
lib_arch_str, running_arch_str);
|
||||
} else {
|
||||
// don't know what architecture this dll was build for
|
||||
::_snprintf(ebuf, ebuflen - 1,
|
||||
"Can't load this .dll (machine code=0x%x) on a %s-bit platform",
|
||||
lib_arch, running_arch_str);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void * os::dll_load(const char *name, char *ebuf, int ebuflen) {
|
||||
log_info(os)("attempting shared library load of %s", name);
|
||||
|
||||
@@ -4420,7 +4632,7 @@ static wchar_t* wide_abs_unc_path(char const* path, errno_t & err, int additiona
|
||||
set_path_prefix(buf, &prefix, &prefix_off, &needs_fullpath);
|
||||
|
||||
LPWSTR unicode_path = NULL;
|
||||
err = convert_to_unicode(buf, &unicode_path);
|
||||
err = convert_to_UTF16(buf, &unicode_path);
|
||||
FREE_C_HEAP_ARRAY(char, buf);
|
||||
if (err != ERROR_SUCCESS) {
|
||||
return NULL;
|
||||
|
||||
@@ -1147,7 +1147,7 @@ bool PhaseIdealLoop::loop_predication_impl_helper(IdealLoopTree *loop, ProjNode*
|
||||
Node* idx = cmp->in(1);
|
||||
assert(!invar.is_invariant(idx), "index is variant");
|
||||
Node* rng = cmp->in(2);
|
||||
assert(rng->Opcode() == Op_LoadRange || iff->is_RangeCheck() || _igvn.type(rng)->is_int()->_lo >= 0, "must be");
|
||||
// [tav: crash] assert(rng->Opcode() == Op_LoadRange || iff->is_RangeCheck() || _igvn.type(rng)->is_int()->_lo >= 0, "must be");
|
||||
assert(invar.is_invariant(rng), "range must be invariant");
|
||||
int scale = 1;
|
||||
Node* offset = zero;
|
||||
|
||||
@@ -3528,6 +3528,19 @@ _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_GetDefaultJavaVMInitArgs(void *args_) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef LINUX
|
||||
static void unsetLdPreload() {
|
||||
// Workaround for: JBR-2253 Preload libjsig.so to fix JNA crashes
|
||||
// NOTE: Probably it still can affect child processes, see
|
||||
// https://stackoverflow.com/questions/3275015/ld-preload-affects-new-child-even-after-unsetenvld-preload
|
||||
char * envUnset = ::getenv("UNSET_LD_PRELOAD");
|
||||
if (envUnset != NULL && strlen(envUnset) > 3 && strncmp("true", envUnset, 4) == 0) {
|
||||
unsetenv("LD_PRELOAD");
|
||||
fprintf(stdout, "LD_PRELOAD was unset\n");
|
||||
}
|
||||
}
|
||||
#endif //LINUX
|
||||
|
||||
DT_RETURN_MARK_DECL(CreateJavaVM, jint
|
||||
, HOTSPOT_JNI_CREATEJAVAVM_RETURN(_ret_ref));
|
||||
|
||||
@@ -3636,6 +3649,10 @@ static jint JNI_CreateJavaVM_inner(JavaVM **vm, void **penv, void *args) {
|
||||
// Since this is not a JVM_ENTRY we have to set the thread state manually before leaving.
|
||||
ThreadStateTransition::transition(thread, _thread_in_vm, _thread_in_native);
|
||||
MACOS_AARCH64_ONLY(thread->enable_wx(WXExec));
|
||||
|
||||
#ifdef LINUX
|
||||
unsetLdPreload();
|
||||
#endif //LINUX
|
||||
} else {
|
||||
// If create_vm exits because of a pending exception, exit with that
|
||||
// exception. In the future when we figure out how to reclaim memory,
|
||||
|
||||
@@ -3357,29 +3357,25 @@ JVM_END
|
||||
|
||||
// Library support ///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
JVM_ENTRY_NO_ENV(void*, JVM_LoadLibrary(const char* name))
|
||||
JVM_ENTRY_NO_ENV(void*, JVM_LoadLibrary(const char* utf8_name))
|
||||
//%note jvm_ct
|
||||
char ebuf[1024];
|
||||
void *load_result;
|
||||
{
|
||||
ThreadToNativeFromVM ttnfvm(thread);
|
||||
load_result = os::dll_load(name, ebuf, sizeof ebuf);
|
||||
load_result = os::dll_load_utf8(utf8_name, ebuf, sizeof ebuf);
|
||||
}
|
||||
if (load_result == NULL) {
|
||||
char msg[1024];
|
||||
jio_snprintf(msg, sizeof msg, "%s: %s", name, ebuf);
|
||||
// Since 'ebuf' may contain a string encoded using
|
||||
// platform encoding scheme, we need to pass
|
||||
// Exceptions::unsafe_to_utf8 to the new_exception method
|
||||
// as the last argument. See bug 6367357.
|
||||
jio_snprintf(msg, sizeof msg, "%s: %s", utf8_name, ebuf);
|
||||
Handle h_exception =
|
||||
Exceptions::new_exception(thread,
|
||||
vmSymbols::java_lang_UnsatisfiedLinkError(),
|
||||
msg, Exceptions::unsafe_to_utf8);
|
||||
msg);
|
||||
|
||||
THROW_HANDLE_0(h_exception);
|
||||
}
|
||||
log_info(library)("Loaded library %s, handle " INTPTR_FORMAT, name, p2i(load_result));
|
||||
log_info(library)("Loaded library %s, handle " INTPTR_FORMAT, utf8_name, p2i(load_result));
|
||||
return load_result;
|
||||
JVM_END
|
||||
|
||||
|
||||
@@ -961,6 +961,7 @@ bool os::print_function_and_library_name(outputStream* st,
|
||||
return have_function_name || have_library_name;
|
||||
}
|
||||
|
||||
ATTRIBUTE_NO_SANITIZE_ADDRESS("Memory is read raw here without any regard for objects' boundaries")
|
||||
void os::print_hex_dump(outputStream* st, address start, address end, int unitsize,
|
||||
int bytes_per_line, address logical_start) {
|
||||
assert(unitsize == 1 || unitsize == 2 || unitsize == 4 || unitsize == 8, "just checking");
|
||||
|
||||
@@ -637,6 +637,7 @@ class os: AllStatic {
|
||||
// same architecture as HotSpot is running on
|
||||
// in case of an error NULL is returned and an error message is stored in ebuf
|
||||
static void* dll_load(const char *name, char *ebuf, int ebuflen);
|
||||
static void* dll_load_utf8(const char *name, char *ebuf, int ebuflen);
|
||||
|
||||
// lookup symbol in a shared library
|
||||
static void* dll_lookup(void* handle, const char* name);
|
||||
|
||||
@@ -66,4 +66,10 @@
|
||||
#define PRAGMA_STRINGOP_TRUNCATION_IGNORED
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) || defined (__GNUC__)
|
||||
# define ATTRIBUTE_NO_SANITIZE_ADDRESS(reason_for_exclusion) __attribute__((no_sanitize_address))
|
||||
#else
|
||||
# define ATTRIBUTE_NO_SANITIZE_ADDRESS(reason_for_exclusion)
|
||||
#endif
|
||||
|
||||
#endif // SHARE_UTILITIES_COMPILERWARNINGS_HPP
|
||||
|
||||
@@ -112,6 +112,7 @@ inline int g_isfinite(jdouble f) { return _finite(f); }
|
||||
|
||||
// Visual Studio 2005 deprecates POSIX names - use ISO C++ names instead
|
||||
#define open _open
|
||||
#define wopen _wopen
|
||||
#define close _close
|
||||
#define read _read
|
||||
#define write _write
|
||||
|
||||
@@ -430,6 +430,7 @@ void VMError::clear_step_start_time() {
|
||||
// could be nested report_and_die() calls on stack (see above). Only one
|
||||
// thread can report error, so large buffers are statically allocated in data
|
||||
// segment.
|
||||
ATTRIBUTE_NO_SANITIZE_ADDRESS("Memory is read raw here without any regard for objects' boundaries")
|
||||
void VMError::report(outputStream* st, bool _verbose) {
|
||||
|
||||
# define BEGIN if (_current_step == 0) { _current_step = __LINE__;
|
||||
|
||||
@@ -115,7 +115,6 @@ JNIEXPORT jboolean JNICALL
|
||||
Java_jdk_internal_loader_NativeLibraries_load
|
||||
(JNIEnv *env, jobject this, jobject lib, jstring name, jboolean isBuiltin, jboolean isJNI)
|
||||
{
|
||||
const char *cname;
|
||||
jint jniVersion;
|
||||
jthrowable cause;
|
||||
void * handle;
|
||||
@@ -124,15 +123,15 @@ Java_jdk_internal_loader_NativeLibraries_load
|
||||
if (!initIDs(env))
|
||||
return JNI_FALSE;
|
||||
|
||||
cname = JNU_GetStringPlatformChars(env, name, 0);
|
||||
if (cname == 0)
|
||||
const char * utf8_name = GetStringUTF8Chars(env, name);
|
||||
if (utf8_name == NULL)
|
||||
return JNI_FALSE;
|
||||
handle = isBuiltin ? procHandle : JVM_LoadLibrary(cname);
|
||||
handle = isBuiltin ? procHandle : JVM_LoadLibrary(utf8_name);
|
||||
if (isJNI) {
|
||||
if (handle) {
|
||||
JNI_OnLoad_t JNI_OnLoad;
|
||||
JNI_OnLoad = (JNI_OnLoad_t)findJniFunction(env, handle,
|
||||
isBuiltin ? cname : NULL,
|
||||
isBuiltin ? utf8_name : NULL,
|
||||
JNI_TRUE);
|
||||
if (JNI_OnLoad) {
|
||||
JavaVM *jvm;
|
||||
@@ -157,7 +156,7 @@ Java_jdk_internal_loader_NativeLibraries_load
|
||||
char msg[256];
|
||||
jio_snprintf(msg, sizeof(msg),
|
||||
"unsupported JNI version 0x%08X required by %s",
|
||||
jniVersion, cname);
|
||||
jniVersion, utf8_name);
|
||||
JNU_ThrowByName(env, "java/lang/UnsatisfiedLinkError", msg);
|
||||
if (!isBuiltin) {
|
||||
JVM_UnloadLibrary(handle);
|
||||
@@ -179,7 +178,7 @@ Java_jdk_internal_loader_NativeLibraries_load
|
||||
loaded = JNI_TRUE;
|
||||
|
||||
done:
|
||||
JNU_ReleaseStringPlatformChars(env, name, cname);
|
||||
ReleaseStringUTF8Chars(env, name, utf8_name);
|
||||
return loaded;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user