aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata
AgeCommit message (Collapse)Author
2023-04-26main: print source location when a panic happens in -monitorAyke van Laethem
The previous commit started printing the instruction address for runtime panics. This commit starts using this address to print the source location. Here is an example where this feature is very useful. There is a heap allocation in the Bluetooth package, but we don't know where exactly. Printing the instruction address of the panic is already useful, but what is even more useful is looking up this address in the DWARF debug information that's part of the binary: $ tinygo flash -target=circuitplay-bluefruit -monitor ./examples/heartrate Connected to /dev/ttyACM0. Press Ctrl-C to exit. tick 00:00.810 tick 00:01.587 tick 00:02.387 tick 00:03.244 panic: runtime error at 0x00027c4d: alloc in interrupt [tinygo: panic at /home/ayke/src/tinygo/bluetooth/adapter_sd.go:74:4] To be clear, this path isn't stored on the microcontroller. It's stored as part of the build, and `-monitor` just looks up the path from the panic message. Possible enhancements: - Print such an address for regular panics as well. I'm not sure that's so useful, as it's usually a lot easier to look up panics just by their message. - Use runtimePanicAt (instead of runtimePanic) in other locations, if that proves to be beneficial. - Print the TinyGo-generated output in some other color, to distinguish it from the regular console output. - Print more details when panicking (registers, stack values), and print an actual backtrace.
2023-04-11testdata: add test for else/defer bugDamian Gryski
2023-03-24feat: fix typosshivay
2023-03-21compiler: correctly generate code for local named typesAyke van Laethem
It is possible to create function-local named types: func foo() any { type named int return named(0) } This patch makes sure they don't alias with named types declared at the package scope. Bug originally found by Damian Gryski while working on reflect support.
2023-03-18compiler: support all kinds of recursive typesAyke van Laethem
Previously we only supported recursive types in structs. But there can be other kinds of recursive types, like slices: type RecursiveSlice []RecursiveSlice This doesn't involve structs, so it led to infinite recursion in the compiler. This fix avoids recursion at the proper level: at the place where the named type is defined.
2023-03-15compiler,reflect: fix pkgpath for struct fieldsDamian Gryski
2023-03-05testdata: add brandondube/pctl to corpusDamian Gryski
2023-02-25runtime: properly turn pointer into empty interface when hashingDamian Gryski
2023-02-18runtime: implement KeepAlive using inline assemblyAyke van Laethem
2023-02-17reflect: make sure null bytes are supported in tagsAyke van Laethem
2023-01-17builder: add support for Go 1.20Ayke van Laethem
Not all features work yet, but allow it to compile with this Go version.
2022-12-07reflect: track flags when size changes from fits-in-pointer to notDamian Gryski
Fixes #3328
2022-11-15corpus: add buger/jsonparserDan Kegel
2022-11-03testdata: clearly correct values for timing test with a little more time to ↵deadprogram
spare on CI machines Signed-off-by: deadprogram <[email protected]>
2022-11-02cgo: support anonymous enums included in multiple Go filesAyke van Laethem
Anonymous enums (often used in typedefs) triggered a problem that was already solved for structs but wasn't yet solved for enums. So this patch generalizes the code to work for both structs and enums, and adds testing for both.
2022-10-19corpus: remove 'noasm' from some testsAyke van Laethem
Unfortunately I couldn't fully test these changes, but they don't seem to be needed on linux/amd64.
2022-10-18corpus: remove golang.org/x/crypto/internal/subtleAyke van Laethem
This subdirectory appears to be gone now.
2022-10-13cgo: add support for C.float and C.doubleAyke van Laethem
They are not necessary in TinyGo because they always map to float32 and float64, but it's a good idea to add them regardless for compatibility with existing software. (Now I think about it, perhaps it would have been better to require explicit casts here just in case we want to support some really weird C system, but then again we even force 64-bit double on AVR even though avr-gcc defaults to 32-bit double).
2022-09-28testdata: increase timings used for timers test to try to avoid race ↵deadprogram
condition errors on macOS CI Signed-off-by: deadprogram <[email protected]>
2022-09-16cgo: implement support for static functionsAyke van Laethem
2022-09-15interp: fix reading from external globalAyke van Laethem
This fixes https://github.com/tinygo-org/tinygo/issues/3020.
2022-09-04add github.com/soypat/mu8 to corpus.yamlPatricio Whittingslow
2022-09-01reflect: implement CanInterface and fix string Index()Ayke van Laethem
This commit fixes two related issues: 1. CanInterface was unimplemented. It now uses the same check as is used in Interface() itself. This issue led to https://github.com/tinygo-org/tinygo/issues/3033 2. Allow making an interface out of a string char element. Doing this in one commit (instead of two) because they are shown to be correct with the same tests.
2022-09-01compiler: fix unsafe.Sizeof for chan and map valuesAyke van Laethem
These types are simply pointers. For some reason, they were never implemented. Fixes https://github.com/tinygo-org/tinygo/issues/3083.
2022-08-30all: drop support for Go 1.16 and Go 1.17Ayke van Laethem
2022-08-25runtime: implement resetTimerJoe Shaw
2022-08-24runtime: improve reliability of timers test in CIKenneth Bell
2022-08-23runtime: add support for time.NewTimer and time.NewTickerKenneth Bell
This commit adds support for time.NewTimer and time.NewTicker. It also adds support for the Stop() method on time.Timer, but doesn't (yet) add support for the Reset() method. The implementation has been carefully written so that programs that don't use these timers will normally not see an increase in RAM or binary size. None of the examples in the drivers repo change as a result of this commit. This comes at the cost of slightly more complex code and possibly slower execution of the timers when they are used.
2022-08-22testdata: add russross/blackfriday markdown parser to corpusDamian Gryski
2022-08-22compiler: fix incorrect DWARF type in some generic parametersAyke van Laethem
For some reason, the type of a function parameter can sometimes be of interface type, while it should be the underlying type. This might be a bug in the x/tools/go/ssa package but this is a simple workaround.
2022-08-07all: move from os.IsFoo to errors.Is(err, ErrFoo)Damian Gryski
2022-08-07all: remove calls to deprecated ioutil packageDamian Gryski
Fixes produced via semgrep and https://github.com/dgryski/semgrep-go/blob/master/ioutil.yml
2022-08-01Set internal linkage and keeping default visibility for anonymous functionsPhil Kedy
2022-07-28compiler: fix issue with methods on generic structsPhil Kedy
2022-07-13Add support for printing slices via print/printlnFederico G. Schwindt
With help from @aykevl.
2022-06-24compiler: really define runtime/volatile.* functionsAyke van Laethem
This makes them available to deferred calls, among others.
2022-06-24compiler: define atomic intrinsic functions directlyAyke van Laethem
This changes the compiler from treating calls to sync/atomic.* functions as special calls (emitted directly at the call site) to actually defining their declarations when there is no Go SSA implementation. And rely on the inliner to inline these very small functions. This works a bit better in practice. For example, this makes it possible to use these functions in deferred function calls. This commit is a bit large because it also needs to refactor a few things to make it possible to define such intrinsic functions.
2022-06-16compiler: implement recover() built-in functionAyke van Laethem
2022-06-11compiler: add support for type parameters (aka generics)Ayke van Laethem
...that was surprisingly easy.
2022-05-30corpus: make non-working packages easy to uncommentAyke van Laethem
This makes it easier to test for changes, just remove the hash sign in front of some packages to test them.
2022-05-30all: add support for the embed packageAyke van Laethem
2022-05-25compiler: alignof(func) is 1 pointer, not 2Steven Kabbes
This ensures that an embedded [0]func() never ends up being larger than 1 pointer, which is requried by protobuf processing code.
2022-05-19compiler: alignof [0]func() = 1Steven Kabbes
In the go protobuf code, a pattern is used to statically prevent comparable structs by embedding: ``` type DoNotCompare [0]func() type message struct { DoNotCompare data *uint32 } ``` Previously, sizezof(message{}) is 2 words large, but it only needs to be 1 byte. Making it be 1 byte allows protobufs to compile slightly more (though not all the way).
2022-05-18avr: enable testdata/map.goAyke van Laethem
The test needs a few changes to support low-memory devices but other than that, it works fine.
2022-04-28testdata: move map growth test to map.goDamian Gryski
2022-04-28testdata: add test for mapgrowth logicDamian Gryski
2022-04-07compiler: fix difference in aliases in interface methodsAyke van Laethem
There used to be a difference between `byte` and `uint8` in interface methods. These are aliases, so they should be treated the same. This patch introduces a custom serialization format for types, circumventing the `Type.String()` method that is slightly wrong for our purposes. This also fixes an issue with the `any` keyword in Go 1.18, which suffers from the same problem (but this time actually leads to a crash).
2022-04-07compiler: allow slices of empty structs.Dan Kegel
Fixes https://github.com/tinygo-org/tinygo/issues/2749
2022-04-06main_test.go: fork testdata/testing.go for go 1.18Dan Kegel
2022-04-05Revert "testdata: add test for mapgrowth logic"Ron Evans
This reverts commit 73571dd423f343a0126e65a8149bf5ac83ee3f55.