Skip to content

Commit 3eb7a4b

Browse files
committed
chore: experimental flags for svm wasm/obfuscation
Signed-off-by: Sam Gammon <[email protected]>
1 parent 74d0dea commit 3eb7a4b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/cli/build.gradle.kts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ val commandMain = "elide.tool.cli.Elide"
113113
val enablePkl = true
114114
val enableJs = true
115115
val enableJsIsolate = false
116+
val enableObfuscation = false
116117
val enableTs = true
117118
val enablePython = true
118119
val enablePythonDynamic = true
@@ -127,6 +128,7 @@ val enableCustomCompiler = findProperty("elide.compiler") != null
127128
val enableNativeCryptoV2 = false
128129
val enableNativeTransportV2 = true
129130
val enableSqliteStatic = true
131+
val nativeTargetFamily = "wasm"
130132
val enableStatic = findProperty("elide.static") == "true"
131133
val enableStaticJni = true
132134
val preferShared = false
@@ -192,6 +194,11 @@ val nativeOptMode = when (val explicit = optMode) {
192194
else -> explicit
193195
}
194196

197+
val obfuscationArgs = listOfNotNull(
198+
onlyIf(enableObfuscation, "-Delide.enterprise=true"),
199+
onlyIf(enableObfuscation, "-H:AdvancedObfuscation=export-mapping"),
200+
)
201+
195202
val elideBinaryArch = project.properties["elide.march"] as? String ?: defaultArchTarget
196203
logger.lifecycle("Building for architecture '$elideBinaryArch' (default: '$defaultArchTarget')")
197204

@@ -802,6 +809,7 @@ val stagedNativeArgs: List<String> = listOfNotNull(
802809
"-H:+TrackPrimitiveValues",
803810
"-H:+UsePredicates",
804811
"-H:+AllowUnsafeAllocationOfAllInstantiatedTypes", // fix: oracle/graal#10912
812+
onlyIf(!enableJit, "-H:+JDWP"),
805813
onlyIf(oracleGvm && enableAuxCache, "-H:ReservedAuxiliaryImageBytes=${8 * 1024 * 1024}"),
806814
onlyIf(enableExperimentalLlvmBackend, "-H:CompilerBackend=llvm"),
807815
onlyIf(enableExperimental, "-H:+LayeredBaseImageAnalysis"),
@@ -827,6 +835,10 @@ val stagedNativeArgs: List<String> = listOfNotNull(
827835
// "-H:+UseExperimentalReachabilityAnalysis", // not supported by truffle feature
828836
// "-H:+UseReachabilityMethodSummaries", // not supported by truffle feature
829837
// "-H:+VMContinuations", // not supported with runtime compilation
838+
).plus(
839+
if (nativeTargetFamily == "wasm") {
840+
listOf("--tool:svm-wasm")
841+
} else emptyList()
830842
)
831843

832844
val deprecatedNativeArgs = listOf(
@@ -1457,6 +1469,8 @@ val commonNativeArgs = listOfNotNull(
14571469
}.map {
14581470
"-H:CLibraryPath=$it"
14591471
}
1472+
).plus(
1473+
obfuscationArgs
14601474
).plus(
14611475
commonGvmArgs.onlyIf(oracleGvm)
14621476
).plus(

0 commit comments

Comments
 (0)