diff options
| author | LemonBoy <thatlemon@gmail.com> | 2021-04-25 19:42:59 +0200 |
|---|---|---|
| committer | LemonBoy <thatlemon@gmail.com> | 2021-04-25 20:41:49 +0200 |
| commit | 82f1d592fae021fcfc737e3cb6c107b325fcf1ee (patch) | |
| tree | e412103ef8f4de28e579b03f0ad6e473cd55daf9 /src/stage1/ir.cpp | |
| parent | 0340ed3a9e3fd62e5f8021f2755a26fb3497123e (diff) | |
| download | zig-82f1d592fae021fcfc737e3cb6c107b325fcf1ee.tar.gz zig-82f1d592fae021fcfc737e3cb6c107b325fcf1ee.zip | |
stage1: Use correct alignment for asyncCall frame
Diffstat (limited to 'src/stage1/ir.cpp')
| -rw-r--r-- | src/stage1/ir.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/stage1/ir.cpp b/src/stage1/ir.cpp index 176d50dc72..7edfe37c92 100644 --- a/src/stage1/ir.cpp +++ b/src/stage1/ir.cpp @@ -20659,8 +20659,12 @@ static IrInstGen *analyze_casted_new_stack(IrAnalyze *ira, IrInst* source_instr, get_fn_frame_type(ira->codegen, fn_entry), false); return ir_implicit_cast(ira, new_stack, needed_frame_type); } else { + // XXX The stack alignment is hardcoded to 16 here and in + // std.Target.stack_align. + const uint32_t required_align = is_async_call_builtin ? + get_async_frame_align_bytes(ira->codegen) : 16; ZigType *u8_ptr = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8, - false, false, PtrLenUnknown, target_fn_align(ira->codegen->zig_target), 0, 0, false); + false, false, PtrLenUnknown, required_align, 0, 0, false); ZigType *u8_slice = get_slice_type(ira->codegen, u8_ptr); ira->codegen->need_frame_size_prefix_data = true; return ir_implicit_cast2(ira, new_stack_src, new_stack, u8_slice); @@ -30095,7 +30099,7 @@ static IrInstGen *ir_align_cast(IrAnalyze *ira, IrInstGen *target, uint32_t alig fn_type_id.alignment = align_bytes; result_type = get_fn_type(ira->codegen, &fn_type_id); } else if (target_type->id == ZigTypeIdAnyFrame) { - if (align_bytes >= target_fn_align(ira->codegen->zig_target)) { + if (align_bytes >= get_async_frame_align_bytes(ira->codegen)) { result_type = target_type; } else { ir_add_error(ira, &target->base, buf_sprintf("sub-aligned anyframe not allowed")); |
