Skip to content

Commit da3e9e0

Browse files
committed
added goexperiment.iseriesaix
merged iseries aix mods
1 parent aeccd61 commit da3e9e0

File tree

6 files changed

+52
-3
lines changed

6 files changed

+52
-3
lines changed

src/cmd/compile/internal/noder/lex.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func (p *noder) pragcgo(pos syntax.Pos, text string) {
101101
case len(f) == 3 && !isQuoted(f[1]) && !isQuoted(f[2]):
102102
case len(f) == 4 && !isQuoted(f[1]) && !isQuoted(f[2]) && isQuoted(f[3]):
103103
f[3] = strings.Trim(f[3], `"`)
104-
if buildcfg.GOOS == "aix" && f[3] != "" {
104+
if buildcfg.GOOS == "aix" && f[3] != "" && !buildcfg.Experiment.ISeriesAix {
105105
// On Aix, library pattern must be "lib.a/object.o"
106106
// or "lib.a/libname.so.X"
107107
n := strings.Split(f[3], "/")

src/cmd/dist/build.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,6 +1654,9 @@ func goCmd(env []string, goBinary string, cmd string, args ...string) {
16541654
if gohostos == "plan9" && os.Getenv("sysname") == "vx32" {
16551655
goCmd = append(goCmd, "-p=1")
16561656
}
1657+
if gohostos == "aix" && os.Getenv("MACHTYPE") == "powerpc-ibm-os400" {
1658+
goCmd = append(goCmd, "-p=1") //IBMi-OS400
1659+
}
16571660

16581661
runEnv(workdir, ShowOutput|CheckExit, env, append(goCmd, args...)...)
16591662
}

src/cmd/dist/util.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ var (
133133
)
134134

135135
func bginit() {
136+
if gohostos == "aix" && os.Getenv("MACHTYPE") == "powerpc-ibm-os400" {
137+
maxbg = 1
138+
}
139+
136140
bghelpers.Add(maxbg)
137141
for i := 0; i < maxbg; i++ {
138142
go bghelper()
@@ -272,6 +276,20 @@ func xmkdir(p string) {
272276
if err != nil {
273277
fatalf("%v", err)
274278
}
279+
if gohostos == "aix" && os.Getenv("MACHTYPE") == "powerpc-ibm-os400" {
280+
// IFS bug?
281+
os.Mkdir(p, 0777)
282+
os.Mkdir(p, 0777)
283+
os.Mkdir(p, 0777)
284+
os.Mkdir(p, 0777)
285+
os.Mkdir(p, 0777)
286+
os.Mkdir(p, 0777)
287+
os.Mkdir(p, 0777)
288+
os.Mkdir(p, 0777)
289+
os.Mkdir(p, 0777)
290+
os.Mkdir(p, 0777)
291+
os.Mkdir(p, 0777)
292+
}
275293
}
276294

277295
// xmkdirall creates the directory p and its parents, as needed.
@@ -280,6 +298,20 @@ func xmkdirall(p string) {
280298
if err != nil {
281299
fatalf("%v", err)
282300
}
301+
if gohostos == "aix" && os.Getenv("MACHTYPE") == "powerpc-ibm-os400" {
302+
// IFS bug?
303+
os.MkdirAll(p, 0777)
304+
os.MkdirAll(p, 0777)
305+
os.MkdirAll(p, 0777)
306+
os.MkdirAll(p, 0777)
307+
os.MkdirAll(p, 0777)
308+
os.MkdirAll(p, 0777)
309+
os.MkdirAll(p, 0777)
310+
os.MkdirAll(p, 0777)
311+
os.MkdirAll(p, 0777)
312+
os.MkdirAll(p, 0777)
313+
os.MkdirAll(p, 0777)
314+
}
283315
}
284316

285317
// xremove removes the file p.

src/internal/goexperiment/flags.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,8 @@ type Flags struct {
127127
// ExecTracer2 controls whether to use the new execution trace
128128
// implementation.
129129
ExecTracer2 bool
130+
131+
// ISeriesAix controls whether to compile for the 'aix' variant
132+
// supported in IBMi/OS400
133+
ISeriesAix bool
130134
}

src/runtime/malloc.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ const (
306306
//
307307
// On other platforms, the user address space is contiguous
308308
// and starts at 0, so no offset is necessary.
309-
arenaBaseOffset = 0xffff800000000000*goarch.IsAmd64 + 0x0a00000000000000*goos.IsAix
309+
310+
// aix/ppc64 on ISeries arena: 0x0700000000000000, so adjust it below
311+
arenaBaseOffset = 0xffff800000000000*goarch.IsAmd64 + 0x0a00000000000000*goos.IsAix - 0x0300000000000000*goexperiment.ISeriesAixInt
310312
// A typed version of this constant that will make it into DWARF (for viewcore).
311313
arenaBaseOffsetUintptr = uintptr(arenaBaseOffset)
312314

@@ -526,7 +528,11 @@ func mallocinit() {
526528
// to avoid collisions with others mmaps done by non-go programs.
527529
continue
528530
}
529-
p = uintptr(i)<<40 | uintptrMask&(0xa0<<52)
531+
if goexperiment.ISeriesAix {
532+
p = uintptr(i)<<40 | uintptrMask&(0x70<<52)
533+
} else {
534+
p = uintptr(i)<<40 | uintptrMask&(0xa0<<52)
535+
}
530536
default:
531537
p = uintptr(i)<<40 | uintptrMask&(0x00c0<<32)
532538
}

src/runtime/tagptr_64bit.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package runtime
99
import (
1010
"internal/goarch"
1111
"internal/goos"
12+
"internal/goexperiment"
1213
"unsafe"
1314
)
1415

@@ -75,6 +76,9 @@ func (tp taggedPointer) pointer() unsafe.Pointer {
7576
return unsafe.Pointer(uintptr(int64(tp) >> tagBits << 3))
7677
}
7778
if GOOS == "aix" {
79+
if goexperiment.ISeriesAix {
80+
return unsafe.Pointer(uintptr((tp >> aixTagBits << 3) | 0x7<<56))
81+
}
7882
return unsafe.Pointer(uintptr((tp >> aixTagBits << 3) | 0xa<<56))
7983
}
8084
if GOARCH == "riscv64" {

0 commit comments

Comments
 (0)