| 132 | */ |
| 133 | export class StackState { |
| 134 | constructor() { |
| 135 | /** current stack pointer */ |
| 136 | this.start = stackSave(); |
| 137 | /** |
| 138 | * The value the stack pointer had when we entered Python. This is how far |
| 139 | * up the stack the current continuation cares about. This was recorded just |
| 140 | * before we entered Python in suspendableApply. |
| 141 | */ |
| 142 | this.stop = Module.stackStop; |
| 143 | /** |
| 144 | * Where we store the data if it gets ejected from the actual argument |
| 145 | * stack. |
| 146 | */ |
| 147 | this._copy = new Uint8Array(0); |
| 148 | taskSizeTotal += this.stop - this.start; |
| 149 | taskSizeCount++; |
| 150 | if (this.start !== this.stop) { |
| 151 | // Edge case that probably never happens: If start and stop are equal, the |
| 152 | // current continuation occupies no arg stack space. |
| 153 | stackStates.push(this); |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * Restore the argument stack in preparation to run the continuation. |