Skip to content

[GR-65272] [GR-65273] [GR-65270] Fixes for some benchmark and coverage jobs after espresso unchained build migration. #11252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions espresso-shared/mx.espresso-shared/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"read" : "https://github.com/oracle/graal.git",
"write" : "[email protected]:oracle/graal.git",
},
"ignore_suite_commit_info": True,

# ------------- licenses

Expand Down
9 changes: 0 additions & 9 deletions espresso/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

### Eclipse ###

.metadata
Expand Down
3 changes: 2 additions & 1 deletion espresso/docs/hacking.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ You can find out where the espresso standalones are by running `mx path --output
$ mx path --output ESPRESSO_NATIVE_STANDALONE
$ mx path --output ESPRESSO_JVM_STANDALONE
```
> Note: If you used options like `--env ...` or `--dynamicimports ...` while building, you should also use them with `mx path`: e.g., `mx --env native-ce path ...`.

`mx espresso` runs Espresso from a standalone (jvm or native). It mimics the `java` command.

Expand All @@ -68,7 +69,7 @@ The `mx espresso` launcher adds some overhead, to execute Espresso native image

```bash
$ mx --env native-ce build # Always build first
$ export ESPRESSO=`mx path --output ESPRESSO_NATIVE_STANDALONE`/bin/java
$ export ESPRESSO=`mx --quiet --no-warning --env native-ce path --output ESPRESSO_NATIVE_STANDALONE`/bin/java
$ time $ESPRESSO -cp my.jar HelloWorld
```

Expand Down
48 changes: 48 additions & 0 deletions espresso/mx.espresso/launchers/java.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
::
:: ----------------------------------------------------------------------------------------------------
::
:: Copyright (c) 2025, 2025, 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.
::
:: ----------------------------------------------------------------------------------------------------
@echo off

setlocal enabledelayedexpansion

call :getScriptLocation location


"%location%\espresso" %*

exit /b %errorlevel%
:: Function are defined via labels, so have to be defined at the end of the file and skipped
:: in order not to be executed.

:: If this script is in `%PATH%` and called quoted without a full path (e.g., `"java"`), `%~dp0` is expanded to `cwd`
:: rather than the path to the script.
:: This does not happen if `%~dp0` is accessed in a subroutine.
:getScriptLocation variableName
set "%~1=%~dp0"
exit /b 0

