Skip to content

Commit 5bb5961

Browse files
committed
fix operand order
1 parent 169638a commit 5bb5961

2 files changed

Lines changed: 79 additions & 98 deletions

File tree

zjit/src/hir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7219,7 +7219,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
72197219
// as a pointer to keep it stable in snapshot tests.
72207220
let expected_shape = fun.push_insn(block, Insn::Const { val: Const::CShape(profiled_shape) });
72217221

7222-
let has_shape = fun.push_insn(block, Insn::IsBitEqual { left: expected_shape, right: runtime_shape });
7222+
let has_shape = fun.push_insn(block, Insn::IsBitEqual { left: runtime_shape, right: expected_shape });
72237223
let iftrue_block = fun.new_block(insn_idx);
72247224
let target = BranchEdge { target: iftrue_block, args: vec![] };
72257225
let fall_through = fun.new_block(insn_idx);
@@ -8394,7 +8394,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
83948394
// If the expected is equal to the actual, then
83958395
// we're good and can load the IV. Otherwise jump
83968396
// to the next block.
8397-
let has_shape = fun.push_insn(block, Insn::IsBitEqual { left: expected_shape, right: runtime_shape });
8397+
let has_shape = fun.push_insn(block, Insn::IsBitEqual { left: runtime_shape, right: expected_shape });
83988398
let iftrue_block = fun.new_block(insn_idx);
83998399
let target = BranchEdge { target: iftrue_block, args: vec![] };
84008400
let fall_through = fun.new_block(insn_idx);

zjit/src/hir/opt_tests.rs

Lines changed: 77 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -5725,32 +5725,27 @@ mod hir_opt_tests {
57255725
Jump bb3(v4)
57265726
bb3(v6:BasicObject):
57275727
v10:HeapBasicObject = GuardType v6, HeapBasicObject
5728-
v11:CUInt64 = LoadField v10, :RBASIC_FLAGS@0x1000
5729-
v13:CUInt64[0xffffffff0000001f] = Const CUInt64(0xffffffff0000001f)
5730-
v14:CPtr[CPtr(0x1001)] = Const CPtr(0x1001)
5731-
v15 = RefineType v14, CUInt64
5732-
v16:CInt64 = IntAnd v11, v13
5733-
v17:CBool = IsBitEqual v16, v15
5734-
CondBranch v17, bb5(), bb6()
5728+
v12:CShape = LoadField v10, :shape_id@0x1000
5729+
v13:CShape[0x1001] = Const CShape(0x1001)
5730+
v14:CBool = IsBitEqual v12, v13
5731+
CondBranch v14, bb5(), bb6()
57355732
bb5():
5736-
v19:NilClass = Const Value(nil)
5737-
Jump bb4(v19)
5733+
v16:NilClass = Const Value(nil)
5734+
Jump bb4(v16)
57385735
bb6():
5739-
v21:CUInt64[0xffffffff0000001f] = Const CUInt64(0xffffffff0000001f)
5740-
v22:CPtr[CPtr(0x1002)] = Const CPtr(0x1002)
5741-
v23 = RefineType v22, CUInt64
5742-
v24:CInt64 = IntAnd v11, v21
5743-
v25:CBool = IsBitEqual v24, v23
5744-
CondBranch v25, bb7(), bb8()
5736+
v18:CShape = LoadField v10, :shape_id@0x1000
5737+
v19:CShape[0x1002] = Const CShape(0x1002)
5738+
v20:CBool = IsBitEqual v18, v19
5739+
CondBranch v20, bb7(), bb8()
57455740
bb7():
5746-
v27:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008))
5747-
Jump bb4(v27)
5741+
v22:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008))
5742+
Jump bb4(v22)
57485743
bb8():
5749-
v29:StringExact|NilClass = DefinedIvar v10, :@a
5750-
Jump bb4(v29)
5751-
bb4(v12:StringExact|NilClass):
5744+
v24:StringExact|NilClass = DefinedIvar v10, :@a
5745+
Jump bb4(v24)
5746+
bb4(v11:StringExact|NilClass):
57525747
CheckInterrupts
5753-
Return v12
5748+
Return v11
57545749
");
57555750
}
57565751

