• Keith Randall's avatar
    runtime: grow stack by copying · 1665b006
    Keith Randall authored
    On stack overflow, if all frames on the stack are
    copyable, we copy the frames to a new stack twice
    as large as the old one.  During GC, if a G is using
    less than 1/4 of its stack, copy the stack to a stack
    half its size.
    
    TODO
    - Do something about C frames.  When a C frame is in the
      stack segment, it isn't copyable.  We allocate a new segment
      in this case.
      - For idempotent C code, we can abort it, copy the stack,
        then retry.  I'm working on a separate CL for this.
      - For other C code, we can raise the stackguard
        to the lowest Go frame so the next call that Go frame
        makes triggers a copy, which will then succeed.
    - Pick a starting stack size?
    
    The plan is that eventually we reach a point where the
    stack contains only copyable frames.
    
    LGTM=rsc
    R=dvyukov, rsc
    CC=golang-codereviews
    https://golang.org/cl/54650044
    1665b006
mem_solaris.c 1.96 KB