mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-24 04:01:46 +00:00
Rework resolver (#489)
* Rework IR and resolver to use nested lookup tables * Integrate types into IR * Make components prefer IR, slimmed down AST * Implement `export *` * Add `@lazy` annotation and remove `--noTreeShaking` * Add `@start` annotation and remove magic `main` * Related refactoring, cleanup and docs
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
(module
|
||||
(type $_ (func))
|
||||
(type $iiii_ (func (param i32 i32 i32 i32)))
|
||||
(type $iii (func (param i32 i32) (result i32)))
|
||||
(type $ii (func (param i32) (result i32)))
|
||||
(type $iii_ (func (param i32 i32 i32)))
|
||||
(type $_ (func))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\03\00\00\00\00\00\00\00\00\01\02\00\00\00\00\00")
|
||||
@ -17,27 +17,33 @@
|
||||
(data (i32.const 168) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00")
|
||||
(table $0 1 funcref)
|
||||
(elem (i32.const 0) $null)
|
||||
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
|
||||
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
|
||||
(global $~lib/internal/allocator/AL_MASK i32 (i32.const 7))
|
||||
(global $~lib/internal/allocator/MAX_SIZE_32 i32 (i32.const 1073741824))
|
||||
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
|
||||
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
|
||||
(global $std/array-literal/staticArrayI8 i32 (i32.const 24))
|
||||
(global $~lib/internal/arraybuffer/HEADER_SIZE i32 (i32.const 8))
|
||||
(global $std/array-literal/staticArrayI32 i32 (i32.const 112))
|
||||
(global $std/array-literal/emptyArrayI32 (mut i32) (i32.const 128))
|
||||
(global $std/array-literal/i (mut i32) (i32.const 0))
|
||||
(global $~lib/internal/arraybuffer/MAX_BLENGTH i32 (i32.const 1073741816))
|
||||
(global $std/array-literal/dynamicArrayI8 (mut i32) (i32.const 0))
|
||||
(global $std/array-literal/dynamicArrayI32 (mut i32) (i32.const 0))
|
||||
(global $std/array-literal/dynamicArrayRef (mut i32) (i32.const 0))
|
||||
(global $std/array-literal/dynamicArrayRefWithCtor (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 228))
|
||||
(global $~lib/memory/HEAP_BASE i32 (i32.const 228))
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(start $start)
|
||||
(func $~lib/array/Array<i8>#__get (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $start:~lib/allocator/arena (; 1 ;) (type $_)
|
||||
global.get $~lib/memory/HEAP_BASE
|
||||
i32.const 7
|
||||
i32.add
|
||||
i32.const 7
|
||||
i32.const -1
|
||||
i32.xor
|
||||
i32.and
|
||||
global.set $~lib/allocator/arena/startOffset
|
||||
global.get $~lib/allocator/arena/startOffset
|
||||
global.set $~lib/allocator/arena/offset
|
||||
)
|
||||
(func $~lib/array/Array<i8>#__get (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
@ -70,7 +76,7 @@
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $~lib/array/Array<i32>#__get (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $~lib/array/Array<i32>#__get (; 3 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
@ -103,11 +109,11 @@
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $~lib/internal/arraybuffer/computeSize (; 3 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $~lib/internal/arraybuffer/computeSize (; 4 ;) (type $ii) (param $0 i32) (result i32)
|
||||
i32.const 1
|
||||
i32.const 32
|
||||
local.get $0
|
||||
global.get $~lib/internal/arraybuffer/HEADER_SIZE
|
||||
i32.const 8
|
||||
i32.add
|
||||
i32.const 1
|
||||
i32.sub
|
||||
@ -115,7 +121,7 @@
|
||||
i32.sub
|
||||
i32.shl
|
||||
)
|
||||
(func $~lib/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $~lib/allocator/arena/__memory_allocate (; 5 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
@ -123,7 +129,7 @@
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
local.get $0
|
||||
global.get $~lib/internal/allocator/MAX_SIZE_32
|
||||
i32.const 1073741824
|
||||
i32.gt_u
|
||||
if
|
||||
unreachable
|
||||
@ -140,9 +146,9 @@
|
||||
i32.gt_u
|
||||
select
|
||||
i32.add
|
||||
global.get $~lib/internal/allocator/AL_MASK
|
||||
i32.const 7
|
||||
i32.add
|
||||
global.get $~lib/internal/allocator/AL_MASK
|
||||
i32.const 7
|
||||
i32.const -1
|
||||
i32.xor
|
||||
i32.and
|
||||
@ -194,11 +200,11 @@
|
||||
global.set $~lib/allocator/arena/offset
|
||||
local.get $1
|
||||
)
|
||||
(func $~lib/internal/arraybuffer/allocateUnsafe (; 5 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $~lib/internal/arraybuffer/allocateUnsafe (; 6 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
local.get $0
|
||||
global.get $~lib/internal/arraybuffer/MAX_BLENGTH
|
||||
i32.const 1073741816
|
||||
i32.le_u
|
||||
i32.eqz
|
||||
if
|
||||
@ -223,12 +229,12 @@
|
||||
i32.store
|
||||
local.get $1
|
||||
)
|
||||
(func $~lib/memory/memory.allocate (; 6 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $~lib/memory/memory.allocate (; 7 ;) (type $ii) (param $0 i32) (result i32)
|
||||
local.get $0
|
||||
call $~lib/allocator/arena/__memory_allocate
|
||||
return
|
||||
)
|
||||
(func $~lib/internal/memory/memset (; 7 ;) (type $iii_) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $~lib/internal/memory/memset (; 8 ;) (type $iii_) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i64)
|
||||
@ -482,7 +488,7 @@
|
||||
end
|
||||
end
|
||||
)
|
||||
(func $~lib/array/Array<i8>#constructor (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $~lib/array/Array<i8>#constructor (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
@ -527,9 +533,9 @@
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.store offset=4
|
||||
block $memory.fill|inlined.0
|
||||
block $~lib/memory/memory.fill|inlined.0
|
||||
local.get $3
|
||||
global.get $~lib/internal/arraybuffer/HEADER_SIZE
|
||||
i32.const 8
|
||||
i32.add
|
||||
local.set $4
|
||||
i32.const 0
|
||||
@ -543,7 +549,7 @@
|
||||
end
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/array/Array<i8>#__unchecked_set (; 9 ;) (type $iii_) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $~lib/array/Array<i8>#__unchecked_set (; 10 ;) (type $iii_) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
@ -567,7 +573,7 @@
|
||||
local.get $5
|
||||
i32.store8 offset=8
|
||||
)
|
||||
(func $~lib/array/Array<i32>#constructor (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $~lib/array/Array<i32>#constructor (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
@ -612,9 +618,9 @@
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.store offset=4
|
||||
block $memory.fill|inlined.1
|
||||
block $~lib/memory/memory.fill|inlined.1
|
||||
local.get $3
|
||||
global.get $~lib/internal/arraybuffer/HEADER_SIZE
|
||||
i32.const 8
|
||||
i32.add
|
||||
local.set $4
|
||||
i32.const 0
|
||||
@ -628,7 +634,7 @@
|
||||
end
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/array/Array<i32>#__unchecked_set (; 11 ;) (type $iii_) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $~lib/array/Array<i32>#__unchecked_set (; 12 ;) (type $iii_) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
@ -652,7 +658,7 @@
|
||||
local.get $5
|
||||
i32.store offset=8
|
||||
)
|
||||
(func $std/array-literal/Ref#constructor (; 12 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $std/array-literal/Ref#constructor (; 13 ;) (type $ii) (param $0 i32) (result i32)
|
||||
local.get $0
|
||||
i32.eqz
|
||||
if
|
||||
@ -662,7 +668,7 @@
|
||||
end
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/array/Array<Ref>#constructor (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $~lib/array/Array<Ref>#constructor (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
@ -707,9 +713,9 @@
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.store offset=4
|
||||
block $memory.fill|inlined.2
|
||||
block $~lib/memory/memory.fill|inlined.2
|
||||
local.get $3
|
||||
global.get $~lib/internal/arraybuffer/HEADER_SIZE
|
||||
i32.const 8
|
||||
i32.add
|
||||
local.set $4
|
||||
i32.const 0
|
||||
@ -723,7 +729,7 @@
|
||||
end
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/array/Array<Ref>#__unchecked_set (; 14 ;) (type $iii_) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $~lib/array/Array<Ref>#__unchecked_set (; 15 ;) (type $iii_) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
@ -747,7 +753,7 @@
|
||||
local.get $5
|
||||
i32.store offset=8
|
||||
)
|
||||
(func $std/array-literal/RefWithCtor#constructor (; 15 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $std/array-literal/RefWithCtor#constructor (; 16 ;) (type $ii) (param $0 i32) (result i32)
|
||||
local.get $0
|
||||
i32.eqz
|
||||
if
|
||||
@ -757,7 +763,7 @@
|
||||
end
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/array/Array<RefWithCtor>#constructor (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(func $~lib/array/Array<RefWithCtor>#constructor (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
@ -802,9 +808,9 @@
|
||||
local.get $0
|
||||
local.get $1
|
||||
i32.store offset=4
|
||||
block $memory.fill|inlined.3
|
||||
block $~lib/memory/memory.fill|inlined.3
|
||||
local.get $3
|
||||
global.get $~lib/internal/arraybuffer/HEADER_SIZE
|
||||
i32.const 8
|
||||
i32.add
|
||||
local.set $4
|
||||
i32.const 0
|
||||
@ -818,7 +824,7 @@
|
||||
end
|
||||
local.get $0
|
||||
)
|
||||
(func $~lib/array/Array<RefWithCtor>#__unchecked_set (; 17 ;) (type $iii_) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $~lib/array/Array<RefWithCtor>#__unchecked_set (; 18 ;) (type $iii_) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
@ -842,22 +848,13 @@
|
||||
local.get $5
|
||||
i32.store offset=8
|
||||
)
|
||||
(func $start (; 18 ;) (type $_)
|
||||
(func $start:std/array-literal (; 19 ;) (type $_)
|
||||
(local $0 i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
global.get $HEAP_BASE
|
||||
global.get $~lib/internal/allocator/AL_MASK
|
||||
i32.add
|
||||
global.get $~lib/internal/allocator/AL_MASK
|
||||
i32.const -1
|
||||
i32.xor
|
||||
i32.and
|
||||
global.set $~lib/allocator/arena/startOffset
|
||||
global.get $~lib/allocator/arena/startOffset
|
||||
global.set $~lib/allocator/arena/offset
|
||||
call $start:~lib/allocator/arena
|
||||
block $~lib/array/Array<i8>#get:length|inlined.0 (result i32)
|
||||
global.get $std/array-literal/staticArrayI8
|
||||
local.set $0
|
||||
@ -1282,6 +1279,9 @@
|
||||
unreachable
|
||||
end
|
||||
)
|
||||
(func $null (; 19 ;) (type $_)
|
||||
(func $start (; 20 ;) (type $_)
|
||||
call $start:std/array-literal
|
||||
)
|
||||
(func $null (; 21 ;) (type $_)
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user