Re: [go-nuts] In the future, how to keep runtime.KeepAlive from dead code elimination?

2016-08-26 Thread Ian Lance Taylor
On Fri, Aug 26, 2016 at 2:56 AM, Cholerae Hu wrote: > I'm curious that how does compiler recognize runtime.KeepAlive specially? The compiler already recognizes some functions specially, most notably math.Sqrt. Search for "Sqrt" in cmd/compile/internal/gc/walk.go. Ian >

Re: [go-nuts] In the future, how to keep runtime.KeepAlive from dead code elimination?

2016-08-26 Thread Dave Cheney
runtime/mfinal.go:464 On Friday, 26 August 2016 19:56:49 UTC+10, Cholerae Hu wrote: > > I'm curious that how does compiler recognize runtime.KeepAlive specially? > > 在 2016年8月26日星期五 UTC+8上午12:04:57,Ian Lance Taylor写道: >> >> On Thu, Aug 25, 2016 at 12:15 AM, Cholerae Hu >>

Re: [go-nuts] In the future, how to keep runtime.KeepAlive from dead code elimination?

2016-08-26 Thread Cholerae Hu
I'm curious that how does compiler recognize runtime.KeepAlive specially? 在 2016年8月26日星期五 UTC+8上午12:04:57,Ian Lance Taylor写道: > > On Thu, Aug 25, 2016 at 12:15 AM, Cholerae Hu > wrote: > > Does that mean that only inlined functions will be optimized and any > > functions

Re: [go-nuts] In the future, how to keep runtime.KeepAlive from dead code elimination?

2016-08-25 Thread Dave Cheney
Not really. Runtime.KeepAlive is special, it'll continue to be special in the future. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [go-nuts] In the future, how to keep runtime.KeepAlive from dead code elimination?

2016-08-25 Thread Cholerae Hu
Does that mean that only inlined functions will be optimized and any functions not inlined will not be optimized ? 在 2016年8月25日星期四 UTC+8上午11:55:12,Ian Lance Taylor写道: > > On Wed, Aug 24, 2016 at 7:06 PM, Cholerae Hu > wrote: > > > > I've read the source of package

[go-nuts] In the future, how to keep runtime.KeepAlive from dead code elimination?

2016-08-24 Thread Cholerae Hu
Hi all, I've read the source of package runtime, and found that runtime.KeepAlive is an empty function. If go compiler can do dead code elimination in the future, how to protect runtime.KeepAlive from being optimized? -- You received this message because you are subscribed to the Google