Bug 1599722 Comment 7 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

(Hidden by Administrator)
I've removed the TLS slot! But this requires us two additional slots right after the arguments:
To see the difference let's consider 2 examples. The first one demonstrates behavior before removing TLS and the second one shows behaviour after.

We will call foo(a, b, c, d, e, f, g, h) and will assume that this is an imported function.
Let us pass a..f via registers and g and h via stack.

Before:

```
  h
-----
  g
-----
retpc
-----
  tls
-----
  fp
-----
```

After:

```
  h
----------
  g
----------
caller tls
----------
callee tls
----------
retpc
----------
  fp
----------
```

We allocate two additional slots before the call for 
1) preserving caller TLS because we change it on import calls. We can pass it before the arguments - yes. We don't need to push it on direct calls in Baseline, for example, because Baseline doesn't change WasmTlsReg on direct calls, but we don't save the extra slot because of the alignment of sp. Before that we just reload WasmTlsReg from our local copy from the frame (frame->tls), now as we removed it we couldn't do that and need to preserve it.
2) saving callee TLS to use it later for frame iteration.
This allocation is merged into allocation space for the call so it's just increasing size in sub rsp, const.

We allocate these slots always! because the callee doesn't know (and shouldn't know) how it was called and have to read its params from stack deterministically.

Back to Bug 1599722 Comment 7