[go-nuts] Re: Roadblock for user-implemented JIT compiler

2019-11-02 Thread Max
On Friday, November 1, 2019 at 8:58:13 AM UTC+1, Sokolov Yura wrote: > > Don't forget about calling to write barriers. Of course. Second update: calling arbitrary Go functions from ARM64 JIT code works too :) See https://github.com/cosmos72/gomacro/blob/master/jit/_hide_from_stack -- You

[go-nuts] Re: How can i create a counter decorator in go?

2019-11-02 Thread 林风
thanks for the idea, totally works. simple than my interface implement. @burak serdar not sure you are talking about this kind of program or not, if yes, then sorry for my misunderstanding. it works. https://play.golang.org/p/DnSc5vgItsL 在 2019年11月2日星期六 UTC+8下午7:44:02,Tamás Gulácsi写道: > > 201

Re: [go-nuts] How can i create a counter decorator in go?

2019-11-02 Thread 林风
totally agree with not use old java thing in go. but here we are trying to solve a real problem. i read your code, it make sense to me we need a interface to fib, so i write such code (still i don't think your code can work with fib(n) n>1 since you did not use Recursive, when you use Recursive

Re: [go-nuts] How can i create a counter decorator in go?

2019-11-02 Thread burak serdar
You don't need to change the original function. Below, Fib(int) int is the original function, and it illustrates two ways to decorate it. https://play.golang.org/p/K6us_rHIsyM Neither is a *bad* way to write code. Go is a different language so some things you're used to in other languages must be

[go-nuts] liteide x36.2 released.

2019-11-02 Thread visualfc
Hi, all. LiteIDE X36.2 released! This version fix gocode crash bug. Add new image viewer plugins. Folder view support multi copy&paste, move to trash. Fix windows floating dock widget style. * LiteIDE Home         * LiteIDE Source code        

[go-nuts] mcache per P or per M?

2019-11-02 Thread Vincent Blanchon
Hello, Reading the code, I can see the structs m and p hold a mcache instance. I'm curious to understand why both of them need an instance of mcache? Also, I see that those instances are the same ones (runtime/proc.go init the p.mcache with m.cache and vice versa), is it correct? Should we cons

[go-nuts] Re: How can i create a counter decorator in go?

2019-11-02 Thread Tamás Gulácsi
2019. november 2., szombat 7:20:02 UTC+1 időpontban 林风 a következőt írta: > > let's say i have a function or method to get fib > > func fib(n int){ > ... > return fib(n-1) + fib(n-2) > } > > > now i want to add a counter to track how many times i have called to fib. > > in python or jave i can

Re: [go-nuts] How can i create a counter decorator in go?

2019-11-02 Thread 林风
there is a way i can do the base, but we still change old function due limit on go https://gist.github.com/Petelin/a7bf8ccfd657536d46aaa355c6dc421a 在 2019年11月2日星期六 UTC+8下午4:50:22,林风写道: > > you may say i can write a fib2 which have fib1+counter. but that is really > bad way to write code. and t

Re: [go-nuts] How can i create a counter decorator in go?

2019-11-02 Thread 林风
you may say i can write a fib2 which have fib1+counter. but that is really bad way to write code. and that's why we need decorator. 在 2019年11月2日星期六 UTC+8下午2:30:33,burak serdar写道: > > On Sat, Nov 2, 2019 at 12:20 AM 林风 > > wrote: > > > > let's say i have a function or method to get fib > > >

Re: [go-nuts] How can i create a counter decorator in go?

2019-11-02 Thread 林风
Hi, thanks for your answer, and i really cannot understander your code. can you write a more clear version in go play ground? i already create a template. pls notice that we cannot change origin fib function. https://play.golang.org/p/hYerZ2fv0dT 在 2019年11月2日星期六 UTC+8下午2:30:33,burak serdar写道: >

[go-nuts] Re: How can i create a counter decorator in go?

2019-11-02 Thread 林风
Hi, thanks for your answer, and i really cannot understander your code. can you write a more clear version in go play ground? i already create a template. pls notice that we cannot change origin fib function. https://play.golang.org/p/hYerZ2fv0dT 在 2019年11月2日星期六 UTC+8下午2:20:02,林风写道: > > let's s