Fix 'static readonly' not being recognized as constant anymore, see #44

This commit is contained in:
dcodeIO 2018-03-19 19:36:39 +01:00
parent 5323e64af9
commit fea8e65a41
22 changed files with 2391 additions and 2368 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

@ -156,7 +156,7 @@ export abstract class Node {
static createParameter(
name: IdentifierExpression,
type: CommonTypeNode | null,
type: CommonTypeNode,
initializer: Expression | null,
kind: ParameterKind,
range: Range
@ -1040,7 +1040,7 @@ export class ParameterNode extends Node {
/** Parameter name. */
name: IdentifierExpression;
/** Parameter type. */
type: CommonTypeNode | null;
type: CommonTypeNode;
/** Initializer expression, if present. */
initializer: Expression | null;
}
@ -1052,7 +1052,7 @@ export class SignatureNode extends CommonTypeNode {
/** Accepted parameters. */
parameterTypes: ParameterNode[];
/** Return type. */
returnType: CommonTypeNode | null;
returnType: CommonTypeNode;
/** Explicitly provided this type, if any. */
explicitThisType: TypeNode | null; // can't be a function
}

View File

@ -510,12 +510,13 @@ export class Compiler extends DiagnosticEmitter {
}
var nativeType = global.type.toNativeType();
var isConstant = global.isAny(CommonFlags.CONST) || global.is(CommonFlags.STATIC | CommonFlags.READONLY);
// handle imports
if (global.is(CommonFlags.DECLARE)) {
// constant global
if (global.is(CommonFlags.CONST)) {
if (isConstant) {
global.set(CommonFlags.MODULE_IMPORT);
module.addGlobalImport(
global.internalName,
@ -558,7 +559,7 @@ export class Compiler extends DiagnosticEmitter {
if (_BinaryenExpressionGetId(initExpr) != ExpressionId.Const) {
// if a constant global, check if the initializer becomes constant after precompute
if (global.is(CommonFlags.CONST)) {
if (isConstant) {
initExpr = this.precomputeExpressionRef(initExpr);
if (_BinaryenExpressionGetId(initExpr) != ExpressionId.Const) {
this.warning(
@ -586,7 +587,7 @@ export class Compiler extends DiagnosticEmitter {
} else { // compile as-is
if (global.is(CommonFlags.CONST)) {
if (isConstant) {
let exprType = _BinaryenExpressionGetType(initExpr);
switch (exprType) {
case NativeType.I32: {
@ -624,7 +625,7 @@ export class Compiler extends DiagnosticEmitter {
}
}
global.set(CommonFlags.INLINED); // inline the value from now on
if (declaration.isTopLevel) { // but keep the element if it might be re-exported
if (declaration.isTopLevel) { // but keep the element as it might be re-exported
module.addGlobal(internalName, nativeType, false, initExpr);
}
if (declaration.range.source.isEntry && declaration.isTopLevelExport) {
@ -632,7 +633,7 @@ export class Compiler extends DiagnosticEmitter {
}
} else /* mutable */ {
module.addGlobal(internalName, nativeType, !global.is(CommonFlags.CONST), initExpr);
module.addGlobal(internalName, nativeType, !isConstant, initExpr);
}
}
return true;
@ -844,6 +845,7 @@ export class Compiler extends DiagnosticEmitter {
let flow = instance.flow;
let stmt: ExpressionRef;
if (body.kind == NodeKind.EXPRESSION) { // () => expression
assert(instance.is(CommonFlags.ARROW));
stmt = this.compileExpression((<ExpressionStatement>body).expression, returnType);
flow.set(FlowFlags.RETURNS);
} else {
@ -854,7 +856,7 @@ export class Compiler extends DiagnosticEmitter {
if (returnType != Type.void && !allBranchesReturn) {
this.error(
DiagnosticCode.A_function_whose_declared_type_is_not_void_must_return_a_value,
assert(declaration.signature.returnType, "return type expected").range
declaration.signature.returnType.range
);
}
}

View File

@ -1032,6 +1032,8 @@ export class Parser extends DiagnosticEmitter {
if (tn.skip(Token.COLON)) {
type = this.parseType(tn);
if (!type) return null;
} else {
type = Node.createOmittedType(tn.range(tn.pos));
}
let initializer: Expression | null = null;
if (tn.skip(Token.EQUALS)) {

View File

@ -9,7 +9,8 @@
import { MASK as AL_MASK } from "./common/alignment";
var offset: usize = (HEAP_BASE + AL_MASK) & ~AL_MASK;
var startOffset: usize = (HEAP_BASE + AL_MASK) & ~AL_MASK;
var offset: usize = startOffset;
@global
export function allocate_memory(size: usize): usize {
@ -37,5 +38,5 @@ export function free_memory(ptr: usize): void {
@global
export function reset_memory(): void {
offset = (HEAP_BASE + AL_MASK) & ~AL_MASK;
offset = startOffset;
}

View File

@ -2,6 +2,7 @@
(type $ii (func (param i32) (result i32)))
(type $iv (func (param i32)))
(type $v (func))
(global "$(lib)/allocator/arena/startOffset" (mut i32) (i32.const 0))
(global "$(lib)/allocator/arena/offset" (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 4))
(memory $0 1)
@ -9,89 +10,89 @@
(export "free_memory" (func "$(lib)/allocator/arena/free_memory"))
(export "reset_memory" (func "$(lib)/allocator/arena/reset_memory"))
(export "memory" (memory $0))
(start $(lib)/allocator/arena/reset_memory)
(start $start)
(func "$(lib)/allocator/arena/allocate_memory" (; 0 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
;;@ (lib)/allocator/arena.ts:14:2
;;@ (lib)/allocator/arena.ts:17:2
(if
;;@ (lib)/allocator/arena.ts:14:6
;;@ (lib)/allocator/arena.ts:17:6
(i32.eqz
;;@ (lib)/allocator/arena.ts:14:7
;;@ (lib)/allocator/arena.ts:17:7
(get_local $0)
)
;;@ (lib)/allocator/arena.ts:14:20
;;@ (lib)/allocator/arena.ts:17:20
(return
(i32.const 0)
)
)
;;@ (lib)/allocator/arena.ts:18:2
;;@ (lib)/allocator/arena.ts:21:2
(if
;;@ (lib)/allocator/arena.ts:18:6
;;@ (lib)/allocator/arena.ts:21:6
(i32.gt_u
;;@ (lib)/allocator/arena.ts:16:2
;;@ (lib)/allocator/arena.ts:19:2
(tee_local $2
;;@ (lib)/allocator/arena.ts:16:15
;;@ (lib)/allocator/arena.ts:19:15
(i32.and
(i32.add
;;@ (lib)/allocator/arena.ts:16:16
;;@ (lib)/allocator/arena.ts:19:16
(i32.add
;;@ (lib)/allocator/arena.ts:15:2
;;@ (lib)/allocator/arena.ts:18:2
(tee_local $1
;;@ (lib)/allocator/arena.ts:15:12
;;@ (lib)/allocator/arena.ts:18:12
(get_global "$(lib)/allocator/arena/offset")
)
;;@ (lib)/allocator/arena.ts:16:22
;;@ (lib)/allocator/arena.ts:19:22
(get_local $0)
)
;;@ (lib)/allocator/arena.ts:16:29
;;@ (lib)/allocator/arena.ts:19:29
(i32.const 7)
)
(i32.const -8)
)
)
;;@ (lib)/allocator/arena.ts:18:15
;;@ (lib)/allocator/arena.ts:21:15
(i32.shl
;;@ (lib)/allocator/arena.ts:17:2
;;@ (lib)/allocator/arena.ts:20:2
(tee_local $0
;;@ (lib)/allocator/arena.ts:17:20
;;@ (lib)/allocator/arena.ts:20:20
(current_memory)
)
;;@ (lib)/allocator/arena.ts:18:37
;;@ (lib)/allocator/arena.ts:21:37
(i32.const 16)
)
)
;;@ (lib)/allocator/arena.ts:21:4
;;@ (lib)/allocator/arena.ts:24:4
(if
;;@ (lib)/allocator/arena.ts:21:8
;;@ (lib)/allocator/arena.ts:24:8
(i32.lt_s
(grow_memory
;;@ (lib)/allocator/arena.ts:20:22
;;@ (lib)/allocator/arena.ts:23:22
(select
;;@ (lib)/allocator/arena.ts:20:26
;;@ (lib)/allocator/arena.ts:23:26
(get_local $0)
(tee_local $4
;;@ (lib)/allocator/arena.ts:19:4
;;@ (lib)/allocator/arena.ts:22:4
(tee_local $3
;;@ (lib)/allocator/arena.ts:19:22
;;@ (lib)/allocator/arena.ts:22:22
(i32.shr_u
(i32.and
;;@ (lib)/allocator/arena.ts:19:23
;;@ (lib)/allocator/arena.ts:22:23
(i32.add
;;@ (lib)/allocator/arena.ts:19:24
;;@ (lib)/allocator/arena.ts:22:24
(i32.sub
(get_local $2)
;;@ (lib)/allocator/arena.ts:19:33
;;@ (lib)/allocator/arena.ts:22:33
(get_local $1)
)
;;@ (lib)/allocator/arena.ts:19:39
;;@ (lib)/allocator/arena.ts:22:39
(i32.const 65535)
)
(i32.const -65536)
)
;;@ (lib)/allocator/arena.ts:19:62
;;@ (lib)/allocator/arena.ts:22:62
(i32.const 16)
)
)
@ -102,50 +103,60 @@
)
)
)
;;@ (lib)/allocator/arena.ts:21:35
;;@ (lib)/allocator/arena.ts:24:35
(i32.const 0)
)
;;@ (lib)/allocator/arena.ts:22:6
;;@ (lib)/allocator/arena.ts:25:6
(if
;;@ (lib)/allocator/arena.ts:22:10
;;@ (lib)/allocator/arena.ts:25:10
(i32.lt_s
(grow_memory
;;@ (lib)/allocator/arena.ts:22:22
;;@ (lib)/allocator/arena.ts:25:22
(get_local $3)
)
;;@ (lib)/allocator/arena.ts:22:37
;;@ (lib)/allocator/arena.ts:25:37
(i32.const 0)
)
;;@ (lib)/allocator/arena.ts:23:8
;;@ (lib)/allocator/arena.ts:26:8
(unreachable)
)
)
)
;;@ (lib)/allocator/arena.ts:27:2
;;@ (lib)/allocator/arena.ts:30:2
(set_global "$(lib)/allocator/arena/offset"
;;@ (lib)/allocator/arena.ts:27:11
;;@ (lib)/allocator/arena.ts:30:11
(get_local $2)
)
;;@ (lib)/allocator/arena.ts:28:9
;;@ (lib)/allocator/arena.ts:31:9
(get_local $1)
)
(func "$(lib)/allocator/arena/free_memory" (; 1 ;) (type $iv) (param $0 i32)
;;@ (lib)/allocator/arena.ts:32:46
;;@ (lib)/allocator/arena.ts:35:46
(nop)
)
(func "$(lib)/allocator/arena/reset_memory" (; 2 ;) (type $v)
;;@ (lib)/allocator/arena.ts:38:2
;;@ (lib)/allocator/arena.ts:41:2
(set_global "$(lib)/allocator/arena/offset"
;;@ (lib)/allocator/arena.ts:38:11
;;@ (lib)/allocator/arena.ts:41:11
(get_global "$(lib)/allocator/arena/startOffset")
)
)
(func $start (; 3 ;) (type $v)
(set_global "$(lib)/allocator/arena/startOffset"
;;@ (lib)/allocator/arena.ts:12:25
(i32.and
(i32.add
;;@ (lib)/allocator/arena.ts:38:12
;;@ (lib)/allocator/arena.ts:12:26
(get_global $HEAP_BASE)
;;@ (lib)/allocator/arena.ts:38:24
;;@ (lib)/allocator/arena.ts:12:38
(i32.const 7)
)
(i32.const -8)
)
)
(set_global "$(lib)/allocator/arena/offset"
;;@ (lib)/allocator/arena.ts:13:20
(get_global "$(lib)/allocator/arena/startOffset")
)
)
)

View File

@ -6,6 +6,7 @@
(global "$(lib)/allocator/common/alignment/BITS" i32 (i32.const 3))
(global "$(lib)/allocator/common/alignment/SIZE" i32 (i32.const 8))
(global "$(lib)/allocator/common/alignment/MASK" i32 (i32.const 7))
(global "$(lib)/allocator/arena/startOffset" (mut i32) (i32.const 0))
(global "$(lib)/allocator/arena/offset" (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 4))
(memory $0 1)
@ -21,101 +22,101 @@
(local $4 i32)
(local $5 i32)
(local $6 i32)
;;@ (lib)/allocator/arena.ts:14:2
;;@ (lib)/allocator/arena.ts:17:2
(if
;;@ (lib)/allocator/arena.ts:14:6
;;@ (lib)/allocator/arena.ts:17:6
(i32.eqz
;;@ (lib)/allocator/arena.ts:14:7
;;@ (lib)/allocator/arena.ts:17:7
(get_local $0)
)
;;@ (lib)/allocator/arena.ts:14:20
;;@ (lib)/allocator/arena.ts:17:20
(return
(i32.const 0)
)
)
;;@ (lib)/allocator/arena.ts:15:2
;;@ (lib)/allocator/arena.ts:18:2
(set_local $1
;;@ (lib)/allocator/arena.ts:15:12
;;@ (lib)/allocator/arena.ts:18:12
(get_global "$(lib)/allocator/arena/offset")
)
;;@ (lib)/allocator/arena.ts:16:2
;;@ (lib)/allocator/arena.ts:19:2
(set_local $2
;;@ (lib)/allocator/arena.ts:16:15
;;@ (lib)/allocator/arena.ts:19:15
(i32.and
(i32.add
;;@ (lib)/allocator/arena.ts:16:16
;;@ (lib)/allocator/arena.ts:19:16
(i32.add
(get_local $1)
;;@ (lib)/allocator/arena.ts:16:22
;;@ (lib)/allocator/arena.ts:19:22
(get_local $0)
)
;;@ (lib)/allocator/arena.ts:16:29
;;@ (lib)/allocator/arena.ts:19:29
(i32.const 7)
)
;;@ (lib)/allocator/arena.ts:16:40
;;@ (lib)/allocator/arena.ts:19:40
(i32.xor
;;@ (lib)/allocator/arena.ts:16:41
;;@ (lib)/allocator/arena.ts:19:41
(i32.const 7)
(i32.const -1)
)
)
)
;;@ (lib)/allocator/arena.ts:17:2
;;@ (lib)/allocator/arena.ts:20:2
(set_local $3
;;@ (lib)/allocator/arena.ts:17:20
;;@ (lib)/allocator/arena.ts:20:20
(current_memory)
)
;;@ (lib)/allocator/arena.ts:18:2
;;@ (lib)/allocator/arena.ts:21:2
(if
;;@ (lib)/allocator/arena.ts:18:6
;;@ (lib)/allocator/arena.ts:21:6
(i32.gt_u
(get_local $2)
;;@ (lib)/allocator/arena.ts:18:15
;;@ (lib)/allocator/arena.ts:21:15
(i32.shl
(get_local $3)
;;@ (lib)/allocator/arena.ts:18:37
;;@ (lib)/allocator/arena.ts:21:37
(i32.const 16)
)
)
;;@ (lib)/allocator/arena.ts:18:41
;;@ (lib)/allocator/arena.ts:21:41
(block
;;@ (lib)/allocator/arena.ts:19:4
;;@ (lib)/allocator/arena.ts:22:4
(set_local $4
;;@ (lib)/allocator/arena.ts:19:22
;;@ (lib)/allocator/arena.ts:22:22
(i32.shr_u
(i32.and
;;@ (lib)/allocator/arena.ts:19:23
;;@ (lib)/allocator/arena.ts:22:23
(i32.add
;;@ (lib)/allocator/arena.ts:19:24
;;@ (lib)/allocator/arena.ts:22:24
(i32.sub
(get_local $2)
;;@ (lib)/allocator/arena.ts:19:33
;;@ (lib)/allocator/arena.ts:22:33
(get_local $1)
)
;;@ (lib)/allocator/arena.ts:19:39
;;@ (lib)/allocator/arena.ts:22:39
(i32.const 65535)
)
;;@ (lib)/allocator/arena.ts:19:49
;;@ (lib)/allocator/arena.ts:22:49
(i32.xor
;;@ (lib)/allocator/arena.ts:19:50
;;@ (lib)/allocator/arena.ts:22:50
(i32.const 65535)
(i32.const -1)
)
)
;;@ (lib)/allocator/arena.ts:19:62
;;@ (lib)/allocator/arena.ts:22:62
(i32.const 16)
)
)
;;@ (lib)/allocator/arena.ts:20:4
;;@ (lib)/allocator/arena.ts:23:4
(set_local $5
;;@ (lib)/allocator/arena.ts:20:22
;;@ (lib)/allocator/arena.ts:23:22
(select
(tee_local $5
;;@ (lib)/allocator/arena.ts:20:26
;;@ (lib)/allocator/arena.ts:23:26
(get_local $3)
)
(tee_local $6
;;@ (lib)/allocator/arena.ts:20:39
;;@ (lib)/allocator/arena.ts:23:39
(get_local $4)
)
(i32.gt_s
@ -124,40 +125,40 @@
)
)
)
;;@ (lib)/allocator/arena.ts:21:4
;;@ (lib)/allocator/arena.ts:24:4
(if
;;@ (lib)/allocator/arena.ts:21:8
;;@ (lib)/allocator/arena.ts:24:8
(i32.lt_s
(grow_memory
;;@ (lib)/allocator/arena.ts:21:20
;;@ (lib)/allocator/arena.ts:24:20
(get_local $5)
)
;;@ (lib)/allocator/arena.ts:21:35
;;@ (lib)/allocator/arena.ts:24:35
(i32.const 0)
)
;;@ (lib)/allocator/arena.ts:22:6
;;@ (lib)/allocator/arena.ts:25:6
(if
;;@ (lib)/allocator/arena.ts:22:10
;;@ (lib)/allocator/arena.ts:25:10
(i32.lt_s
(grow_memory
;;@ (lib)/allocator/arena.ts:22:22
;;@ (lib)/allocator/arena.ts:25:22
(get_local $4)
)
;;@ (lib)/allocator/arena.ts:22:37
;;@ (lib)/allocator/arena.ts:25:37
(i32.const 0)
)
;;@ (lib)/allocator/arena.ts:23:8
;;@ (lib)/allocator/arena.ts:26:8
(unreachable)
)
)
)
)
;;@ (lib)/allocator/arena.ts:27:2
;;@ (lib)/allocator/arena.ts:30:2
(set_global "$(lib)/allocator/arena/offset"
;;@ (lib)/allocator/arena.ts:27:11
;;@ (lib)/allocator/arena.ts:30:11
(get_local $2)
)
;;@ (lib)/allocator/arena.ts:28:9
;;@ (lib)/allocator/arena.ts:31:9
(return
(get_local $1)
)
@ -165,42 +166,33 @@
(func "$(lib)/allocator/arena/free_memory" (; 1 ;) (type $iv) (param $0 i32)
)
(func "$(lib)/allocator/arena/reset_memory" (; 2 ;) (type $v)
;;@ (lib)/allocator/arena.ts:38:2
;;@ (lib)/allocator/arena.ts:41:2
(set_global "$(lib)/allocator/arena/offset"
;;@ (lib)/allocator/arena.ts:38:11
(i32.and
(i32.add
;;@ (lib)/allocator/arena.ts:38:12
(get_global $HEAP_BASE)
;;@ (lib)/allocator/arena.ts:38:24
(i32.const 7)
)
;;@ (lib)/allocator/arena.ts:38:35
(i32.xor
;;@ (lib)/allocator/arena.ts:38:36
(i32.const 7)
(i32.const -1)
)
)
;;@ (lib)/allocator/arena.ts:41:11
(get_global "$(lib)/allocator/arena/startOffset")
)
)
(func $start (; 3 ;) (type $v)
(set_global "$(lib)/allocator/arena/offset"
;;@ (lib)/allocator/arena.ts:10:20
(set_global "$(lib)/allocator/arena/startOffset"
;;@ (lib)/allocator/arena.ts:12:25
(i32.and
(i32.add
;;@ (lib)/allocator/arena.ts:10:21
;;@ (lib)/allocator/arena.ts:12:26
(get_global $HEAP_BASE)
;;@ (lib)/allocator/arena.ts:10:33
;;@ (lib)/allocator/arena.ts:12:38
(i32.const 7)
)
;;@ (lib)/allocator/arena.ts:10:44
;;@ (lib)/allocator/arena.ts:12:49
(i32.xor
;;@ (lib)/allocator/arena.ts:10:45
;;@ (lib)/allocator/arena.ts:12:50
(i32.const 7)
(i32.const -1)
)
)
)
(set_global "$(lib)/allocator/arena/offset"
;;@ (lib)/allocator/arena.ts:13:20
(get_global "$(lib)/allocator/arena/startOffset")
)
)
)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@
(type $iv (func (param i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global "$(lib)/allocator/arena/startOffset" (mut i32) (i32.const 0))
(global "$(lib)/allocator/arena/offset" (mut i32) (i32.const 0))
(global $std/allocator_arena/ptr1 (mut i32) (i32.const 0))
(global $std/allocator_arena/ptr2 (mut i32) (i32.const 0))
@ -2361,6 +2362,11 @@
)
(func "$(lib)/allocator/arena/reset_memory" (; 7 ;) (type $v)
(set_global "$(lib)/allocator/arena/offset"
(get_global "$(lib)/allocator/arena/startOffset")
)
)
(func $start (; 8 ;) (type $v)
(set_global "$(lib)/allocator/arena/startOffset"
(i32.and
(i32.add
(get_global $HEAP_BASE)
@ -2369,16 +2375,8 @@
(i32.const -8)
)
)
)
(func $start (; 8 ;) (type $v)
(set_global "$(lib)/allocator/arena/offset"
(i32.and
(i32.add
(get_global $HEAP_BASE)
(i32.const 7)
)
(i32.const -8)
)
(get_global "$(lib)/allocator/arena/startOffset")
)
(set_global $std/allocator_arena/ptr1
(call "$(lib)/allocator/arena/allocate_memory"

View File

@ -10,6 +10,7 @@
(global "$(lib)/allocator/common/alignment/BITS" i32 (i32.const 3))
(global "$(lib)/allocator/common/alignment/SIZE" i32 (i32.const 8))
(global "$(lib)/allocator/common/alignment/MASK" i32 (i32.const 7))
(global "$(lib)/allocator/arena/startOffset" (mut i32) (i32.const 0))
(global "$(lib)/allocator/arena/offset" (mut i32) (i32.const 0))
(global $std/allocator_arena/size i32 (i32.const 42))
(global $std/allocator_arena/ptr1 (mut i32) (i32.const 0))
@ -2668,6 +2669,11 @@
)
(func "$(lib)/allocator/arena/reset_memory" (; 7 ;) (type $v)
(set_global "$(lib)/allocator/arena/offset"
(get_global "$(lib)/allocator/arena/startOffset")
)
)
(func $start (; 8 ;) (type $v)
(set_global "$(lib)/allocator/arena/startOffset"
(i32.and
(i32.add
(get_global $HEAP_BASE)
@ -2679,19 +2685,8 @@
)
)
)
)
(func $start (; 8 ;) (type $v)
(set_global "$(lib)/allocator/arena/offset"
(i32.and
(i32.add
(get_global $HEAP_BASE)
(i32.const 7)
)
(i32.xor
(i32.const 7)
(i32.const -1)
)
)
(get_global "$(lib)/allocator/arena/startOffset")
)
(set_global $std/allocator_arena/ptr1
(call "$(lib)/allocator/arena/allocate_memory"

View File

@ -9,6 +9,7 @@
(type $iiiii (func (param i32 i32 i32 i32) (result i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global "$(lib)/allocator/arena/startOffset" (mut i32) (i32.const 0))
(global "$(lib)/allocator/arena/offset" (mut i32) (i32.const 0))
(global $std/array/arr (mut i32) (i32.const 0))
(global $std/array/i (mut i32) (i32.const 0))
@ -3068,7 +3069,7 @@
)
)
(func $start (; 19 ;) (type $v)
(set_global "$(lib)/allocator/arena/offset"
(set_global "$(lib)/allocator/arena/startOffset"
(i32.and
(i32.add
(get_global $HEAP_BASE)
@ -3077,6 +3078,9 @@
(i32.const -8)
)
)
(set_global "$(lib)/allocator/arena/offset"
(get_global "$(lib)/allocator/arena/startOffset")
)
(set_global $std/array/arr
(call "$(lib)/allocator/arena/allocate_memory"
(i32.const 12)

View File

@ -13,6 +13,7 @@
(global "$(lib)/allocator/common/alignment/BITS" i32 (i32.const 3))
(global "$(lib)/allocator/common/alignment/SIZE" i32 (i32.const 8))
(global "$(lib)/allocator/common/alignment/MASK" i32 (i32.const 7))
(global "$(lib)/allocator/arena/startOffset" (mut i32) (i32.const 0))
(global "$(lib)/allocator/arena/offset" (mut i32) (i32.const 0))
(global $std/array/arr (mut i32) (i32.const 0))
(global $std/array/i (mut i32) (i32.const 0))
@ -3434,7 +3435,7 @@
)
)
(func $start (; 19 ;) (type $v)
(set_global "$(lib)/allocator/arena/offset"
(set_global "$(lib)/allocator/arena/startOffset"
(i32.and
(i32.add
(get_global $HEAP_BASE)
@ -3446,6 +3447,9 @@
)
)
)
(set_global "$(lib)/allocator/arena/offset"
(get_global "$(lib)/allocator/arena/startOffset")
)
(set_global $std/array/arr
(call "$(lib)/allocator/arena/allocate_memory"
(i32.add

View File

@ -2,6 +2,7 @@
(type $ii (func (param i32) (result i32)))
(type $ifv (func (param i32 f32)))
(type $v (func))
(global "$(lib)/allocator/arena/startOffset" (mut i32) (i32.const 0))
(global "$(lib)/allocator/arena/offset" (mut i32) (i32.const 0))
(global $std/new/aClass (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 4))
@ -107,7 +108,7 @@
)
(func $start (; 2 ;) (type $v)
(local $0 i32)
(set_global "$(lib)/allocator/arena/offset"
(set_global "$(lib)/allocator/arena/startOffset"
(i32.and
(i32.add
(get_global $HEAP_BASE)
@ -116,6 +117,9 @@
(i32.const -8)
)
)
(set_global "$(lib)/allocator/arena/offset"
(get_global "$(lib)/allocator/arena/startOffset")
)
(set_global $std/new/aClass
(block (result i32)
(i32.store

View File

@ -6,6 +6,7 @@
(global "$(lib)/allocator/common/alignment/BITS" i32 (i32.const 3))
(global "$(lib)/allocator/common/alignment/SIZE" i32 (i32.const 8))
(global "$(lib)/allocator/common/alignment/MASK" i32 (i32.const 7))
(global "$(lib)/allocator/arena/startOffset" (mut i32) (i32.const 0))
(global "$(lib)/allocator/arena/offset" (mut i32) (i32.const 0))
(global $std/new/aClass (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 4))
@ -132,7 +133,7 @@
)
(func $start (; 2 ;) (type $v)
(local $0 i32)
(set_global "$(lib)/allocator/arena/offset"
(set_global "$(lib)/allocator/arena/startOffset"
(i32.and
(i32.add
(get_global $HEAP_BASE)
@ -144,6 +145,9 @@
)
)
)
(set_global "$(lib)/allocator/arena/offset"
(get_global "$(lib)/allocator/arena/startOffset")
)
(set_global $std/new/aClass
(block (result i32)
(set_local $0

View File

@ -6,6 +6,7 @@
(type $iv (func (param i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global "$(lib)/allocator/arena/startOffset" (mut i32) (i32.const 0))
(global "$(lib)/allocator/arena/offset" (mut i32) (i32.const 0))
(global $std/set/set (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 56))
@ -2273,7 +2274,7 @@
)
)
(func $start (; 10 ;) (type $v)
(set_global "$(lib)/allocator/arena/offset"
(set_global "$(lib)/allocator/arena/startOffset"
(i32.and
(i32.add
(get_global $HEAP_BASE)
@ -2282,6 +2283,9 @@
(i32.const -8)
)
)
(set_global "$(lib)/allocator/arena/offset"
(get_global "$(lib)/allocator/arena/startOffset")
)
(set_global $std/set/set
(call "$(lib)/allocator/arena/allocate_memory"
(i32.const 12)

View File

@ -10,6 +10,7 @@
(global "$(lib)/allocator/common/alignment/BITS" i32 (i32.const 3))
(global "$(lib)/allocator/common/alignment/SIZE" i32 (i32.const 8))
(global "$(lib)/allocator/common/alignment/MASK" i32 (i32.const 7))
(global "$(lib)/allocator/arena/startOffset" (mut i32) (i32.const 0))
(global "$(lib)/allocator/arena/offset" (mut i32) (i32.const 0))
(global $std/set/set (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 56))
@ -2596,7 +2597,7 @@
)
)
(func $start (; 10 ;) (type $v)
(set_global "$(lib)/allocator/arena/offset"
(set_global "$(lib)/allocator/arena/startOffset"
(i32.and
(i32.add
(get_global $HEAP_BASE)
@ -2608,6 +2609,9 @@
)
)
)
(set_global "$(lib)/allocator/arena/offset"
(get_global "$(lib)/allocator/arena/startOffset")
)
(set_global $std/set/set
(call "$(lib)/allocator/arena/allocate_memory"
(i32.add