Skip to content
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

Add env file to easily use Java version of Graal #200

Merged
merged 5 commits into from
Jan 31, 2024
Merged
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
27 changes: 13 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

- name: Setup MX
run: |
./som --setup mx
Expand All @@ -36,59 +36,58 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

- name: Setup MX
run: |
./som --setup mx
echo "PATH=$PATH:`pwd`/../mx" >> "$GITHUB_ENV"

- name: Get LabsJDK and Get Graal
run: |
./som --setup labsjdk
mx sforceimport
rm libs/jvmci || true
./som --setup labsjdk

- name: Compile TruffleSOM
run: |
mx build

- name: Tests
run: |
mx tests-junit
mx tests-som

- name: Build native-image tool
run: |
mx build-native-image-tool

- name: Test Object Storage System
run: |
mx build-native-obj-test
./som-obj-storage-tester



- name: Tool Tests
continue-on-error: true
run: |
mx tests-nodestats
mx tests-coverage

- name: SomSom Tests
run: |
export JAVA_HOME=$JAVA_HOME_17_X64
./som -G -cp core-lib/Smalltalk:core-lib/TestSuite:core-lib/SomSom/src/compiler:core-lib/SomSom/src/vm:core-lib/SomSom/src/vmobjects:core-lib/SomSom/src/interpreter:core-lib/SomSom/src/primitives \
core-lib/SomSom/tests/SomSomTests.som

- name: Checkout AWFY
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: smarr/are-we-fast-yet
path: are-we-fast-yet

- name: AWFY Test Run
run: |
pwd
Expand Down
2 changes: 1 addition & 1 deletion mx.trufflesom/env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
JAVA_HOME=libs/jvmci
# MX_BUILD_EXPLODED=true
# MX_BUILD_EXPLODED=true # Java modules, which are now used, don't support exploded builds
LINKY_LAYOUT=*.jar
FORCE_BASH_LAUNCHERS=true
DISABLE_LIBPOLYGLOT=true
Expand Down
9 changes: 9 additions & 0 deletions mx.trufflesom/graal
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
JAVA_HOME=libs/jvmci
# MX_BUILD_EXPLODED=true # Java modules, which are now used, don't support exploded builds
LINKY_LAYOUT=*.jar
DYNAMIC_IMPORTS=/vm,/tools,/truffle,/sdk,/compiler
FORCE_BASH_LAUNCHERS=true
DISABLE_LIBPOLYGLOT=true
EXCLUDE_COMPONENTS=svmag,nju,nic,ni,nil,ins,dap,lsp,insight,insightheap,vvm,SubstrateVM,LibGraal
GRAALVM_SKIP_ARCHIVE=true
MX_IDE_ECLIPSE_ASYNC_DISTRIBUTIONS=true
2 changes: 1 addition & 1 deletion mx.trufflesom/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{
"name": "truffle",
"subdir": True,
"version": "a43123982961881e39ebc82321639ba2119f500c",
"version": "7de6be8b77acdda5eab5f4e73c46ceec214b0d41",
"urls": [{"url": "https://github.com/oracle/graal", "kind": "git"}],
},
]
Expand Down
22 changes: 15 additions & 7 deletions som
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,19 @@ def find_mx(exit_when_missing=True):
return m
except:
pass

if exit_when_missing:
print("The mx build tool is not on the PATH or in the " + BASE_DIR + "/../mx folder. Please run `./som --setup mx`")
exit(1)

return None

def get_compiled_graalvm_java_bin():
def get_compiled_graalvm_java_bin(use_libgraal):
graal_bin = None

mx = find_mx()
libgraal_jdk_home = check_output(
[mx, '--env', 'libgraal', 'graalvm-home'],
[mx, '--env', 'libgraal' if use_libgraal else 'graal', 'graalvm-home'],
stderr=STDOUT
).decode()
return libgraal_jdk_home.strip() + '/bin/java'
Expand Down Expand Up @@ -234,7 +234,15 @@ if not java_bin:
if args.use_embedded_graal is True:
from subprocess import check_output, STDOUT, CalledProcessError
try:
java_bin = get_compiled_graalvm_java_bin()
java_bin = get_compiled_graalvm_java_bin(args.use_libgraal)
if not os.path.isfile(java_bin):
if args.use_libgraal:
print("The use of LibGraal was requested, but it does not seem to be available.")
print("To build it, please run `mx --env libgraal build`")
else:
print("The use of the Graal compiler was requested, but it does not seem to be available.")
print("To build it, please run `mx --env graal build`")
sys.exit(1)
except CalledProcessError as e:
print("Failed to determine location of libgraal")
print(e.output.decode())
Expand All @@ -244,7 +252,7 @@ else:
if not os.path.isdir(args.use_embedded_graal):
print("USE_EMBEDDED_GRAAL does not seem to exist: " + args.use_embedded_graal)
sys.exit(1)

if not os.path.isfile(args.use_embedded_graal + '/bin/java'):
print("USE_EMBEDDED_GRAAL did not seem to have a bin/java: " + args.use_embedded_graal)
sys.exit(1)
Expand Down Expand Up @@ -376,7 +384,7 @@ if args.coverage != False:
if args.cpusampler != False:
MODULE_PATH_ENTRIES.append(PROFILER_JAR)
flags += ['-Dpolyglot.cpusampler=true', '-Dpolyglot.cpusampler.Output=' + args.cpusampler]


if args.assert_:
flags += ['-esa', '-ea']
Expand Down
Loading