# GC proposal report - bulk memory 可以視為有可程式控制初始化順序的 data segments - `externref` 可以引用 host 記憶體 - `table.grow` 可以動態配置記憶體 ### 問題 1. `externref` 能不能是另一個 module 的 table,或是說 exported table 可以是普通的 reference 2. 要怎麼讓編譯器知道某段記憶體要去參照外部? 所以還是會需要有類似 wit-bindgen 這樣的間接層 ### Appendix: concept + bulk memory * wasm module 有一群 segment * 每個 segment 都有 memory index * 因為現在的 wasm 不允許多個 memory 區塊,於是 memory index 必定是 `0` * 於是 bulk memory 希望把這個 32-bits 拿去當旗標 * 旗標為 `1` 時:segment 是被動記憶體 * 被動記憶體不會在 initial module 的時候就初始化 * 用 `memory.init` 或是 `table.init` 手動初始化 * 被動記憶體沒有 initializer 表達式 * 用 `data.drop` 或是 `elem.drop` 將記憶體區塊歸零 * 主動記憶體幾乎跟被動記憶體一樣,但是被歸零之後會自動重新初始化 + function references(typed) * 跟現存的 function reference 不同,禁止 null 參考 * 呼叫不需要執行期檢查 * 沒有 default value,因為 non-nullable * 用 `ref $t` 表示,nullable 表示為 `ref null $t` * 用來實現高階函數 * 引入必須放到 heap 的型別概念 + GC * runtime type(RTT) 跟 validation type 區分 * 其他看起來都跟記憶體分享無關 + multi value: 就像 **racket**, **common-lisp** 中的 `values` 概念,目前用途僅在符合 stack machine 的多值回傳概念 + non-trapping float to int conversion: LLVM 相關 + reference types * (related) 引入 `externref` 直接引用 host 的記憶體 * 不用維護雙向的記憶體映射 * (related) `table.get`/`table.set` * `table.size`/`table.grow` + sign-extension ops: 整數轉換指令 + SIMD: 指令相關
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up