• Russ Cox's avatar
    cmd/gc: never pass ptr to uninit temp to runtime · e150ca9c
    Russ Cox authored
    chanrecv now expects a pointer to the data to be filled in.
    mapiterinit expects a pointer to the hash iterator to be filled in.
    In both cases, the temporary being pointed at changes from
    dead to alive during the call. In order to make sure it is
    preserved if a garbage collection happens after that transition
    but before the call returns, the temp must be marked as live
    during the entire call.
    
    But if it is live during the entire call, it needs to be safe for
    the garbage collector to scan at the beginning of the call,
    before the new data has been filled in. Therefore, it must be
    zeroed by the caller, before the call. Do that.
    
    My previous attempt waited to mark it live until after the
    call returned, but that's unsafe (see first paragraph);
    undo that change in plive.c.
    
    This makes powser2 pass again reliably.
    
    I looked at every call to temp in the compiler.
    The vast majority are followed immediately by an
    initialization of temp, so those are fine.
    The only ones that needed changing were the ones
    where the next operation is to pass the address of
    the temp to a function call, and there aren't too many.
    
    Maps are exempted from this because mapaccess
    returns a pointer to the data and lets the caller make
    the copy.
    
    Fixes many builds.
    
    TBR=khr
    CC=golang-codereviews
    https://golang.org/cl/80700046
    e150ca9c
Name
Last commit
Last update
..
5a Loading commit data...
5c Loading commit data...
5g Loading commit data...
5l Loading commit data...
6a Loading commit data...
6c Loading commit data...
6g Loading commit data...
6l Loading commit data...
8a Loading commit data...
8c Loading commit data...
8g Loading commit data...
8l Loading commit data...
addr2line Loading commit data...
api Loading commit data...
cc Loading commit data...
cgo Loading commit data...
dist Loading commit data...
fix Loading commit data...
gc Loading commit data...
go Loading commit data...
gofmt Loading commit data...
ld Loading commit data...
link Loading commit data...
nm Loading commit data...
objdump Loading commit data...
pack Loading commit data...
prof Loading commit data...
yacc Loading commit data...