Commit Graph

12 Commits

Author SHA1 Message Date
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