@@ -5789,22 +5784,19 @@ mod hir_opt_tests {
57895784
Jump bb3(v4)
57905785
bb3(v6:BasicObject):
57915786
v10:HeapBasicObject = GuardType v6, HeapBasicObject
5792-
v11:CUInt64 = LoadField v10, :RBASIC_FLAGS@0x1000
5793-
v13:CUInt64[0xffffffff0000001f] = Const CUInt64(0xffffffff0000001f)
5794-
v14:CPtr[CPtr(0x1001)] = Const CPtr(0x1001)
5795-
v15 = RefineType v14, CUInt64
5796-
v16:CInt64 = IntAnd v11, v13
5797-
v17:CBool = IsBitEqual v16, v15
5798-
CondBranch v17, bb5(), bb6()
5787+
v12:CShape = LoadField v10, :shape_id@0x1000
5788+
v13:CShape[0x1001] = Const CShape(0x1001)
5789+
v14:CBool = IsBitEqual v12, v13
5790+
CondBranch v14, bb5(), bb6()
57995791
bb5():
5800-
v19:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008))
5801-
Jump bb4(v19)
5792+
v16:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008))
5793+
Jump bb4(v16)
58025794
bb6():
5803-
v21:StringExact|NilClass = DefinedIvar v10, :@a
5804-
Jump bb4(v21)
5805-
bb4(v12:StringExact|NilClass):
5795+
v18:StringExact|NilClass = DefinedIvar v10, :@a
5796+
Jump bb4(v18)
5797+
bb4(v11:StringExact|NilClass):
58065798
CheckInterrupts
5807-
Return v12
5799+
Return v11
58085800
");
58095801
}
58105802

@@ -5846,22 +5838,19 @@ mod hir_opt_tests {
58465838
Jump bb3(v4)
58475839
bb3(v6:BasicObject):
58485840
v10:HeapBasicObject = GuardType v6, HeapBasicObject
5849-
v11:CUInt64 = LoadField v10, :RBASIC_FLAGS@0x1000
5850-
v13:CUInt64[0xffffffff0000001f] = Const CUInt64(0xffffffff0000001f)
5851-
v14:CPtr[CPtr(0x1001)] = Const CPtr(0x1001)
5852-
v15 = RefineType v14, CUInt64
5853-
v16:CInt64 = IntAnd v11, v13
5854-
v17:CBool = IsBitEqual v16, v15
5855-
CondBranch v17, bb5(), bb6()
5841+
v12:CShape = LoadField v10, :shape_id@0x1000
5842+
v13:CShape[0x1001] = Const CShape(0x1001)
5843+
v14:CBool = IsBitEqual v12, v13
5844+
CondBranch v14, bb5(), bb6()
58565845
bb5():
5857-
v19:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008))
5858-
Jump bb4(v19)
5846+
v16:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008))
5847+
Jump bb4(v16)
58595848
bb6():
5860-
v21:StringExact|NilClass = DefinedIvar v10, :@a
5861-
Jump bb4(v21)
5862-
bb4(v12:StringExact|NilClass):
5849+
v18:StringExact|NilClass = DefinedIvar v10, :@a
5850+
Jump bb4(v18)
5851+
bb4(v11:StringExact|NilClass):
58635852
CheckInterrupts
5864-
Return v12
5853+
Return v11
58655854
");
58665855
}
58675856

