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:
Daniel Wirtz
2019-02-21 00:11:22 +01:00
committed by GitHub
parent e623786b42
commit 0c64f21250
234 changed files with 16949 additions and 37871 deletions

View File

@ -1,8 +1,8 @@
(module
(type $_ (func))
(type $i_ (func (param i32)))
(type $ii (func (param i32) (result i32)))
(type $ii_ (func (param i32 i32)))
(type $_ (func))
(type $iii (func (param i32 i32) (result i32)))
(type $iii_ (func (param i32 i32 i32)))
(type $iiii_ (func (param i32 i32 i32 i32)))
@ -24,8 +24,8 @@
(global $~lib/collector/itcm/toSpace (mut i32) (i32.const 0))
(global $~lib/collector/itcm/iter (mut i32) (i32.const 0))
(global $std/gc-array/arr (mut i32) (i32.const 48))
(global $~argc (mut i32) (i32.const 0))
(global $~started (mut i32) (i32.const 0))
(global $~lib/argc (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(export "memory" (memory $0))
(export "table" (table $0))
(export "main" (func $std/gc-array/main))
@ -292,7 +292,7 @@
i32.or
i32.store
i32.const 1
global.set $~argc
global.set $~lib/argc
local.get $0
i32.const 16
i32.add
@ -1913,23 +1913,11 @@
local.get $2
call $~lib/collector/itcm/__gc_link
)
(func $std/gc-array/main (; 18 ;) (type $i) (result i32)
global.get $~started
i32.eqz
if
call $start
i32.const 1
global.set $~started
end
i32.const 0
)
(func $start (; 19 ;) (type $_)
(func $start:std/gc-array (; 18 ;) (type $_)
i32.const 184
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
i32.const 0
global.set $~lib/collector/itcm/state
call $~lib/collector/itcm/__gc_collect
global.get $std/gc-array/arr
i32.const 0
@ -1953,6 +1941,16 @@
call $~lib/array/Array<Foo>#__set
call $~lib/collector/itcm/__gc_collect
)
(func $std/gc-array/main (; 19 ;) (type $i) (result i32)
global.get $~lib/started
i32.eqz
if
call $start:std/gc-array
i32.const 1
global.set $~lib/started
end
i32.const 0
)
(func $null (; 20 ;) (type $_)
nop
)