Skip to content

Instantly share code, notes, and snippets.

@xacrimon
Created January 30, 2025 08:40
Show Gist options
  • Save xacrimon/99a4ae4ec5a10b58a16d0412ea896c8a to your computer and use it in GitHub Desktop.
Save xacrimon/99a4ae4ec5a10b58a16d0412ea896c8a to your computer and use it in GitHub Desktop.
with my rustc patch that's almost ready for review
.section __TEXT,__text,regular,pure_instructions
.build_version macos, 11, 0
.globl _to_errno
.p2align 2
_to_errno:
Lfunc_begin0:
.cfi_startproc
// /Volumes/Q/repos/rust/library/core/src/slice/mod.rs : 2113
if mid <= self.len() {
sub x8, x1, #28
cmn x8, #28
b.hi LBB0_2
// /Volumes/Q/repos/rust/library/core/src/slice/cmp.rs : 91
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldp x8, x9, [x0]
ldr x10, [x0, #16]
ldur x11, [x0, #19]
mov x12, #29295
movk x12, #11879, lsl #16
movk x12, #29286, lsl #32
movk x12, #25957, lsl #48
cmp x8, x12
mov x8, #25956
movk x8, #27507, lsl #16
movk x8, #28532, lsl #32
movk x8, #11888, lsl #48
ccmp x9, x8, #0, eq
mov x8, #16964
movk x8, #29557, lsl #16
movk x8, #17710, lsl #32
movk x8, #29298, lsl #48
ccmp x10, x8, #0, eq
mov x8, #11891
movk x8, #29253, lsl #16
movk x8, #28530, lsl #32
movk x8, #11890, lsl #48
ccmp x11, x8, #0, eq
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 6
if pfx != STANDARD_BASE {
b.eq LBB0_4
LBB0_2:
mov w8, #0
LBB0_3:
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 23
}
mov x0, x8
ret
LBB0_4:
mov w8, #0
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 10
b"NoMemory" => NonZero::new(1),
cmp x1, #40
b.le LBB0_10
cmp x1, #43
b.gt LBB0_17
cmp x1, #41
b.eq LBB0_36
cmp x1, #42
b.eq LBB0_29
cmp x1, #43
b.ne LBB0_3
// /Volumes/Q/repos/rust/library/core/src/cmp/pattern.rs : 71
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldur x8, [x0, #27]
ldur x9, [x0, #34]
mov x10, #28245
movk x10, #28267, lsl #16
movk x10, #30575, lsl #32
movk x10, #20590, lsl #48
cmp x8, x10
mov x8, #29264
movk x8, #28783, lsl #16
movk x8, #29285, lsl #32
movk x8, #31092, lsl #48
b LBB0_39
LBB0_10:
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 10
b"NoMemory" => NonZero::new(1),
cmp x1, #36
b.le LBB0_21
cmp x1, #37
b.eq LBB0_33
cmp x1, #38
b.eq LBB0_27
cmp x1, #40
b.ne LBB0_3
mov w8, #26990
movk w8, #25701, lsl #16
// /Volumes/Q/repos/rust/library/core/src/cmp/pattern.rs : 71
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldur x9, [x0, #27]
ldur w10, [x0, #35]
mov x11, #25409
movk x11, #25955, lsl #16
movk x11, #29555, lsl #32
movk x11, #25924, lsl #48
cmp x9, x11
ccmp w10, w8, #0, eq
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 13
b"AccessDenied" | b"AuthFailed" | b"InteractiveAuthorizationRequired" => {
b.eq LBB0_28
// /Volumes/Q/repos/rust/library/core/src/cmp/pattern.rs : 71
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldur x9, [x0, #27]
ldur w10, [x0, #35]
add x8, x8, #2820
mov x11, #28494
movk x11, #21364, lsl #16
movk x11, #28789, lsl #32
movk x11, #28528, lsl #48
cmp x9, x11
ccmp x10, x8, #0, eq
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 19
b"NotSupported" => NonZero::new(228),
b.eq LBB0_43
// /Volumes/Q/repos/rust/library/core/src/cmp/pattern.rs : 71
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldur x8, [x0, #27]
ldur w9, [x0, #35]
mov x10, #25665
movk x10, #29284, lsl #16
movk x10, #29541, lsl #32
movk x10, #18803, lsl #48
cmp x8, x10
mov w8, #21870
movk w8, #25971, lsl #16
b LBB0_34
LBB0_17:
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 10
b"NoMemory" => NonZero::new(1),
cmp x1, #44
b.eq LBB0_38
cmp x1, #48
b.eq LBB0_32
cmp x1, #60
b.ne LBB0_3
// /Volumes/Q/repos/rust/library/core/src/cmp/pattern.rs : 71
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldur x8, [x0, #27]
ldur x9, [x0, #35]
ldur x10, [x0, #43]
ldur x11, [x0, #51]
mov x12, #28233
movk x12, #25972, lsl #16
movk x12, #24946, lsl #32
movk x12, #29795, lsl #48
cmp x8, x12
mov x8, #30313
movk x8, #16741, lsl #16
movk x8, #29813, lsl #32
movk x8, #28520, lsl #48
ccmp x9, x8, #0, eq
mov x8, #26994
movk x8, #24954, lsl #16
movk x8, #26996, lsl #32
movk x8, #28271, lsl #48
ccmp x10, x8, #0, eq
mov x8, #25938
movk x8, #30065, lsl #16
movk x8, #29289, lsl #32
movk x8, #25701, lsl #48
ccmp x11, x8, #0, eq
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 13
b"AccessDenied" | b"AuthFailed" | b"InteractiveAuthorizationRequired" => {
b.ne LBB0_2
b LBB0_28
LBB0_21:
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 10
b"NoMemory" => NonZero::new(1),
cmp x1, #35
b.eq LBB0_25
cmp x1, #36
b.ne LBB0_3
// /Volumes/Q/repos/rust/library/core/src/cmp/pattern.rs : 71
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldur x8, [x0, #27]
mov x9, #28494
movk x9, #25933, lsl #16
movk x9, #28525, lsl #32
movk x9, #31090, lsl #48
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 10
b"NoMemory" => NonZero::new(1),
cmp x8, x9
b.eq LBB0_42
// /Volumes/Q/repos/rust/library/core/src/cmp/pattern.rs : 71
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldur x8, [x0, #27]
mov x9, #26964
movk x9, #25965, lsl #16
movk x9, #20324, lsl #32
movk x9, #29813, lsl #48
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 17
b"Timeout" | b"TimedOut" => NonZero::new(420),
cmp x8, x9
b.ne LBB0_2
b LBB0_41
LBB0_25:
// /Volumes/Q/repos/rust/library/core/src/cmp/pattern.rs : 71
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldur w8, [x0, #27]
ldur w9, [x0, #30]
mov w10, #26964
movk w10, #25965, lsl #16
cmp w8, w10
mov w8, #28517
movk w8, #29813, lsl #16
ccmp w9, w8, #0, eq
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 17
b"Timeout" | b"TimedOut" => NonZero::new(420),
b.eq LBB0_41
// /Volumes/Q/repos/rust/library/core/src/cmp/pattern.rs : 71
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldur w8, [x0, #27]
ldur w9, [x0, #30]
mov w10, #20297
movk w10, #29253, lsl #16
cmp w8, w10
mov w8, #29298
movk w8, #29295, lsl #16
b LBB0_34
LBB0_27:
ldur x8, [x0, #27]
ldurh w9, [x0, #35]
mov x10, #30017
movk x10, #26740, lsl #16
movk x10, #24902, lsl #32
movk x10, #27753, lsl #48
cmp x8, x10
mov w8, #25701
ccmp w9, w8, #0, eq
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 13
b"AccessDenied" | b"AuthFailed" | b"InteractiveAuthorizationRequired" => {
b.ne LBB0_2
LBB0_28:
mov w0, #1245
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 23
}
ret
LBB0_29:
// /Volumes/Q/repos/rust/library/core/src/cmp/pattern.rs : 71
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldur x8, [x0, #27]
ldur x9, [x0, #33]
mov x10, #25939
movk x10, #30322, lsl #16
movk x10, #25449, lsl #32
movk x10, #21861, lsl #48
cmp x8, x10
mov x8, #21861
movk x8, #27502, lsl #16
movk x8, #28526, lsl #32
movk x8, #28279, lsl #48
ccmp x9, x8, #0, eq
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 11
b"ServiceUnknown" | b"UnknownObject" | b"UnknownInterface" | b"UnknownMethod"
b.eq LBB0_40
// /Volumes/Q/repos/rust/library/core/src/cmp/pattern.rs : 71
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldur x8, [x0, #27]
ldur x9, [x0, #33]
mov x10, #24910
movk x10, #25965, lsl #16
movk x10, #24904, lsl #32
movk x10, #20083, lsl #48
cmp x8, x10
mov x8, #20083
movk x8, #20335, lsl #16
movk x8, #28279, lsl #32
movk x8, #29285, lsl #48
ccmp x9, x8, #0, eq
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 12
| b"UnknownProperty" | b"NameHasNoOwner" => NonZero::new(18),
b.eq LBB0_40
// /Volumes/Q/repos/rust/library/core/src/cmp/pattern.rs : 71
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldur x8, [x0, #27]
mov x9, #26956
movk x9, #26989, lsl #16
movk x9, #29556, lsl #32
movk x9, #30789, lsl #48
eor x8, x8, x9
ldur x9, [x0, #33]
mov x10, #30789
movk x10, #25955, lsl #16
movk x10, #25701, lsl #32
movk x10, #25701, lsl #48
eor x9, x9, x10
orr x8, x8, x9
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 16
b"LimitsExceeded" => NonZero::new(9),
cmp x8, #0
mov w8, #9
csel w0, wzr, w8, ne
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 23
}
ret
LBB0_32:
// /Volumes/Q/repos/rust/library/core/src/cmp/pattern.rs : 71
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldur x8, [x0, #27]
mov x9, #28245
movk x9, #30825, lsl #16
movk x9, #29264, lsl #32
movk x9, #25455, lsl #48
eor x8, x8, x9
ldur x9, [x0, #35]
mov x10, #29541
movk x10, #18803, lsl #16
movk x10, #21860, lsl #32
movk x10, #27502, lsl #48
eor x9, x9, x10
ldur w10, [x0, #43]
mov w11, #28526
movk w11, #28279, lsl #16
eor x10, x10, x11
orr x8, x8, x9
orr x8, x8, x10
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 18
b"UnixProcessIdUnknown" => NonZero::new(69),
cmp x8, #0
mov w8, #69
csel w0, wzr, w8, ne
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 23
}
ret
LBB0_33:
// /Volumes/Q/repos/rust/library/core/src/cmp/pattern.rs : 71
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldur x8, [x0, #27]
ldrb w9, [x0, #35]
mov x10, #28494
movk x10, #25934, lsl #16
movk x10, #30580, lsl #32
movk x10, #29295, lsl #48
cmp x8, x10
mov w8, #107
LBB0_34:
ccmp w9, w8, #0, eq
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 20
b"IOError" | b"NoNetwork" | b"AddressInUse" => NonZero::new(100500),
b.ne LBB0_2
mov w0, #34964
movk w0, #1, lsl #16
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 23
}
ret
LBB0_36:
// /Volumes/Q/repos/rust/library/core/src/cmp/pattern.rs : 71
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldur x8, [x0, #27]
ldr x9, [x0, #32]
mov x10, #28245
movk x10, #28267, lsl #16
movk x10, #30575, lsl #32
movk x10, #20334, lsl #48
cmp x8, x10
mov x8, #28279
movk x8, #25167, lsl #16
movk x8, #25962, lsl #32
movk x8, #29795, lsl #48
ccmp x9, x8, #0, eq
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 11
b"ServiceUnknown" | b"UnknownObject" | b"UnknownInterface" | b"UnknownMethod"
b.eq LBB0_40
// /Volumes/Q/repos/rust/library/core/src/cmp/pattern.rs : 71
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
ldur x8, [x0, #27]
ldr x9, [x0, #32]
mov x10, #28245
movk x10, #28267, lsl #16
movk x10, #30575, lsl #32
movk x10, #19822, lsl #48
cmp x8, x10
mov x8, #28279
movk x8, #25933, lsl #16
movk x8, #26740, lsl #32
movk x8, #25711, lsl #48
b LBB0_39
LBB0_38:
ldur x8, [x0, #27]
ldur x9, [x0, #35]
mov x10, #28245
movk x10, #28267, lsl #16
movk x10, #30575, lsl #32
movk x10, #18798, lsl #48
cmp x8, x10
mov x8, #29806
movk x8, #29285, lsl #16
movk x8, #24934, lsl #32
movk x8, #25955, lsl #48
LBB0_39:
ccmp x9, x8, #0, eq
b.ne LBB0_2
LBB0_40:
mov w0, #18
// /Volumes/Q/repos/bytestr-match/src/lib.rs : 23
}
ret
LBB0_41:
mov w0, #420
ret
LBB0_42:
mov w0, #1
ret
LBB0_43:
mov w0, #228
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment