Skip to content

Commit

Permalink
reflect/makefunc: move amd64-specific definitions
Browse files Browse the repository at this point in the history
Move amd64-specific definitions from general makefunc.go to
amd64-specific makefunc_amd64.go.

For golang#38783
  • Loading branch information
TheCount committed Sep 12, 2023
1 parent 8c66874 commit ffc6822
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/reflect/makefunc.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,6 @@ var dispatchToMethodAddr = abi.FuncPCABIInternal(dispatchToMethod)
// at runtime. Initially, it's the actual code address of dispatchToMethod.
var currentMethodKey = dispatchToMethodAddr

const (
// dispatchStep is the number of bytes we should call deeper into
// dispatchToMethod with each generated method.
dispatchStep = 5 // FIXME: AMD64 specific

// dispatchLimit is the upper limit for currentMethodKey. Once this limit
// is reached, we need to switch to a different page.
dispatchLimit = dispatchStep * 812 // FIXME: AMD64 specific
)

// methodSlotsExhausted is a drop-in for when there are no more method slots.
// It will cause the method to panic when called. This late-failure behaviour
// makes it possible to successfully call StructOf even if no more slots for
Expand Down
10 changes: 10 additions & 0 deletions src/reflect/makefunc_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ import (
"unsafe"
)

const (
// dispatchStep is the number of bytes we should call deeper into
// dispatchToMethod with each generated method.
dispatchStep = 5

// dispatchLimit is the upper limit for currentMethodKey. Once this limit
// is reached, we need to switch to a different page.
dispatchLimit = dispatchStep * 812
)

// getMethodImpl returns the pointer to the closure for the specified key.
// It is called from the ASM dispatch code.
func getMethodImpl(
Expand Down

0 comments on commit ffc6822

Please sign in to comment.