Skip to content

Commit c795461

Browse files
authored
closure: add sparc64 support (#26731)
* closure: add sparc64 support * missed comma * add sparc64 to native too
1 parent 51bd39e commit c795461

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎vlib/builtin/closure/closure.c.v‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ pub const closure_thunk = $if ppc64le {
9797
0x51, 0x22, 0xC0, 0x28, // ld.d t5, t6, 8
9898
0x20, 0x02, 0x00, 0x4C, // jr t5
9999
]!
100+
} $else $if sparc64 {
101+
[
102+
u8(0x83), 0x41, 0x40, 0x00, // rd %pc, %g1
103+
0x05, 0x00, 0x00, 0x10, // sethi %hi(0x4000), %g2
104+
0x84, 0x10, 0xa0, 0x00, // mov %g2, %g2 ! 4000 <main>
105+
0x82, 0x20, 0x40, 0x02, // sub %g1, %g2, %g1
106+
0xff, 0x18, 0x60, 0x00, // ldd [ %l1 ], %d62
107+
0xc2, 0x58, 0x60, 0x08, // ldx [ %g1 + 8 ], %g1
108+
0x81, 0xc0, 0x40, 0x00, // jmp %g1
109+
0x01, 0x00, 0x00, 0x00 // nop
110+
]!
100111
} $else {
101112
[u8(0)]!
102113
}
@@ -150,6 +161,12 @@ const closure_get_data_bytes = $if arm32 {
150161
u8(0x04), 0xB9, 0x14, 0x01, // movfr2gr.d a0, f8
151162
0x20, 0x00, 0x00, 0x4C, // ret
152163
]!
164+
} $else $if sparc64 {
165+
[
166+
u8(0x91), 0xb0, 0x22, 0x1f, // movdtox %f62, %o0
167+
0x81, 0xc3, 0xe0, 0x08, // retl
168+
0x01, 0x00, 0x00, 0x00 // nop
169+
]!
153170
} $else {
154171
[u8(0)]!
155172
}

‎vlib/v/gen/native/comptime.v‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ fn (mut g Gen) comptime_ident(name string, is_comptime_option bool) bool {
170170
'x86', 'x32', 'i386', 'arm32', 'rv32' {
171171
false // native only supports 64-bit systems
172172
}
173-
'rv64', 's390x', 'ppc64le', 'loongarch64' {
173+
'rv64', 's390x', 'ppc64le', 'loongarch64', 'sparc64' {
174174
false // not support yet
175175
}
176176
'little_endian' {

0 commit comments

Comments
 (0)