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,6 +1,6 @@
(module
(type $i_ (func (param i32)))
(type $_ (func))
(type $i_ (func (param i32)))
(type $ii (func (param i32) (result i32)))
(type $ii_ (func (param i32 i32)))
(type $iiii_ (func (param i32 i32 i32 i32)))
@ -18,10 +18,10 @@
(global $~lib/collector/itcm/fromSpace (mut i32) (i32.const 0))
(global $~lib/collector/itcm/toSpace (mut i32) (i32.const 0))
(global $~lib/collector/itcm/iter (mut i32) (i32.const 0))
(global $~argc (mut i32) (i32.const 0))
(global $~lib/argc (mut i32) (i32.const 0))
(global $std/gc-basics/obj (mut i32) (i32.const 0))
(global $std/gc-basics/obj2 (mut i32) (i32.const 0))
(global $~started (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-basics/main))
@ -252,7 +252,7 @@
i32.or
i32.store
i32.const 1
global.set $~argc
global.set $~lib/argc
local.get $0
i32.const 16
i32.add
@ -374,17 +374,7 @@
end
end
)
(func $std/gc-basics/main (; 10 ;) (type $i) (result i32)
global.get $~started
i32.eqz
if
call $start
i32.const 1
global.set $~started
end
i32.const 0
)
(func $start (; 11 ;) (type $_)
(func $start:std/gc-basics (; 10 ;) (type $_)
(local $0 i32)
(local $1 i32)
(local $2 i32)
@ -393,8 +383,6 @@
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_allocate
global.set $std/gc-basics/obj
global.get $std/gc-basics/obj
@ -479,6 +467,16 @@
global.set $std/gc-basics/obj
call $~lib/collector/itcm/__gc_collect
)
(func $std/gc-basics/main (; 11 ;) (type $i) (result i32)
global.get $~lib/started
i32.eqz
if
call $start:std/gc-basics
i32.const 1
global.set $~lib/started
end
i32.const 0
)
(func $null (; 12 ;) (type $_)
nop
)