endlocal
37 changes: 37 additions & 0 deletions espresso/mx.espresso/launchers/java.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
#
# Copyright (c) 2025, 2025, 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.
#
source="${BASH_SOURCE[0]}"
while [ -h "$source" ] ; do
prev_source="$source"
source="$(readlink "$source")";
if [[ "$source" != /* ]]; then
# if the link was relative, it was relative to where it came from
dir="$( cd -P "$( dirname "$prev_source" )" && pwd )"
source="$dir/$source"
fi
done
location="$( cd -P "$( dirname "$source" )" && pwd )"
exec "${location}/espresso" "${@}"
153 changes: 153 additions & 0 deletions espresso/mx.espresso/launchers/javac.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
::
:: ----------------------------------------------------------------------------------------------------
::
:: Copyright (c) 2025, 2025, 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.
::
:: ----------------------------------------------------------------------------------------------------
@echo off

setlocal enabledelayedexpansion

call :getScriptLocation location


:: The two white lines above this comment are significant.

set "jvm_args=--add-modules=ALL-DEFAULT"
set "javac_args="

call :escape_args %*
for %%a in (%args%) do (
call :unescape_arg %%a
call :process_arg !arg!
if errorlevel 1 exit /b 1
)

if "%VERBOSE_GRAALVM_LAUNCHERS%"=="true" echo on

"%location%\espresso" %jvm_args% -m jdk.compiler/com.sun.tools.javac.Main %javac_args%

exit /b %errorlevel%
:: Function are defined via labels, so have to be defined at the end of the file and skipped
:: in order not to be executed.

:escape_args
set "args=%*"
:: Without early exit on empty contents, substitutions fail.
if "!args!"=="" exit /b 0
set "args=%args:,=##GR_ESC_COMMA##%"
set "args=%args:;=##GR_ESC_SEMI##%"
:: Temporarily, so that args are split on '=' only.
set "args=%args: =##GR_ESC_SPACE##%"
:: Temporarily, otherwise we won't split on '=' inside quotes.
set "args=%args:"=##GR_ESC_QUOTE##%"
:: We can't replace equal using the variable substitution syntax.
call :replace_equals %args%
set "args=%args:##GR_ESC_SPACE##= %"
set "args=%args:##GR_ESC_QUOTE##="%"
exit /b 0

:replace_equals
setlocal
:: The argument passed to this function was split on =, because all other
:: delimiters were replaced in escape_args.
set "arg=%1"
if "!arg!"=="" goto :end_replace_equals
set "args=%1"
shift
:loop_replace_equals
set "arg=%1"
if "!arg!"=="" goto :end_replace_equals
set "args=%args%##GR_ESC_EQUAL##%arg%"
shift
goto :loop_replace_equals
:end_replace_equals
endlocal & ( set "args=%args%" )
exit /b 0

:unescape_arg
set "arg=%*"
set "arg=%arg:##GR_ESC_COMMA##=,%"
set "arg=%arg:##GR_ESC_SEMI##=;%"
set "arg=%arg:##GR_ESC_EQUAL##==%"
exit /b 0

:is_quoted
setlocal
set "args=%*"
set /a argslen=0
for %%a in (%args%) do set /a argslen+=1
if %argslen% gtr 1 (
set "quoted=false"
) else (
if "!args:~0,1!!args:~-1!"=="""" ( set "quoted=true" ) else ( set "quoted=false" )
)
endlocal & ( set "quoted=%quoted%" )
exit /b 0

:unquote_arg
:: Sets %arg% to a version of the argument with outer quotes stripped, if present.
call :is_quoted %*
setlocal
set "maybe_quoted=%*"
if %quoted%==true ( set "arg=%~1" ) else ( set "arg=!maybe_quoted!" )
endlocal & ( set "arg=%arg%" )
exit /b 0

:process_vm_arg
if %arg_quoted%==false (
call :is_quoted %*
set "arg_quoted=%quoted%"
)
call :unquote_arg %*
set "vm_arg=%arg%"

if %arg_quoted%==true ( set "arg="%vm_arg%"" ) else ( set "arg=%vm_arg%" )
set "jvm_args=%jvm_args% !arg!"
exit /b 0

:process_arg
set "original_arg=%*"
call :unquote_arg !original_arg!
set "arg_quoted=%quoted%"

if "!arg:~0,2!"=="-J" (
set prefix=vm
call :unquote_arg !arg:~2!
call :process_vm_arg !arg!
if errorlevel 1 exit /b 1
) else (
:: Use !original_arg! instead of !arg! to preserve surrounding quotes if present.
set "launcher_args=%launcher_args% !original_arg!"
)
exit /b 0

:: If this script is in `%PATH%` and called quoted without a full path (e.g., `"java"`), `%~dp0` is expanded to `cwd`
:: rather than the path to the script.
:: This does not happen if `%~dp0` is accessed in a subroutine.
:getScriptLocation variableName
set "%~1=%~dp0"
exit /b 0

endlocal
57 changes: 57 additions & 0 deletions espresso/mx.espresso/launchers/javac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env bash
#
# Copyright (c) 2025, 2025, 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.
#
source="${BASH_SOURCE[0]}"
while [ -h "$source" ] ; do
prev_source="$source"
source="$(readlink "$source")";
if [[ "$source" != /* ]]; then
# if the link was relative, it was relative to where it came from
dir="$( cd -P "$( dirname "$prev_source" )" && pwd )"
source="$dir/$source"
fi
done
location="$( cd -P "$( dirname "$source" )" && pwd )"

jvm_args=("--add-modules=ALL-DEFAULT")
javac_args=()

process_arg() {
if [[ "$1" == -J* ]]; then
jvm_args+=("${1#-J}")
else
launcher_args+=("$1")
fi
}

for o in "$@"; do
process_arg "$o"
done

if [[ "${VERBOSE_GRAALVM_LAUNCHERS}" == "true" ]]; then
set -x
fi

exec "${location}/espresso" "${jvm_args[@]}" -m jdk.compiler/com.sun.tools.javac.Main "${javac_args[@]}"
2 changes: 1 addition & 1 deletion espresso/mx.espresso/mx_espresso.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def _espresso_standalone_command(args, with_sulong=False, allow_jacoco=True, jdk
+ jacoco_args
# This is needed for Truffle since JEP 472: Prepare to Restrict the Use of JNI
+ ['--enable-native-access=org.graalvm.truffle']
+ [mx.distribution('ESPRESSO_LAUNCHER').mainClass] + args
+ ["--module", "org.graalvm.espresso.launcher/" + mx.distribution('ESPRESSO_LAUNCHER').mainClass] + args
)

def javavm_deps():
Expand Down
28 changes: 27 additions & 1 deletion espresso/mx.espresso/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,19 +575,45 @@
"maven": False,
},

"ESPRESSO_JVM_STANDALONE_JAVA_LINKS": {
"type": "dir",
"platformDependent": True,
"platforms": "local",
"os": {
"windows": {
"layout": {
"bin/java.cmd": "file:mx.espresso/launchers/java.cmd",
"bin/javac.cmd": "file:mx.espresso/launchers/javac.cmd",
},
},
"<others>": {
"layout": {
"bin/java": "file:mx.espresso/launchers/java.sh",
"bin/javac": "file:mx.espresso/launchers/javac.sh",
},
},
},
"maven": False,
},

"ESPRESSO_JVM_STANDALONE": {
"type": "dir",
"pruning_mode": "optional",
"description": "Espresso JVM standalone distribution for testing",
"platformDependent": True,
"platforms": "local",
"defaultDereference": "never",
"layout": {
"bin/": ["dependency:espresso:espresso"],
"bin/": [
"dependency:espresso:espresso",
"dependency:ESPRESSO_JVM_STANDALONE_JAVA_LINKS/bin/*",
],
"./": [{
"source_type": "dependency",
"dependency": "espresso:JAVA_HOME",
"path": "*",
"exclude": [
"bin", # those can't run without <jdk_lib_dir>/server
"lib/jfr",
"lib/static",
"<jdk_lib_dir>/server",
Expand Down
Loading
Loading