tiancaiamao / shen-go

A Go implementation of the Shen programming language
Other
55 stars 4 forks source link

codegen: modify codegen to inline the primitive call #27

Closed tiancaiamao closed 3 years ago

tiancaiamao commented 3 years ago

shen code (f x) is translated to cora code as ((ns2-value f) x) Now in the compiler, (ns2-value f) is generated as ($global 2 f) bytecode And in the code generator, optimize those call pattern:

    (call ($global ns XX) ...)
    (tailapply ($global ns XX) ...)

If XX is known primitive, use PrimXX instead of __e.Call(PrimNS2Value(XX), ...)

Before this change, run the shen test suite takes 26s, and now it takes 12s