Skip to content

Commit 8e8616a

Browse files
committed
reflect: cram method dispatch into one memory page
For golang#38783
1 parent b84a139 commit 8e8616a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/cmd/internal/obj/x86/asm6.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,8 +2044,8 @@ type nopPad struct {
20442044
// cursym: current function being assembled
20452045
// returns number of bytes of padding needed
20462046
func addpad(pc, a int64, ctxt *obj.Link, cursym *obj.LSym) int {
2047-
if !((a&(a-1) == 0) && 8 <= a && a <= 2048) {
2048-
ctxt.Diag("alignment value of an instruction must be a power of two and in the range [8, 2048], got %d\n", a)
2047+
if !((a&(a-1) == 0) && 8 <= a && a <= 4096) {
2048+
ctxt.Diag("alignment value of an instruction must be a power of two and in the range [8, 4096], got %d\n", a)
20492049
return 0
20502050
}
20512051

src/reflect/asm_amd64.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ TEXT ·methodValueCall(SB),(NOSPLIT|WRAPPER),$312
8383
// the closure which implements the method.
8484
// No preamble of any kind, we need to do things manually.
8585
TEXT ·dispatchToMethod<ABIInternal>(SB),(NOSPLIT|NOFRAME),$0-0
86+
// cram dispatchToMethod and dispatchLabel into a single memory page
87+
PCALIGN $4096
8688
CALL ·dispatchLabel(SB)
8789
CALL ·dispatchLabel(SB)
8890
CALL ·dispatchLabel(SB)

0 commit comments

Comments
 (0)