Skip to content

Commit ee1c76d

Browse files
committed
runtime: simplify constant strings in asm
As of CL 163747, we can write arbitrary length strings in assembly DATA instructions. Make use of it here to improve readability. Change-Id: I556279ca893f527874e3b26112c43573834ccd9c Reviewed-on: https://go-review.googlesource.com/c/go/+/167386 Run-TryBot: Josh Bleecher Snyder <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 7c04110 commit ee1c76d

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

src/runtime/asm_386.s

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -248,16 +248,8 @@ ok:
248248
CALL runtime·abort(SB)
249249
RET
250250

251-
DATA bad_proc_msg<>+0x00(SB)/8, $"This pro"
252-
DATA bad_proc_msg<>+0x08(SB)/8, $"gram can"
253-
DATA bad_proc_msg<>+0x10(SB)/8, $" only be"
254-
DATA bad_proc_msg<>+0x18(SB)/8, $" run on "
255-
DATA bad_proc_msg<>+0x20(SB)/8, $"processo"
256-
DATA bad_proc_msg<>+0x28(SB)/8, $"rs with "
257-
DATA bad_proc_msg<>+0x30(SB)/8, $"MMX supp"
258-
DATA bad_proc_msg<>+0x38(SB)/4, $"ort."
259-
DATA bad_proc_msg<>+0x3c(SB)/1, $0xa
260-
GLOBL bad_proc_msg<>(SB), RODATA, $0x3d
251+
DATA bad_proc_msg<>+0x00(SB)/61, $"This program can only be run on processors with MMX support.\n"
252+
GLOBL bad_proc_msg<>(SB), RODATA, $61
261253

262254
DATA runtime·mainPC+0(SB)/4,$runtime·main(SB)
263255
GLOBL runtime·mainPC(SB),RODATA,$4

src/runtime/asm_amd64.s

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,10 +1438,8 @@ flush:
14381438
MOVQ 96(SP), R15
14391439
JMP ret
14401440

1441-
DATA debugCallFrameTooLarge<>+0x00(SB)/8, $"call fra"
1442-
DATA debugCallFrameTooLarge<>+0x08(SB)/8, $"me too l"
1443-
DATA debugCallFrameTooLarge<>+0x10(SB)/4, $"arge"
1444-
GLOBL debugCallFrameTooLarge<>(SB), RODATA, $0x14 // Size duplicated below
1441+
DATA debugCallFrameTooLarge<>+0x00(SB)/20, $"call frame too large"
1442+
GLOBL debugCallFrameTooLarge<>(SB), RODATA, $20 // Size duplicated below
14451443

14461444
// debugCallV1 is the entry point for debugger-injected function
14471445
// calls on running goroutines. It informs the runtime that a
@@ -1565,7 +1563,7 @@ good:
15651563
// The frame size is too large. Report the error.
15661564
MOVQ $debugCallFrameTooLarge<>(SB), AX
15671565
MOVQ AX, 0(SP)
1568-
MOVQ $0x14, 8(SP)
1566+
MOVQ $20, 8(SP) // length of debugCallFrameTooLarge string
15691567
MOVQ $8, AX
15701568
BYTE $0xcc
15711569
JMP restore

0 commit comments

Comments
 (0)