| author | |
| committer | |
| log | 656cc33f8d49cb5e79cd3f9f8f56963747d43ed6 |
| tree | e35ada7d719c2ab2e486f4bd6ba32261a35e40be |
| parent | 71b7f4b47f69e9b3241e9d44554572258f5eb5b1 |
| signature |
Calling with a new stack, with a runtime-known stack pointer (e.g.
not a global variable) is regressed with this branch. It is now a
compile-error, due to the Runtime Hint system not being smart enough
to mix a compile-time modifier field with a runtime stack field.
I'm OK with this regression because this feature is flawed (see #3268)
and may be deleted from the language.4 files changed, 16 insertions(+), 27 deletions(-)
doc/langref.html.in+4-11| ... | ... | @@ -6870,16 +6870,6 @@ pub const CallOptions = struct { |
| 6870 | 6870 | /// Equivalent to function call syntax. |
| 6871 | 6871 | auto, |
| 6872 | 6872 | |
| 6873 | /// Asserts that the function call will not suspend. This allows a | |
| 6874 | /// non-async function to call an async function. | |
| 6875 | no_async, | |
| 6876 | ||
| 6877 | /// The function call will return an async function frame instead of | |
| 6878 | /// the function's result, which is expected to then be awaited. | |
| 6879 | /// This is equivalent to using the `async` keyword in front of function | |
| 6880 | /// call syntax. | |
| 6881 | async_call, | |
| 6882 | ||
| 6883 | 6873 | /// Prevents tail call optimization. This guarantees that the return |
| 6884 | 6874 | /// address will point to the callsite, as opposed to the callsite's |
| 6885 | 6875 | /// callsite. If the call is otherwise required to be tail-called |
| ... | ... | @@ -6890,6 +6880,10 @@ pub const CallOptions = struct { |
| 6890 | 6880 | /// otherwise required to be inlined, a compile error is emitted instead. |
| 6891 | 6881 | never_inline, |
| 6892 | 6882 | |
| 6883 | /// Asserts that the function call will not suspend. This allows a | |
| 6884 | /// non-async function to call an async function. | |
| 6885 | no_async, | |
| 6886 | ||
| 6893 | 6887 | /// Guarantees that the call will be generated with tail call optimization. |
| 6894 | 6888 | /// If this is not possible, a compile error is emitted instead. |
| 6895 | 6889 | always_tail, |
| ... | ... | @@ -6938,7 +6932,6 @@ fn targetFunction(x: i32) usize { |
| 6938 | 6932 | } |
| 6939 | 6933 | {#code_end#} |
| 6940 | 6934 | {#header_close#} |
| 6941 | ||
| 6942 | 6935 | {#header_close#} |
| 6943 | 6936 | |
| 6944 | 6937 | {#header_open|@cDefine#} |
lib/std/builtin.zig+4-10| ... | ... | @@ -382,16 +382,6 @@ pub const CallOptions = struct { |
| 382 | 382 | /// Equivalent to function call syntax. |
| 383 | 383 | auto, |
| 384 | 384 | |
| 385 | /// Asserts that the function call will not suspend. This allows a | |
| 386 | /// non-async function to call an async function. | |
| 387 | no_async, | |
| 388 | ||
| 389 | /// The function call will return an async function frame instead of | |
| 390 | /// the function's result, which is expected to then be awaited. | |
| 391 | /// This is equivalent to using the `async` keyword in front of function | |
| 392 | /// call syntax. | |
| 393 | async_call, | |
| 394 | ||
| 395 | 385 | /// Prevents tail call optimization. This guarantees that the return |
| 396 | 386 | /// address will point to the callsite, as opposed to the callsite's |
| 397 | 387 | /// callsite. If the call is otherwise required to be tail-called |
| ... | ... | @@ -402,6 +392,10 @@ pub const CallOptions = struct { |
| 402 | 392 | /// otherwise required to be inlined, a compile error is emitted instead. |
| 403 | 393 | never_inline, |
| 404 | 394 | |
| 395 | /// Asserts that the function call will not suspend. This allows a | |
| 396 | /// non-async function to call an async function. | |
| 397 | no_async, | |
| 398 | ||
| 405 | 399 | /// Guarantees that the call will be generated with tail call optimization. |
| 406 | 400 | /// If this is not possible, a compile error is emitted instead. |
| 407 | 401 | always_tail, |
src/all_types.hpp+6-4| ... | ... | @@ -409,6 +409,9 @@ struct ZigValue { |
| 409 | 409 | LLVMValueRef llvm_global; |
| 410 | 410 | |
| 411 | 411 | union { |
| 412 | // populated if special == ConstValSpecialLazy | |
| 413 | LazyValue *x_lazy; | |
| 414 | ||
| 412 | 415 | // populated if special == ConstValSpecialStatic |
| 413 | 416 | BigInt x_bigint; |
| 414 | 417 | BigFloat x_bigfloat; |
| ... | ... | @@ -429,7 +432,6 @@ struct ZigValue { |
| 429 | 432 | ConstPtrValue x_ptr; |
| 430 | 433 | ConstArgTuple x_arg_tuple; |
| 431 | 434 | Buf *x_enum_literal; |
| 432 | LazyValue *x_lazy; | |
| 433 | 435 | |
| 434 | 436 | // populated if special == ConstValSpecialRuntime |
| 435 | 437 | RuntimeHintErrorUnion rh_error_union; |
| ... | ... | @@ -770,16 +772,16 @@ struct AstNodeUnwrapOptional { |
| 770 | 772 | // Must be synchronized with std.builtin.CallOptions.Modifier |
| 771 | 773 | enum CallModifier { |
| 772 | 774 | CallModifierNone, |
| 773 | CallModifierNoAsync, | |
| 774 | CallModifierAsync, | |
| 775 | 775 | CallModifierNeverTail, |
| 776 | 776 | CallModifierNeverInline, |
| 777 | CallModifierNoAsync, | |
| 777 | 778 | CallModifierAlwaysTail, |
| 778 | 779 | CallModifierAlwaysInline, |
| 779 | 780 | CallModifierCompileTime, |
| 780 | 781 | |
| 781 | // This is an additional tag in the compiler, but not exposed in the std lib. | |
| 782 | // These are additional tags in the compiler, but not exposed in the std lib. | |
| 782 | 783 | CallModifierBuiltin, |
| 784 | CallModifierAsync, | |
| 783 | 785 | }; |
| 784 | 786 | |
| 785 | 787 | struct AstNodeFnCallExpr { |
test/compile_errors.zig+2-2| ... | ... | @@ -45,9 +45,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 45 | 45 | |
| 46 | 46 | cases.addCase(x: { |
| 47 | 47 | var tc = cases.create("call with new stack on unsupported target", |
| 48 | \\var buf: [10]u8 align(16) = undefined; | |
| 48 | 49 | \\export fn entry() void { |
| 49 | \\ var buf: [10]u8 align(16) = undefined; | |
| 50 | \\ @call(.{.stack = &buf}, foo); | |
| 50 | \\ @call(.{.stack = &buf}, foo, .{}); | |
| 51 | 51 | \\} |
| 52 | 52 | \\fn foo() void {} |
| 53 | 53 | , "tmp.zig:3:5: error: target arch 'wasm32' does not support calling with a new stack"); |