mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
coff: fix runtime traps
This commit is contained in:
parent
49b1716064
commit
38573fed0b
@ -4204,6 +4204,7 @@ fn airRet(self: *Self, inst: Air.Inst.Index) !void {
|
||||
},
|
||||
.stack_offset => {
|
||||
const reg = try self.copyToTmpRegister(Type.usize, self.ret_mcv);
|
||||
log.warn("REG = {}", .{reg});
|
||||
const reg_lock = self.register_manager.lockRegAssumeUnused(reg);
|
||||
defer self.register_manager.unlockReg(reg_lock);
|
||||
|
||||
@ -5854,7 +5855,11 @@ fn genInlineMemcpy(
|
||||
len: MCValue,
|
||||
opts: InlineMemcpyOpts,
|
||||
) InnerError!void {
|
||||
// TODO preserve contents of .rax and .rcx if not free, and then restore
|
||||
// TODO: Preserve contents of .rax and .rcx if not free and locked, and then restore
|
||||
// How can we do this without context if the value inside .rax or .rcx we preserve contains
|
||||
// value needed to perform the memcpy in the first place?
|
||||
// I think we should have an accumulator-based context that we pass with each subsequent helper
|
||||
// call until we resolve the entire instruction.
|
||||
try self.register_manager.getReg(.rax, null);
|
||||
try self.register_manager.getReg(.rcx, null);
|
||||
|
||||
|
||||
@ -447,7 +447,7 @@ pub fn getCAbiIntReturnRegs(target: Target) []const Register {
|
||||
}
|
||||
|
||||
const gp_regs = [_]Register{
|
||||
.rax, .rbx, .rcx, .rdx, .rsi, .rdi, .r8, .r9, .r10, .r11, .r12, .r13, .r14, .r15,
|
||||
.rbx, .r12, .r13, .r14, .r15, .rax, .rcx, .rdx, .rsi, .rdi, .r8, .r9, .r10, .r11,
|
||||
};
|
||||
const sse_avx_regs = [_]Register{
|
||||
.ymm0, .ymm1, .ymm2, .ymm3, .ymm4, .ymm5, .ymm6, .ymm7,
|
||||
|
||||
@ -1053,7 +1053,7 @@ pub fn updateDecl(self: *Coff, module: *Module, decl_index: Module.Decl.Index) !
|
||||
.ty = decl.ty,
|
||||
.val = decl_val,
|
||||
}, &code_buffer, .none, .{
|
||||
.parent_atom_index = 0,
|
||||
.parent_atom_index = decl.link.coff.sym_index,
|
||||
});
|
||||
const code = switch (res) {
|
||||
.externally_managed => |x| x,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user