• Cherry Zhang's avatar
    cmd, runtime: remove PC_F & PC_B globals on Wasm · 496b8dbb
    Cherry Zhang authored
    Following the previous CL, this removes more global variables on
    Wasm.
    
    PC_B is used mostly for intra-function jumps, and for a function
    telling its callee where to start or resume. This usage can be
    served by a parameter. The top level loop (wasm_pc_f_loop) uses
    PC_B for resuming a function. This value is either set by gogo,
    or loaded from the Go stack at function return. Instead of
    loading PC_B at each function return, we could make gogo stores
    PC_B at the same stack location, and let the top level loop do
    the load. This way, we don't need to use global PC_B to
    communicate with the top level loop, and we can replace global
    PC_B with a parameter.
    
    PC_F is similar. It is even more so in that the only reader is
    the top level loop. Let the top level loop read it from the stack,
    and we can get rid of PC_F entirely.
    
    PC_F and PC_B are used less entensively as SP, so this CL has
    smaller performance gain.
    
    Running on Chrome 74.0.3729.108 on Linux/AMD64,
    
    name    ...
    496b8dbb
asm_wasm.s 9.28 KB