Assemble kernel on the client #1

Merged
cdo merged 72 commits from client-side-assembler into main 2026-03-18 15:21:33 +00:00
Showing only changes of commit 347dd8f534 - Show all commits

4
asm.js
View File

@@ -884,6 +884,7 @@ export class Assembler {
wasm_section_type() { wasm_section_type() {
const funcs = Object.values(this.funcs); const funcs = Object.values(this.funcs);
if (funcs.length == 0) return null;
const contents = funcs.map(({ params, results }) => { const contents = funcs.map(({ params, results }) => {
const param_types = Object.values(params); const param_types = Object.values(params);
return [ return [
@@ -917,6 +918,7 @@ export class Assembler {
wasm_section_func() { wasm_section_func() {
const func_count = Object.entries(this.funcs).length; const func_count = Object.entries(this.funcs).length;
if (func_count == 0) return null;
return [ func_count, ...Array(func_count).keys() ]; return [ func_count, ...Array(func_count).keys() ];
} }
@@ -940,6 +942,7 @@ export class Assembler {
wasm_section_export() { wasm_section_export() {
const exports = Object.entries(this.exports); const exports = Object.entries(this.exports);
if (exports.length == 0) return null;
const contents = exports.map(([ name, { kind, index }]) => { const contents = exports.map(([ name, { kind, index }]) => {
const name_utf8 = this.encoder.encode(name); const name_utf8 = this.encoder.encode(name);
return [ return [
@@ -954,6 +957,7 @@ export class Assembler {
wasm_section_code() { wasm_section_code() {
const funcs = Object.values(this.funcs); const funcs = Object.values(this.funcs);
if (funcs.length == 0) return null;
const contents = funcs.map(({ body, locals }) => { const contents = funcs.map(({ body, locals }) => {
const local_types = Object.values(locals); const local_types = Object.values(locals);
const local_count = local_types.length; const local_count = local_types.length;