From fea2ef8c7368280e2209f4c0c9dec29802f5c7e9 Mon Sep 17 00:00:00 2001 From: Guido Zuidhof Date: Tue, 9 Jun 2020 17:13:30 +0100 Subject: [PATCH 1/3] Make JS target value 0 in enum --- std/assembly/index.d.ts | 2 +- std/assembly/shared/target.ts | 8 ++++---- std/portable/index.d.ts | 2 +- std/portable/index.js | 2 +- tests/compiler/asc-constants.untouched.wat | 2 +- tests/compiler/wasi/snapshot_preview1.untouched.wat | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 4df3ba5e2d..b2161353d3 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -40,7 +40,7 @@ declare type anyref = object; // Compiler hints -/** Compiler target. 0 = WASM32, 1 = WASM64, 2 = JS. */ +/** Compiler target. 0 = JS, 1 = WASM32, 2 = WASM64. */ declare const ASC_TARGET: i32; /** Provided noAssert option. */ declare const ASC_NO_ASSERT: bool; diff --git a/std/assembly/shared/target.ts b/std/assembly/shared/target.ts index d6d0a3a086..680037f34f 100644 --- a/std/assembly/shared/target.ts +++ b/std/assembly/shared/target.ts @@ -2,10 +2,10 @@ /** Compilation target. */ export enum Target { + /** Portable. */ + JS = 0, /** WebAssembly with 32-bit pointers. */ - WASM32 = 0, + WASM32 = 1, /** WebAssembly with 64-bit pointers. Experimental and not supported by any runtime yet. */ - WASM64 = 1, - /** Portable. */ - JS = 2 + WASM64 = 2, } diff --git a/std/portable/index.d.ts b/std/portable/index.d.ts index a8fe3d3f53..bc4587db3d 100644 --- a/std/portable/index.d.ts +++ b/std/portable/index.d.ts @@ -33,7 +33,7 @@ declare type valueof = T[0]; // Compiler hints -/** Compiler target. 0 = WASM32, 1 = WASM64, 2 = JS. */ +/** Compiler target. 0 = JS, 1 = WASM32, 2 = WASM64. */ declare const ASC_TARGET: i32; /** Provided noAssert option. */ declare const ASC_NO_ASSERT: bool; diff --git a/std/portable/index.js b/std/portable/index.js index 604c48aa78..80aeae3834 100644 --- a/std/portable/index.js +++ b/std/portable/index.js @@ -2,7 +2,7 @@ var globalScope = typeof window !== "undefined" && window || typeof global !== "undefined" && global || self; -globalScope.ASC_TARGET = 2; // Target.JS +globalScope.ASC_TARGET = 0; // Target.JS globalScope.ASC_NO_ASSERT = false; globalScope.ASC_MEMORY_BASE = 0; globalScope.ASC_OPTIMIZE_LEVEL = 3; diff --git a/tests/compiler/asc-constants.untouched.wat b/tests/compiler/asc-constants.untouched.wat index a90d03a62a..e46f4528fd 100644 --- a/tests/compiler/asc-constants.untouched.wat +++ b/tests/compiler/asc-constants.untouched.wat @@ -2,7 +2,7 @@ (type $none_=>_none (func)) (memory $0 0) (table $0 1 funcref) - (global $~lib/ASC_TARGET i32 (i32.const 0)) + (global $~lib/ASC_TARGET i32 (i32.const 1)) (global $~lib/ASC_NO_ASSERT i32 (i32.const 0)) (global $~lib/ASC_MEMORY_BASE i32 (i32.const 0)) (global $~lib/ASC_OPTIMIZE_LEVEL i32 (i32.const 0)) diff --git a/tests/compiler/wasi/snapshot_preview1.untouched.wat b/tests/compiler/wasi/snapshot_preview1.untouched.wat index ab8cf77c14..aee8285822 100644 --- a/tests/compiler/wasi/snapshot_preview1.untouched.wat +++ b/tests/compiler/wasi/snapshot_preview1.untouched.wat @@ -5,7 +5,7 @@ (global $~lib/shared/target/Target.WASM32 i32 (i32.const 0)) (global $~lib/shared/target/Target.WASM64 i32 (i32.const 1)) (global $~lib/shared/target/Target.JS i32 (i32.const 2)) - (global $~lib/ASC_TARGET i32 (i32.const 0)) + (global $~lib/ASC_TARGET i32 (i32.const 1)) (global $wasi/snapshot_preview1/sig (mut i32) (i32.const 1)) (export "memory" (memory $0)) (start $~start) From a6469a65da46d230f3403b28c738de5fc489c74d Mon Sep 17 00:00:00 2001 From: Guido Zuidhof Date: Tue, 9 Jun 2020 20:05:46 +0100 Subject: [PATCH 2/3] Update fixtures --- tests/compiler/asc-constants.untouched.wat | 2 +- tests/compiler/wasi/snapshot_preview1.untouched.wat | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/compiler/asc-constants.untouched.wat b/tests/compiler/asc-constants.untouched.wat index e46f4528fd..0f74c055b8 100644 --- a/tests/compiler/asc-constants.untouched.wat +++ b/tests/compiler/asc-constants.untouched.wat @@ -20,7 +20,7 @@ (export "memory" (memory $0)) (start $~start) (func $start:asc-constants - i32.const 0 + i32.const 1 drop i32.const 0 drop diff --git a/tests/compiler/wasi/snapshot_preview1.untouched.wat b/tests/compiler/wasi/snapshot_preview1.untouched.wat index aee8285822..350359727e 100644 --- a/tests/compiler/wasi/snapshot_preview1.untouched.wat +++ b/tests/compiler/wasi/snapshot_preview1.untouched.wat @@ -2,9 +2,9 @@ (type $none_=>_none (func)) (memory $0 0) (table $0 1 funcref) - (global $~lib/shared/target/Target.WASM32 i32 (i32.const 0)) - (global $~lib/shared/target/Target.WASM64 i32 (i32.const 1)) - (global $~lib/shared/target/Target.JS i32 (i32.const 2)) + (global $~lib/shared/target/Target.JS i32 (i32.const 0)) + (global $~lib/shared/target/Target.WASM32 i32 (i32.const 1)) + (global $~lib/shared/target/Target.WASM64 i32 (i32.const 2)) (global $~lib/ASC_TARGET i32 (i32.const 1)) (global $wasi/snapshot_preview1/sig (mut i32) (i32.const 1)) (export "memory" (memory $0)) @@ -118,7 +118,7 @@ i32.const 0 i32.eq drop - i32.const 0 + i32.const 1 global.get $~lib/shared/target/Target.WASM32 i32.eq drop @@ -182,7 +182,7 @@ i32.const 0 i32.eq drop - i32.const 0 + i32.const 1 global.get $~lib/shared/target/Target.WASM32 i32.eq drop From bbd5a394aa155f338ee1c796eb9a8ade5db65af0 Mon Sep 17 00:00:00 2001 From: Guido Zuidhof Date: Tue, 9 Jun 2020 21:55:52 +0100 Subject: [PATCH 3/3] Minimal changes to trigger a CI rebuild --- .eslintrc.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 8dc670e2d4..9672dcaa2d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -69,10 +69,10 @@ module.exports = { // Quite common in scenarios where an iteration starts at `current = this`. "@typescript-eslint/no-this-alias": "off", - // Disabled here, but enabled again for JavaScript files + // Disabled here, but enabled again for JavaScript files. "no-unused-vars": "off", - // Disabled here, but enabled again for TypeScript files + // Disabled here, but enabled again for TypeScript files. "@typescript-eslint/no-unused-vars": "off" }, overrides: [