Commit Graph

17 Commits

Author SHA1 Message Date
Ayke van Laethem 1484bb5c2c all: basic support for the os package
The resulting binary is pretty big due to lacking optimizations
(probably because of interfaces), so that should be fixed.
2018-09-16 13:01:03 +02:00
Ayke van Laethem 94b18e2d79 compiler: support integer convert in interpreter 2018-09-15 18:47:15 +02:00
Ayke van Laethem 1ac67cf8de compiler: adding a few more ignored init calls
These calls are generated in the JavaScript target (syscall/js and
syscall with GOOS=js), but they are not used at the moment. So ignore
them until they're needed.
2018-09-15 01:04:19 +02:00
Ayke van Laethem 5b4b6cfee2 compiler: use -dumpssa flag in interpreter
This is useful for debugging.
2018-09-14 23:29:33 +02:00
Ayke van Laethem 65358ed3c9 interpreter: don't panic on a nil (*ssa.Call).Object() 2018-09-06 09:47:39 +02:00
Ayke van Laethem 771f23e320 Implement //go:linkname pragma 2018-08-30 22:27:19 +02:00
Ayke van Laethem 906e061e37 Replace own dummy syscall with standard library syscall
This makes it easier to support other standard library packages.
2018-08-30 05:58:54 +02:00
Ayke van Laethem e01259ba77 interpreter: string concatenation
Sometimes strings are concatenated in a way that isn't const-propagated
by the SSA transformation (e.g. the result of a function call).
Concatenate them during init() interpretation.
2018-08-30 05:54:40 +02:00
Ayke van Laethem 16cdffc367 Try to interpret simple function calls in init() functions
This is useful for example for globals like these:

    import "errors"

    var MyError = errors.New("mymodule: something went wrong!")
2018-08-30 05:53:22 +02:00
Ayke van Laethem a5252d07f0 Support zero-initialized pointers in globals 2018-08-30 05:38:27 +02:00
Ayke van Laethem 5edf94ea10 Fix named structs inside global named structs 2018-08-30 05:36:44 +02:00
Ayke van Laethem 7956ca2f29 Function pointers in global variables 2018-08-30 05:36:09 +02:00
Ayke van Laethem 0b372ba5bd Support initialized map values in another global 2018-08-30 02:32:35 +02:00
Ayke van Laethem 25344bc08f Reorder Program.interpret cases 2018-08-30 02:09:02 +02:00
Ayke van Laethem 75477eb14e Implement global .data-initalized interfaces 2018-08-30 02:08:00 +02:00
Ayke van Laethem 9f2bcfe5e3 Implement global interface variable constant 2018-08-25 02:58:00 +02:00
Ayke van Laethem c25b448758 Rewrite init() interpretation to a real interpreter
Instead of mostly heuristics, actually execute the init() instruction in
an interpreter to calculate initializers for globals. This is far more
flexible and extensible, and gives the option of extending the
interpreter to other code and make it a partial evaluator.
2018-08-25 02:07:01 +02:00