aboutsummaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2024-08-06compileopts: add CanonicalArchName to centralize arch detectioncanonical-arch-nameAyke van Laethem
It's possible to detect the architecture from the target triple, but there are a number of exceptions that make it unpleasant to use for this purpose. There are just too many weird exceptions (like mips vs mipsel, and armv6m vs thumv6m vs arm64 vs aarch64) so it's better to centralize these to canonical architecture names. I picked the architecture names that happen to match the musl architecture names, because those seem the most natural to me.
2024-08-06main: show runtime panic addresses for `tinygo run`Ayke van Laethem
This adds the same panic locations that are already present for `tinygo flash -monitor`, but for `tinygo run` and `tinygo test`. For example, this is the output that I get while working on some GC code. It now shows the source location instead of just an address: $ tinygo test -v archive/zip === RUN TestReader === RUN TestReader/test.zip panic: runtime error at 0x000000000024d9b4: goroutine stack overflow [tinygo: panic at /home/ayke/src/tinygo/tinygo/src/internal/task/task_stack.go:58:15] FAIL archive/zip 0.139s (This particular location isn't all that useful, but it shows that the feature works).
2024-08-06ci: don't include prebuilt libraries in the releaseAyke van Laethem
These libraries will be automatically built when needed and cached. The main reason these were needed is for play.tinygo.org, but I've now prebuilt them there directly (so they don't need to be built for every tarball).
2024-08-02os: add file.Truncateleongross
2024-07-31runtime: Simplify slice growing/appending code (#4287)L. Pereira
* reflect: rawFieldByNameFunc: copy index slice to avoid later overwrites * runtime: Simplify slice growing/appending code Refactor the slice appending function to rely on the slice growing function, and remove branches/loops to use a branchfree variant. Signed-off-by: L. Pereira <[email protected]> * runtime: Remove one branch in sliceAppend() Both branches were equivalent, so guard the overall logic in sliceAppend() with the more general condition. Signed-off-by: L. Pereira <[email protected]> * runtime: Simplify slice growing calculation Use `bits.Len()` rather than `32 - bits.LeadingZeros32()`. They're equivalent, but the Len version is a bit easier to read. Signed-off-by: L. Pereira <[email protected]> * reflect: Always call sliceGrow() in extendSlice() sliceGrow() will return the old slice if its capacity is large enough. Signed-off-by: L. Pereira <[email protected]> --------- Signed-off-by: L. Pereira <[email protected]> Co-authored-by: Damian Gryski <[email protected]>
2024-07-31reflect: return correct name for unsafe.Pointer typeAyke van Laethem
For some reason, the type kind name is "unsafe.Pointer" while the .Name() method just returns "Pointer". Not sure why this difference exists, but to be able to test .Name() in testdata/reflect.go it needs to match.
2024-07-31transform: use thinlto-pre-link passesAyke van Laethem
This improves compilation performance by about 5% in my quick test, while increasing binary size on average by 0.13% when comparing the smoke tests in the drivers repo (and about two thirds of that 0.13% is actually caused by a single smoke test). I think this is a good idea because it aligns the TinyGo optimization sequence with what ThinLTO expects.
2024-07-29Revert "Getting DeepEqual to work with maps whose key is an interface (#4360)"Ayke van Laethem
This reverts commit 1fd75ffbda1ff021289f2feb6a062434df68d8b7. The change is not correct and allows code to continue while it should panic. For details, see: https://github.com/tinygo-org/tinygo/pull/4360#issuecomment-2252943012
2024-07-24Getting DeepEqual to work with maps whose key is an interface (#4360)Laurent Demailly
reflect: Getting DeepEqual to work with maps whose key is an interface
2024-07-23Add missing T.DeadlineLaurent Demailly
2024-07-23add Fork and Exec libc hooksleongross
Signed-off-by: leongross <[email protected]>
2024-07-22all: add linux/mipsle supportAyke van Laethem
This adds linux/mipsle (little endian Mips) support to TinyGo. It also adds experimental linux/mips (big-endian) support. It doesn't quite work yet, some parts of the standard library (like the reflect package) currently seem to assume a little-endian system.
2024-07-21build: add package ID to compiler and optimization error messagesAyke van Laethem
This improves error reporting slightly.
2024-07-21os/Chown (#4213)leongross
src/os, src/syscall: add os.Chown
2024-07-21net: update to latest net packagedeadprogram
Signed-off-by: deadprogram <[email protected]>
2024-07-20Add enough tls.ConnectionState and tls.CipherSuiteName() to compile ↵Laurent Demailly
fortio/log (#4345) src/crypt: add enough tls.ConnectionState and tls.CipherSuiteName() to compile fortio/log
2024-07-20rewrite Reply() to fix sending long replies in I2C Target ModeMatthew Hiles
2024-07-20Allows compilation of code using debug.BuildInfo and show correct tinygo ↵Laurent Demailly
version (#4343) debug: Allows compilation of code using debug.BuildInfo and show correct tinygo version
2024-07-20diagnostics: sort package diagnostics by positionAyke van Laethem
Previously, the error messages could be shown out of order. With this patch, the errors are sorted before being shown to the user. This makes it easier to read the error messages, and matches what the `go` toolchain does.
2024-07-20diagnostics: move diagnostic printing to a new packageAyke van Laethem
This is a refactor, which should (in theory) not change the behavior of the compiler. But since this is a pretty large change, there is a chance there will be some regressions. For that reason, the previous commits added a bunch of tests to make sure most error messages will not be changed due to this refactor.
2024-07-20main: add test for error coming from the optimizerAyke van Laethem
This is just one optimizer pass that's easy to test for. There are others, but I'm ignoring them for now. The one other that would be reasonable to test is when starting a goroutine with -gc=none, but I'm leaving that one for another time.
2024-07-20main: add error tests for the compilerAyke van Laethem
The compiler can in fact return errors, but these weren't tested yet.
2024-07-20main: add interp testsAyke van Laethem
This one needed more advanced checking of the error messages, because we don't want to hardcode things like `!dbg !10` in the output.
2024-07-20main: refactor error messages to use FileCheck-like patternsAyke van Laethem
Match the error messages in testdata/errors/*.go like LLVM FileCheck, which includes regular expressions. I believe this is much more flexible, and LLVM uses it in nearly all of their tests so it must work quite well for compilers.
2024-07-20fix: set ubuntu version to 24.04 to try to address #4347deadprogram
Signed-off-by: deadprogram <[email protected]>
2024-07-18syscall: remove some dead codeAyke van Laethem
Not sure why it's here but it's not referenced anywhere.
2024-07-17all: simplify wasm-tools-go dependencyRandy Reddig
- add internal/wasm-tools/go.mod file to depend on wasm-tools-go - copy package cm into src/internal/cm - remove wasm-tools-go "vendor" submodule internal/tools: fix typo go.{mod,sum}, internal/tools: add wit-bindgen-go to tools GNUmakefile: use go run for wit-bindgen-go GNUmakefile: add tools target to go:generate tools binaries in internal/tools GNUmakefile: add .PHONY for lint and spell GNUmakefile, internal/cm: vendor package cm into internal/cm go.{mod,sum}: update wasm-tools-go to v0.1.4 internal/wasi: use internal/cm package remove submodule src/vendor/github.com/ydnar/wasm-tools-go GNUmakefile: add comment documenting what wasi-cm target does go.{mod,sum}: remove toolchain; go mod tidy go.mod: revert to Go 1.19 go.mod: go 1.19 go.{mod,sum}, internal/{tools,wasm-tools}: revert root go.mod file to go1.19 Create a wasm-tools specific module that can require go1.22 for wasm-tools-go.
2024-07-15add chromeos 9p supportTai Groot
2024-07-14Do not stop compilation on compiler warningsAnatol Pomozov
Compilers like GCC keep adding new checks that produce new warnings. Sometimes it can be false positives. Do not treat such warnings in binaryen library as errors. tinygo won't be able to provide zero warnings in its dependencies. Closes #4332
2024-07-13loader: handle `go list` errors inside TinyGoAyke van Laethem
Instead of exiting with an error, handle these errors internally. This will enable a few improvements in the future.
2024-07-13libclang: do not make error locations relativeAyke van Laethem
This is done at a later time anyway, so doesn't need to be done in the cgo package. In fact, _not_ doing it there makes it easier to print correct relative packages.
2024-07-13all: add testing for compiler error messagesAyke van Laethem
This is needed for some improvements I'm going to make next. This commit also refactors error handling slightly to make it more easily testable, this should hopefully not result in any actual changes in behavior.
2024-07-13builder: remove workaround for generics race conditionAyke van Laethem
This commit reverts commit 13a8eae0d. It appars that the race has been fixed by https://github.com/golang/tools/commit/db513b091504, which we now use because it fixes another race condition as well. See: https://github.com/tinygo-org/tinygo/issues/4206
2024-07-13cgo: support preprocessor macros passed on the command lineAyke van Laethem
Go code might sometimes want to use preprocessor macros that were passed on the command line. This wasn't working before and resulted in the following error: internal error: could not find file where macro is defined This is now supported, though location information isn't available (which makes sense: the command line is not a file). I had to use the `clang_tokenize` API for this and reconstruct the original source location. Apparently this is the only way to do it: https://stackoverflow.com/a/19074846/559350 In the future we could consider replacing our own tokenization with the tokenizer that's built into Clang directly. This should reduce the possibility of bugs a bit.
2024-07-09fix: remove message after test binary builtDmitry Shemin
2024-07-08main_test: Diff expected and actual results when tests fail (#4288)L. Pereira
Uses a vendored "internal/diff" from Big Go to show the differences between the expected and actual outputs when tests fail. Signed-off-by: L. Pereira <[email protected]>
2024-07-08gc_leaking: Don't zero out new allocations in some targets (#4302)L. Pereira
Wasm linear memory is always initialized to zero by definition, so there's no need to waste time zeroing out this allocation. This is the case for freshly-obtained memory from mmap(). Signed-off-by: L. Pereira <[email protected]>
2024-07-08internal/wasi: update to [email protected] (#4326)Randy Reddig
* internal/wasi: update to [email protected] See https://github.com/ydnar/wasm-tools-go/releases/tag/v0.1.1 for additional information. * internal/wasi: update to [email protected] * internal/wasi: regenerate with [email protected]
2024-07-08runtime: implement dummy getAuxv to satisfy golang.org/x/sys/cpu (#4325)Elias Naur
Fixes the program package main import _ "golang.org/x/sys/cpu" func main() { }
2024-07-03transform: fix incorrect alignment of heap-to-stack transformAyke van Laethem
It assumed the maximum alignment was equal to sizeof(void*), which is definitely not the case. So this only worked more or less by accident previously. It now uses the alignment as specified by the frontend, or else `unsafe.Alignof(complex128)` which is typically the maximum alignment of a given platform (though this shouldn't really happen in practice: the optimizer should keep the 'align' attribute in place).
2024-07-03compiler: add 'align' attribute to runtime.alloc callsAyke van Laethem
This adds something like 'align 4' to the runtime.alloc calls, so that the compiler knows the alignment of the allocation and can optimize accordingly. The optimization is very small, only 0.01% in my small test. However, my plan is to read the value in the heap-to-stack transform pass to make it more correct and let it produce slightly more optimal code.
2024-07-02wasi preview 2 support (#4027)Damian Gryski
* all: wasip2 support Co-authored-by: Randy Reddig <[email protected]>
2024-06-28test: support GOOS/GOARCH pairs in the -target flagAyke van Laethem
This means it's possible to test just a particular OS/arch with a command like this: go test -run=Build -target=linux/arm I found it useful while working on MIPS support.
2024-06-27add support for unix.{RawSyscall,RawSyscallNoError}leongross
2024-06-27add support for unix.Syscall* invocationsleongross
Signed-off-by: leongross <[email protected]>
2024-06-27wasm-unknown: make sure the os package can be importedAyke van Laethem
See: https://github.com/tinygo-org/tinygo/issues/4314 The os package isn't particularly useful on wasm-unknown, but just like on baremetal systems it's imported by a lot of packages so it should at least be possible to import this package.
2024-06-25version: update to 0.33.0-devdeadprogram
Signed-off-by: deadprogram <[email protected]>
2024-06-25compiler: remove old atomics workaround for AVRAyke van Laethem
The bug should have been fixed in any LLVM version that we currently support.
2024-06-24machine: use new internal/binary packageAyke van Laethem
The encoding/binary package in Go 1.23 imports the slices package, which results in circular import when imported from the machine package. Therefore, encoding/binary cannot be used in the machine package. This commit fixes that by introducing a new internal/binary package that is just plain Go code without dependencies. It can be safely used anywhere (including the runtime if needed).
2024-06-23all: use latest version of x/toolsAyke van Laethem
We previously picked a work-in-progress patch, but this is the proper fix for this race condition. I think we should use that instead of relying on the previous work-in-progress patch.