X7ROOT File Manager
Current Path:
/opt/golang/1.17.2/test
opt
/
golang
/
1.17.2
/
test
/
📁
..
📄
235.go
(1.56 KB)
📄
64bit.go
(24.83 KB)
📄
README.md
(696 B)
📁
abi
📄
alg.go
(822 B)
📄
alias.go
(588 B)
📄
alias1.go
(803 B)
📄
alias2.go
(2.52 KB)
📁
alias3.dir
📄
alias3.go
(187 B)
📄
align.go
(603 B)
📄
append.go
(9.09 KB)
📄
append1.go
(836 B)
📄
args.go
(374 B)
📄
armimm.go
(3.85 KB)
📄
assign.go
(1.01 KB)
📄
assign1.go
(5.55 KB)
📄
atomicload.go
(798 B)
📁
bench
📄
bigalg.go
(2.12 KB)
📄
bigmap.go
(2.46 KB)
📄
blank.go
(2.1 KB)
📄
blank1.go
(724 B)
📄
bom.go
(406 B)
📄
bombad.go
(480 B)
📄
bounds.go
(6.09 KB)
📄
cannotassign.go
(1.04 KB)
📁
chan
📄
chancap.go
(1.57 KB)
📄
chanlinear.go
(2.12 KB)
📄
char_lit.go
(657 B)
📄
char_lit1.go
(822 B)
📄
checkbce.go
(3.56 KB)
📄
clearfat.go
(1.15 KB)
📄
closedchan.go
(5.79 KB)
📄
closure.go
(1.69 KB)
📄
closure1.go
(280 B)
📄
closure2.go
(1.86 KB)
📁
closure3.dir
📄
closure3.go
(321 B)
📄
closure4.go
(364 B)
📁
closure5.dir
📄
closure5.go
(280 B)
📄
closure6.go
(346 B)
📄
closure7.go
(373 B)
📄
cmp.go
(7.63 KB)
📄
cmp6.go
(2.16 KB)
📄
cmplx.go
(1.39 KB)
📄
cmplxdivide.c
(2.05 KB)
📄
cmplxdivide.go
(868 B)
📄
cmplxdivide1.go
(240.68 KB)
📁
codegen
📄
complit.go
(1.71 KB)
📄
complit1.go
(1.66 KB)
📄
compos.go
(403 B)
📄
const.go
(4.78 KB)
📄
const1.go
(3.79 KB)
📄
const2.go
(1008 B)
📄
const3.go
(659 B)
📄
const4.go
(1.28 KB)
📄
const5.go
(835 B)
📄
const6.go
(834 B)
📄
const7.go
(1.9 KB)
📄
convT2X.go
(3.33 KB)
📄
convert.go
(833 B)
📄
convert1.go
(3.41 KB)
📄
convert2.go
(5.92 KB)
📄
convert3.go
(544 B)
📄
convert4.go
(1.63 KB)
📄
convlit.go
(2.39 KB)
📄
convlit1.go
(458 B)
📄
copy.go
(6.6 KB)
📄
copy1.go
(851 B)
📄
crlf.go
(782 B)
📄
ddd.go
(4.23 KB)
📄
ddd1.go
(1.58 KB)
📁
ddd2.dir
📄
ddd2.go
(252 B)
📄
decl.go
(926 B)
📄
declbad.go
(1.43 KB)
📄
defer.go
(875 B)
📄
defererrcheck.go
(1.4 KB)
📄
deferfin.go
(1.05 KB)
📄
defernil.go
(563 B)
📄
deferprint.go
(586 B)
📄
deferprint.out
(126 B)
📄
devirt.go
(599 B)
📄
directive.go
(2.24 KB)
📄
divide.go
(1.22 KB)
📄
divmod.go
(9.28 KB)
📁
dwarf
📄
embedfunc.go
(308 B)
📄
embedvers.go
(292 B)
📄
empty.go
(316 B)
📄
env.go
(585 B)
📄
eof.go
(308 B)
📄
eof1.go
(333 B)
📄
escape.go
(3.79 KB)
📄
escape2.go
(35.07 KB)
📄
escape2n.go
(35.1 KB)
📄
escape3.go
(524 B)
📄
escape4.go
(1.31 KB)
📄
escape5.go
(5.37 KB)
📄
escape_array.go
(3.64 KB)
📄
escape_calls.go
(1.26 KB)
📄
escape_closure.go
(4.24 KB)
📄
escape_field.go
(2.92 KB)
📄
escape_goto.go
(674 B)
📄
escape_hash_maphash.go
(368 B)
📄
escape_iface.go
(4.47 KB)
📄
escape_indir.go
(3.31 KB)
📄
escape_level.go
(1.79 KB)
📄
escape_map.go
(2.76 KB)
📄
escape_param.go
(8.9 KB)
📄
escape_runtime_atomic.go
(874 B)
📄
escape_selfassign.go
(538 B)
📄
escape_slice.go
(3.79 KB)
📄
escape_struct_param1.go
(8.9 KB)
📄
escape_struct_param2.go
(8.94 KB)
📄
escape_struct_return.go
(1.04 KB)
📄
escape_sync_atomic.go
(943 B)
📄
escape_unsafe.go
(2.16 KB)
📄
fibo.go
(6.28 KB)
📄
finprofiled.go
(1.95 KB)
📁
fixedbugs
📄
float_lit.go
(3.95 KB)
📄
float_lit2.go
(7.88 KB)
📄
float_lit3.go
(1.59 KB)
📄
floatcmp.go
(3.03 KB)
📄
for.go
(844 B)
📄
func.go
(1.29 KB)
📄
func1.go
(445 B)
📄
func2.go
(578 B)
📄
func3.go
(505 B)
📄
func4.go
(409 B)
📄
func5.go
(1.49 KB)
📄
func6.go
(393 B)
📄
func7.go
(477 B)
📄
func8.go
(599 B)
📄
funcdup.go
(1.31 KB)
📄
funcdup2.go
(721 B)
📄
fuse.go
(5.31 KB)
📄
gc.go
(411 B)
📄
gc1.go
(303 B)
📄
gc2.go
(972 B)
📄
gcgort.go
(34.54 KB)
📄
gcstring.go
(872 B)
📄
goprint.go
(722 B)
📄
goprint.out
(65 B)
📄
goto.go
(8.39 KB)
📄
heapsampling.go
(9.53 KB)
📄
helloworld.go
(269 B)
📄
helloworld.out
(13 B)
📄
if.go
(1.36 KB)
📄
import.go
(425 B)
📄
import1.go
(633 B)
📁
import2.dir
📄
import2.go
(247 B)
📁
import4.dir
📄
import4.go
(310 B)
📄
import5.go
(722 B)
📄
import6.go
(1.38 KB)
📄
index.go
(6.42 KB)
📄
index0.go
(301 B)
📄
index1.go
(305 B)
📄
index2.go
(305 B)
📄
indirect.go
(1.39 KB)
📄
indirect1.go
(1.53 KB)
📄
init.go
(479 B)
📄
init1.go
(1.08 KB)
📄
initcomma.go
(1.22 KB)
📄
initempty.go
(604 B)
📄
initexp.go
(1.74 KB)
📄
initialize.go
(1.24 KB)
📄
initializerr.go
(1.04 KB)
📄
initloop.go
(407 B)
📄
inline.go
(7.59 KB)
📄
inline_big.go
(12.67 KB)
📄
inline_caller.go
(1.36 KB)
📄
inline_callers.go
(1.87 KB)
📄
inline_literal.go
(1.02 KB)
📄
inline_math_bits_rotate.go
(569 B)
📄
inline_sync.go
(1.52 KB)
📄
inline_variadic.go
(513 B)
📄
int_lit.go
(387 B)
📄
intcvt.go
(4.26 KB)
📁
interface
📁
intrinsic.dir
📄
intrinsic.go
(259 B)
📄
intrinsic_atomic.go
(799 B)
📄
iota.go
(1.59 KB)
📁
ken
📄
label.go
(1.02 KB)
📄
label1.go
(2.08 KB)
📄
linkmain.go
(236 B)
📄
linkmain_run.go
(1.71 KB)
📁
linkname.dir
📄
linkname.go
(456 B)
📄
linkname2.go
(794 B)
📄
linkobj.go
(3.17 KB)
📄
linkx.go
(741 B)
📄
linkx_run.go
(1.65 KB)
📄
literal.go
(4.99 KB)
📄
literal2.go
(2.22 KB)
📄
live.go
(17.96 KB)
📄
live1.go
(1.29 KB)
📄
live2.go
(963 B)
📄
live_regabi.go
(17.93 KB)
📄
live_syscall.go
(1.13 KB)
📄
locklinear.go
(3.56 KB)
📄
loopbce.go
(9.75 KB)
📄
mainsig.go
(598 B)
📄
makechan.go
(1.04 KB)
📄
makemap.go
(1.3 KB)
📄
makenew.go
(605 B)
📄
makeslice.go
(5.49 KB)
📄
mallocfin.go
(1.18 KB)
📄
map.go
(14.91 KB)
📄
map1.go
(1.47 KB)
📄
mapclear.go
(1.49 KB)
📄
maplinear.go
(3.62 KB)
📄
mergemul.go
(3.16 KB)
📄
method.go
(5.24 KB)
📄
method1.go
(727 B)
📄
method2.go
(1.16 KB)
📄
method3.go
(570 B)
📁
method4.dir
📄
method4.go
(230 B)
📄
method5.go
(6.73 KB)
📄
method6.go
(467 B)
📄
method7.go
(1.15 KB)
📄
named.go
(4.61 KB)
📄
named1.go
(984 B)
📄
nil.go
(2.23 KB)
📄
nilcheck.go
(3.62 KB)
📄
nilptr.go
(3.15 KB)
📄
nilptr2.go
(3.6 KB)
📄
nilptr3.go
(5.39 KB)
📄
nilptr4.go
(428 B)
📄
nilptr5.go
(814 B)
📄
nilptr5_aix.go
(805 B)
📄
nilptr5_wasm.go
(812 B)
📄
nilptr_aix.go
(3.09 KB)
📄
nosplit.go
(10.8 KB)
📄
notinheap.go
(1.29 KB)
📄
notinheap2.go
(1.78 KB)
📄
notinheap3.go
(1.24 KB)
📄
nowritebarrier.go
(1.21 KB)
📄
nul1.go
(1.23 KB)
📁
oldescape_linkname.dir
📄
opt_branchlikely.go
(2.08 KB)
📄
parentype.go
(424 B)
📄
peano.go
(2.22 KB)
📄
phiopt.go
(2.02 KB)
📄
print.go
(1.56 KB)
📄
print.out
(247 B)
📄
printbig.go
(315 B)
📄
printbig.out
(41 B)
📄
prove.go
(19.65 KB)
📄
range.go
(8.14 KB)
📄
recover.go
(10.64 KB)
📄
recover1.go
(2.5 KB)
📄
recover2.go
(1.22 KB)
📄
recover3.go
(1.64 KB)
📄
recover4.go
(2.17 KB)
📄
recover5.go
(408 B)
📄
reflectmethod1.go
(578 B)
📄
reflectmethod2.go
(719 B)
📄
reflectmethod3.go
(651 B)
📄
reflectmethod4.go
(573 B)
📄
reflectmethod5.go
(544 B)
📄
reflectmethod6.go
(555 B)
📄
reflectmethod7.go
(417 B)
📄
rename.go
(1.52 KB)
📄
rename1.go
(1.13 KB)
📄
reorder.go
(2.28 KB)
📄
reorder2.go
(7.22 KB)
📁
retjmp.dir
📄
retjmp.go
(252 B)
📄
return.go
(32.69 KB)
📄
rotate.go
(3.27 KB)
📄
rotate0.go
(286 B)
📄
rotate1.go
(286 B)
📄
rotate2.go
(286 B)
📄
rotate3.go
(286 B)
📄
run.go
(56.89 KB)
📄
rune.go
(603 B)
📁
runtime
📄
runtime.go
(600 B)
📄
shift1.go
(8.92 KB)
📄
shift2.go
(1.31 KB)
📄
sieve.go
(1 KB)
📄
sigchld.go
(365 B)
📄
sigchld.out
(17 B)
📄
simassign.go
(1.12 KB)
📄
sinit.go
(5.75 KB)
📄
sinit_run.go
(856 B)
📄
sizeof.go
(2.95 KB)
📄
slice3.go
(2.92 KB)
📄
slice3err.go
(5.19 KB)
📄
slicecap.go
(1.85 KB)
📄
sliceopt.go
(735 B)
📄
solitaire.go
(2.9 KB)
📄
stack.go
(1.69 KB)
📄
stackobj.go
(975 B)
📄
stackobj2.go
(1.55 KB)
📄
stackobj3.go
(1.42 KB)
📄
strcopy.go
(674 B)
📄
strength.go
(1.02 KB)
📁
stress
📄
string_lit.go
(3.58 KB)
📄
stringrange.go
(1.45 KB)
📄
struct0.go
(565 B)
📄
switch.go
(6.1 KB)
📄
switch2.go
(778 B)
📄
switch3.go
(1.24 KB)
📄
switch4.go
(526 B)
📄
switch5.go
(2.25 KB)
📄
switch6.go
(1.16 KB)
📄
switch7.go
(796 B)
📁
syntax
📄
tinyfin.go
(1.57 KB)
📄
torture.go
(7.69 KB)
📄
turing.go
(893 B)
📄
typecheck.go
(549 B)
📄
typecheckloop.go
(526 B)
📁
typeparam
📄
typeswitch.go
(1.83 KB)
📄
typeswitch1.go
(1.6 KB)
📄
typeswitch2.go
(655 B)
📄
typeswitch2b.go
(598 B)
📄
typeswitch3.go
(1009 B)
📁
uintptrescapes.dir
📄
uintptrescapes.go
(250 B)
📄
uintptrescapes2.go
(2.18 KB)
📄
uintptrescapes3.go
(1.28 KB)
📄
undef.go
(758 B)
📄
unsafebuiltins.go
(1.29 KB)
📄
used.go
(5.96 KB)
📄
utf.go
(1.19 KB)
📄
varerr.go
(449 B)
📄
varinit.go
(509 B)
📄
winbatch.go
(1.97 KB)
📄
writebarrier.go
(5.57 KB)
📄
zerodivide.go
(5.71 KB)
Editing: inline.go
// errorcheck -0 -m -d=inlfuncswithclosures=1 // Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Test, using compiler diagnostic flags, that inlining is working. // Compiles but does not run. package foo import ( "runtime" "unsafe" ) func add2(p *byte, n uintptr) *byte { // ERROR "can inline add2" "leaking param: p to result" return (*byte)(add1(unsafe.Pointer(p), n)) // ERROR "inlining call to add1" } func add1(p unsafe.Pointer, x uintptr) unsafe.Pointer { // ERROR "can inline add1" "leaking param: p to result" return unsafe.Pointer(uintptr(p) + x) } func f(x *byte) *byte { // ERROR "can inline f" "leaking param: x to result" return add2(x, 1) // ERROR "inlining call to add2" "inlining call to add1" } //go:noinline func g(x int) int { return x + 1 } func h(x int) int { // ERROR "can inline h" return x + 2 } func i(x int) int { // ERROR "can inline i" const y = 2 return x + y } func j(x int) int { // ERROR "can inline j" switch { case x > 0: return x + 2 default: return x + 1 } } func _() int { // ERROR "can inline _" tmp1 := h tmp2 := tmp1 return tmp2(0) // ERROR "inlining call to h" } var somethingWrong error // local closures can be inlined func l(x, y int) (int, int, error) { // ERROR "can inline l" e := func(err error) (int, int, error) { // ERROR "can inline l.func1" "func literal does not escape" "leaking param: err to result" return 0, 0, err } if x == y { e(somethingWrong) // ERROR "inlining call to l.func1" } else { f := e f(nil) // ERROR "inlining call to l.func1" } return y, x, nil } // any re-assignment prevents closure inlining func m() int { foo := func() int { return 1 } // ERROR "can inline m.func1" "func literal does not escape" x := foo() foo = func() int { return 2 } // ERROR "can inline m.func2" "func literal does not escape" return x + foo() } // address taking prevents closure inlining func n() int { foo := func() int { return 1 } // ERROR "can inline n.func1" "func literal does not escape" bar := &foo x := (*bar)() + foo() return x } // make sure assignment inside closure is detected func o() int { foo := func() int { return 1 } // ERROR "can inline o.func1" "func literal does not escape" func(x int) { // ERROR "can inline o.func2" if x > 10 { foo = func() int { return 2 } // ERROR "func literal does not escape" "can inline o.func2" } }(11) // ERROR "inlining call to o.func2" return foo() } func p() int { // ERROR "can inline p" return func() int { return 42 }() // ERROR "can inline p.func1" "inlining call to p.func1" } func q(x int) int { // ERROR "can inline q" foo := func() int { return x * 2 } // ERROR "can inline q.func1" "func literal does not escape" return foo() // ERROR "inlining call to q.func1" } func r(z int) int { foo := func(x int) int { // ERROR "can inline r.func1" "func literal does not escape" return x + z } bar := func(x int) int { // ERROR "func literal does not escape" "can inline r.func2" return x + func(y int) int { // ERROR "can inline r.func2.1" "can inline r.func3" return 2*y + x*z }(x) // ERROR "inlining call to r.func2.1" } return foo(42) + bar(42) // ERROR "inlining call to r.func1" "inlining call to r.func2" "inlining call to r.func3" } func s0(x int) int { // ERROR "can inline s0" foo := func() { // ERROR "can inline s0.func1" "func literal does not escape" x = x + 1 } foo() // ERROR "inlining call to s0.func1" return x } func s1(x int) int { // ERROR "can inline s1" foo := func() int { // ERROR "can inline s1.func1" "func literal does not escape" return x } x = x + 1 return foo() // ERROR "inlining call to s1.func1" } // can't currently inline functions with a break statement func switchBreak(x, y int) int { var n int switch x { case 0: n = 1 Done: switch y { case 0: n += 10 break Done } n = 2 } return n } func switchType(x interface{}) int { // ERROR "can inline switchType" "x does not escape" switch x.(type) { case int: return x.(int) default: return 0 } } type T struct{} func (T) meth(int, int) {} // ERROR "can inline T.meth" func k() (T, int, int) { return T{}, 0, 0 } // ERROR "can inline k" func _() { // ERROR "can inline _" T.meth(k()) // ERROR "inlining call to k" "inlining call to T.meth" } func small1() { // ERROR "can inline small1" runtime.GC() } func small2() int { // ERROR "can inline small2" return runtime.GOMAXPROCS(0) } func small3(t T) { // ERROR "can inline small3" t.meth2(3, 5) } func small4(t T) { // not inlineable - has 2 calls. t.meth2(runtime.GOMAXPROCS(0), 5) } func (T) meth2(int, int) { // not inlineable - has 2 calls. runtime.GC() runtime.GC() } // Issue #29737 - make sure we can do inlining for a chain of recursive functions func ee() { // ERROR "can inline ee" ff(100) // ERROR "inlining call to ff" "inlining call to gg" "inlining call to hh" } func ff(x int) { // ERROR "can inline ff" if x < 0 { return } gg(x - 1) } func gg(x int) { // ERROR "can inline gg" hh(x - 1) } func hh(x int) { // ERROR "can inline hh" ff(x - 1) // ERROR "inlining call to ff" // ERROR "inlining call to gg" } // Issue #14768 - make sure we can inline for loops. func for1(fn func() bool) { // ERROR "can inline for1" "fn does not escape" for { if fn() { break } else { continue } } } // BAD: for2 should be inlineable too. func for2(fn func() bool) { // ERROR "fn does not escape" Loop: for { if fn() { break Loop } else { continue Loop } } } // Issue #18493 - make sure we can do inlining of functions with a method value type T1 struct{} func (a T1) meth(val int) int { // ERROR "can inline T1.meth" "inlining call to T1.meth" return val + 5 } func getMeth(t1 T1) func(int) int { // ERROR "can inline getMeth" return t1.meth // ERROR "t1.meth escapes to heap" } func ii() { // ERROR "can inline ii" var t1 T1 f := getMeth(t1) // ERROR "inlining call to getMeth" "t1.meth does not escape" _ = f(3) } // Issue #42194 - make sure that functions evaluated in // go and defer statements can be inlined. func gd1(int) { defer gd1(gd2()) // ERROR "inlining call to gd2" defer gd3()() // ERROR "inlining call to gd3" go gd1(gd2()) // ERROR "inlining call to gd2" go gd3()() // ERROR "inlining call to gd3" } func gd2() int { // ERROR "can inline gd2" return 1 } func gd3() func() { // ERROR "can inline gd3" return ii } // Issue #42788 - ensure ODEREF OCONVNOP* OADDR is low cost. func EncodeQuad(d []uint32, x [6]float32) { // ERROR "can inline EncodeQuad" "d does not escape" _ = d[:6] d[0] = float32bits(x[0]) // ERROR "inlining call to float32bits" d[1] = float32bits(x[1]) // ERROR "inlining call to float32bits" d[2] = float32bits(x[2]) // ERROR "inlining call to float32bits" d[3] = float32bits(x[3]) // ERROR "inlining call to float32bits" d[4] = float32bits(x[4]) // ERROR "inlining call to float32bits" d[5] = float32bits(x[5]) // ERROR "inlining call to float32bits" } // float32bits is a copy of math.Float32bits to ensure that // these tests pass with `-gcflags=-l`. func float32bits(f float32) uint32 { // ERROR "can inline float32bits" return *(*uint32)(unsafe.Pointer(&f)) } // Ensure OCONVNOP is zero cost. func Conv(v uint64) uint64 { // ERROR "can inline Conv" return conv2(conv2(conv2(v))) // ERROR "inlining call to (conv1|conv2)" } func conv2(v uint64) uint64 { // ERROR "can inline conv2" return conv1(conv1(conv1(conv1(v)))) // ERROR "inlining call to conv1" } func conv1(v uint64) uint64 { // ERROR "can inline conv1" return uint64(uint64(uint64(uint64(uint64(uint64(uint64(uint64(uint64(uint64(uint64(v))))))))))) }
Upload File
Create Folder