Skip to content

Slice v0.9.3 #1153

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

Merged
merged 2 commits into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion cli/asc.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@
"TODO_doesNothingYet": [
" nontrapping-f2i Non-trapping float to integer ops.",
" exception-handling Exception handling.",
" tail-calls Tail call operations."
" tail-calls Tail call operations.",
" multi-value Multi value types."
],
"type": "S"
},
Expand Down
68 changes: 38 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"assemblyscript",
"wasm"
],
"version": "0.9.2",
"version": "0.9.3",
"author": "Daniel Wirtz <[email protected]>",
"contributors": [],
"license": "Apache-2.0",
Expand All @@ -21,13 +21,13 @@
"url": "https://github.com/AssemblyScript/assemblyscript/issues"
},
"dependencies": {
"binaryen": "90.0.0-nightly.20200214",
"binaryen": "91.0.0-nightly.20200310",
"long": "^4.0.0",
"source-map-support": "^0.5.16",
"ts-node": "^6.2.0"
},
"devDependencies": {
"@types/node": "^13.7.1",
"@types/node": "^13.9.0",
"browser-process-hrtime": "^1.0.0",
"diff": "^4.0.2",
"glob": "^7.1.6",
Expand All @@ -36,8 +36,8 @@
"ts-loader": "^6.2.1",
"ts-node": "^6.2.0",
"tslint": "^5.20.1",
"typescript": "^3.7.5",
"webpack": "^4.41.6",
"typescript": "^3.8.3",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11"
},
"main": "index.js",
Expand Down
1 change: 1 addition & 0 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export namespace CommonNames {
export const ASC_FEATURE_EXCEPTION_HANDLING = "ASC_FEATURE_EXCEPTION_HANDLING";
export const ASC_FEATURE_TAIL_CALLS = "ASC_FEATURE_TAIL_CALLS";
export const ASC_FEATURE_REFERENCE_TYPES = "ASC_FEATURE_REFERENCE_TYPES";
export const ASC_FEATURE_MULTI_VALUE = "ASC_FEATURE_MULTI_VALUE";
// classes
export const I8 = "I8";
export const I16 = "I16";
Expand Down
1 change: 1 addition & 0 deletions src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ export class Compiler extends DiagnosticEmitter {
if (options.hasFeature(Feature.EXCEPTION_HANDLING)) featureFlags |= FeatureFlags.ExceptionHandling;
if (options.hasFeature(Feature.TAIL_CALLS)) featureFlags |= FeatureFlags.TailCall;
if (options.hasFeature(Feature.REFERENCE_TYPES)) featureFlags |= FeatureFlags.ReferenceTypes;
if (options.hasFeature(Feature.MULTI_VALUE)) featureFlags |= FeatureFlags.MultiValue;
module.setFeatures(featureFlags);
}

Expand Down
1 change: 1 addition & 0 deletions src/glue/binaryen.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export declare function _BinaryenFeatureSignExt(): BinaryenFeatureFlags;
export declare function _BinaryenFeatureExceptionHandling(): BinaryenFeatureFlags;
export declare function _BinaryenFeatureTailCall(): BinaryenFeatureFlags;
export declare function _BinaryenFeatureReferenceTypes(): BinaryenFeatureFlags;
export declare function _BinaryenFeatureMultivalue(): BinaryenFeatureFlags;
export declare function _BinaryenFeatureAll(): BinaryenFeatureFlags;

type BinaryenExpressionId = i32;
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ export const FEATURE_EXCEPTION_HANDLING = Feature.EXCEPTION_HANDLING;
export const FEATURE_TAIL_CALLS = Feature.TAIL_CALLS;
/** Reference types. */
export const FEATURE_REFERENCE_TYPES = Feature.REFERENCE_TYPES;
/** Multi value types. */
export const FEATURE_MULTI_VALUE = Feature.MULTI_VALUE;

/** Enables a specific feature. */
export function enableFeature(options: Options, feature: Feature): void {
Expand Down
3 changes: 2 additions & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export enum FeatureFlags {
ExceptionHandling = 64 /* _BinaryenFeatureExceptionHandling */,
TailCall = 128 /* _BinaryenFeatureTailCall */,
ReferenceTypes = 256 /* _BinaryenFeatureReferenceTypes */,
All = 511 /* _BinaryenFeatureAll */
MultiValue = 512 /* _BinaryenFeatureMultivalue */,
All = 1023 /* _BinaryenFeatureAll */
}

export enum ExpressionId {
Expand Down
2 changes: 2 additions & 0 deletions src/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,8 @@ export class Program extends DiagnosticEmitter {
i64_new(options.hasFeature(Feature.TAIL_CALLS) ? 1 : 0, 0));
this.registerConstantInteger(CommonNames.ASC_FEATURE_REFERENCE_TYPES, Type.bool,
i64_new(options.hasFeature(Feature.REFERENCE_TYPES) ? 1 : 0, 0));
this.registerConstantInteger(CommonNames.ASC_FEATURE_MULTI_VALUE, Type.bool,
i64_new(options.hasFeature(Feature.MULTI_VALUE) ? 1 : 0, 0));

// remember deferred elements
var queuedImports = new Array<QueuedImport>();
Expand Down
2 changes: 2 additions & 0 deletions std/assembly/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ declare const ASC_FEATURE_EXCEPTION_HANDLING: bool;
declare const ASC_FEATURE_TAIL_CALLS: bool;
/** Whether the reference types feature is enabled. */
declare const ASC_FEATURE_REFERENCE_TYPES: bool;
/** Whether the multi value types feature is enabled. */
declare const ASC_FEATURE_MULTI_VALUE: bool;

// Builtins

Expand Down
5 changes: 4 additions & 1 deletion std/assembly/shared/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export const enum Feature {
/** Tail call operations. */
TAIL_CALLS = 1 << 7, // see: https://github.com/WebAssembly/tail-call
/** Reference types. */
REFERENCE_TYPES = 1 << 8 // see: https://github.com/WebAssembly/reference-types
REFERENCE_TYPES = 1 << 8, // see: https://github.com/WebAssembly/reference-types
/** Multi value types. */
MULTI_VALUE = 1 << 9 // see: https://github.com/WebAssembly/multi-value
}

/** Gets the name of the specified feature one would specify on the command line. */
Expand All @@ -36,6 +38,7 @@ export function featureToString(feature: Feature): string {
case Feature.EXCEPTION_HANDLING: return "exception-handling";
case Feature.TAIL_CALLS: return "tail-calls";
case Feature.REFERENCE_TYPES: return "reference-types";
case Feature.MULTI_VALUE: return "multi-value";
}
assert(false);
return "";
Expand Down
1 change: 1 addition & 0 deletions tests/compiler/asc-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ ASC_FEATURE_THREADS;
ASC_FEATURE_EXCEPTION_HANDLING;
ASC_FEATURE_TAIL_CALLS;
ASC_FEATURE_REFERENCE_TYPES;
ASC_FEATURE_MULTI_VALUE;
3 changes: 3 additions & 0 deletions tests/compiler/asc-constants.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
(global $~lib/ASC_FEATURE_EXCEPTION_HANDLING i32 (i32.const 0))
(global $~lib/ASC_FEATURE_TAIL_CALLS i32 (i32.const 0))
(global $~lib/ASC_FEATURE_REFERENCE_TYPES i32 (i32.const 0))
(global $~lib/ASC_FEATURE_MULTI_VALUE i32 (i32.const 0))
(export "memory" (memory $0))
(start $~start)
(func $start:asc-constants (; 0 ;)
Expand Down Expand Up @@ -47,6 +48,8 @@
drop
i32.const 0
drop
i32.const 0
drop
)
(func $~start (; 1 ;)
call $start:asc-constants
Expand Down