From b55377a5ab34ba17336d25a9336a3bc18f535c43 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Tue, 24 Oct 2023 12:08:26 -0400 Subject: x86_64: pass more tests * 128-bit integer multiplication with overflow * more instruction encodings used by std inline asm * implement the `try_ptr` air instruction * follow correct stack frame abi * enable full panic handler * enable stack traces --- src/codegen.zig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/codegen.zig') diff --git a/src/codegen.zig b/src/codegen.zig index 72084c3741..051c2b33b3 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -850,7 +850,7 @@ fn genDeclRef( bin_file: *link.File, src_loc: Module.SrcLoc, tv: TypedValue, - decl_index: Module.Decl.Index, + ptr_decl_index: Module.Decl.Index, ) CodeGenError!GenResult { const mod = bin_file.options.module.?; log.debug("genDeclRef: ty = {}, val = {}", .{ tv.ty.fmt(mod), tv.val.fmtValue(tv.ty, mod) }); @@ -859,6 +859,12 @@ fn genDeclRef( const ptr_bits = target.ptrBitWidth(); const ptr_bytes: u64 = @divExact(ptr_bits, 8); + const ptr_decl = mod.declPtr(ptr_decl_index); + const decl_index = switch (mod.intern_pool.indexToKey(try ptr_decl.internValue(mod))) { + .func => |func| func.owner_decl, + .extern_func => |extern_func| extern_func.decl, + else => ptr_decl_index, + }; const decl = mod.declPtr(decl_index); if (!decl.ty.isFnOrHasRuntimeBitsIgnoreComptime(mod)) { -- cgit v1.2.3