[go-nuts] Go compiler - questions about escape analysis.

2021-05-19 Thread messi...@gmail.com
Hi, I'm reading the go compiler source code and now come to the escape analysis part, I just can't figured out the following question so I want to get some help from the community: What's the meaning of location.transient

Re: [go-nuts] Go compiler - syntax tree vs AST?

2021-05-19 Thread messi...@gmail.com
> I don't know of a way to dump the former, but perhaps there is one. It seems there's no way to dump the former tree through any compiler flag by now. The dumper entry point is Fdum

Re: [go-nuts] Need help/tips on golang compiler souce code reading

2021-04-22 Thread messi...@gmail.com
Hi, Now I've finished the package types2 for typecheck logic, and continue the journey to next step: IR generation(directory: cmd/compile/internal/ir/). It seems the ir package is a new abstract layer created during the refactor process of types2, and it's main purpose is to translate the AST t

[go-nuts] Go compiler typechecker - why are there two ways to test type equality(checker.identical0() and unifier)?

2021-03-25 Thread messi...@gmail.com
Hi, While reading the source code of typechecker, I found there're two ways to check type equality: 1. Method checker.identical(x, y Type) bool {}, defined in predicates.go, used by many places to see if two types are identical during typecheck process; 2. Method unifier.unify(x, y Type) bool {

Re: [go-nuts] go cycle reference type - what's the practical usage of decls like "type T *T" and similars?

2021-03-15 Thread messi...@gmail.com
Thanks Ian, the state machine case reminds me of a video by Rob Pike: https://www.youtube.com/watch?v=HxaD_trXwRE , put the link here to help others who are interested :-) On Tuesday, March 16, 2021 at 12:58:00 PM UTC+8 Ian Lance Taylor wrote: > On Mon, Mar 15, 2021 at 9:23 PM me

[go-nuts] go cycle reference type - what's the practical usage of decls like "type T *T" and similars?

2021-03-15 Thread messi...@gmail.com
Hi, In file cycles.src there're many type declarations to demo cycle reference, some are invalid and some are valid, I can understand why invalid ones are invalid, but for some of the valid ones, I

Re: [go-nuts] Re: Go compiler - where and how the implicit interface "comparable" used?

2021-03-14 Thread messi...@gmail.com
Thanks for your explanation, that's very helpful :-) On Friday, March 12, 2021 at 3:03:00 PM UTC+8 axel.wa...@googlemail.com wrote: > On Fri, Mar 12, 2021 at 4:55 AM messi...@gmail.com > wrote: > >> Does it use for generics constraints only? > > > That is

[go-nuts] Re: Go compiler - where and how the implicit interface "comparable" used?

2021-03-11 Thread messi...@gmail.com
AM UTC+8 messi...@gmail.com wrote: > Hi, > > I'm reading the new typechecker source code of go compiler(under directory > cmd/compile/internal/types2), during the initialization process, > universe.go registers an implicit interface "comparable" inside functi

[go-nuts] Go compiler - where and how the implicit interface "comparable" used?

2021-03-11 Thread messi...@gmail.com
Hi, I'm reading the new typechecker source code of go compiler(under directory cmd/compile/internal/types2), during the initialization process, universe.go registers an implicit interface "comparable" inside function defPredeclaredComparable

Re: [go-nuts] Need help/tips on golang compiler souce code reading

2021-02-26 Thread messi...@gmail.com
ut just because I enjoy puzzles and I think > that these efforts to learn will pay great dividends in the future. > > On Thursday, February 25, 2021 at 8:56:01 AM UTC-6 Ian Lance Taylor wrote: > >> On Wed, Feb 24, 2021 at 10:24 PM messi...@gmail.com >> wrote: >> > >

Re: [go-nuts] Need help/tips on golang compiler souce code reading

2021-02-26 Thread messi...@gmail.com
up the whole process? Thanks again. On Thursday, February 25, 2021 at 10:56:01 PM UTC+8 Ian Lance Taylor wrote: > On Wed, Feb 24, 2021 at 10:24 PM messi...@gmail.com > wrote: > > > > I'm trying to read golang compiler source code and now have come to the > midd

[go-nuts] Need help/tips on golang compiler souce code reading

2021-02-24 Thread messi...@gmail.com
Hi, I'm trying to read golang compiler source code and now have come to the middle of syntax analysis: just finished parser.fileOrNil , next step is noder.node()

[go-nuts] Re: Code style in golang compiler

2021-02-08 Thread messi...@gmail.com
;t claim to fully understand the commit message, but I believe that > this change will cause the runtime to allocate both values together, rather > than separately, and this slightly reduces GC pressure. > > On Monday, February 8, 2021 at 10:37:29 PM UTC-5 messi...@gmail.com wrote: >

[go-nuts] Code style in golang compiler

2021-02-08 Thread messi...@gmail.com
Hi, I'm reading the go compiler source code and found the following code style in several places: [image: DeepinScreenshot_select-area_20210209105635.png] Is there some special reasons to group n,m,p to a local struct? Why don't we just init n the following way: [image: DeepinScreenshot_sele