Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support wasm library using comment #144

Merged
merged 26 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9ce8c69
draft for wasm library type using comment
yviansu Jan 16, 2024
91fce37
simple implementation of wasmArray
yviansu Jan 17, 2024
63c566c
avoid cast value in semantic tree
yviansu Jan 18, 2024
81b5af5
Merge remote-tracking branch 'upstream/main' into wasmLibraryTestUsin…
yviansu Jan 19, 2024
fedf157
change wasmArray comment format
yviansu Jan 19, 2024
f590f7b
fix semantic tree logic
yviansu Jan 19, 2024
804d948
change basic wasm type recording way
yviansu Jan 22, 2024
8281aee
Merge remote-tracking branch 'upstream/main' into wasmLibraryTestUsin…
yviansu Jan 22, 2024
1ba25e4
add parse phase of wasmstruct
yviansu Jan 22, 2024
f6ff63e
support tuple type in frontend
yviansu Jan 23, 2024
196b390
add tuple value in semantic tree
yviansu Jan 24, 2024
5d7fa21
add wasmstructtype in frontend and semantic tree
yviansu Jan 24, 2024
2e73f42
add backend wasmRawType parse
yviansu Jan 24, 2024
98b9d3e
add initValues for wasmArray
yviansu Jan 26, 2024
dab9dfc
support basic ops
yviansu Jan 26, 2024
4d57dd2
add test samples
yviansu Jan 26, 2024
5260a64
add test sample for tuple type
yviansu Jan 26, 2024
078cd8b
support non-constant index get in tuple
yviansu Jan 29, 2024
f9d66ac
add more samples
yviansu Jan 30, 2024
7d062c7
support New Array Expression
yviansu Jan 31, 2024
6bc23f9
update test samples
yviansu Jan 31, 2024
98e2c96
add more test samples
yviansu Feb 2, 2024
423251b
avoid array copy if no spread expr is found
yviansu Feb 5, 2024
97c0f11
Merge remote-tracking branch 'upstream/main' into wasmLibraryTestUsin…
yviansu Feb 5, 2024
12916c5
add doc
yviansu Feb 5, 2024
fe5d026
add doc of example
yviansu Feb 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/builtin/builtin_name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export namespace BuiltinNames {
export const findPropertyFlagAndIndex = 'find_property_flag_and_index';
export const findPropertyType = 'find_property_type';
export const getInfcProperty = 'get_infc_property';
export const getTupleField = 'get_tuple_field';

// builtin globals
export const builtinTypeManglePrefix = 'lib/builtin/lib.type.d';
Expand Down
2 changes: 2 additions & 0 deletions src/backend/binaryen/glue/packType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ import {
arrayBufferType,
dataViewType,
numberArrayStructType,
i32ArrayType,
} from './transform.js';
import { typeInfo } from './utils.js';

export const i8ArrayTypeInfo: typeInfo = i8ArrayType;
export const stringTypeInfo: typeInfo = stringType;
export const numberArrayTypeInfo = numberArrayType;
export const i32ArrayTypeInfo = i32ArrayType;
export const stringArrayTypeInfo = stringArrayType;
export const stringArrayStructTypeInfo = stringArrayStructType;
export const stringrefArrayTypeInfo = stringrefArrayType;
Expand Down
15 changes: 15 additions & 0 deletions src/backend/binaryen/glue/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ export function initStructType(
export const i8ArrayType = genarateI8ArrayTypeInfo();
/* array(f64) */
export const numberArrayType = genarateNumberArrayTypeInfo();
/* array(i32) */
export const i32ArrayType = genarateI32ArrayTypeInfo();
/* array(stringref) */
export const stringrefArrayType = genarateStringrefArrayTypeInfo(false);
/* array(i32) */
Expand Down Expand Up @@ -355,6 +357,19 @@ function genarateNumberArrayTypeInfo(): typeInfo {
return numberArrayTypeInfo;
}

// generate i32 array type
function genarateI32ArrayTypeInfo(): typeInfo {
const i32ArrayTypeInfo = initArrayType(
binaryen.i32,
Packed.Not,
true,
true,
-1,
binaryenCAPI._TypeBuilderCreate(1),
);
return i32ArrayTypeInfo;
}

// generate string array type
function genarateStringArrayTypeInfo(struct_wrap: boolean): typeInfo {
const stringTypeInfo = stringType;
Expand Down
Loading
Loading