diff --git a/src/builtins/builtins.zig b/src/builtins/builtins.zig index 946b309a5..298cc8cd9 100644 --- a/src/builtins/builtins.zig +++ b/src/builtins/builtins.zig @@ -896,7 +896,7 @@ fn String_decode2(vm: *cy.VM) Value { fn arrayIndex(vm: *cy.VM) anyerror!Value { const arr = vm.getObject(*cy.heap.Array, 0); const elem_t: cy.TypeId = @intCast(vm.getInt(1)); - const idx = try intAsIndex(vm.getInt(2), arr.len); + const idx = try intAsIndex(vm.getInt(2), @intCast(arr.len)); const elems = arr.getElemsPtr(); if (vm.sema.isUnboxedType(elem_t)) { @@ -952,7 +952,7 @@ fn String_getInt32(vm: *cy.VM) anyerror!Value { fn stringFindAnyByte(vm: *cy.VM) Value { const slice = vm.getString(0); const set_slice = vm.getObject(*cy.heap.Object, 1); - const set_ptr: [*]u8 = @ptrFromInt(set_slice.getValue(0).val); + const set_ptr: [*]u8 = @ptrFromInt(@as(usize, @intCast(set_slice.getValue(0).val))); const set_len: usize = @intCast(set_slice.getValue(1).asInt()); const set = set_ptr[0..set_len]; const setIsAscii = cy.string.isAstring(set); diff --git a/src/heap.zig b/src/heap.zig index 3ec0018c1..4eac0b957 100644 --- a/src/heap.zig +++ b/src/heap.zig @@ -2095,13 +2095,13 @@ pub fn freeObject(vm: *cy.VM, obj: *HeapObject, comptime skip_cyc_children: bool } }, .array => { - for (obj.array.getElemsPtr()[0..obj.array.len]) |it| { + for (obj.array.getElemsPtr()[0..@intCast(obj.array.len)]) |it| { if (skip_cyc_children and it.isCycPointer()) { continue; } cy.arc.release(vm, it); } - freeExternalObject(vm, obj, (2 + obj.array.len) * @sizeOf(Value), true); + freeExternalObject(vm, obj, @intCast((2 + obj.array.len) * @sizeOf(Value)), true); }, .trait => { const impl = obj.trait.impl; diff --git a/src/sym.zig b/src/sym.zig index 46e95553e..f35c204fb 100644 --- a/src/sym.zig +++ b/src/sym.zig @@ -1750,7 +1750,7 @@ test "sym internals" { } else { if (cy.is32Bit) { try t.eq(@sizeOf(Sym), 16); - try t.eq(@sizeOf(Func), 40); + try t.eq(@sizeOf(Func), 44); } else { try t.eq(@sizeOf(Sym), 24); try t.eq(@sizeOf(Func), 72); diff --git a/src/vm.zig b/src/vm.zig index 9490ea64c..ad3b0060e 100644 --- a/src/vm.zig +++ b/src/vm.zig @@ -199,6 +199,7 @@ pub const VM = struct { stdHttpClient: if (cy.hasCLI) *http.StdHttpClient else *anyopaque, emptyString: Value, + placeholder: Value, varSymExtras: cy.List(*cy.Sym), @@ -234,6 +235,7 @@ pub const VM = struct { .compiler = undefined, .sema = undefined, .emptyString = undefined, + .placeholder = undefined, .strInterns = .{}, .staticObjects = .{}, .names = .{}, @@ -3463,7 +3465,7 @@ pub const VMGetArgExt = struct { pub fn getArrayElems(vm: *VM, idx: u32) []Value { const arr = vm.c.framePtr[CallArgStart + idx].castHeapObject(*cy.heap.Array); - return arr.getElemsPtr()[0..arr.len]; + return arr.getElemsPtr()[0..@intCast(arr.len)]; } pub fn getEnumValue(vm: *VM, idx: u32) u32 {