Skip to content

Commit

Permalink
For wasm transpiles, use the C2 java compiler.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 576711675
  • Loading branch information
Googler authored and copybara-github committed Oct 26, 2023
1 parent e3d2564 commit 0e2a251
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
5 changes: 5 additions & 0 deletions build_defs/internal_do_not_use/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ alias(
actual = "//transpiler/java/com/google/j2cl/transpiler:BazelJ2clBuilder",
)

alias(
name = "BazelJ2clBuilderForLargeHeap",
actual = "//transpiler/java/com/google/j2cl/transpiler:BazelJ2clBuilderForLargeHeap",
)

alias(
name = "BazelJ2clBuilderWithKotlinSupport",
actual = "//transpiler/java/com/google/j2cl/transpiler:BazelJ2clBuilderWithKotlinSupport",
Expand Down
2 changes: 1 addition & 1 deletion build_defs/internal_do_not_use/j2wasm_application.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ _J2WASM_APP_ATTRS = {
cfg = "exec",
executable = True,
default = Label(
"//build_defs/internal_do_not_use:BazelJ2clBuilder",
"//build_defs/internal_do_not_use:BazelJ2clBuilderForLargeHeap",
),
),
"_binaryen": attr.label(
Expand Down
18 changes: 18 additions & 0 deletions transpiler/java/com/google/j2cl/transpiler/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ JVM_FLAGS = [
"-Dj2cl.deterministicTimestamps=true",
]

# Like JVM_FLAGS, but using the C2 compiler.
# When modular compilation for Wasm is enabled, this can be removed in favor
# of using the same flags as non-wasm transpilation.
JVM_FLAGS_FOR_LARGE_HEAP = [
"-Xss2M",
# Disable bytecode verification to save from class-loading time.
"-Xverify:none",
"-Dj2cl.deterministicTimestamps=true",
]

java_binary(
name = "BazelJ2clBuilder",
jvm_flags = JVM_FLAGS,
Expand All @@ -95,6 +105,14 @@ java_binary(
runtime_deps = [":bazelbuilder_lib"],
)

java_binary(
name = "BazelJ2clBuilderForLargeHeap",
jvm_flags = JVM_FLAGS_FOR_LARGE_HEAP,
main_class = "com.google.j2cl.transpiler.BazelJ2clBuilder",
visibility = ["//build_defs/internal_do_not_use:__pkg__"],
runtime_deps = [":bazelbuilder_lib"],
)

java_binary(
name = "BazelJ2wasmExportGenerator",
jvm_flags = JVM_FLAGS,
Expand Down

0 comments on commit 0e2a251

Please sign in to comment.