Re: [go-nuts] go[runtime.rt0_go]: why should 104 be subtracted from g0 stack 64k?

2022-11-05 Thread liiu liiu
Thanks for the info. I submit a pull request to remove it.

Ian Lance Taylor  于2022年11月5日周六 06:01写道:

> On Thu, Nov 3, 2022 at 7:46 AM liiux...@gmail.com 
> wrote:
> >
> > asm_amd64.s
> >
> > Please explain why 104 should be subtracted from g0 stack?
>
> Interesting question.  The number 104 appears to date back to the
> first implementation of split stacks in
> https://go.googlesource.com/go/+/b987f7a757f53f460973622a36eebb696f9b5060.
> That change introduces a 104 byte stack guard, and I believe that that
> stack guard has been carried forward over the years.  I don't really
> know whether it still makes any sense today.  Probably it doesn't.
>
> Ian
>

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAJhgtRNfi0v645AHcSxJ5A4sH3pr1UpPz9y%3D%3D%2BpZZw4OGs_%2BAA%40mail.gmail.com.


Re: [go-nuts] go[runtime.rt0_go]: why should 104 be subtracted from g0 stack 64k?

2022-11-04 Thread Ian Lance Taylor
On Thu, Nov 3, 2022 at 7:46 AM liiux...@gmail.com  wrote:
>
> asm_amd64.s
>
> Please explain why 104 should be subtracted from g0 stack?

Interesting question.  The number 104 appears to date back to the
first implementation of split stacks in
https://go.googlesource.com/go/+/b987f7a757f53f460973622a36eebb696f9b5060.
That change introduces a 104 byte stack guard, and I believe that that
stack guard has been carried forward over the years.  I don't really
know whether it still makes any sense today.  Probably it doesn't.

Ian

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVk6%3DUcPWChitPDqND4voJQJwc30XGAftzoqdTakCL9yQ%40mail.gmail.com.


[go-nuts] go[runtime.rt0_go]: why should 104 be subtracted from g0 stack 64k?

2022-11-03 Thread liiux...@gmail.com

asm_amd64.s 


Please explain why 104 should be subtracted from g0 stack?
```go

TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0

   // copy arguments forward on an even stack

   MOVQDI, AX// argc

   MOVQSI, BX// argv

   SUBQ$(5*8), SP// 3args 2auto

   ANDQ$~15, SP

   MOVQAX, 24(SP)

   MOVQBX, 32(SP)



   // create istack out of the given (operating system) stack.

   // _cgo_init may update stackguard.

   MOVQ$runtime·g0(SB), DI

   LEAQ(-64*1024+104)(SP), BX

   MOVQBX, g_stackguard0(DI)

   MOVQBX, g_stackguard1(DI)

   MOVQBX, (g_stack+stack_lo)(DI)

   MOVQSP, (g_stack+stack_hi)(DI)
```

but asm_arm64.s is 64kb:
asm_arm64.s 


```go

   // create istack out of the given (operating system) stack.

   // _cgo_init may update stackguard.

   MOVD$runtime·g0(SB), g

   MOVDRSP, R7

   MOVD$(-64*1024)(R7), R0

   MOVDR0, g_stackguard0(g)

   MOVDR0, g_stackguard1(g)

   MOVDR0, (g_stack+stack_lo)(g)

   MOVDR7, (g_stack+stack_hi)(g)
```

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6be1ed1e-d6f5-4942-9d4a-746ea27687a1n%40googlegroups.com.