@@ -5908,22 +5897,19 @@ mod hir_opt_tests {
59085897
Jump bb3(v4)
59095898
bb3(v6:BasicObject):
59105899
v10:HeapBasicObject = GuardType v6, HeapBasicObject
5911-
v11:CUInt64 = LoadField v10, :RBASIC_FLAGS@0x1000
5912-
v13:CUInt64[0xffffffff0000001f] = Const CUInt64(0xffffffff0000001f)
5913-
v14:CPtr[CPtr(0x1001)] = Const CPtr(0x1001)
5914-
v15 = RefineType v14, CUInt64
5915-
v16:CInt64 = IntAnd v11, v13
5916-
v17:CBool = IsBitEqual v16, v15
5917-
CondBranch v17, bb5(), bb6()
5900+
v12:CShape = LoadField v10, :shape_id@0x1000
5901+
v13:CShape[0x1001] = Const CShape(0x1001)
5902+
v14:CBool = IsBitEqual v12, v13
5903+
CondBranch v14, bb5(), bb6()
59185904
bb5():
5919-
v19:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008))
5920-
Jump bb4(v19)
5905+
v16:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008))
5906+
Jump bb4(v16)
59215907
bb6():
5922-
v21:StringExact|NilClass = DefinedIvar v10, :@a
5923-
Jump bb4(v21)
5924-
bb4(v12:StringExact|NilClass):
5908+
v18:StringExact|NilClass = DefinedIvar v10, :@a
5909+
Jump bb4(v18)
5910+
bb4(v11:StringExact|NilClass):
59255911
CheckInterrupts
5926-
Return v12
5912+
Return v11
59275913
");
59285914
}
59295915

@@ -7966,15 +7952,15 @@ mod hir_opt_tests {
79667952
PatchPoint SingleRactorMode
79677953
v13:CShape = LoadField v6, :shape_id@0x1000
79687954
v14:CShape[0x1001] = Const CShape(0x1001)
7969-
v15:CBool = IsBitEqual v14, v13
7955+
v15:CBool = IsBitEqual v13, v14
79707956
CondBranch v15, bb5(), bb6()
79717957
bb5():
79727958
v17:BasicObject = LoadField v6, :@foo@0x1002
79737959
Jump bb4(v17)
79747960
bb6():
79757961
v19:CShape = LoadField v6, :shape_id@0x1000
79767962
v20:CShape[0x1003] = Const CShape(0x1003)
7977-
v21:CBool = IsBitEqual v20, v19
7963+
v21:CBool = IsBitEqual v19, v20
79787964
CondBranch v21, bb7(), bb8()
79797965
bb7():
79807966
v23:BasicObject = LoadField v6, :@foo@0x1004
@@ -8277,32 +8263,27 @@ mod hir_opt_tests {
82778263
v4:HeapBasicObject = LoadArg :self@0
82788264
Jump bb3(v4)
82798265
bb3(v6:HeapBasicObject):
8280-
v11:CUInt64 = LoadField v6, :RBASIC_FLAGS@0x1000
8281-
v13:CUInt64[0xffffffff0000001f] = Const CUInt64(0xffffffff0000001f)
8282-
v14:CPtr[CPtr(0x1001)] = Const CPtr(0x1001)
8283-
v15 = RefineType v14, CUInt64
8284-
v16:CInt64 = IntAnd v11, v13
8285-
v17:CBool = IsBitEqual v16, v15
8286-
CondBranch v17, bb5(), bb6()
8266+
v12:CShape = LoadField v6, :shape_id@0x1000
8267+
v13:CShape[0x1001] = Const CShape(0x1001)
8268+
v14:CBool = IsBitEqual v12, v13
8269+
CondBranch v14, bb5(), bb6()
82878270
bb5():
8288-
v19:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008))
8289-
Jump bb4(v19)
8271+
v16:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008))
8272+
Jump bb4(v16)
82908273
bb6():
8291-
v21:CUInt64[0xffffffff0000001f] = Const CUInt64(0xffffffff0000001f)
8292-
v22:CPtr[CPtr(0x1010)] = Const CPtr(0x1010)
8293-
v23 = RefineType v22, CUInt64
8294-
v24:CInt64 = IntAnd v11, v21
8295-
v25:CBool = IsBitEqual v24, v23
8296-
CondBranch v25, bb7(), bb8()
8274+
v18:CShape = LoadField v6, :shape_id@0x1000
8275+
v19:CShape[0x1010] = Const CShape(0x1010)
8276+
v20:CBool = IsBitEqual v18, v19
8277+
CondBranch v20, bb7(), bb8()
82978278
bb7():
8298-
v27:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008))
8299-
Jump bb4(v27)
8279+
v22:StringExact[VALUE(0x1008)] = Const Value(VALUE(0x1008))
8280+
Jump bb4(v22)
83008281
bb8():
8301-
v29:StringExact|NilClass = DefinedIvar v6, :@foo
8302-
Jump bb4(v29)
8303-
bb4(v12:StringExact|NilClass):
8282+
v24:StringExact|NilClass = DefinedIvar v6, :@foo
8283+
Jump bb4(v24)
8284+
bb4(v11:StringExact|NilClass):
83048285
CheckInterrupts
8305-
Return v12
8286+
Return v11
83068287
");
83078288
}
83088289

