From 31e3793202402fda21905027c18ebfa5c8d8c832 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 14 Jan 2026 18:44:17 +0100 Subject: fix: improve handling of indirections Added 2 VM instructions, FnewE variant of Fnew with a dereference, and FieldE, variant of Field with dereference. It's now possible to pointers in structs and literal composites. --- vm/op_string.go | 64 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 31 deletions(-) (limited to 'vm/op_string.go') diff --git a/vm/op_string.go b/vm/op_string.go index e838628..5542c6e 100644 --- a/vm/op_string.go +++ b/vm/op_string.go @@ -21,40 +21,42 @@ func _() { _ = x[Dup-10] _ = x[Fdup-11] _ = x[Fnew-12] - _ = x[Equal-13] - _ = x[EqualSet-14] - _ = x[Exit-15] - _ = x[Field-16] - _ = x[FieldSet-17] - _ = x[FieldFset-18] - _ = x[Greater-19] - _ = x[Grow-20] - _ = x[Index-21] - _ = x[IndexSet-22] - _ = x[MapIndex-23] - _ = x[MapSet-24] - _ = x[Jump-25] - _ = x[JumpTrue-26] - _ = x[JumpFalse-27] - _ = x[JumpSetTrue-28] - _ = x[JumpSetFalse-29] - _ = x[Lower-30] - _ = x[Loweri-31] - _ = x[Mul-32] - _ = x[New-33] - _ = x[Negate-34] - _ = x[Not-35] - _ = x[Pop-36] - _ = x[Push-37] - _ = x[Return-38] - _ = x[Sub-39] - _ = x[Subi-40] - _ = x[Swap-41] + _ = x[FnewE-13] + _ = x[Equal-14] + _ = x[EqualSet-15] + _ = x[Exit-16] + _ = x[Field-17] + _ = x[FieldE-18] + _ = x[FieldSet-19] + _ = x[FieldFset-20] + _ = x[Greater-21] + _ = x[Grow-22] + _ = x[Index-23] + _ = x[IndexSet-24] + _ = x[MapIndex-25] + _ = x[MapSet-26] + _ = x[Jump-27] + _ = x[JumpTrue-28] + _ = x[JumpFalse-29] + _ = x[JumpSetTrue-30] + _ = x[JumpSetFalse-31] + _ = x[Lower-32] + _ = x[Loweri-33] + _ = x[Mul-34] + _ = x[New-35] + _ = x[Negate-36] + _ = x[Not-37] + _ = x[Pop-38] + _ = x[Push-39] + _ = x[Return-40] + _ = x[Sub-41] + _ = x[Subi-42] + _ = x[Swap-43] } -const _Op_name = "NopAddAddrAssignFassignVassignCallCalliCallXDerefDupFdupFnewEqualEqualSetExitFieldFieldSetFieldFsetGreaterGrowIndexIndexSetMapIndexMapSetJumpJumpTrueJumpFalseJumpSetTrueJumpSetFalseLowerLoweriMulNewNegateNotPopPushReturnSubSubiSwap" +const _Op_name = "NopAddAddrAssignFassignVassignCallCalliCallXDerefDupFdupFnewFnewEEqualEqualSetExitFieldFieldEFieldSetFieldFsetGreaterGrowIndexIndexSetMapIndexMapSetJumpJumpTrueJumpFalseJumpSetTrueJumpSetFalseLowerLoweriMulNewNegateNotPopPushReturnSubSubiSwap" -var _Op_index = [...]uint8{0, 3, 6, 10, 16, 23, 30, 34, 39, 44, 49, 52, 56, 60, 65, 73, 77, 82, 90, 99, 106, 110, 115, 123, 131, 137, 141, 149, 158, 169, 181, 186, 192, 195, 198, 204, 207, 210, 214, 220, 223, 227, 231} +var _Op_index = [...]uint8{0, 3, 6, 10, 16, 23, 30, 34, 39, 44, 49, 52, 56, 60, 65, 70, 78, 82, 87, 93, 101, 110, 117, 121, 126, 134, 142, 148, 152, 160, 169, 180, 192, 197, 203, 206, 209, 215, 218, 221, 225, 231, 234, 238, 242} func (i Op) String() string { idx := int(i) - 0 -- cgit v1.2.3