diff --git a/examples/expected/0031-basic-local-fn-return.ir b/examples/expected/0031-basic-local-fn-return.ir index cefaab9..0528550 100644 --- a/examples/expected/0031-basic-local-fn-return.ir +++ b/examples/expected/0031-basic-local-fn-return.ir @@ -4149,7 +4149,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 @@ -4695,7 +4695,7 @@ declare ptr @BuildOptions.keystore_path.109(i64) #0 declare i64 @BuildOptions.jni_main_count.110(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at.111(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at.111(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at.112(i64, i64) #0 @@ -5247,7 +5247,7 @@ declare ptr @BuildOptions.keystore_path.293(i64) #0 declare i64 @BuildOptions.jni_main_count.294(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at.295(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at.295(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at.296(i64, i64) #0 diff --git a/examples/expected/0032-basic-ufcs-return-type.ir b/examples/expected/0032-basic-ufcs-return-type.ir index 9da36c3..7637e2b 100644 --- a/examples/expected/0032-basic-ufcs-return-type.ir +++ b/examples/expected/0032-basic-ufcs-return-type.ir @@ -4069,7 +4069,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 @@ -4615,7 +4615,7 @@ declare ptr @BuildOptions.keystore_path.109(i64) #0 declare i64 @BuildOptions.jni_main_count.110(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at.111(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at.111(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at.112(i64, i64) #0 @@ -5167,7 +5167,7 @@ declare ptr @BuildOptions.keystore_path.293(i64) #0 declare i64 @BuildOptions.jni_main_count.294(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at.295(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at.295(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at.296(i64, i64) #0 diff --git a/examples/expected/0044-basic-default-arg-expansion.ir b/examples/expected/0044-basic-default-arg-expansion.ir index 0161cd0..3d9ba62 100644 --- a/examples/expected/0044-basic-default-arg-expansion.ir +++ b/examples/expected/0044-basic-default-arg-expansion.ir @@ -4016,7 +4016,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/0107-types-int-cmp-in-float-ternary.ir b/examples/expected/0107-types-int-cmp-in-float-ternary.ir index 96b3dca..51fa860 100644 --- a/examples/expected/0107-types-int-cmp-in-float-ternary.ir +++ b/examples/expected/0107-types-int-cmp-in-float-ternary.ir @@ -3991,7 +3991,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/0200-generics-generic.ir b/examples/expected/0200-generics-generic.ir index 4ca188f..fba4330 100644 --- a/examples/expected/0200-generics-generic.ir +++ b/examples/expected/0200-generics-generic.ir @@ -3992,7 +3992,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/0201-generics-generic-struct.ir b/examples/expected/0201-generics-generic-struct.ir index ea46693..fe4186a 100644 --- a/examples/expected/0201-generics-generic-struct.ir +++ b/examples/expected/0201-generics-generic-struct.ir @@ -4296,7 +4296,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/0301-closures-fn-pointers.ir b/examples/expected/0301-closures-fn-pointers.ir index 1856ba4..b6182ba 100644 --- a/examples/expected/0301-closures-fn-pointers.ir +++ b/examples/expected/0301-closures-fn-pointers.ir @@ -3997,7 +3997,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/0400-protocols-impl-for-builtin.ir b/examples/expected/0400-protocols-impl-for-builtin.ir index dc4a1ad..14a2ea3 100644 --- a/examples/expected/0400-protocols-impl-for-builtin.ir +++ b/examples/expected/0400-protocols-impl-for-builtin.ir @@ -4105,7 +4105,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/0413-protocols-parameterized-protocol-value.ir b/examples/expected/0413-protocols-parameterized-protocol-value.ir index 9220764..558bcb2 100644 --- a/examples/expected/0413-protocols-parameterized-protocol-value.ir +++ b/examples/expected/0413-protocols-parameterized-protocol-value.ir @@ -4202,7 +4202,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/0414-protocols-generic-struct-protocol-erase.ir b/examples/expected/0414-protocols-generic-struct-protocol-erase.ir index b885996..50f839f 100644 --- a/examples/expected/0414-protocols-generic-struct-protocol-erase.ir +++ b/examples/expected/0414-protocols-generic-struct-protocol-erase.ir @@ -4218,7 +4218,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/0416-protocols-auto-type-erasure.ir b/examples/expected/0416-protocols-auto-type-erasure.ir index 88da38c..2c23a4d 100644 --- a/examples/expected/0416-protocols-auto-type-erasure.ir +++ b/examples/expected/0416-protocols-auto-type-erasure.ir @@ -4308,7 +4308,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 @@ -4854,7 +4854,7 @@ declare ptr @BuildOptions.keystore_path.109(i64) #0 declare i64 @BuildOptions.jni_main_count.110(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at.111(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at.111(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at.112(i64, i64) #0 @@ -5406,7 +5406,7 @@ declare ptr @BuildOptions.keystore_path.293(i64) #0 declare i64 @BuildOptions.jni_main_count.294(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at.295(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at.295(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at.296(i64, i64) #0 diff --git a/examples/expected/0507-packs-pack-mono-dedup.ir b/examples/expected/0507-packs-pack-mono-dedup.ir index f4ba5f6..0cb1b1c 100644 --- a/examples/expected/0507-packs-pack-mono-dedup.ir +++ b/examples/expected/0507-packs-pack-mono-dedup.ir @@ -4061,7 +4061,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/0513-packs-pack-mixed-comptime.ir b/examples/expected/0513-packs-pack-mixed-comptime.ir index 44491ca..aac4d7e 100644 --- a/examples/expected/0513-packs-pack-mixed-comptime.ir +++ b/examples/expected/0513-packs-pack-mixed-comptime.ir @@ -4004,7 +4004,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/0518-packs-pack-value-dispatch.ir b/examples/expected/0518-packs-pack-value-dispatch.ir index 7f7ce0c..86469a7 100644 --- a/examples/expected/0518-packs-pack-value-dispatch.ir +++ b/examples/expected/0518-packs-pack-value-dispatch.ir @@ -3998,7 +3998,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/0528-packs-protocol-pack-methods.ir b/examples/expected/0528-packs-protocol-pack-methods.ir index 99a0468..6380919 100644 --- a/examples/expected/0528-packs-protocol-pack-methods.ir +++ b/examples/expected/0528-packs-protocol-pack-methods.ir @@ -4154,7 +4154,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/0903-optionals-optional-roundtrip.ir b/examples/expected/0903-optionals-optional-roundtrip.ir index f3232b0..60a672a 100644 --- a/examples/expected/0903-optionals-optional-roundtrip.ir +++ b/examples/expected/0903-optionals-optional-roundtrip.ir @@ -4186,7 +4186,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/0904-optionals-any-to-string-optional.ir b/examples/expected/0904-optionals-any-to-string-optional.ir index 4df8fe6..08703f6 100644 --- a/examples/expected/0904-optionals-any-to-string-optional.ir +++ b/examples/expected/0904-optionals-any-to-string-optional.ir @@ -4037,7 +4037,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/1004-errors-try.ir b/examples/expected/1004-errors-try.ir index 84e12fc..53b2632 100644 --- a/examples/expected/1004-errors-try.ir +++ b/examples/expected/1004-errors-try.ir @@ -4001,7 +4001,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/1006-errors-inferred-error-sets.ir b/examples/expected/1006-errors-inferred-error-sets.ir index f384fd2..14d5a40 100644 --- a/examples/expected/1006-errors-inferred-error-sets.ir +++ b/examples/expected/1006-errors-inferred-error-sets.ir @@ -4008,7 +4008,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/1009-errors-catch.ir b/examples/expected/1009-errors-catch.ir index 143ac8d..9c9719c 100644 --- a/examples/expected/1009-errors-catch.ir +++ b/examples/expected/1009-errors-catch.ir @@ -4003,7 +4003,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/1202-ffi-cc-c-large-aggregate.ir b/examples/expected/1202-ffi-cc-c-large-aggregate.ir index fc0e360..1870787 100644 --- a/examples/expected/1202-ffi-cc-c-large-aggregate.ir +++ b/examples/expected/1202-ffi-cc-c-large-aggregate.ir @@ -660,7 +660,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/1309-ffi-objc-class-method-lowering.ir b/examples/expected/1309-ffi-objc-class-method-lowering.ir index 040766e..2433af1 100644 --- a/examples/expected/1309-ffi-objc-class-method-lowering.ir +++ b/examples/expected/1309-ffi-objc-class-method-lowering.ir @@ -1152,7 +1152,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 @@ -1632,7 +1632,7 @@ declare ptr @BuildOptions.keystore_path.109(i64) #0 declare i64 @BuildOptions.jni_main_count.110(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at.111(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at.111(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at.112(i64, i64) #0 diff --git a/examples/expected/1314-ffi-objc-class-dealloc-roundtrip.ir b/examples/expected/1314-ffi-objc-class-dealloc-roundtrip.ir index a6765bc..5ecc40e 100644 --- a/examples/expected/1314-ffi-objc-class-dealloc-roundtrip.ir +++ b/examples/expected/1314-ffi-objc-class-dealloc-roundtrip.ir @@ -1168,7 +1168,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 @@ -1648,7 +1648,7 @@ declare ptr @BuildOptions.keystore_path.109(i64) #0 declare i64 @BuildOptions.jni_main_count.110(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at.111(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at.111(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at.112(i64, i64) #0 diff --git a/examples/expected/1319-ffi-objc-property-sx-defined.ir b/examples/expected/1319-ffi-objc-property-sx-defined.ir index ccf947b..9773364 100644 --- a/examples/expected/1319-ffi-objc-property-sx-defined.ir +++ b/examples/expected/1319-ffi-objc-property-sx-defined.ir @@ -4152,7 +4152,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 @@ -4632,7 +4632,7 @@ declare ptr @BuildOptions.keystore_path.109(i64) #0 declare i64 @BuildOptions.jni_main_count.110(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at.111(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at.111(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at.112(i64, i64) #0 diff --git a/examples/expected/1329-ffi-objc-call-03-selector-sharing.ir b/examples/expected/1329-ffi-objc-call-03-selector-sharing.ir index 71f3836..d0cce8d 100644 --- a/examples/expected/1329-ffi-objc-call-03-selector-sharing.ir +++ b/examples/expected/1329-ffi-objc-call-03-selector-sharing.ir @@ -1144,7 +1144,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 @@ -1624,7 +1624,7 @@ declare ptr @BuildOptions.keystore_path.109(i64) #0 declare i64 @BuildOptions.jni_main_count.110(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at.111(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at.111(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at.112(i64, i64) #0 diff --git a/examples/expected/1332-ffi-objc-call-06-sret-return.ir b/examples/expected/1332-ffi-objc-call-06-sret-return.ir index 9912b34..81a1c7b 100644 --- a/examples/expected/1332-ffi-objc-call-06-sret-return.ir +++ b/examples/expected/1332-ffi-objc-call-06-sret-return.ir @@ -4080,7 +4080,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 @@ -4560,7 +4560,7 @@ declare ptr @BuildOptions.keystore_path.109(i64) #0 declare i64 @BuildOptions.jni_main_count.110(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at.111(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at.111(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at.112(i64, i64) #0 diff --git a/examples/expected/1347-ffi-objc-dsl-07-mangling-table.ir b/examples/expected/1347-ffi-objc-dsl-07-mangling-table.ir index e104746..35eecd5 100644 --- a/examples/expected/1347-ffi-objc-dsl-07-mangling-table.ir +++ b/examples/expected/1347-ffi-objc-dsl-07-mangling-table.ir @@ -1170,7 +1170,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 @@ -1650,7 +1650,7 @@ declare ptr @BuildOptions.keystore_path.109(i64) #0 declare i64 @BuildOptions.jni_main_count.110(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at.111(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at.111(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at.112(i64, i64) #0 diff --git a/examples/expected/1402-ffi-jni-call-03-methodid-sharing.ir b/examples/expected/1402-ffi-jni-call-03-methodid-sharing.ir index 79d4019..f571801 100644 --- a/examples/expected/1402-ffi-jni-call-03-methodid-sharing.ir +++ b/examples/expected/1402-ffi-jni-call-03-methodid-sharing.ir @@ -1146,7 +1146,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/1403-ffi-jni-call-04-jint-return.ir b/examples/expected/1403-ffi-jni-call-04-jint-return.ir index 453893a..e8777b9 100644 --- a/examples/expected/1403-ffi-jni-call-04-jint-return.ir +++ b/examples/expected/1403-ffi-jni-call-04-jint-return.ir @@ -1144,7 +1144,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/1404-ffi-jni-call-05-jlong-return.ir b/examples/expected/1404-ffi-jni-call-05-jlong-return.ir index 54fb1ac..12ad0d6 100644 --- a/examples/expected/1404-ffi-jni-call-05-jlong-return.ir +++ b/examples/expected/1404-ffi-jni-call-05-jlong-return.ir @@ -1144,7 +1144,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/1405-ffi-jni-call-06-jdouble-return.ir b/examples/expected/1405-ffi-jni-call-06-jdouble-return.ir index 7390dec..7b2adbb 100644 --- a/examples/expected/1405-ffi-jni-call-06-jdouble-return.ir +++ b/examples/expected/1405-ffi-jni-call-06-jdouble-return.ir @@ -1144,7 +1144,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/1406-ffi-jni-call-07-jboolean-return.ir b/examples/expected/1406-ffi-jni-call-07-jboolean-return.ir index 98f62d6..fcb10e4 100644 --- a/examples/expected/1406-ffi-jni-call-07-jboolean-return.ir +++ b/examples/expected/1406-ffi-jni-call-07-jboolean-return.ir @@ -1144,7 +1144,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/1407-ffi-jni-call-08-jobject-return.ir b/examples/expected/1407-ffi-jni-call-08-jobject-return.ir index 388c1e9..ade56fb 100644 --- a/examples/expected/1407-ffi-jni-call-08-jobject-return.ir +++ b/examples/expected/1407-ffi-jni-call-08-jobject-return.ir @@ -1144,7 +1144,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/1408-ffi-jni-call-09-static.ir b/examples/expected/1408-ffi-jni-call-09-static.ir index 6d4e8e9..dd800da 100644 --- a/examples/expected/1408-ffi-jni-call-09-static.ir +++ b/examples/expected/1408-ffi-jni-call-09-static.ir @@ -1144,7 +1144,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/1418-ffi-jni-class-08-call.ir b/examples/expected/1418-ffi-jni-class-08-call.ir index d0f4a8c..3a1db54 100644 --- a/examples/expected/1418-ffi-jni-class-08-call.ir +++ b/examples/expected/1418-ffi-jni-class-08-call.ir @@ -1144,7 +1144,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/1421-ffi-jni-env-02-lexical-direct.ir b/examples/expected/1421-ffi-jni-env-02-lexical-direct.ir index f624426..dbca2d1 100644 --- a/examples/expected/1421-ffi-jni-env-02-lexical-direct.ir +++ b/examples/expected/1421-ffi-jni-env-02-lexical-direct.ir @@ -1144,7 +1144,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 diff --git a/examples/expected/1425-ffi-jni-main-03-ctor.ir b/examples/expected/1425-ffi-jni-main-03-ctor.ir index 30abc81..35a5564 100644 --- a/examples/expected/1425-ffi-jni-main-03-ctor.ir +++ b/examples/expected/1425-ffi-jni-main-03-ctor.ir @@ -667,7 +667,7 @@ declare ptr @BuildOptions.keystore_path(i64) #0 declare i64 @BuildOptions.jni_main_count(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at(i64, i64) #0 @@ -1147,7 +1147,7 @@ declare ptr @BuildOptions.keystore_path.109(i64) #0 declare i64 @BuildOptions.jni_main_count.110(i64) #0 ; Function Attrs: nounwind -declare ptr @BuildOptions.jni_main_foreign_path_at.111(i64, i64) #0 +declare ptr @BuildOptions.jni_main_runtime_path_at.111(i64, i64) #0 ; Function Attrs: nounwind declare ptr @BuildOptions.jni_main_java_source_at.112(i64, i64) #0 diff --git a/library/modules/build.sx b/library/modules/build.sx index 9f3e7f7..aafba09 100644 --- a/library/modules/build.sx +++ b/library/modules/build.sx @@ -84,10 +84,10 @@ BuildOptions :: struct #compiler { // `#jni_main #jni_class("path") { ... }` decls collected during // lowering. The Android bundler walks `0..jni_main_count()` and // for each entry writes a `.java` file at - // `/java/.java`, compiles via javac + d8, and + // `/java/.java`, compiles via javac + d8, and // bundles the resulting classes.dex into the APK. jni_main_count :: (self: BuildOptions) -> i64; - jni_main_foreign_path_at :: (self: BuildOptions, i: i64) -> string; + jni_main_runtime_path_at :: (self: BuildOptions, i: i64) -> string; jni_main_java_source_at :: (self: BuildOptions, i: i64) -> string; } diff --git a/library/modules/platform/bundle.sx b/library/modules/platform/bundle.sx index 1b54128..737bbc8 100644 --- a/library/modules/platform/bundle.sx +++ b/library/modules/platform/bundle.sx @@ -871,11 +871,11 @@ build_android_manifest :: (opts: BuildOptions, package: string, lib_name: string pkg_esc := xml.escape(package); lib_esc := xml.escape(lib_name); if opts.jni_main_count() > 0 { - // First `#jni_main` decl drives the Activity. The foreign_path + // First `#jni_main` decl drives the Activity. The runtime_path // uses `/` separators; Java fully-qualified class names use // `.` so we rewrite. - foreign := opts.jni_main_foreign_path_at(0); - cls := slash_to_dot(foreign); + runtime_path := opts.jni_main_runtime_path_at(0); + cls := slash_to_dot(runtime_path); cls_esc := xml.escape(cls); return format(#string MANIFEST @@ -938,7 +938,7 @@ slash_to_dot :: (path: string) -> string { } // Last `/`-separated component of a forward-slash path (used to split -// JNI foreign paths into pkg + class). `co/swipelab/Foo` → `Foo`. +// JNI runtime-class paths into pkg + class). `co/swipelab/Foo` → `Foo`. // `Foo` → `Foo`. `dir_part` returns the part before the last slash // (or "" if none). last_slash_component :: (path: string) -> string { @@ -990,10 +990,10 @@ compile_jni_main_sources :: (opts: BuildOptions, stage: string, android_jar: str count := opts.jni_main_count(); i : i64 = 0; while i < count { - foreign := opts.jni_main_foreign_path_at(i); + runtime_path := opts.jni_main_runtime_path_at(i); java_source := opts.jni_main_java_source_at(i); - pkg := dir_part(foreign); - cls := last_slash_component(foreign); + pkg := dir_part(runtime_path); + cls := last_slash_component(runtime_path); pkg_dir := if pkg.len > 0 then path_join(java_root, pkg) else java_root; if !create_dir_all(str_to_cstr(pkg_dir)) { @@ -1003,7 +1003,7 @@ compile_jni_main_sources :: (opts: BuildOptions, stage: string, android_jar: str java_path := path_join(pkg_dir, concat(cls, ".java")); if !write_file(str_to_cstr(java_path), java_source) { out("error: apk: cannot write .java for "); - out(foreign); + out(runtime_path); out("\n"); return false; } diff --git a/specs.md b/specs.md index 51adf0f..63a2a09 100644 --- a/specs.md +++ b/specs.md @@ -2972,7 +2972,7 @@ back inside the post-link callback. | `is_macos() / is_ios() / is_ios_device() / is_ios_simulator() / is_android()` | read | per-target predicates | | `framework_count() / framework_at(i)` | read | linker `-framework` names (for `Frameworks/` embed) | | `framework_path_count() / framework_path_at(i)` | read | linker `-F` search paths | -| `jni_main_count() / jni_main_foreign_path_at(i) / jni_main_java_source_at(i)` | read | `#jni_main` emissions for the APK bundler | +| `jni_main_count() / jni_main_runtime_path_at(i) / jni_main_java_source_at(i)` | read | `#jni_main` emissions for the APK bundler | | `asset_dir_count() / asset_dir_src_at(i) / asset_dir_dest_at(i)` | read | iterate registered asset trees | Returned strings are `""` when unset; integer counts are `0`. Accessors @@ -3046,7 +3046,7 @@ The Android branch: 3. **Stage `.stage/lib/arm64-v8a/`** — `copy_file` from the linked output. 4. **Manifest** — user-supplied via `set_manifest_path()`, or synthesized: - `NativeActivity` shape when no `#jni_main` is declared. - - `#jni_main` Activity shape with `android:name=""` + `android:hasCode="true"` otherwise. + - `#jni_main` Activity shape with `android:name=""` + `android:hasCode="true"` otherwise. 5. **Compile `#jni_main` Java sources** — write each entry's `java_source` to `/java//.java`, run `javac --release 11 -classpath ` to `/classes/`, run `d8 --release --lib --output ` to produce `/classes.dex`. `javac` discovered via `$JAVA_HOME/bin/javac` then `command -v javac`. 6. **`aapt2 link -I --manifest -o `**. 7. **Append archives** — `zip -q -r lib/`, then `zip -q classes.dex` (if dex was produced), then `zip` each registered asset dir at its `dest` path. diff --git a/src/ast.zig b/src/ast.zig index c62b2ab..fced71b 100644 --- a/src/ast.zig +++ b/src/ast.zig @@ -885,7 +885,7 @@ pub const RuntimeClassMember = union(enum) { pub const RuntimeClassDecl = struct { name: []const u8, // sx-side alias (left of `::`) - foreign_path: []const u8, // directive arg: "java/path/Foo" / "NSString" / "Foundation.URL" + runtime_path: []const u8, // directive arg: "java/path/Foo" / "NSString" / "Foundation.URL" runtime: RuntimeKind, members: []const RuntimeClassMember = &.{}, is_extern: bool = false, // `#objc_class(…) extern` — class is provided by the runtime; we only reference it (vs `export`, which defines + registers a new sx class) diff --git a/src/core.zig b/src/core.zig index ece0a80..62d8712 100644 --- a/src/core.zig +++ b/src/core.zig @@ -362,10 +362,10 @@ pub const Compilation = struct { /// Walk `lowering.program_index.runtime_class_map` and render Java sources for every /// `#jni_main #jni_class("...")` declaration. Renders happen here so the /// AST + class-registry snapshot stay confined to the lowering pass; the - /// downstream APK pipeline only needs `{foreign_path, java_source}` pairs. + /// downstream APK pipeline only needs `{runtime_path, java_source}` pairs. fn collectJniMainEmissions(self: *Compilation, lowering: *ir.Lowering) !void { // `runtime_class_map` registers each decl under bare + qualified names — - // dedupe by foreign_path so a single decl emits one .java. + // dedupe by runtime_path so a single decl emits one .java. var seen = std.StringHashMap(void).init(self.allocator); defer seen.deinit(); @@ -375,7 +375,7 @@ pub const Compilation = struct { defer registry.deinit(); var it_reg = lowering.program_index.runtime_class_map.iterator(); while (it_reg.next()) |entry| { - try registry.put(entry.key_ptr.*, entry.value_ptr.*.foreign_path); + try registry.put(entry.key_ptr.*, entry.value_ptr.*.runtime_path); } // Derive the `System.loadLibrary` argument from the `-o` basename @@ -390,15 +390,15 @@ pub const Compilation = struct { if (!fcd.is_main) continue; if (fcd.is_extern) continue; if (fcd.runtime != .jni_class) continue; - if (seen.contains(fcd.foreign_path)) continue; - try seen.put(fcd.foreign_path, {}); + if (seen.contains(fcd.runtime_path)) continue; + try seen.put(fcd.runtime_path, {}); const java_source = try ir.jni_java_emit.emitJavaSource(self.allocator, fcd, .{ .classes = ®istry, .lib_name = lib_name, }); try self.lowering_jni_main_decls.append(self.allocator, .{ - .foreign_path = try self.allocator.dupe(u8, fcd.foreign_path), + .runtime_path = try self.allocator.dupe(u8, fcd.runtime_path), .java_source = java_source, }); } diff --git a/src/ir/calls.test.zig b/src/ir/calls.test.zig index 196dda4..8526a66 100644 --- a/src/ir/calls.test.zig +++ b/src/ir/calls.test.zig @@ -359,7 +359,7 @@ test "plan: foreign-class instance vs static dispatch" { .{ .method = .{ .name = "length", .params = &.{}, .param_names = &.{}, .return_type = typeExpr(alloc, "i64"), .is_static = false } }, .{ .method = .{ .name = "stringWithUTF8String", .params = &.{}, .param_names = &.{}, .return_type = typeExpr(alloc, "i64"), .is_static = true } }, }; - var fcd = ast.RuntimeClassDecl{ .name = "NSString", .foreign_path = "NSString", .runtime = .objc_class, .members = &members }; + var fcd = ast.RuntimeClassDecl{ .name = "NSString", .runtime_path = "NSString", .runtime = .objc_class, .members = &members }; l.program_index.runtime_class_map.put("NSString", &fcd) catch unreachable; _ = module.types.intern(.{ .@"struct" = .{ .name = module.types.internString("NSString"), .fields = &.{} } }); diff --git a/src/ir/compiler_hooks.zig b/src/ir/compiler_hooks.zig index 7c69660..d43a515 100644 --- a/src/ir/compiler_hooks.zig +++ b/src/ir/compiler_hooks.zig @@ -81,7 +81,7 @@ pub const BuildConfig = struct { /// and bundles the resulting `classes.dex` into the APK. Slices /// reference compiler-owned memory that outlives the post-link /// callback. - jni_main_foreign_paths: []const []const u8 = &.{}, + jni_main_runtime_paths: []const []const u8 = &.{}, jni_main_java_sources: []const []const u8 = &.{}, pub fn deinit(self: *BuildConfig, alloc: Allocator) void { @@ -160,7 +160,7 @@ pub const Registry = struct { self.hooks.put("BuildOptions.keystore_path", &hookGetKeystorePath) catch {}; // #jni_main class emissions, exposed by index so bundle.sx can iterate. self.hooks.put("BuildOptions.jni_main_count", &hookJniMainCount) catch {}; - self.hooks.put("BuildOptions.jni_main_foreign_path_at", &hookJniMainForeignPathAt) catch {}; + self.hooks.put("BuildOptions.jni_main_runtime_path_at", &hookJniMainRuntimePathAt) catch {}; self.hooks.put("BuildOptions.jni_main_java_source_at", &hookJniMainJavaSourceAt) catch {}; // Framework list accessors (for `.app/Frameworks/` embedding) self.hooks.put("BuildOptions.framework_count", &hookFrameworkCount) catch {}; @@ -470,19 +470,19 @@ fn hookGetKeystorePath(_: *const Interpreter, _: []const Value, bc: *BuildConfig // ── #jni_main emission accessors ────────────────────────────────────── // The Android bundler walks these as `0..jni_main_count()` and reads -// each entry's `(foreign_path, java_source)` pair so it can write a +// each entry's `(runtime_path, java_source)` pair so it can write a // `.java` file per decl, compile via javac, and produce classes.dex // via d8 before zipping into the APK. fn hookJniMainCount(_: *const Interpreter, _: []const Value, bc: *BuildConfig, _: Allocator) HookError!Value { - return Value{ .int = @intCast(bc.jni_main_foreign_paths.len) }; + return Value{ .int = @intCast(bc.jni_main_runtime_paths.len) }; } -fn hookJniMainForeignPathAt(_: *const Interpreter, args: []const Value, bc: *BuildConfig, _: Allocator) HookError!Value { +fn hookJniMainRuntimePathAt(_: *const Interpreter, args: []const Value, bc: *BuildConfig, _: Allocator) HookError!Value { if (args.len < 2) return Value{ .string = "" }; const idx = args[1].asInt() orelse return error.TypeError; - if (idx < 0 or @as(usize, @intCast(idx)) >= bc.jni_main_foreign_paths.len) return Value{ .string = "" }; - return Value{ .string = bc.jni_main_foreign_paths[@intCast(idx)] }; + if (idx < 0 or @as(usize, @intCast(idx)) >= bc.jni_main_runtime_paths.len) return Value{ .string = "" }; + return Value{ .string = bc.jni_main_runtime_paths[@intCast(idx)] }; } fn hookJniMainJavaSourceAt(_: *const Interpreter, args: []const Value, bc: *BuildConfig, _: Allocator) HookError!Value { diff --git a/src/ir/jni_descriptor.zig b/src/ir/jni_descriptor.zig index 4358740..db622b2 100644 --- a/src/ir/jni_descriptor.zig +++ b/src/ir/jni_descriptor.zig @@ -169,14 +169,14 @@ pub fn isJniReturnTypeSupported(table: *const types.TypeTable, ret_ty: TypeId) b }; } -/// Encode a (foreign_path, method_name) pair as the JNI-resolved symbol +/// Encode a (runtime_path, method_name) pair as the JNI-resolved symbol /// `Java___sx_1`. JNI mangling: /// `/` → `_`, `_` → `_1`. The `sx_` prefix matches the Java-side /// `private native sx_(...)` delegate. -pub fn jniMangleNativeName(allocator: std.mem.Allocator, foreign_path: []const u8, method_name: []const u8) ![]u8 { +pub fn jniMangleNativeName(allocator: std.mem.Allocator, runtime_path: []const u8, method_name: []const u8) ![]u8 { var buf = std.ArrayList(u8).empty; try buf.appendSlice(allocator, "Java_"); - for (foreign_path) |ch| { + for (runtime_path) |ch| { if (ch == '/') { try buf.append(allocator, '_'); } else if (ch == '_') { diff --git a/src/ir/jni_java_emit.test.zig b/src/ir/jni_java_emit.test.zig index 76f2690..7da3aeb 100644 --- a/src/ir/jni_java_emit.test.zig +++ b/src/ir/jni_java_emit.test.zig @@ -42,7 +42,7 @@ test "rejects non-main decl" { const a = std.testing.allocator; const fcd: ast.RuntimeClassDecl = .{ .name = "Foo", - .foreign_path = "co/example/Foo", + .runtime_path = "co/example/Foo", .runtime = .jni_class, .is_main = false, // ← not main }; @@ -73,7 +73,7 @@ test "void onCreate(Bundle) with default Activity superclass" { } }; const fcd: ast.RuntimeClassDecl = .{ .name = "SxApp", - .foreign_path = "co/swipelab/sx_runtime/SxNativeActivity", + .runtime_path = "co/swipelab/sx_runtime/SxNativeActivity", .runtime = .jni_class, .is_main = true, .members = &.{member}, @@ -116,7 +116,7 @@ test "primitive params" { } }; const fcd: ast.RuntimeClassDecl = .{ .name = "Sx", - .foreign_path = "co/sample/Sx", + .runtime_path = "co/sample/Sx", .runtime = .jni_class, .is_main = true, .members = &.{member}, @@ -157,7 +157,7 @@ test "declaration-only methods are skipped" { const fcd: ast.RuntimeClassDecl = .{ .name = "Sx", - .foreign_path = "co/example/Sx", + .runtime_path = "co/example/Sx", .runtime = .jni_class, .is_main = true, .members = &.{ bodied, decl_only }, @@ -194,7 +194,7 @@ test "#extends Alias resolves through class registry" { const fcd: ast.RuntimeClassDecl = .{ .name = "Sx", - .foreign_path = "co/example/Sx", + .runtime_path = "co/example/Sx", .runtime = .jni_class, .is_main = true, .members = &.{ extends_member, method_member }, @@ -204,7 +204,7 @@ test "#extends Alias resolves through class registry" { try std.testing.expect(std.mem.indexOf(u8, out, "extends co.example.MyParentActivity") != null); } -test "default-package class (no slash in foreign_path)" { +test "default-package class (no slash in runtime_path)" { const a = std.testing.allocator; var arena = std.heap.ArenaAllocator.init(a); defer arena.deinit(); @@ -222,7 +222,7 @@ test "default-package class (no slash in foreign_path)" { } }; const fcd: ast.RuntimeClassDecl = .{ .name = "Sx", - .foreign_path = "SxNoPackage", + .runtime_path = "SxNoPackage", .runtime = .jni_class, .is_main = true, .members = &.{member}, @@ -253,7 +253,7 @@ test "lib_name renders System.loadLibrary static init block" { const fcd: ast.RuntimeClassDecl = .{ .name = "SxApp", - .foreign_path = "co/example/SxApp", + .runtime_path = "co/example/SxApp", .runtime = .jni_class, .is_main = true, .members = &.{method}, @@ -296,7 +296,7 @@ test "field declarations render as private Java fields" { const fcd: ast.RuntimeClassDecl = .{ .name = "SxApp", - .foreign_path = "co/example/SxApp", + .runtime_path = "co/example/SxApp", .runtime = .jni_class, .is_main = true, .members = &.{ view_field, w_field, method }, @@ -334,7 +334,7 @@ test "#implements clauses on the class header" { const fcd: ast.RuntimeClassDecl = .{ .name = "SxApp", - .foreign_path = "co/example/SxApp", + .runtime_path = "co/example/SxApp", .runtime = .jni_class, .is_main = true, .members = &.{ impl_a, impl_b, method }, diff --git a/src/ir/jni_java_emit.zig b/src/ir/jni_java_emit.zig index 41f4f4f..e1230f0 100644 --- a/src/ir/jni_java_emit.zig +++ b/src/ir/jni_java_emit.zig @@ -4,7 +4,7 @@ // Given a `RuntimeClassDecl` whose `is_main` flag is set, emit a `.java` // source file that: // -// - declares a `public class` at the foreign_path's package + simple +// - declares a `public class` at the runtime_path's package + simple // name (e.g. `co/swipelab/Test/SxTestActivity` → // `package co.swipelab.Test; public class SxTestActivity`); // - extends the parent specified by `#extends Alias` (or @@ -91,7 +91,7 @@ pub fn emitJavaSource( var buf: std.ArrayList(u8) = .empty; errdefer buf.deinit(allocator); - const parts = splitForeignPath(fcd.foreign_path); + const parts = splitRuntimePath(fcd.runtime_path); if (parts.pkg.len > 0) { try buf.appendSlice(allocator, "package "); try appendDotted(allocator, &buf, parts.pkg); @@ -104,7 +104,7 @@ pub fn emitJavaSource( .extends => |alias| { if (opts.classes) |reg| { if (reg.get(alias)) |path| { - parent = try foreignPathToJavaName(allocator, path); + parent = try runtimePathToJavaName(allocator, path); parent_owned = true; break; } @@ -189,13 +189,13 @@ pub fn emitJavaSource( const PathParts = struct { pkg: []const u8, cls: []const u8 }; -fn splitForeignPath(foreign_path: []const u8) PathParts { - const last_slash = std.mem.lastIndexOfScalar(u8, foreign_path, '/') orelse { - return .{ .pkg = "", .cls = foreign_path }; +fn splitRuntimePath(runtime_path: []const u8) PathParts { + const last_slash = std.mem.lastIndexOfScalar(u8, runtime_path, '/') orelse { + return .{ .pkg = "", .cls = runtime_path }; }; return .{ - .pkg = foreign_path[0..last_slash], - .cls = foreign_path[last_slash + 1 ..], + .pkg = runtime_path[0..last_slash], + .cls = runtime_path[last_slash + 1 ..], }; } @@ -212,7 +212,7 @@ fn appendDotted( } } -fn foreignPathToJavaName(allocator: Allocator, slash_path: []const u8) EmitError![]u8 { +fn runtimePathToJavaName(allocator: Allocator, slash_path: []const u8) EmitError![]u8 { var buf: std.ArrayList(u8) = .empty; try appendDotted(allocator, &buf, slash_path); return buf.toOwnedSlice(allocator); diff --git a/src/ir/lower.test.zig b/src/ir/lower.test.zig index dbd1de0..7d2d980 100644 --- a/src/ir/lower.test.zig +++ b/src/ir/lower.test.zig @@ -386,7 +386,7 @@ test "lower: objcDefinedStateStructType collects user-declared fields" { }; const fcd = ast.RuntimeClassDecl{ .name = "SxFoo", - .foreign_path = "SxFoo", + .runtime_path = "SxFoo", .runtime = .objc_class, .members = &members, .is_extern = false, @@ -418,7 +418,7 @@ test "lower: objcDefinedStateStructType handles empty field set" { const fcd = ast.RuntimeClassDecl{ .name = "SxEmpty", - .foreign_path = "SxEmpty", + .runtime_path = "SxEmpty", .runtime = .objc_class, .members = &.{}, .is_extern = false, @@ -450,7 +450,7 @@ test "lower: objcDefinedStateStructType skips non-field members" { }; const fcd = ast.RuntimeClassDecl{ .name = "SxMixed", - .foreign_path = "SxMixed", + .runtime_path = "SxMixed", .runtime = .objc_class, .members = &members, .is_extern = false, @@ -478,7 +478,7 @@ test "lower: objcTypeEncodingFromSignature emits @ for Obj-C class pointers" { const ns_ptr = module.types.ptrTo(ns_struct); var ns_fcd = ast.RuntimeClassDecl{ .name = "NSString", - .foreign_path = "NSString", + .runtime_path = "NSString", .runtime = .objc_class, .members = &.{}, .is_extern = true, @@ -511,7 +511,7 @@ test "lower: objcTypeEncodingFromSignature unwraps optional to wire type" { const ns_ptr = module.types.ptrTo(ns_struct); var ns_fcd = ast.RuntimeClassDecl{ .name = "NSString", - .foreign_path = "NSString", + .runtime_path = "NSString", .runtime = .objc_class, .members = &.{}, .is_extern = true, @@ -680,7 +680,7 @@ test "lower: isObjcClassPointer recognises pointer-to-foreign-Obj-C-class" { const ns_ptr = module.types.ptrTo(ns_struct); var ns_fcd = ast.RuntimeClassDecl{ .name = "NSString", - .foreign_path = "NSString", + .runtime_path = "NSString", .runtime = .objc_class, .members = &.{}, .is_extern = true, @@ -696,7 +696,7 @@ test "lower: isObjcClassPointer recognises pointer-to-foreign-Obj-C-class" { const proto_ptr = module.types.ptrTo(proto_struct); var proto_fcd = ast.RuntimeClassDecl{ .name = "NSCopying", - .foreign_path = "NSCopying", + .runtime_path = "NSCopying", .runtime = .objc_protocol, .members = &.{}, .is_extern = true, @@ -728,7 +728,7 @@ test "lower: objcPropertyKind defaults + explicit ARC modifiers" { _ = module.types.intern(.{ .@"struct" = .{ .name = ns_name, .fields = &.{} } }); var ns_fcd = ast.RuntimeClassDecl{ .name = "NSString", - .foreign_path = "NSString", + .runtime_path = "NSString", .runtime = .objc_class, .members = &.{}, .is_extern = true, @@ -753,7 +753,7 @@ test "lower: objcPropertyKind defaults + explicit ARC modifiers" { _ = module.types.intern(.{ .@"struct" = .{ .name = proto_name, .fields = &.{} } }); var proto_fcd = ast.RuntimeClassDecl{ .name = "NSCoding", - .foreign_path = "NSCoding", + .runtime_path = "NSCoding", .runtime = .objc_protocol, .members = &.{}, .is_extern = true, diff --git a/src/ir/lower/ffi.zig b/src/ir/lower/ffi.zig index d1f5023..9bc22ab 100644 --- a/src/ir/lower/ffi.zig +++ b/src/ir/lower/ffi.zig @@ -297,11 +297,11 @@ pub fn lowerRuntimeMethodCall( defer registry.deinit(); var it = self.program_index.runtime_class_map.iterator(); while (it.next()) |entry| { - registry.put(entry.key_ptr.*, entry.value_ptr.*.foreign_path) catch {}; + registry.put(entry.key_ptr.*, entry.value_ptr.*.runtime_path) catch {}; } const desc_str = jni_descriptor.deriveMethod(self.alloc, .{ - .enclosing_path = fcd.foreign_path, + .enclosing_path = fcd.runtime_path, .classes = ®istry, }, method) catch |err| { if (self.diagnostics) |d| { @@ -496,7 +496,7 @@ pub fn lowerObjcStaticCall( // Load the class object from its module-scoped cached slot. // `objc_getClass()` runs once at module-init via the // constructor emit_llvm synthesizes (see `emitObjcClassInit`). - const class_slot_gid = self.internObjcClassObject(fcd.foreign_path); + const class_slot_gid = self.internObjcClassObject(fcd.runtime_path); const class_slot_ptr = self.builder.emit(.{ .global_addr = class_slot_gid }, self.module.types.ptrTo(vptr_ty)); const class_obj = self.builder.emit(.{ .load = .{ .operand = class_slot_ptr } }, vptr_ty); @@ -602,7 +602,7 @@ pub fn lowerRuntimeStaticCall( defer registry.deinit(); var it = self.program_index.runtime_class_map.iterator(); while (it.next()) |entry| { - registry.put(entry.key_ptr.*, entry.value_ptr.*.foreign_path) catch {}; + registry.put(entry.key_ptr.*, entry.value_ptr.*.runtime_path) catch {}; } // For `new`, the JNI descriptor's return position is `V` (the @@ -620,7 +620,7 @@ pub fn lowerRuntimeStaticCall( }; const descriptor = jni_descriptor.deriveMethod(self.alloc, .{ - .enclosing_path = fcd.foreign_path, + .enclosing_path = fcd.runtime_path, .classes = ®istry, }, m_for_desc) catch |err| { if (self.diagnostics) |d| d.addFmt(.err, span, "JNI descriptor derivation failed for '{s}.new': {s}", .{ fcd.name, @errorName(err) }); @@ -655,7 +655,7 @@ pub fn lowerRuntimeStaticCall( .args = args_owned, .is_static = false, .is_constructor = true, - .parent_class_path = self.alloc.dupe(u8, fcd.foreign_path) catch fcd.foreign_path, + .parent_class_path = self.alloc.dupe(u8, fcd.runtime_path) catch fcd.runtime_path, .cache_key = null, } }, ret_ty); } @@ -684,13 +684,13 @@ pub fn lowerSuperCall( return Ref.none; }; - // Resolve parent foreign_path from the fcd's `#extends`. Default to + // Resolve parent runtime_path from the fcd's `#extends`. Default to // android.app.Activity to match the jni_java_emit default. var parent_path: []const u8 = "android/app/Activity"; for (fcd.members) |m| switch (m) { .extends => |alias| { if (self.program_index.runtime_class_map.get(alias)) |parent_fcd| { - parent_path = parent_fcd.foreign_path; + parent_path = parent_fcd.runtime_path; } else { parent_path = alias; } @@ -735,7 +735,7 @@ pub fn lowerSuperCall( defer registry.deinit(); var it = self.program_index.runtime_class_map.iterator(); while (it.next()) |entry| { - registry.put(entry.key_ptr.*, entry.value_ptr.*.foreign_path) catch {}; + registry.put(entry.key_ptr.*, entry.value_ptr.*.runtime_path) catch {}; } descriptor = jni_descriptor.deriveMethod(self.alloc, .{ .enclosing_path = parent_path, @@ -822,14 +822,14 @@ pub fn registerRuntimeClassDecl(self: *Lowering, fcd: *const ast.RuntimeClassDec /// `#objc_class` to the actual Obj-C runtime class name. Falls /// back to "NSObject" when no `#extends` is declared. /// Aliases that resolve to foreign Obj-C classes use the -/// foreign_path; aliases for OTHER sx-defined classes use the +/// runtime_path; aliases for OTHER sx-defined classes use the /// alias name directly (which equals the Obj-C class name for /// sx-defined classes). pub fn resolveObjcParentName(self: *Lowering, fcd: *const ast.RuntimeClassDecl) []const u8 { for (fcd.members) |m| switch (m) { .extends => |alias| { if (self.program_index.runtime_class_map.get(alias)) |parent_fcd| { - if (parent_fcd.is_extern) return parent_fcd.foreign_path; + if (parent_fcd.is_extern) return parent_fcd.runtime_path; // Sx-defined parent — its alias IS its Obj-C name. return parent_fcd.name; } @@ -1039,8 +1039,8 @@ pub fn synthesizeJniMainStubs(self: *Lowering) void { if (!fcd.is_main) continue; if (fcd.is_extern) continue; if (fcd.runtime != .jni_class) continue; - if (seen.contains(fcd.foreign_path)) continue; - seen.put(fcd.foreign_path, {}) catch continue; + if (seen.contains(fcd.runtime_path)) continue; + seen.put(fcd.runtime_path, {}) catch continue; for (fcd.members) |m| switch (m) { .method => |md| { @@ -1054,7 +1054,7 @@ pub fn synthesizeJniMainStubs(self: *Lowering) void { } pub fn synthesizeJniMainStub(self: *Lowering, fcd: *const ast.RuntimeClassDecl, md: ast.RuntimeMethodDecl) void { - const mangled = jni_descriptor.jniMangleNativeName(self.alloc, fcd.foreign_path, md.name) catch return; + const mangled = jni_descriptor.jniMangleNativeName(self.alloc, fcd.runtime_path, md.name) catch return; const name_id = self.module.types.internString(mangled); const ptr_void = self.module.types.ptrTo(.void); diff --git a/src/ir/program_index.test.zig b/src/ir/program_index.test.zig index 5b115c6..29f3074 100644 --- a/src/ir/program_index.test.zig +++ b/src/ir/program_index.test.zig @@ -70,7 +70,7 @@ test "ProgramIndex declaration maps round-trip (A1.1b)" { // runtime_class_map: sx alias → RuntimeClassDecl. const fcd = ast.RuntimeClassDecl{ .name = "NSString", - .foreign_path = "NSString", + .runtime_path = "NSString", .runtime = .objc_class, .members = &.{}, .is_extern = true, diff --git a/src/main.zig b/src/main.zig index 89be516..d2858e9 100644 --- a/src/main.zig +++ b/src/main.zig @@ -704,7 +704,7 @@ fn compileWithTimer(allocator: std.mem.Allocator, io: std.Io, input_path: []cons if (e.build_config.manifest_path == null) e.build_config.manifest_path = merged_config.manifest_path; if (e.build_config.keystore_path == null) e.build_config.keystore_path = merged_config.keystore_path; // `#jni_main` decls flow from the compiler's lowering pass — - // pre-rendered Java sources + the foreign_path for each. Build + // pre-rendered Java sources + the runtime_path for each. Build // two parallel slices since BuildConfig hooks return strings. const jni_decls = comp.getJniMainEmissions(); if (jni_decls.len > 0) { @@ -722,13 +722,13 @@ fn compileWithTimer(allocator: std.mem.Allocator, io: std.Io, input_path: []cons const fps = try allocator.alloc([]const u8, jni_decls.len); const srcs = try allocator.alloc([]const u8, jni_decls.len); for (jni_decls, 0..) |em, idx| { - fps[idx] = em.foreign_path; + fps[idx] = em.runtime_path; srcs[idx] = if (lib_name) |ln| try sx.ir.jni_java_emit.injectLoadLibrary(allocator, em.java_source, ln) else em.java_source; } - e.build_config.jni_main_foreign_paths = fps; + e.build_config.jni_main_runtime_paths = fps; e.build_config.jni_main_java_sources = srcs; } } diff --git a/src/parser.zig b/src/parser.zig index 2841236..9ceea8e 100644 --- a/src/parser.zig +++ b/src/parser.zig @@ -1371,7 +1371,7 @@ pub const Parser = struct { return self.fail("expected string literal foreign-type path after directive"); } const raw = self.tokenSlice(self.current); - const foreign_path = raw[1 .. raw.len - 1]; + const runtime_path = raw[1 .. raw.len - 1]; self.advance(); try self.expect(.r_paren); @@ -1621,7 +1621,7 @@ pub const Parser = struct { return try self.createNode(start_pos, .{ .runtime_class_decl = .{ .name = name, - .foreign_path = foreign_path, + .runtime_path = runtime_path, .runtime = runtime, .members = try members.toOwnedSlice(self.allocator), .is_extern = is_extern_eff, diff --git a/src/target.zig b/src/target.zig index 2603e43..59a5ca1 100644 --- a/src/target.zig +++ b/src/target.zig @@ -9,9 +9,9 @@ const c = llvm.c; /// compiles via `javac`, dexes via `d8`, and bundles the resulting /// `classes.dex` into the APK. pub const JniMainEmission = struct { - /// foreign_path of the source decl (e.g. "co/swipelab/sxmain/SxApp"). + /// runtime_path of the source decl (e.g. "co/swipelab/sxmain/SxApp"). /// Splits into package + class name for `/java//.java`. - foreign_path: []const u8, + runtime_path: []const u8, /// Pre-rendered Java source bytes (from `jni_java_emit.emitJavaSource`). java_source: []const u8, };