x86_64: fix errors compiling the compiler

This fixes issues targetting both `x86_64-linux` and `x86_64-macos` with
the self-hosted backend.
This commit is contained in:
Jacob Young
2024-02-04 05:48:25 +01:00
parent f5dbcd1cb4
commit eaa6218f09
5 changed files with 55 additions and 24 deletions

View File

@@ -20136,6 +20136,7 @@ fn finishStructInit(
},
else => |e| return e,
};
try sema.resolveStructFieldInits(struct_ty);
try sema.queueFullTypeResolution(struct_ty);
const struct_val = try block.addAggregateInit(struct_ty, field_inits);
return sema.coerce(block, result_ty, struct_val, init_src);
@@ -35939,7 +35940,7 @@ pub fn resolveTypeFully(sema: *Sema, ty: Type) CompileError!void {
return sema.resolveTypeFully(ty.childType(mod));
},
.Struct => switch (mod.intern_pool.indexToKey(ty.toIntern())) {
.struct_type => return sema.resolveStructFully(ty),
.struct_type => try sema.resolveStructFully(ty),
.anon_struct_type => |tuple| {
for (tuple.types.get(ip)) |field_ty| {
try sema.resolveTypeFully(Type.fromInterned(field_ty));

View File

@@ -310,11 +310,6 @@ pub fn print(
return writer.writeAll(" }");
},
.ptr => |ptr| {
if (ptr.addr == .int) {}
const ptr_ty = ip.indexToKey(ty.toIntern()).ptr_type;
if (ptr_ty.flags.size == .Slice) {}
switch (ptr.addr) {
.decl => |decl_index| {
const decl = mod.declPtr(decl_index);
@@ -348,7 +343,14 @@ pub fn print(
.val = Value.fromInterned(field_val_ip),
}, writer, level - 1, mod);
},
.int => unreachable,
.int => |int_ip| {
try writer.writeAll("@ptrFromInt(");
try print(.{
.ty = Type.usize,
.val = Value.fromInterned(int_ip),
}, writer, level - 1, mod);
try writer.writeByte(')');
},
.eu_payload => |eu_ip| {
try writer.writeAll("(payload of ");
try print(.{

View File

@@ -9978,10 +9978,10 @@ fn fnTypeAssumeCapacity(
}
pub fn eql(ctx: @This(), lhs_key: Key, _: void, rhs_index: usize) bool {
const rhs_data = ctx.builder.type_items.items[rhs_index];
if (rhs_data.tag != tag) return false;
var rhs_extra = ctx.builder.typeExtraDataTrail(Type.Function, rhs_data.data);
const rhs_params = rhs_extra.trail.next(rhs_extra.data.params_len, Type, ctx.builder);
return rhs_data.tag == tag and lhs_key.ret == rhs_extra.data.ret and
std.mem.eql(Type, lhs_key.params, rhs_params);
return lhs_key.ret == rhs_extra.data.ret and std.mem.eql(Type, lhs_key.params, rhs_params);
}
};
const gop = self.type_map.getOrPutAssumeCapacityAdapted(
@@ -10161,9 +10161,10 @@ fn structTypeAssumeCapacity(
}
pub fn eql(ctx: @This(), lhs_key: []const Type, _: void, rhs_index: usize) bool {
const rhs_data = ctx.builder.type_items.items[rhs_index];
if (rhs_data.tag != tag) return false;
var rhs_extra = ctx.builder.typeExtraDataTrail(Type.Structure, rhs_data.data);
const rhs_fields = rhs_extra.trail.next(rhs_extra.data.fields_len, Type, ctx.builder);
return rhs_data.tag == tag and std.mem.eql(Type, lhs_key, rhs_fields);
return std.mem.eql(Type, lhs_key, rhs_fields);
}
};
const gop = self.type_map.getOrPutAssumeCapacityAdapted(fields, Adapter{ .builder = self });