Skip to content

Commit fba087a

Browse files
fix compile fail
1 parent a441526 commit fba087a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/cmd/compile/internal/walk/builtin.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"fmt"
99
"go/constant"
1010
"go/token"
11+
"internal/abi"
1112
"strings"
1213

1314
"cmd/compile/internal/base"
@@ -321,7 +322,7 @@ func walkMakeMap(n *ir.MakeExpr, init *ir.Nodes) ir.Node {
321322
// Maximum key and elem size is 128 bytes, larger objects
322323
// are stored with an indirection. So max bucket size is 2048+eps.
323324
if !ir.IsConst(hint, constant.Int) ||
324-
constant.Compare(hint.Val(), token.LEQ, constant.MakeInt64(reflectdata.BUCKETSIZE)) {
325+
constant.Compare(hint.Val(), token.LEQ, constant.MakeInt64(abi.MapBucketCount)) {
325326

326327
// In case hint is larger than BUCKETSIZE runtime.makemap
327328
// will allocate the buckets on the heap, see #20184
@@ -332,7 +333,7 @@ func walkMakeMap(n *ir.MakeExpr, init *ir.Nodes) ir.Node {
332333
// h.buckets = b
333334
// }
334335

335-
nif := ir.NewIfStmt(base.Pos, ir.NewBinaryExpr(base.Pos, ir.OLE, hint, ir.NewInt(base.Pos, reflectdata.BUCKETSIZE)), nil, nil)
336+
nif := ir.NewIfStmt(base.Pos, ir.NewBinaryExpr(base.Pos, ir.OLE, hint, ir.NewInt(base.Pos, abi.MapBucketCount)), nil, nil)
336337
nif.Likely = true
337338

338339
// var bv bmap
@@ -347,7 +348,7 @@ func walkMakeMap(n *ir.MakeExpr, init *ir.Nodes) ir.Node {
347348
}
348349
}
349350

350-
if ir.IsConst(hint, constant.Int) && constant.Compare(hint.Val(), token.LEQ, constant.MakeInt64(reflectdata.BUCKETSIZE)) {
351+
if ir.IsConst(hint, constant.Int) && constant.Compare(hint.Val(), token.LEQ, constant.MakeInt64(abi.MapBucketCount)) {
351352
// Handling make(map[any]any) and
352353
// make(map[any]any, hint) where hint <= BUCKETSIZE
353354
// special allows for faster map initialization and

0 commit comments

Comments
 (0)