Eliminate @builtin decorator for compatibility with TS

This commit is contained in:
dcodeIO 2018-03-21 16:29:08 +01:00
parent 56d891583e
commit 49f4d3dff1
22 changed files with 949 additions and 984 deletions

2
dist/asc.js vendored

File diff suppressed because one or more lines are too long

2
dist/asc.js.map vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -9,26 +9,29 @@ export function getHi(): u32 {
return hi;
}
function clz_(loLeft: u32, hiLeft: u32): void {
var ret = clz<u64>(<u64>loLeft | <u64>hiLeft << 32);
lo = <u32>ret;
hi = 0;
}
export { clz_ as clz };
import { clz as builtin_clz } from "builtins";
function ctz_(loLeft: u32, hiLeft: u32): void {
var ret = ctz<u64>(<u64>loLeft | <u64>hiLeft << 32);
export function clz(loLeft: u32, hiLeft: u32): void {
var ret = builtin_clz<u64>(<u64>loLeft | <u64>hiLeft << 32);
lo = <u32>ret;
hi = 0;
}
export { ctz_ as ctz };
function popcnt_(loLeft: u32, hiLeft: u32): void {
var ret = popcnt<u64>(<u64>loLeft | <u64>hiLeft << 32);
import { ctz as builtin_ctz } from "builtins";
export function ctz(loLeft: u32, hiLeft: u32): void {
var ret = builtin_ctz<u64>(<u64>loLeft | <u64>hiLeft << 32);
lo = <u32>ret;
hi = 0;
}
import { popcnt as builtin_popcnt } from "builtins";
export function popcnt(loLeft: u32, hiLeft: u32): void {
var ret = builtin_popcnt<u64>(<u64>loLeft | <u64>hiLeft << 32);
lo = <u32>ret;
hi = 0;
}
export { popcnt_ as popcnt };
export function eqz(loLeft: u32, hiLeft: u32): void {
var ret: bool = !(<u64>loLeft | <u64>hiLeft << 32);
@ -114,19 +117,21 @@ export function shr_u(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): voi
hi = <u32>(ret >>> 32);
}
function rotl_(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
var ret = rotl<u64>(<u64>loLeft | <u64>hiLeft << 32, <u64>loRight | <u64>hiRight << 32);
lo = <u32>ret;
hi = <u32>(ret >>> 32);
}
export { rotl_ as rotl };
import { rotl as builtin_rotl } from "builtins";
function rotr_(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
var ret = rotr<u64>(<u64>loLeft | <u64>hiLeft << 32, <u64>loRight | <u64>hiRight << 32);
export function rotl(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
var ret = builtin_rotl<u64>(<u64>loLeft | <u64>hiLeft << 32, <u64>loRight | <u64>hiRight << 32);
lo = <u32>ret;
hi = <u32>(ret >>> 32);
}
import { rotr as builtin_rotr } from "builtins";
export function rotr(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
var ret = builtin_rotr<u64>(<u64>loLeft | <u64>hiLeft << 32, <u64>loRight | <u64>hiRight << 32);
lo = <u32>ret;
hi = <u32>(ret >>> 32);
}
export { rotr_ as rotr };
export function eq(loLeft: u32, hiLeft: u32, loRight: u32, hiRight: u32): void {
var ret: bool = (<u64>loLeft | <u64>hiLeft << 32) == (<u64>loRight | <u64>hiRight << 32);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,8 @@ import {
CommonFlags,
PATH_DELIMITER,
STATIC_DELIMITER,
INSTANCE_DELIMITER
INSTANCE_DELIMITER,
LIBRARY_PREFIX
} from "./program";
import {
@ -703,12 +704,15 @@ export abstract class Node {
stmt.namespaceName = null;
stmt.path = path;
var normalizedPath = normalizePath(path.value);
if (path.value.startsWith(".")) { // relative
if (path.value.startsWith(".")) { // relative in project
stmt.normalizedPath = resolvePath(
normalizedPath,
range.source.normalizedPath
);
} else { // absolute
} else { // absolute in library
if (!normalizedPath.startsWith(LIBRARY_PREFIX)) {
normalizedPath = LIBRARY_PREFIX + normalizedPath;
}
stmt.normalizedPath = normalizedPath;
}
stmt.internalPath = mangleInternalPath(stmt.normalizedPath);

View File

@ -26,8 +26,8 @@ import {
} from "./types";
import {
UnaryOp,
BinaryOp,
UnaryOp,
HostOp,
NativeType,
ExpressionRef,
@ -35,11 +35,11 @@ import {
} from "./module";
import {
Global,
FunctionPrototype,
Local,
Class,
ElementKind,
Global,
Local,
FunctionPrototype,
Class,
ClassPrototype
} from "./program";
@ -2500,8 +2500,6 @@ export function compileAllocate(
);
}
const abortInternalName = "abort";
/** Compiles an abort wired to the conditionally imported 'abort' function. */
export function compileAbort(
compiler: Compiler,
@ -2514,7 +2512,7 @@ export function compileAbort(
var stringType = program.typesLookup.get("string"); // might be intended
if (!stringType) return module.createUnreachable();
var abortPrototype = program.elementsLookup.get(abortInternalName); // might be intended
var abortPrototype = program.elementsLookup.get("abort"); // might be intended
if (!abortPrototype || abortPrototype.kind != ElementKind.FUNCTION_PROTOTYPE) return module.createUnreachable();
var abortInstance = (<FunctionPrototype>abortPrototype).resolve(); // reports

View File

@ -464,7 +464,7 @@ export class Compiler extends DiagnosticEmitter {
}
compileGlobal(global: Global): bool {
if (global.is(CommonFlags.COMPILED) || global.is(CommonFlags.BUILTIN)) return true;
if (global.is(CommonFlags.COMPILED) || global.is(CommonFlags.AMBIENT | CommonFlags.BUILTIN)) return true;
global.set(CommonFlags.COMPILED); // ^ built-ins are compiled on use
var module = this.module;
@ -814,7 +814,7 @@ export class Compiler extends DiagnosticEmitter {
/** Compiles a readily resolved function instance. */
compileFunction(instance: Function): bool {
if (instance.is(CommonFlags.COMPILED)) return true;
assert(!instance.is(CommonFlags.BUILTIN) || instance.simpleName == "abort");
assert(!instance.is(CommonFlags.AMBIENT | CommonFlags.BUILTIN) || instance.simpleName == "abort");
instance.set(CommonFlags.COMPILED);
// check that modifiers are matching but still compile as-is
@ -3975,7 +3975,7 @@ export class Compiler extends DiagnosticEmitter {
let prototype = <FunctionPrototype>element;
// builtins are compiled on the fly
if (prototype.is(CommonFlags.BUILTIN)) {
if (prototype.is(CommonFlags.AMBIENT | CommonFlags.BUILTIN)) {
let expr = compileBuiltinCall( // reports
this,
prototype,
@ -4521,7 +4521,7 @@ export class Compiler extends DiagnosticEmitter {
return this.module.createGetLocal(localIndex, localType.toNativeType());
}
case ElementKind.GLOBAL: {
if (element.is(CommonFlags.BUILTIN)) {
if (element.is(CommonFlags.AMBIENT | CommonFlags.BUILTIN)) {
return compileBuiltinGetConstant(this, <Global>element, expression);
}
if (!this.compileGlobal(<Global>element)) { // reports; not yet compiled if a static field
@ -4996,7 +4996,7 @@ export class Compiler extends DiagnosticEmitter {
var targetExpr: ExpressionRef;
switch (element.kind) {
case ElementKind.GLOBAL: { // static property
if (element.is(CommonFlags.BUILTIN)) {
if (element.is(CommonFlags.AMBIENT | CommonFlags.BUILTIN)) {
return compileBuiltinGetConstant(this, <Global>element, propertyAccess);
}
if (!this.compileGlobal(<Global>element)) { // reports; not yet compiled if a static field

View File

@ -92,6 +92,7 @@ export enum DiagnosticCode {
Function_implementation_is_missing_or_not_immediately_following_the_declaration = 2391,
Multiple_constructor_implementations_are_not_allowed = 2392,
Duplicate_function_implementation = 2393,
Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local = 2395,
The_0_operator_cannot_be_applied_to_type_1 = 2469,
Export_declaration_conflicts_with_exported_declaration_of_0 = 2484,
Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property = 2540,
@ -193,6 +194,7 @@ export function diagnosticCodeToString(code: DiagnosticCode): string {
case 2391: return "Function implementation is missing or not immediately following the declaration.";
case 2392: return "Multiple constructor implementations are not allowed.";
case 2393: return "Duplicate function implementation.";
case 2395: return "Individual declarations in merged declaration '{0}' must be all exported or all local.";
case 2469: return "The '{0}' operator cannot be applied to type '{1}'.";
case 2484: return "Export declaration conflicts with exported declaration of '{0}'.";
case 2540: return "Cannot assign to '{0}' because it is a constant or a read-only property.";

View File

@ -86,6 +86,7 @@
"Function implementation is missing or not immediately following the declaration.": 2391,
"Multiple constructor implementations are not allowed.": 2392,
"Duplicate function implementation.": 2393,
"Individual declarations in merged declaration '{0}' must be all exported or all local.": 2395,
"The '{0}' operator cannot be applied to type '{1}'.": 2469,
"Export declaration conflicts with exported declaration of '{0}'.": 2484,
"Cannot assign to '{0}' because it is a constant or a read-only property.": 2540,

View File

@ -1395,10 +1395,6 @@ export class ASTBuilder {
sb.push("@global\n");
indent(sb, indentLevel);
}
if (node.is(CommonFlags.BUILTIN)) {
sb.push("@builtin\n");
indent(sb, indentLevel);
}
if (node.is(CommonFlags.UNMANAGED)) {
sb.push("@unmanaged\n");
indent(sb, indentLevel);

View File

@ -78,6 +78,8 @@ import {
WhileStatement
} from "./ast";
const builtinsFile = LIBRARY_PREFIX + "builtins.ts";
/** Parser interface. */
export class Parser extends DiagnosticEmitter {
@ -124,6 +126,11 @@ export class Parser extends DiagnosticEmitter {
);
sources.push(source);
// mark the special builtins library file
if (source.normalizedPath == builtinsFile) {
source.set(CommonFlags.BUILTIN);
}
// tokenize and parse
var tn = new Tokenizer(source, program.diagnostics);
tn.onComment = this.onComment;
@ -160,10 +167,6 @@ export class Parser extends DiagnosticEmitter {
flags |= CommonFlags.GLOBAL;
continue;
}
if (text == "builtin") {
flags |= CommonFlags.BUILTIN;
continue;
}
if (text == "unmananged") {
flags |= CommonFlags.UNMANAGED;
continue;
@ -173,6 +176,9 @@ export class Parser extends DiagnosticEmitter {
decorators.push(decorator);
}
// mark builtins
flags |= (tn.source.flags & CommonFlags.BUILTIN);
// check modifiers
var exportStart: i32 = 0;
var exportEnd: i32 = 0;

View File

@ -347,7 +347,6 @@ export class Program extends DiagnosticEmitter {
} else {
element.set(CommonFlags.GLOBAL);
this.elementsLookup.set(simpleName, element);
this.fileLevelExports.set(simpleName, element);
if (element.is(CommonFlags.BUILTIN)) {
element.internalName = simpleName;
}
@ -378,8 +377,6 @@ export class Program extends DiagnosticEmitter {
prototype.namespace = namespace;
this.elementsLookup.set(internalName, prototype);
this.checkInternalDecorators(prototype, declaration);
var implementsTypes = declaration.implementsTypes;
var numImplementsTypes = implementsTypes.length;
if (prototype.is(CommonFlags.UNMANAGED)) {
@ -472,6 +469,8 @@ export class Program extends DiagnosticEmitter {
}
}
this.checkInternalDecorators(prototype, declaration);
// check and possibly register string type
if (
prototype.is(CommonFlags.GLOBAL) &&
@ -839,8 +838,6 @@ export class Program extends DiagnosticEmitter {
element.namespace = namespace;
this.elementsLookup.set(internalName, element);
this.checkInternalDecorators(element, declaration);
if (namespace) {
if (namespace.members) {
if (namespace.members.has(simpleName)) {
@ -883,6 +880,8 @@ export class Program extends DiagnosticEmitter {
for (let i = 0, k = values.length; i < k; ++i) {
this.initializeEnumValue(values[i], element);
}
this.checkInternalDecorators(element, declaration);
}
private initializeEnumValue(
@ -1068,8 +1067,6 @@ export class Program extends DiagnosticEmitter {
prototype.namespace = namespace;
this.elementsLookup.set(internalName, prototype);
this.checkInternalDecorators(prototype, declaration);
if (namespace) {
if (namespace.members) {
if (namespace.members.has(simpleName)) {
@ -1107,6 +1104,8 @@ export class Program extends DiagnosticEmitter {
this.moduleLevelExports.set(internalName, prototype);
}
}
this.checkInternalDecorators(prototype, declaration);
}
private initializeImports(
@ -1204,8 +1203,6 @@ export class Program extends DiagnosticEmitter {
prototype.namespace = namespace;
this.elementsLookup.set(internalName, prototype);
this.checkInternalDecorators(prototype, declaration);
if (namespace) {
if (namespace.members) {
if (namespace.members.has(prototype.internalName)) {
@ -1266,6 +1263,8 @@ export class Program extends DiagnosticEmitter {
}
}
}
this.checkInternalDecorators(prototype, declaration);
}
private initializeNamespace(
@ -1300,14 +1299,18 @@ export class Program extends DiagnosticEmitter {
namespace.set(CommonFlags.MODULE_EXPORT);
}
} else if (namespace.is(CommonFlags.EXPORT)) { // no parent namespace
if (this.fileLevelExports.has(internalName)) {
this.error(
DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,
declaration.name.range, internalName
);
return;
let existingExport = this.fileLevelExports.get(internalName);
if (existingExport) {
if (!existingExport.is(CommonFlags.EXPORT)) {
this.error(
DiagnosticCode.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local,
declaration.name.range, namespace.internalName
); // recoverable
}
namespace = existingExport; // join
} else {
this.fileLevelExports.set(internalName, namespace);
}
this.fileLevelExports.set(internalName, namespace);
if (declaration.range.source.isEntry) {
if (this.moduleLevelExports.has(internalName)) {
this.error(
@ -1404,8 +1407,6 @@ export class Program extends DiagnosticEmitter {
global.namespace = namespace;
this.elementsLookup.set(internalName, global);
this.checkInternalDecorators(global, declaration);
if (namespace) {
if (namespace.members) {
if (namespace.members.has(simpleName)) {
@ -1443,6 +1444,7 @@ export class Program extends DiagnosticEmitter {
this.moduleLevelExports.set(internalName, global);
}
}
this.checkInternalDecorators(global, declaration);
}
}

3
std/assembly.d.ts vendored
View File

@ -346,6 +346,3 @@ declare function unmanaged(target: Function): any;
/** Annotates a class field with an explicit offset. */
declare function offset(offset: usize): any;
/** Annotates an element as begin built-in. */
declare function builtin(target: Function): any;

View File

@ -1,113 +1,73 @@
// types
@builtin
export declare function isInteger(value: void): bool;
@builtin
export declare function isFloat(value: void): bool;
@builtin
export declare function isReference(value: void): bool;
@builtin
export declare function isString(value: void): bool;
@builtin
export declare function isArray(value: void): bool;
// math
@builtin
export declare const NaN: f64; // | f32
@builtin
export declare const Infinity: f64; // | f32
@builtin
export declare function isNaN<T>(value: T): bool;
@builtin
export declare function isFinite<T>(value: T): bool;
@builtin
export declare function clz<T>(value: T): T;
@builtin
export declare function ctz<T>(value: T): T;
@builtin
export declare function popcnt<T>(value: T): T;
@builtin
export declare function rotl<T>(value: T, shift: T): T;
@builtin
export declare function rotr<T>(value: T, shift: T): T;
@builtin
export declare function abs<T>(value: T): T;
@builtin
export declare function max<T>(left: T, right: T): T;
@builtin
export declare function min<T>(left: T, right: T): T;
@builtin
export declare function ceil<T>(value: T): T;
@builtin
export declare function floor<T>(value: T): T;
@builtin
export declare function copysign<T>(left: T, right: T): T;
@builtin
export declare function nearest<T>(left: T, right: T): T;
@builtin
export declare function reinterpret<T>(value: void): T;
@builtin
export declare function sqrt<T>(value: T): T;
@builtin
export declare function trunc<T>(value: T): T;
@builtin
export declare function load<T>(offset: usize, constantOffset?: usize): T;
@builtin
export declare function store<T>(offset: usize, value: void, constantOffset?: usize): T;
@builtin
export declare function sizeof<T>(): usize;
@builtin
export declare function select<T>(ifTrue: T, ifFalse: T, condition: bool): T;
@builtin
export declare function unreachable(): void;
@builtin
export declare function current_memory(): i32;
@builtin
export declare function grow_memory(pages: i32): i32;
// @builtin
// export declare function move_memory(dest: usize, src: usize: n: usize): void;
// @builtin
// export declare function set_memory(dest: usize, value: u32, n: usize): void;
@builtin
export declare function changetype<T>(value: void): T;
@builtin
export declare function assert<T>(isTrueish: T, message?: string): T;
@builtin
export declare function abort(
message?: string | null,
fileName?: string | null,
@ -115,41 +75,32 @@ export declare function abort(
columnNumber?: u32
): void;
@builtin
declare function i8(value: void): i8;
namespace i8 {
export declare function i8(value: void): i8;
export namespace i8 {
export const MIN_VALUE: i8 = -128;
export const MAX_VALUE: i8 = 127;
}
export { i8 };
@builtin
declare function i16(value: void): i16;
namespace i16 {
export declare function i16(value: void): i16;
export namespace i16 {
export const MIN_VALUE: i16 = -32768;
export const MAX_VALUE: i16 = 32767;
}
export { i16 };
@builtin
declare function i32(value: void): i32;
namespace i32 {
export declare function i32(value: void): i32;
export namespace i32 {
export const MIN_VALUE: i32 = -2147483648;
export const MAX_VALUE: i32 = 2147483647;
}
export { i32 };
@builtin
declare function i64(value: void): i64;
namespace i64 {
export declare function i64(value: void): i64;
export namespace i64 {
export const MIN_VALUE: i64 = -9223372036854775808;
export const MAX_VALUE: i64 = 9223372036854775807;
}
export { i64 };
@builtin
declare function isize(value: void): isize;
namespace isize {
export declare function isize(value: void): isize;
export namespace isize {
export const MIN_VALUE: isize = sizeof<i32>() == sizeof<isize>()
? -2147483648
: <isize>-9223372036854775808;
@ -157,61 +108,47 @@ namespace isize {
? 2147483647
: <isize>9223372036854775807;
}
export { isize };
@builtin
declare function u8(value: void): u8;
namespace u8 {
export declare function u8(value: void): u8;
export namespace u8 {
export const MIN_VALUE: u8 = 0;
export const MAX_VALUE: u8 = 255;
}
export { u8 };
@builtin
declare function u16(value: void): u16;
namespace u16 {
export declare function u16(value: void): u16;
export namespace u16 {
export const MIN_VALUE: u16 = 0;
export const MAX_VALUE: u16 = 65535;
}
export { u16 };
@builtin
declare function u32(value: void): u32;
namespace u32 {
export declare function u32(value: void): u32;
export namespace u32 {
export const MIN_VALUE: u32 = 0;
export const MAX_VALUE: u32 = 4294967295;
}
export { u32 };
@builtin
declare function u64(value: void): u64;
namespace u64 {
export declare function u64(value: void): u64;
export namespace u64 {
export const MIN_VALUE: u64 = 0;
export const MAX_VALUE: u64 = 18446744073709551615;
}
export { u64 };
@builtin
declare function usize(value: void): usize;
namespace usize {
export declare function usize(value: void): usize;
export namespace usize {
export const MIN_VALUE: usize = 0;
export const MAX_VALUE: usize = sizeof<u32>() == sizeof<usize>()
? 4294967295
: <usize>18446744073709551615;
}
export { usize };
@builtin
declare function bool(value: void): bool;
namespace bool {
export declare function bool(value: void): bool;
export namespace bool {
export const MIN_VALUE: bool = false;
export const MAX_VALUE: bool = true;
}
export { bool };
@builtin
declare function f32(value: void): f32;
namespace f32 {
export declare function f32(value: void): f32;
export namespace f32 {
export const MIN_VALUE: f32 = -3.40282347e+38;
export const MAX_VALUE: f32 = 3.40282347e+38;
export const MIN_POSITIVE_VALUE: f32 = 1.175494351e-38;
@ -219,11 +156,9 @@ namespace f32 {
export const MAX_SAFE_INTEGER: f32 = 16777215;
export const EPSILON: f32 = 1.19209290e-07;
}
export { f32 };
@builtin
declare function f64(value: void): f64;
namespace f64 {
export declare function f64(value: void): f64;
export namespace f64 {
export const MIN_VALUE: f64 = -1.7976931348623157e+308;
export const MAX_VALUE: f64 = 1.7976931348623157e+308;
export const MIN_POSITIVE_VALUE: f64 = 2.2250738585072014e-308;
@ -231,10 +166,7 @@ namespace f64 {
export const MAX_SAFE_INTEGER: f64 = 9007199254740991;
export const EPSILON: f64 = 2.2204460492503131e-16;
}
export{ f64 };
@builtin
export declare const HEAP_BASE: usize;
@builtin
export declare function start(): void;

View File

@ -282,3 +282,9 @@ assert(f64.MAX_VALUE == 1.7976931348623157e+308);
assert(f64.MIN_SAFE_INTEGER == -9007199254740991);
assert(f64.MAX_SAFE_INTEGER == 9007199254740991);
assert(f64.EPSILON == 2.2204460492503131e-16);
import {
isNaN as isItNaN
} from "builtins";
isItNaN(1);

View File

@ -2020,5 +2020,13 @@
(unreachable)
)
)
(drop
(f64.ne
(tee_local $5
(f64.const 1)
)
(get_local $5)
)
)
)
)

View File

@ -7,9 +7,9 @@
(memory $0 1)
(export "getHi" (func $../../examples/i64-polyfill/assembly/i64/getHi))
(export "getLo" (func $../../examples/i64-polyfill/assembly/i64/getLo))
(export "clz" (func $../../examples/i64-polyfill/assembly/i64/clz_))
(export "ctz" (func $../../examples/i64-polyfill/assembly/i64/ctz_))
(export "popcnt" (func $../../examples/i64-polyfill/assembly/i64/popcnt_))
(export "clz" (func $../../examples/i64-polyfill/assembly/i64/clz))
(export "ctz" (func $../../examples/i64-polyfill/assembly/i64/ctz))
(export "popcnt" (func $../../examples/i64-polyfill/assembly/i64/popcnt))
(export "eqz" (func $../../examples/i64-polyfill/assembly/i64/eqz))
(export "add" (func $../../examples/i64-polyfill/assembly/i64/add))
(export "sub" (func $../../examples/i64-polyfill/assembly/i64/sub))
@ -24,8 +24,8 @@
(export "shl" (func $../../examples/i64-polyfill/assembly/i64/shl))
(export "shr_s" (func $../../examples/i64-polyfill/assembly/i64/shr_s))
(export "shr_u" (func $../../examples/i64-polyfill/assembly/i64/shr_u))
(export "rotl" (func $../../examples/i64-polyfill/assembly/i64/rotl_))
(export "rotr" (func $../../examples/i64-polyfill/assembly/i64/rotr_))
(export "rotl" (func $../../examples/i64-polyfill/assembly/i64/rotl))
(export "rotr" (func $../../examples/i64-polyfill/assembly/i64/rotr))
(export "eq" (func $../../examples/i64-polyfill/assembly/i64/eq))
(export "ne" (func $../../examples/i64-polyfill/assembly/i64/ne))
(export "lt_s" (func $../../examples/i64-polyfill/assembly/i64/lt_s))
@ -43,7 +43,7 @@
(func $../../examples/i64-polyfill/assembly/i64/getLo (; 1 ;) (type $i) (result i32)
(get_global $../../examples/i64-polyfill/assembly/i64/lo)
)
(func $../../examples/i64-polyfill/assembly/i64/clz_ (; 2 ;) (type $iiv) (param $0 i32) (param $1 i32)
(func $../../examples/i64-polyfill/assembly/i64/clz (; 2 ;) (type $iiv) (param $0 i32) (param $1 i32)
(set_global $../../examples/i64-polyfill/assembly/i64/lo
(i32.wrap/i64
(i64.clz
@ -65,7 +65,7 @@
(i32.const 0)
)
)
(func $../../examples/i64-polyfill/assembly/i64/ctz_ (; 3 ;) (type $iiv) (param $0 i32) (param $1 i32)
(func $../../examples/i64-polyfill/assembly/i64/ctz (; 3 ;) (type $iiv) (param $0 i32) (param $1 i32)
(set_global $../../examples/i64-polyfill/assembly/i64/lo
(i32.wrap/i64
(i64.ctz
@ -87,7 +87,7 @@
(i32.const 0)
)
)
(func $../../examples/i64-polyfill/assembly/i64/popcnt_ (; 4 ;) (type $iiv) (param $0 i32) (param $1 i32)
(func $../../examples/i64-polyfill/assembly/i64/popcnt (; 4 ;) (type $iiv) (param $0 i32) (param $1 i32)
(set_global $../../examples/i64-polyfill/assembly/i64/lo
(i32.wrap/i64
(i64.popcnt
@ -662,7 +662,7 @@
)
)
)
(func $../../examples/i64-polyfill/assembly/i64/rotl_ (; 19 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(func $../../examples/i64-polyfill/assembly/i64/rotl (; 19 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(local $4 i64)
(set_global $../../examples/i64-polyfill/assembly/i64/lo
(i32.wrap/i64
@ -703,7 +703,7 @@
)
)
)
(func $../../examples/i64-polyfill/assembly/i64/rotr_ (; 20 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(func $../../examples/i64-polyfill/assembly/i64/rotr (; 20 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(local $4 i64)
(set_global $../../examples/i64-polyfill/assembly/i64/lo
(i32.wrap/i64

View File

@ -8,9 +8,9 @@
(memory $0 1)
(export "getHi" (func $../../examples/i64-polyfill/assembly/i64/getHi))
(export "getLo" (func $../../examples/i64-polyfill/assembly/i64/getLo))
(export "clz" (func $../../examples/i64-polyfill/assembly/i64/clz_))
(export "ctz" (func $../../examples/i64-polyfill/assembly/i64/ctz_))
(export "popcnt" (func $../../examples/i64-polyfill/assembly/i64/popcnt_))
(export "clz" (func $../../examples/i64-polyfill/assembly/i64/clz))
(export "ctz" (func $../../examples/i64-polyfill/assembly/i64/ctz))
(export "popcnt" (func $../../examples/i64-polyfill/assembly/i64/popcnt))
(export "eqz" (func $../../examples/i64-polyfill/assembly/i64/eqz))
(export "add" (func $../../examples/i64-polyfill/assembly/i64/add))
(export "sub" (func $../../examples/i64-polyfill/assembly/i64/sub))
@ -25,8 +25,8 @@
(export "shl" (func $../../examples/i64-polyfill/assembly/i64/shl))
(export "shr_s" (func $../../examples/i64-polyfill/assembly/i64/shr_s))
(export "shr_u" (func $../../examples/i64-polyfill/assembly/i64/shr_u))
(export "rotl" (func $../../examples/i64-polyfill/assembly/i64/rotl_))
(export "rotr" (func $../../examples/i64-polyfill/assembly/i64/rotr_))
(export "rotl" (func $../../examples/i64-polyfill/assembly/i64/rotl))
(export "rotr" (func $../../examples/i64-polyfill/assembly/i64/rotr))
(export "eq" (func $../../examples/i64-polyfill/assembly/i64/eq))
(export "ne" (func $../../examples/i64-polyfill/assembly/i64/ne))
(export "lt_s" (func $../../examples/i64-polyfill/assembly/i64/lt_s))
@ -48,7 +48,7 @@
(get_global $../../examples/i64-polyfill/assembly/i64/lo)
)
)
(func $../../examples/i64-polyfill/assembly/i64/clz_ (; 2 ;) (type $iiv) (param $0 i32) (param $1 i32)
(func $../../examples/i64-polyfill/assembly/i64/clz (; 2 ;) (type $iiv) (param $0 i32) (param $1 i32)
(local $2 i64)
(set_local $2
(i64.clz
@ -74,7 +74,7 @@
(i32.const 0)
)
)
(func $../../examples/i64-polyfill/assembly/i64/ctz_ (; 3 ;) (type $iiv) (param $0 i32) (param $1 i32)
(func $../../examples/i64-polyfill/assembly/i64/ctz (; 3 ;) (type $iiv) (param $0 i32) (param $1 i32)
(local $2 i64)
(set_local $2
(i64.ctz
@ -100,7 +100,7 @@
(i32.const 0)
)
)
(func $../../examples/i64-polyfill/assembly/i64/popcnt_ (; 4 ;) (type $iiv) (param $0 i32) (param $1 i32)
(func $../../examples/i64-polyfill/assembly/i64/popcnt (; 4 ;) (type $iiv) (param $0 i32) (param $1 i32)
(local $2 i64)
(set_local $2
(i64.popcnt
@ -696,7 +696,7 @@
)
)
)
(func $../../examples/i64-polyfill/assembly/i64/rotl_ (; 19 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(func $../../examples/i64-polyfill/assembly/i64/rotl (; 19 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(local $4 i64)
(set_local $4
(i64.rotl
@ -738,7 +738,7 @@
)
)
)
(func $../../examples/i64-polyfill/assembly/i64/rotr_ (; 20 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(func $../../examples/i64-polyfill/assembly/i64/rotr (; 20 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(local $4 i64)
(set_local $4
(i64.rotr

View File

@ -6413,6 +6413,14 @@
(unreachable)
)
)
(drop
(f64.ne
(tee_local $3
(f64.const 1)
)
(get_local $3)
)
)
(if
(i32.eqz
(i32.eq