@@ -8419,7 +8400,7 @@ mod hir_opt_tests {
84198400
Jump bb3(v4)
84208401
bb3(v6:BasicObject):
84218402
PatchPoint SingleRactorMode
8422-
v17:HeapBasicObject = GuardType v6, HeapBasicObject
8403+
v17:Module = GuardType v6, Module
84238404
v18:CShape = LoadField v17, :shape_id@0x1000
84248405
v19:CShape[0x1001] = GuardBitEquals v18, CShape(0x1001) recompile
84258406
v20:RubyValue = LoadField v17, :fields_obj@0x1002
@@ -8490,7 +8471,7 @@ mod hir_opt_tests {
84908471
Jump bb3(v4)
84918472
bb3(v6:BasicObject):
84928473
PatchPoint SingleRactorMode
8493-
v17:HeapBasicObject = GuardType v6, HeapBasicObject
8474+
v17:Class = GuardType v6, Class
84948475
v18:CShape = LoadField v17, :shape_id@0x1000
84958476
v19:CShape[0x1001] = GuardBitEquals v18, CShape(0x1001) recompile
84968477
v20:RubyValue = LoadField v17, :fields_obj@0x1002
@@ -8589,7 +8570,7 @@ mod hir_opt_tests {
85898570
Jump bb3(v4)
85908571
bb3(v6:BasicObject):
85918572
PatchPoint SingleRactorMode
8592-
v17:HeapBasicObject = GuardType v6, HeapBasicObject
8573+
v17:TData = GuardType v6, TData
85938574
v18:CShape = LoadField v17, :shape_id@0x1000
85948575
v19:CShape[0x1001] = GuardBitEquals v18, CShape(0x1001) recompile
85958576
v20:RubyValue = LoadField v17, :fields_obj@0x1002
@@ -8728,15 +8709,15 @@ mod hir_opt_tests {
87288709
v11:HeapBasicObject = GuardType v6, HeapBasicObject
87298710
v13:CShape = LoadField v11, :shape_id@0x1000
87308711
v14:CShape[0x1001] = Const CShape(0x1001)
8731-
v15:CBool = IsBitEqual v14, v13
8712+
v15:CBool = IsBitEqual v13, v14
87328713
CondBranch v15, bb5(), bb6()
87338714
bb5():
87348715
v17:BasicObject = LoadField v11, :@foo@0x1002
87358716
Jump bb4(v17)
87368717
bb6():
87378718
v19:CShape = LoadField v11, :shape_id@0x1000
87388719
v20:CShape[0x1003] = Const CShape(0x1003)
8739-
v21:CBool = IsBitEqual v20, v19
8720+
v21:CBool = IsBitEqual v19, v20
87408721
CondBranch v21, bb7(), bb8()
87418722
bb7():
87428723
v23:CPtr = LoadField v11, :as_heap@0x1004
@@ -8802,7 +8783,7 @@ mod hir_opt_tests {
88028783
v11:HeapBasicObject = GuardType v6, HeapBasicObject
88038784
v13:CShape = LoadField v11, :shape_id@0x1000
88048785
v14:CShape[0x1001] = Const CShape(0x1001)
8805-
v15:CBool = IsBitEqual v14, v13
8786+
v15:CBool = IsBitEqual v13, v14
88068787
CondBranch v15, bb5(), bb6()
88078788
bb5():
88088789
v17:CPtr = LoadField v11, :as_heap@0x1002
@@ -8811,7 +8792,7 @@ mod hir_opt_tests {
88118792
bb6():
88128793
v20:CShape = LoadField v11, :shape_id@0x1000
88138794
v21:CShape[0x1004] = Const CShape(0x1004)
8814-
v22:CBool = IsBitEqual v21, v20
8795+
v22:CBool = IsBitEqual v20, v21
88158796
CondBranch v22, bb7(), bb8()
88168797
bb7():
88178798
v24:BasicObject = LoadField v11, :@foo@0x1005
@@ -8871,15 +8852,15 @@ mod hir_opt_tests {
88718852
v11:HeapBasicObject = GuardType v6, HeapBasicObject
88728853
v13:CShape = LoadField v11, :shape_id@0x1000
88738854
v14:CShape[0x1001] = Const CShape(0x1001)
8874-
v15:CBool = IsBitEqual v14, v13
8855+
v15:CBool = IsBitEqual v13, v14
88758856
CondBranch v15, bb5(), bb6()
88768857
bb5():
88778858
v17:BasicObject = LoadField v11, :@foo@0x1002
88788859
Jump bb4(v17)
88798860
bb6():
88808861
v19:CShape = LoadField v11, :shape_id@0x1000
88818862
v20:CShape[0x1003] = Const CShape(0x1003)
8882-
v21:CBool = IsBitEqual v20, v19
8863+
v21:CBool = IsBitEqual v19, v20
88838864
CondBranch v21, bb7(), bb8()
88848865
bb7():
88858866
v23:BasicObject = LoadField v11, :@foo@0x1002
@@ -8934,7 +8915,7 @@ mod hir_opt_tests {
89348915
v11:HeapBasicObject = GuardType v6, HeapBasicObject
89358916
v13:CShape = LoadField v11, :shape_id@0x1000
89368917
v14:CShape[0x1001] = Const CShape(0x1001)
8937-
v15:CBool = IsBitEqual v14, v13
8918+
v15:CBool = IsBitEqual v13, v14
89388919
CondBranch v15, bb5(), bb6()
89398920
bb5():
89408921
v17:RubyValue = LoadField v11, :fields_obj@0x1002
@@ -8943,7 +8924,7 @@ mod hir_opt_tests {
89438924
bb6():
89448925
v20:CShape = LoadField v11, :shape_id@0x1000
89458926
v21:CShape[0x1003] = Const CShape(0x1003)
8946-
v22:CBool = IsBitEqual v21, v20
8927+
v22:CBool = IsBitEqual v20, v21
89478928
CondBranch v22, bb7(), bb8()
89488929
bb7():
89498930
v24:RubyValue = LoadField v11, :fields_obj@0x1004
@@ -16646,15 +16627,15 @@ mod hir_opt_tests {
1664616627
PatchPoint SingleRactorMode
1664716628
v48:CShape = LoadField v40, :shape_id@0x1038
1664816629
v49:CShape[0x1039] = Const CShape(0x1039)
16649-
v50:CBool = IsBitEqual v49, v48
16630+
v50:CBool = IsBitEqual v48, v49
1665016631
CondBranch v50, bb9(), bb10()
1665116632
bb9():
1665216633
v52:BasicObject = LoadField v40, :@levar@0x103a
1665316634
Jump bb8(v52)
1665416635
bb10():
1665516636
v54:CShape = LoadField v40, :shape_id@0x1038
1665616637
v55:CShape[0x103b] = Const CShape(0x103b)
16657-
v56:CBool = IsBitEqual v55, v54
16638+
v56:CBool = IsBitEqual v54, v55
1665816639
CondBranch v56, bb11(), bb12()
1665916640
bb11():
1666016641
v58:NilClass = Const Value(nil)

0 commit comments

Comments
 (0)