Ayke van Laethem
8ba3fef7d7
runtime/scheduler: always update task state
Not updating it only saves 4 bytes and makes debugging harder.
6 years ago
Ayke van Laethem
d183f12395
nrf: fix sleep
For some reason, the old behavior stopped working at some point (maybe
at the nrfx update?). Change sleep behavior to be more correct.
6 years ago
Ayke van Laethem
1e90858145
Fix blocking functions
Don't think they're blocking when the scheduler has been disabled.
6 years ago
Ayke van Laethem
bfff0c33e4
Fix external globals
This broke the allocator on ARM, and with that the blinky example.
6 years ago
Ayke van Laethem
88b6b2e7f5
Optimize/eliminate bounds checking
TODO: do better at it by tracking min/max values of integers. The
following straightforward code doesn't have its bounds checks removed:
for _, n := range slice {
println(n)
}
6 years ago
Ayke van Laethem
42cddd3260
Move runtime.TargetBits out of the compiler
6 years ago
Ayke van Laethem
9fca0e99b5
compiler: use InternalLinkage where appropriate
Internal linkage means that symbols show up in tools like objdump, which
is very useful for debugging.
6 years ago
Ayke van Laethem
58c87329d4
Implement closures and bound methods
6 years ago
Ayke van Laethem
58b853bbef
Defer for trivial cases
6 years ago
Ayke van Laethem
cd2a9d99a1
Add dummy runtime.SetFinalizer()
Requirement for the os package. The os package can't be compiled yet,
though.
6 years ago
Ayke van Laethem
887814a69d
Be able to handle complex64 and complex128 types
No support for complex types yet, but at least be able to handle their
types.
6 years ago
Ayke van Laethem
94ce893ab4
Copy printfloat() from original runtime
I've tried writing my own, but I couldn't make it correct in all cases.
So just copy the one from upstream for now, hopefully to be replaced at
some point.
TODO: add a printfloat32() implementation, now it just casts to float64.
This will be useful for embedded systems that sometimes have float32 but
not float64.
6 years ago
Ayke van Laethem
46d2d2e777
Add support for floats
I'm not sure all operations are supported but the vast majority should
be supported now.
This commit also refactors binop translation.
6 years ago
Ayke van Laethem
3cdf606183
Improve runtime.printuint32: avoid recursion
This reduces size slightly at least on the PCA10040, and is probably
faster and probably uses less stack as well.
6 years ago
Ayke van Laethem
f057d612fc
Add support for indexing in an array by a non-constant
6 years ago
Ayke van Laethem
a1359d7f64
passes: small code cleanup
6 years ago
Ayke van Laethem
734b0cb6bc
Implement runtime functions for reflect
The reflect package isn't supported yet. But at least the Go
parser/typechecker can now deal with it.
6 years ago
Ayke van Laethem
b13cfc5255
Be able to deal with anonymous functions
6 years ago
Ayke van Laethem
674b506bb2
Replace compiler hack for sync package with //go:linkname
6 years ago
Ayke van Laethem
74bd378c29
Replace _llvm_* workaround in the scheduler with //go:linkname
This also removes the need for the _llvm_ special case in the compiler.
And it makes the scheduler code a whole lot nicer!
6 years ago
Ayke van Laethem
771f23e320
Implement //go:linkname pragma
6 years ago
Ayke van Laethem
906e061e37
Replace own dummy syscall with standard library syscall
This makes it easier to support other standard library packages.
6 years ago
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.
6 years ago
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!")
6 years ago
Ayke van Laethem
15f62b29cf
Add runtime.GOOS
6 years ago
Ayke van Laethem
82d0d70ba2
Add (hardcoded) runtime.GOROOT()
Necessary for the time package.
6 years ago
Ayke van Laethem
cfd20c7a12
Add a number for the "error" type by default
6 years ago
Ayke van Laethem
a5252d07f0
Support zero-initialized pointers in globals
6 years ago
Ayke van Laethem
5edf94ea10
Fix named structs inside global named structs
6 years ago
Ayke van Laethem
7956ca2f29
Function pointers in global variables
6 years ago
Ayke van Laethem
a4fd096393
Add dummy channel support
6 years ago
Ayke van Laethem
6e0c60a7a1
Some extra header docs
6 years ago
Ayke van Laethem
0b372ba5bd
Support initialized map values in another global
6 years ago
Ayke van Laethem
42711c11e9
Be able to print maps to some degree
Print the number of elements, or nil if it is a nil map.
6 years ago
Ayke van Laethem
d930a9ba16
Implement print() for interface values
6 years ago
Ayke van Laethem
25344bc08f
Reorder Program.interpret cases
6 years ago
Ayke van Laethem
75477eb14e
Implement global .data-initalized interfaces
6 years ago
Ayke van Laethem
d13c124df9
Implement casting from (Unicode) integer to string
6 years ago
Ayke van Laethem
fdc56d5940
Implement convert string <- []byte
6 years ago
Ayke van Laethem
eed25c78df
Clean up ssa.Convert and ssa.ChangeType
6 years ago
Ayke van Laethem
8b95b869ab
Implement string concatenation
6 years ago
Ayke van Laethem
c912091f8b
Add integer key support to hashmap
6 years ago
Ayke van Laethem
8f7db8661b
Move string type to runtime in separate file
6 years ago
Ayke van Laethem
bf160d096b
Move lenType definition to runtime (partially)
6 years ago
Ayke van Laethem
abaae5b90d
Remove unnecessary compiler workaround
This workaround isn't needed anymore: the feature has been implemented
now.
6 years ago
Ayke van Laethem
7991243554
Remove CGo from machine module
It isn't necessary anymore but apparently the Go importer didn't
complain about an unused import.
6 years ago
Ayke van Laethem
d4f5700625
Remove use of CGo in the runtime
CGo depends on syscall, which (in the standard library) depends on sync,
which depends on the runtime. There are also other import cycles. To be
able to use the syscall package from upstream, stop using CGo.
6 years ago
Ayke van Laethem
d620f0d188
Implement multiple return values from functions
Use structs in LLVM as it appears LLVM has no support for multiple
return values (I should look into how Rust does it...).
6 years ago
Ayke van Laethem
ee10162564
Extra check on interface asserts
Interface asserts haven't been implemented yet. Don't produce incorrect
code in that case.
6 years ago
Ayke van Laethem
0c71ed81a4
Rename runtime.itfmethod -> runtime.interfaceMethod
6 years ago