| 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,16 +6870,6 @@ pub const CallOptions = struct { |
| 6870 | /// Equivalent to function call syntax. | 6870 | /// Equivalent to function call syntax. |
| 6871 | auto, | 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 | /// Prevents tail call optimization. This guarantees that the return | 6873 | /// Prevents tail call optimization. This guarantees that the return |
| 6884 | /// address will point to the callsite, as opposed to the callsite's | 6874 | /// address will point to the callsite, as opposed to the callsite's |
| 6885 | /// callsite. If the call is otherwise required to be tail-called | 6875 | /// callsite. If the call is otherwise required to be tail-called |
| ... | @@ -6890,6 +6880,10 @@ pub const CallOptions = struct { | ... | @@ -6890,6 +6880,10 @@ pub const CallOptions = struct { |
| 6890 | /// otherwise required to be inlined, a compile error is emitted instead. | 6880 | /// otherwise required to be inlined, a compile error is emitted instead. |
| 6891 | never_inline, | 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 | /// Guarantees that the call will be generated with tail call optimization. | 6887 | /// Guarantees that the call will be generated with tail call optimization. |
| 6894 | /// If this is not possible, a compile error is emitted instead. | 6888 | /// If this is not possible, a compile error is emitted instead. |
| 6895 | always_tail, | 6889 | always_tail, |
| ... | @@ -6938,7 +6932,6 @@ fn targetFunction(x: i32) usize { | ... | @@ -6938,7 +6932,6 @@ fn targetFunction(x: i32) usize { |
| 6938 | } | 6932 | } |
| 6939 | {#code_end#} | 6933 | {#code_end#} |
| 6940 | {#header_close#} | 6934 | {#header_close#} |
| 6941 | |||
| 6942 | {#header_close#} | 6935 | {#header_close#} |
| 6943 | 6936 | ||
| 6944 | {#header_open|@cDefine#} | 6937 | {#header_open|@cDefine#} |
lib/std/builtin.zig+4-10| ... | @@ -382,16 +382,6 @@ pub const CallOptions = struct { | ... | @@ -382,16 +382,6 @@ pub const CallOptions = struct { |
| 382 | /// Equivalent to function call syntax. | 382 | /// Equivalent to function call syntax. |
| 383 | auto, | 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 | /// Prevents tail call optimization. This guarantees that the return | 385 | /// Prevents tail call optimization. This guarantees that the return |
| 396 | /// address will point to the callsite, as opposed to the callsite's | 386 | /// address will point to the callsite, as opposed to the callsite's |
| 397 | /// callsite. If the call is otherwise required to be tail-called | 387 | /// callsite. If the call is otherwise required to be tail-called |
| ... | @@ -402,6 +392,10 @@ pub const CallOptions = struct { | ... | @@ -402,6 +392,10 @@ pub const CallOptions = struct { |
| 402 | /// otherwise required to be inlined, a compile error is emitted instead. | 392 | /// otherwise required to be inlined, a compile error is emitted instead. |
| 403 | never_inline, | 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 | /// Guarantees that the call will be generated with tail call optimization. | 399 | /// Guarantees that the call will be generated with tail call optimization. |
| 406 | /// If this is not possible, a compile error is emitted instead. | 400 | /// If this is not possible, a compile error is emitted instead. |
| 407 | always_tail, | 401 | always_tail, |
src/all_types.hpp+6-4| ... | @@ -409,6 +409,9 @@ struct ZigValue { | ... | @@ -409,6 +409,9 @@ struct ZigValue { |
| 409 | LLVMValueRef llvm_global; | 409 | LLVMValueRef llvm_global; |
| 410 | 410 | ||
| 411 | union { | 411 | union { |
| 412 | // populated if special == ConstValSpecialLazy | ||
| 413 | LazyValue *x_lazy; | ||
| 414 | |||
| 412 | // populated if special == ConstValSpecialStatic | 415 | // populated if special == ConstValSpecialStatic |
| 413 | BigInt x_bigint; | 416 | BigInt x_bigint; |
| 414 | BigFloat x_bigfloat; | 417 | BigFloat x_bigfloat; |
| ... | @@ -429,7 +432,6 @@ struct ZigValue { | ... | @@ -429,7 +432,6 @@ struct ZigValue { |
| 429 | ConstPtrValue x_ptr; | 432 | ConstPtrValue x_ptr; |
| 430 | ConstArgTuple x_arg_tuple; | 433 | ConstArgTuple x_arg_tuple; |
| 431 | Buf *x_enum_literal; | 434 | Buf *x_enum_literal; |
| 432 | LazyValue *x_lazy; | ||
| 433 | 435 | ||
| 434 | // populated if special == ConstValSpecialRuntime | 436 | // populated if special == ConstValSpecialRuntime |
| 435 | RuntimeHintErrorUnion rh_error_union; | 437 | RuntimeHintErrorUnion rh_error_union; |
| ... | @@ -770,16 +772,16 @@ struct AstNodeUnwrapOptional { | ... | @@ -770,16 +772,16 @@ struct AstNodeUnwrapOptional { |
| 770 | // Must be synchronized with std.builtin.CallOptions.Modifier | 772 | // Must be synchronized with std.builtin.CallOptions.Modifier |
| 771 | enum CallModifier { | 773 | enum CallModifier { |
| 772 | CallModifierNone, | 774 | CallModifierNone, |
| 773 | CallModifierNoAsync, | ||
| 774 | CallModifierAsync, | ||
| 775 | CallModifierNeverTail, | 775 | CallModifierNeverTail, |
| 776 | CallModifierNeverInline, | 776 | CallModifierNeverInline, |
| 777 | CallModifierNoAsync, | ||
| 777 | CallModifierAlwaysTail, | 778 | CallModifierAlwaysTail, |
| 778 | CallModifierAlwaysInline, | 779 | CallModifierAlwaysInline, |
| 779 | CallModifierCompileTime, | 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 | CallModifierBuiltin, | 783 | CallModifierBuiltin, |
| 784 | CallModifierAsync, | ||
| 783 | }; | 785 | }; |
| 784 | 786 | ||
| 785 | struct AstNodeFnCallExpr { | 787 | struct AstNodeFnCallExpr { |
test/compile_errors.zig+2-2| ... | @@ -45,9 +45,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { | ... | @@ -45,9 +45,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 45 | 45 | ||
| 46 | cases.addCase(x: { | 46 | cases.addCase(x: { |
| 47 | var tc = cases.create("call with new stack on unsupported target", | 47 | var tc = cases.create("call with new stack on unsupported target", |
| 48 | \\var buf: [10]u8 align(16) = undefined; | ||
| 48 | \\export fn entry() void { | 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 | \\fn foo() void {} | 52 | \\fn foo() void {} |
| 53 | , "tmp.zig:3:5: error: target arch 'wasm32' does not support calling with a new stack"); | 53 | , "tmp.zig:3:5: error: target arch 'wasm32' does not support calling with a new stack"); |