This interpreter currently complements the Go SSA level interpreter. It
may stay complementary or may be the only interpreter in the future.
This interpreter is experimental and not yet finished (there are known
bugs!) so it is disabled by default. It can be enabled by passing the
-initinterp flag.
The goal is to be able to run all initializations at compile time except
for the ones having side effects. This mostly works except perhaps for a
few edge cases.
In the future, this interpeter may be used to actually run regular Go
code, perhaps in a shell.
JavaScript does not support i64 directly, so make sure we pass a pointer
instead which can be read from JavaScript.
This is a temporary workaround which should be removed once JavaScript
supports some form of i64 (probably in the form of BigInt).
Panics don't usually happen nowadays, instead the compiler package
returns errors while compiling. If it still panics, this is usually from
within LLVM from where deferred functions are not run.
The list of options passed to build/run/gdb/etc commands was getting
unwieldly and hard to add extra options to. Put all common build options
in a single build config struct so that these options are more
centralized.
In most cases, it's useless. But in some cases it may be critical if the
OCD server (like openocd) has a problem.
It would be nice if openocd would differentiate between stdout and
stderr, and only write errors to stderr. But sadly it doesn't.
Be more compatible with the Go toolchain by setting GOPATH in the same
way. This makes it possible to flash and run examples from the standard
GOPATH instead of only from the source tree.
Apparently -Oz without inliner is the fastest, probably because it
removes code that would otherwise need to be emitted.
TODO: does this mean that the ExecutionEngine compiles the module before
running it? Can we control this?
The size flag has two modes:
-size=short: prints data basically equivalent to the `size` program.
-size=full: tries to determine sizes per package (not entirely
accurate).
To get more compatibility with the go command, implement a similar
command line interface (with "tinygo build <package>" etc.).
Other than that, an all-round cleanup of command parsing.
This has the benefit of not requiring a 'runtime' IR file, so that
complete relocatable files can be built without requiring input IR.
This makes the compiler a lot easier to use without the Makefile.
Code size is not affected.
This reverts commit d9ca5f97fb.
There is a problem with coroutines that I haven't solved yet. Reverting
makes it work, for now.
Also, use a better coroutines flag for the LLVM opt tool.