rune
rune copied to clipboard
Some benchmarks are failing on the main branch
The brainfuck benchmarks are currently failing on the main branch. I bisected this and it looks like the problem was introduced by 2d86f90a3725c5962e9fa334510ea4a5859f2452.
I'm running cargo +nightly bench on tip of tree (38ec66c60e63e1648e7400a1fb3a82ca74d7f2aa), and get the following stderr outputs:
brainfuck_fib:
thread 'main' panicked at 'successful execution: VmError { kind: Unwound { kind: BadArgumentCount { actual: 3, expected: 1 }, unit: Unit { instructions: [Copy { offset: 0 }, ObjectIndexGet { slot: 0 }, Copy { offset: 0 }, ObjectIndexGet { slot: 1 }, IndexGet { target: Top, index: Top }, Return { address: Top, clean: 1 }, Copy { offset: 0 }, CallInstance { hash: Hash(0x154a80dcea7ed212), args: 0 }, Call { hash: Hash(0xaaf1bfc7b01267a8), args: 1 }, String { slot: 2 }, CallInstance { hash: Hash(0x765c22263789f18f), args: 1 }, Return { address: Top, clean: 1 }, Copy { offset: 1 }, Copy { offset: 0 }, ObjectIndexGet { slot: 0 }, Copy { offset: 0 }, ObjectIndexGet { slot: 1 }, IndexGet { target: Top, index: Top }, Op { op: Add, a: Top, b: Offset(2) }, Push { value: Integer(256) }, Op { op: Rem, a: Top, b: Top }, Copy { offset: 0 }, ObjectIndexGet { slot: 0 }, Copy { offset: 0 }, ObjectIndexGet { slot: 1 }, IndexSet, Copy { offset: 0 }, ObjectIndexGet { slot: 0 }, Copy { offset: 0 }, ObjectIndexGet { slot: 1 }, IndexGet { target: Top, index: Top }, Push { value: Integer(0) }, Op { op: Lt, a: Top, b: Top }, JumpIf { offset: 2 }, Push { value: Unit }, Jump { offset: 13 }, Copy { offset: 0 }, ObjectIndexGet { slot: 0 }, Copy { offset: 0 }, ObjectIndexGet { slot: 1 }, IndexGet { target: Top, index: Top }, Push { value: Integer(256) }, Op { op: Add, a: Top, b: Top }, Copy { offset: 0 }, ObjectIndexGet { slot: 0 }, Copy { offset: 0 }, ObjectIndexGet { slot: 1 }, IndexSet, Push { value: Unit }, Return { address: Top, clean: 3 }, Copy { offset: 1 }, Copy { offset: 0 }, ObjectIndexGet { slot: 1 }, Op { op: Add, a: Top, b: Offset(2) }, Copy { offset: 0 }, ObjectIndexSet { slot: 1 }, Copy { offset: 0 }, ObjectIndexGet { slot: 1 }, Copy { offset: 0 }, ObjectIndexGet { slot: 0 }, CallInstance { hash: Hash(0x781ce796b98306a2), args: 0 }, Op { op: Gte, a: Top, b: Top }, JumpIf { offset: 1 }, Jump { offset: 6 }, Copy { offset: 0 }, ObjectIndexGet { slot: 0 }, Push { value: Integer(0) }, CallInstance { hash: Hash(0x67d2d093d0365210), args: 1 }, Pop, Jump { offset: -14 }, Push { value: Unit }, Return { address: Top, clean: 3 }, Copy { offset: 1 }, Copy { offset: 2 }, Copy { offset: 0 }, ObjectIndexGet { slot: 0 }, Copy { offset: 0 }, ObjectIndexGet { slot: 1 }, IndexSet, PopN { count: 3 }, ReturnUnit, Call { hash: Hash(0xbc0038809a13e43b), args: 0 }, Copy { offset: 0 }, ObjectIndexGet { slot: 3 }, Copy { offset: 1 }, Copy { offset: 0 }, ObjectIndexGet { slot: 4 }, Call { hash: Hash(0xbe991eb2969d8fcc), args: 3 }, Pop, Pop, Pop, ReturnUnit, Copy { offset: 0 }, Copy { offset: 1 }, Copy { offset: 2 }, CallInstance { hash: Hash(0xed4f04636c1b6c16), args: 0 }, Copy { offset: 3 }, Call { hash: Hash(0x3fb50137fb1cfd05), args: 2 }, Copy { offset: 4 }, CallInstance { hash: Hash(0xefa5db2e4c594d05), args: 0 }, Pop, Pop, PopN { count: 4 }, ReturnUnit, Push { value: Integer(0) }, Push { value: Integer(0) }, Vec { count: 1 }, Struct { hash: Hash(0x190341f97b2cec53), slot: 0 }, Return { address: Top, clean: 0 }, Copy { offset: 0 }, Copy { offset: 1 }, Copy { offset: 2 }, Call { hash: Hash(0x63b1284a4affb138), args: 1 }, Copy { offset: 3 }, Struct { hash: Hash(0x47cd26de4321be1a), slot: 1 }, Return { address: Top, clean: 4 }, Copy { offset: 0 }, Call { hash: Hash(0x48e60589770d6e5c), args: 0 }, Copy { offset: 1 }, CallInstance { hash: Hash(0xebdc1fcf3d04b0e5), args: 0 }, Copy { offset: 3 }, MatchBuiltIn { type_check: Option(0) }, PopAndJumpIfNot { count: 1, offset: 2 }, TupleIndexGetAt { offset: 3, index: 0 }, Jump { offset: 1 }, Jump { offset: 84 }, Copy { offset: 4 }, Copy { offset: 5 }, EqChar { char: '+' }, PopAndJumpIfNot { count: 0, offset: 1 }, Jump { offset: 30 }, Copy { offset: 5 }, EqChar { char: '-' }, PopAndJumpIfNot { count: 0, offset: 1 }, Jump { offset: 32 }, Copy { offset: 5 }, EqChar { char: '>' }, PopAndJumpIfNot { count: 0, offset: 1 }, Jump { offset: 34 }, Copy { offset: 5 }, EqChar { char: '<' }, PopAndJumpIfNot { count: 0, offset: 1 }, Jump { offset: 36 }, Copy { offset: 5 }, EqChar { char: '.' }, PopAndJumpIfNot { count: 0, offset: 1 }, Jump { offset: 38 }, Copy { offset: 5 }, EqChar { char: '[' }, PopAndJumpIfNot { count: 0, offset: 1 }, Jump { offset: 39 }, Copy { offset: 5 }, EqChar { char: ',' }, PopAndJumpIfNot { count: 0, offset: 1 }, Jump { offset: 42 }, Copy { offset: 5 }, EqChar { char: ']' }, PopAndJumpIfNot { count: 0, offset: 1 }, Jump { offset: 43 }, Jump { offset: 45 }, Jump { offset: 46 }, Copy { offset: 2 }, Push { value: Integer(1) }, Call { hash: Hash(0x1ed8d12f8d81937d), args: 1 }, CallInstance { hash: Hash(0x67d2d093d0365210), args: 1 }, Pop, Jump { offset: 40 }, Copy { offset: 2 }, Push { value: Integer(-1) }, Call { hash: Hash(0x1ed8d12f8d81937d), args: 1 }, CallInstance { hash: Hash(0x67d2d093d0365210), args: 1 }, Pop, Jump { offset: 34 }, Copy { offset: 2 }, Push { value: Integer(1) }, Call { hash: Hash(0xe7842aacaf3107b6), args: 1 }, CallInstance { hash: Hash(0x67d2d093d0365210), args: 1 }, Pop, Jump { offset: 28 }, Copy { offset: 2 }, Push { value: Integer(-1) }, Call { hash: Hash(0xe7842aacaf3107b6), args: 1 }, CallInstance { hash: Hash(0x67d2d093d0365210), args: 1 }, Pop, Jump { offset: 22 }, Copy { offset: 2 }, Call { hash: Hash(0xc6e07bb8ab6e8bf3), args: 0 }, CallInstance { hash: Hash(0x67d2d093d0365210), args: 1 }, Pop, Jump { offset: 17 }, Copy { offset: 2 }, Copy { offset: 1 }, Call { hash: Hash(0x63b1284a4affb138), args: 1 }, Call { hash: Hash(0x43d4ce3a0a954060), args: 1 }, CallInstance { hash: Hash(0x67d2d093d0365210), args: 1 }, Pop, Jump { offset: 10 }, Copy { offset: 2 }, Call { hash: Hash(0x3e9f6a2fc4343b5f), args: 0 }, CallInstance { hash: Hash(0x67d2d093d0365210), args: 1 }, Pop, Jump { offset: 5 }, PopN { count: 3 }, Jump { offset: 6 }, Jump { offset: 2 }, PopN { count: 3 }, Jump { offset: -89 }, Pop, PopN { count: 2 }, Jump { offset: -92 }, Copy { offset: 2 }, Clean { count: 1 }, Return { address: Top, clean: 2 }], functions: {Hash(0x1ed8d12f8d81937d): TupleVariant { hash: Hash(0x1ed8d12f8d81937d), args: 1 }, Hash(0x7a635130c9a87db8): Offset { offset: 72, call: Immediate, args: 2 }, Hash(0x43d4ce3a0a954060): TupleVariant { hash: Hash(0x43d4ce3a0a954060), args: 1 }, Hash(0xc6e07bb8ab6e8bf3): UnitVariant { hash: Hash(0xc6e07bb8ab6e8bf3) }, Hash(0x7529c7922fddfd76): Offset { offset: 50, call: Immediate, args: 2 }, Hash(0xf6cf820bc28d001d): Offset { offset: 81, call: Immediate, args: 1 }, Hash(0x8f3362bb7c41db): Offset { offset: 12, call: Immediate, args: 2 }, Hash(0x489fe3daeb3646d4): Offset { offset: 6, call: Immediate, args: 1 }, Hash(0x3fb50137fb1cfd05): Offset { offset: 109, call: Immediate, args: 2 }, Hash(0xa173fe6057d973b): Offset { offset: 72, call: Immediate, args: 2 }, Hash(0x9af15a6ebdae9a15): Offset { offset: 6, call: Immediate, args: 1 }, Hash(0xe7842aacaf3107b6): TupleVariant { hash: Hash(0xe7842aacaf3107b6), args: 1 }, Hash(0xbba503ba53842031): Offset { offset: 50, call: Immediate, args: 2 }, Hash(0x3e9f6a2fc4343b5f): UnitVariant { hash: Hash(0x3e9f6a2fc4343b5f) }, Hash(0x52eebede5ca7cd43): Offset { offset: 0, call: Immediate, args: 1 }, Hash(0xbc0038809a13e43b): Offset { offset: 104, call: Immediate, args: 0 }, Hash(0x63b1284a4affb138): Offset { offset: 116, call: Immediate, args: 1 }, Hash(0x8f935822bf22a7f0): Offset { offset: 0, call: Immediate, args: 1 }, Hash(0x1c69d5964e831fc1): Offset { offset: 92, call: Immediate, args: 2 }, Hash(0x82d8af489fc33f6): Offset { offset: 12, call: Immediate, args: 2 }, Hash(0xbe991eb2969d8fcc): Offset { offset: 81, call: Immediate, args: 1 }}, static_strings: ["tape", "pos", "a valid char", "ops", "inputs"], static_bytes: [], static_object_keys: [["pos", "tape"], ["ops", "inputs"]], rtti: {Hash(0x190341f97b2cec53): Rtti { hash: Hash(0x190341f97b2cec53), item: Item(Tape) }, Hash(0x47cd26de4321be1a): Rtti { hash: Hash(0x47cd26de4321be1a), item: Item(Program) }}, variant_rtti: {Hash(0xc6e07bb8ab6e8bf3): VariantRtti { enum_hash: Hash(0x75b098a9f714f9d7), hash: Hash(0xc6e07bb8ab6e8bf3), item: Item(Op::Print) }, Hash(0xe7842aacaf3107b6): VariantRtti { enum_hash: Hash(0x75b098a9f714f9d7), hash: Hash(0xe7842aacaf3107b6), item: Item(Op::Move) }, Hash(0x43d4ce3a0a954060): VariantRtti { enum_hash: Hash(0x75b098a9f714f9d7), hash: Hash(0x43d4ce3a0a954060), item: Item(Op::Loop) }, Hash(0x3e9f6a2fc4343b5f): VariantRtti { enum_hash: Hash(0x75b098a9f714f9d7), hash: Hash(0x3e9f6a2fc4343b5f), item: Item(Op::Input) }, Hash(0x1ed8d12f8d81937d): VariantRtti { enum_hash: Hash(0x75b098a9f714f9d7), hash: Hash(0x1ed8d12f8d81937d), item: Item(Op::Inc) }}, debug: Some(DebugInfo { instructions: [DebugInst { source_id: SourceId { index: 0 }, span: Span(158, 162), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(158, 167), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(169, 173), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(169, 177), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(158, 178), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(139, 180), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(225, 229), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(225, 235), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(201, 236), comment: Some("fn ::std::char::from_int"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(244, 258), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(201, 259), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(181, 261), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(279, 280), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(320, 324), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(320, 329), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(331, 335), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(331, 339), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(320, 340), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(320, 344), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(348, 351), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(319, 351), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(296, 300), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(296, 305), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(307, 311), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(307, 315), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(296, 351), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(357, 361), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(357, 366), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(376, 380), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(376, 384), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(357, 385), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(388, 389), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(357, 389), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(357, 389), comment: Some("label:if_then_1"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(354, 445), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(354, 445), comment: Some("label:if_end_2"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(415, 419), comment: Some("self"), label: Some(DebugLabel { name: "if_then", id: 1 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(415, 424), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(426, 430), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(426, 434), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(415, 435), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(438, 441), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(415, 441), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(392, 396), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(392, 401), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(403, 407), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(403, 411), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(392, 441), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(390, 445), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(262, 451), comment: None, label: Some(DebugLabel { name: "if_end", id: 2 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(465, 466), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(494, 498), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(494, 502), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(494, 506), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(482, 486), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(482, 507), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(516, 520), comment: Some("self"), label: Some(DebugLabel { name: "while_continue", id: 4 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(516, 524), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(528, 532), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(528, 537), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(528, 543), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(516, 543), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(516, 543), comment: Some("label:whiel_then_5"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(510, 575), comment: Some("label:while_end_6"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(554, 558), comment: Some("self"), label: Some(DebugLabel { name: "whiel_then", id: 5 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(554, 563), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(569, 570), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(554, 571), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(554, 571), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(510, 575), comment: Some("label:while_continue_4"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(510, 575), comment: None, label: Some(DebugLabel { name: "while_end", id: 6 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(452, 581), comment: None, label: Some(DebugLabel { name: "while_break", id: 7 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(595, 596), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(623, 624), comment: Some("var `v`"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(600, 604), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(600, 609), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(611, 615), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(611, 619), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(600, 624), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(582, 628), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(582, 628), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1629, 1642), comment: Some("fn Tape::new"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1649, 1653), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1649, 1657), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1659, 1663), comment: Some("var `tape`"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1665, 1669), comment: Some("self"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1665, 1676), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1645, 1677), comment: Some("fn Program::run"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1645, 1677), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1616, 1681), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1595, 1681), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1595, 1681), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1696, 1697), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1699, 1700), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1733, 1734), comment: Some("var `s`"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1733, 1742), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1744, 1745), comment: Some("var `i`"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1718, 1746), comment: Some("fn Program::new"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1749, 1756), comment: Some("var `program`"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1749, 1762), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1749, 1762), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1702, 1766), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1684, 1766), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1684, 1766), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(121, 122), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(132, 133), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(131, 134), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(108, 136), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(97, 138), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1539, 1543), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1545, 1551), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1577, 1581), comment: Some("var `code`"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1571, 1582), comment: Some("fn parse"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1584, 1590), comment: Some("name `inputs`"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1555, 1592), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1532, 1594), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1042, 1044), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1062, 1074), comment: Some("fn ::std::vec::Vec::new"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1097, 1099), comment: Some("var `it`"), label: Some(DebugLabel { name: "while_continue", id: 17 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1097, 1106), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1087, 1094), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1087, 1094), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1087, 1094), comment: Some("label:if_condition_false_21"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1092, 1093), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1087, 1106), comment: Some("label:whiel_then_18"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1077, 1475), comment: Some("label:while_end_19"), label: Some(DebugLabel { name: "if_condition_false", id: 21 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1127, 1128), comment: Some("var `c`"), label: Some(DebugLabel { name: "whiel_then", id: 18 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1151, 1180), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1151, 1154), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1151, 1154), comment: Some("label:match_false_24"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1151, 1180), comment: Some("label:match_branch_23"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1182, 1213), comment: None, label: Some(DebugLabel { name: "match_false", id: 24 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1182, 1185), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1182, 1185), comment: Some("label:match_false_26"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1182, 1213), comment: Some("label:match_branch_25"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1227, 1257), comment: None, label: Some(DebugLabel { name: "match_false", id: 26 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1227, 1230), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1227, 1230), comment: Some("label:match_false_28"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1227, 1257), comment: Some("label:match_branch_27"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1259, 1291), comment: None, label: Some(DebugLabel { name: "match_false", id: 28 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1259, 1262), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1259, 1262), comment: Some("label:match_false_30"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1259, 1291), comment: Some("label:match_branch_29"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1305, 1333), comment: None, label: Some(DebugLabel { name: "match_false", id: 30 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1305, 1308), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1305, 1308), comment: Some("label:match_false_32"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1305, 1333), comment: Some("label:match_branch_31"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1335, 1385), comment: None, label: Some(DebugLabel { name: "match_false", id: 32 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1335, 1338), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1335, 1338), comment: Some("label:match_false_34"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1335, 1385), comment: Some("label:match_branch_33"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1387, 1415), comment: None, label: Some(DebugLabel { name: "match_false", id: 34 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1387, 1390), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1387, 1390), comment: Some("label:match_false_36"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1387, 1415), comment: Some("label:match_branch_35"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1417, 1441), comment: None, label: Some(DebugLabel { name: "match_false", id: 36 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1417, 1420), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1417, 1420), comment: Some("label:match_false_38"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1417, 1441), comment: Some("label:match_branch_37"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1443, 1456), comment: Some("label:match_branch_39"), label: Some(DebugLabel { name: "match_false", id: 38 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1121, 1467), comment: Some("label:match_end_22"), label: Some(DebugLabel { name: "match_false", id: 40 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1158, 1161), comment: Some("var `buf`"), label: Some(DebugLabel { name: "match_branch", id: 23 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1177, 1178), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1167, 1179), comment: Some("variant Op::Inc"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1158, 1180), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1158, 1180), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1151, 1180), comment: Some("label:match_end_22"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1189, 1192), comment: Some("var `buf`"), label: Some(DebugLabel { name: "match_branch", id: 25 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1208, 1211), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1198, 1212), comment: Some("variant Op::Inc"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1189, 1213), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1189, 1213), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1182, 1213), comment: Some("label:match_end_22"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1234, 1237), comment: Some("var `buf`"), label: Some(DebugLabel { name: "match_branch", id: 27 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1254, 1255), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1243, 1256), comment: Some("variant Op::Move"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1234, 1257), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1234, 1257), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1227, 1257), comment: Some("label:match_end_22"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1266, 1269), comment: Some("var `buf`"), label: Some(DebugLabel { name: "match_branch", id: 29 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1286, 1289), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1275, 1290), comment: Some("variant Op::Move"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1266, 1291), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1266, 1291), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1259, 1291), comment: Some("label:match_end_22"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1312, 1315), comment: Some("var `buf`"), label: Some(DebugLabel { name: "match_branch", id: 31 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1321, 1332), comment: Some("unit variant Op::Print"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1312, 1333), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1312, 1333), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1305, 1333), comment: Some("label:match_end_22"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1354, 1357), comment: Some("var `buf`"), label: Some(DebugLabel { name: "match_branch", id: 33 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1380, 1382), comment: Some("var `it`"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1374, 1383), comment: Some("fn parse"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1363, 1384), comment: Some("variant Op::Loop"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1354, 1385), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1354, 1385), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1335, 1385), comment: Some("label:match_end_22"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1394, 1397), comment: Some("var `buf`"), label: Some(DebugLabel { name: "match_branch", id: 35 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1403, 1414), comment: Some("unit variant Op::Input"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1394, 1415), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1394, 1415), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1387, 1415), comment: Some("label:match_end_22"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1436, 1441), comment: None, label: Some(DebugLabel { name: "match_branch", id: 37 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1436, 1441), comment: Some("label:while_break_20"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1417, 1441), comment: Some("label:match_end_22"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1448, 1456), comment: None, label: Some(DebugLabel { name: "match_branch", id: 39 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1448, 1456), comment: Some("label:while_continue_17"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1121, 1467), comment: None, label: Some(DebugLabel { name: "match_end", id: 22 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1077, 1475), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1077, 1475), comment: Some("label:while_continue_17"), label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1476, 1479), comment: Some("var `buf`"), label: Some(DebugLabel { name: "while_break", id: 20 }) }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1046, 1481), comment: None, label: None }, DebugInst { source_id: SourceId { index: 0 }, span: Span(1033, 1481), comment: None, label: None }], functions: {Hash(0x52eebede5ca7cd43): DebugSignature { path: Item(Tape::get), args: Named(["self"]) }, Hash(0x7529c7922fddfd76): DebugSignature { path: Item(Tape::mov), args: Named(["self", "x"]) }, Hash(0xe7842aacaf3107b6): DebugSignature { path: Item(Op::Move), args: TupleArgs(1) }, Hash(0x1c69d5964e831fc1): DebugSignature { path: Item(main), args: Named(["s", "i"]) }, Hash(0x9af15a6ebdae9a15): DebugSignature { path: Item(Tape::getc), args: Named(["self"]) }, Hash(0xc6e07bb8ab6e8bf3): DebugSignature { path: Item(Op::Print), args: EmptyArgs }, Hash(0x43d4ce3a0a954060): DebugSignature { path: Item(Op::Loop), args: TupleArgs(1) }, Hash(0x3e9f6a2fc4343b5f): DebugSignature { path: Item(Op::Input), args: EmptyArgs }, Hash(0x82d8af489fc33f6): DebugSignature { path: Item(Tape::inc), args: Named(["self", "x"]) }, Hash(0x3fb50137fb1cfd05): DebugSignature { path: Item(Program::new), args: Named(["code", "inputs"]) }, Hash(0xf6cf820bc28d001d): DebugSignature { path: Item(Program::run), args: Named(["self"]) }, Hash(0x1ed8d12f8d81937d): DebugSignature { path: Item(Op::Inc), args: TupleArgs(1) }, Hash(0x63b1284a4affb138): DebugSignature { path: Item(parse), args: Named(["it"]) }, Hash(0x7a635130c9a87db8): DebugSignature { path: Item(Tape::set), args: Named(["self", "v"]) }, Hash(0xbc0038809a13e43b): DebugSignature { path: Item(Tape::new), args: Named([]) }}, functions_rev: {104: Hash(0xbc0038809a13e43b), 116: Hash(0x63b1284a4affb138), 109: Hash(0x3fb50137fb1cfd05), 92: Hash(0x1c69d5964e831fc1), 6: Hash(0x489fe3daeb3646d4), 72: Hash(0xa173fe6057d973b), 50: Hash(0xbba503ba53842031), 0: Hash(0x8f935822bf22a7f0), 81: Hash(0xbe991eb2969d8fcc), 12: Hash(0x8f3362bb7c41db)} }), constants: {Hash(0xa697519d98160b9a): String("Program"), Hash(0x94eaefea2c234c57): String("Op"), Hash(0x82eb5f0991c804b8): String("parse"), Hash(0x6ec92f6164151270): String("Tape::get"), Hash(0x5aff74f988b395b1): String("Tape::mov"), Hash(0xfd33a2d595b4aa41): String("main"), Hash(0xa9c594993001f354): String("Tape::getc"), Hash(0xe1d54421604bf45b): String("Tape::inc"), Hash(0xeb4d48a5de4a22bb): String("Tape::set"), Hash(0x5d5a4fc3412451bb): String("Tape::new"), Hash(0xdeef7674202b4885): String("Program::new"), Hash(0xf85936baa01b59d3): String("Tape"), Hash(0x5fc369f14daa3a4c): String("Program::run")} }, ip: 87, frames: [CallFrame { ip: 99, stack_bottom: 0 }] } }', benches/benches/brainfuck.rs:151:50
I can post the outputs of the other brainfuck results if it helps but they are too long to add to the same issue.
Thanks!
It looks like it's confusing the two run functions. Minimal repro:
fn run(a,b,c) { }
struct Foo {}
impl Foo {
fn run(self) {
run(1,2,3);
}
}
pub fn main() {
let f = Foo{};
f.run();
}
error: wrong number of arguments
┌─ entry:9:6
│
9 │ run(1,2,3);
│ ^^^^^^^^^^ in this function call
│
= expected `1`
= got `3`
backtrace:
entry:9:6: run(1,2,3);
entry:16:5: f.run();
Ah. Thanks for the report and the super clear repro. I've been intending to ensure that the benches are included in integration tests before baking the next release.
Item resolution which as done through Query::query_path there seems to treat run(1, 2, 3) as Foo::run. I suspect the change you're linking to caused it to break because it eagerly indexes the element before it has been compiled where previously the element wasn't indexed in the item tree until after it compiled.
The error is most likely caused by naive item resolution, as is initially done by Query::convert_initial_path here. More details below.
Notes on initial item resolution
The following is intended for anyone who wants to take a stab at fixing the issue.
Item resolution as done through Query::convert_path and I suspect it starts looking for run in Foo::run by constructing Foo::run::run, since that is not found, it pops the current item looking for Foo::run, which matches the wrong function.
The fix would be to ensure that item resolution starts outside of Foo - or in that example the root module.
The function responsible for this would be Query::convert_initial_path as mentioned above.
The fix is a bit complicated, since there's two passes necessary for item lookup:
- We need to see function-local items, such as:
impl Foo {
fn run() {
run(); // <- this should call the internal run method.
fn run() {
}
}
}
To achieve this we need to look at least once in the internal scope for Foo::run::run, if that doesn't match anything move on to 2..
2. The rest of the lookup recurses upwards through contexts which contains items, such as modules, functions, .... That means we need to distinguish between the items being popped whether it is a place we should be looking. Foo which is a type isn't such a place. But inside of functions and modules are.
After this step is resolving imports, which is a whole other mess that (hopefully) isn't responsible for this.