Граф коммитов

3753 коммитов

Автор SHA1 Сообщение Дата
Damian Gryski
bedd27b20e reflect: handle map-keys-as-interfaces for MapIter() 2023-03-25 22:32:29 +01:00
Damian Gryski
3612b7749e reflect: uncomment all(?) the tests that pass 2023-03-25 13:57:00 +01:00
Damian Gryski
45c916f5c0 reflect: rename tests in value_test to avoid conflicts upstream tests 2023-03-25 13:57:00 +01:00
Damian Gryski
688a5dbf8d reflct: reenable DeepEqual tests 2023-03-25 13:57:00 +01:00
Damian Gryski
35dcf135c0 reflect: comment out all tests but keep imports 2023-03-25 13:57:00 +01:00
Damian Gryski
c482d65397 reflect: replace all_test with copy from upstream 2023-03-25 13:57:00 +01:00
shivay
d73e12db63 feat: fix typos 2023-03-24 09:22:38 -07:00
Daniel Esteban
4b0e56cbec Added Gopher Badge support 2023-03-22 16:17:12 +01:00
Ayke van Laethem
62e1c3ebb7 wasm: implement the //go:wasmimport directive
It is implemented upstream and looks pretty stable.
2023-03-22 11:29:26 +01:00
deadprogram
a4a1001dd3 examples: use hid-keyboard example to show how to to override default USB VID, PID, manufacturer name, and product name
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-03-22 08:35:42 +01:00
deadprogram
e8f6df928c machine/usb: add ability to override default VID, PID, manufacturer name, and product name
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-03-22 08:35:42 +01:00
Ayke van Laethem
f180339d6b compiler: add alloc attributes to runtime.alloc
This gives a small improvement now, and is needed to be able to use the
Heap2Stack transform that's available in the Attributor pass. This
Heap2Stack transform could replace our custom OptimizeAllocs pass.

Most of the changes are just IR that changed, the actual change is
relatively small.

To give an example of why this is useful, here is the code size before
this change:

    $ tinygo build -o test -size=short ./testdata/stdlib.go
       code    data     bss |   flash     ram
      95620    1812     968 |   97432    2780

    $ tinygo build -o test -size=short ./testdata/stdlib.go
       code    data     bss |   flash     ram
      95380    1812     968 |   97192    2780

That's a 0.25% reduction. Not a whole lot, but nice for such a small
patch.
2023-03-22 00:34:43 +01:00
Ayke van Laethem
5ed0cecf0d nrf: fix memory issue in ADC read
There was a very subtle bug in the ADC read code: it stores a pointer to
a variable in a register, waits for the hardware to complete the read,
and then reads the value again from the local variable. Unfortunately,
the compiler doesn't know there is some form of synchronization
happening in between.

This can be fixed in roughly two ways:
  * Introduce some sort of synchronization.
  * Do a volatile read from the variable.

I chose the second one as it is probably the least intrusive. We
certainly don't need atomic instructions (the chip is single threaded),
we just need to tell the compiler the value could have changed by making
the read volatile.
2023-03-22 00:34:43 +01:00
Ayke van Laethem
523c6c0e3b compiler: correctly generate code for local named types
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-21 22:22:03 +01:00
Damian Gryski
17f5fb1071 reflect; SetLen() requires an addressable value 2023-03-21 20:53:37 +01:00
Damian Gryski
4d43df75d5 reflect: fix some vet issues 2023-03-21 20:53:37 +01:00
Damian Gryski
57b0c21492 reflect: tweak Type.String() for interfaces to make encoding/xml happy 2023-03-19 13:50:38 -07:00
Damian Gryski
8fb5877d9e reflect: fix isBinary() for float types 2023-03-19 13:49:55 -07:00
Damian Gryski
6fbe6fa2ae reflect: tweak Type.String() to match what encoding/json expects for empty structs 2023-03-19 20:37:57 +01:00
Damian Gryski
24b4dc31a4 reflect: stub MapOf() 2023-03-19 19:12:34 +01:00
Damian Gryski
4f8127d0bf builder: bump sizes tests 2023-03-19 17:45:43 +01:00
Damian Gryski
e0329b25de transform: fix OptimizeReflectImplements pass for new named elem offset 2023-03-19 17:45:43 +01:00
Damian Gryski
229f479a7d reflect: make sure pointerTo() works for named types 2023-03-19 17:45:43 +01:00
Damian Gryski
876f08979f compiler,reflect: sort out pkg path vs pkg name for named types 2023-03-19 17:45:43 +01:00
Damian Gryski
f2cc98caa5 compiler,reflect: adjust struct layout for type info 2023-03-19 17:45:43 +01:00
Damian Gryski
0d65b4dd26 compiler: only define the package path once
Adding https://github.com/tinygo-org/tinygo/pull/3534 by hand to avoid conflicts when I rebase.
2023-03-19 17:45:43 +01:00
Damian Gryski
6a685b2a8d reflect: add test for Type.NumMethod() 2023-03-19 17:45:43 +01:00
Damian Gryski
569817a514 refect: Type.String() should use a shortened package name 2023-03-19 17:45:43 +01:00
Damian Gryski
7a96f0f609 compiler,reflect: add reflect.Type.NumMethods() 2023-03-19 17:45:43 +01:00
deadprogram
821227a03b docker: correct path for GHCR dev container build
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-03-19 16:16:42 +01:00
Ayke van Laethem
5b42871baa compiler: support all kinds of recursive types
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-18 17:53:47 +01:00
deadprogram
c5598630c9 machine/stm32: correct Flash implementation
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-03-18 11:18:17 +01:00
Ayke van Laethem
6c40ee93fe transform: update wasm-abi to use opaque pointers 2023-03-16 13:46:03 -07:00
Ayke van Laethem
4acb1a5845 transform: update stringtobytes test to opaque pointers 2023-03-16 13:46:03 -07:00
Ayke van Laethem
e0f3333cc3 transform: update stringequal test to opaque pointers 2023-03-16 13:46:03 -07:00
Ayke van Laethem
af247e27ff transform: update stacksize test to opaque pointers 2023-03-16 13:46:03 -07:00
Ayke van Laethem
ec3a4da4df transform: update panic test to opaque pointers 2023-03-16 13:46:03 -07:00
Ayke van Laethem
905269bf11 transform: update maps test to opaque pointers 2023-03-16 13:46:03 -07:00
Ayke van Laethem
e4f29ae2f9 transform: update interrupt test to opaque pointers 2023-03-16 13:46:03 -07:00
Ayke van Laethem
7fb23824e2 transform: update interface test to opaque pointers 2023-03-16 13:46:03 -07:00
Ayke van Laethem
f8a6e662d8 transform: update gc-stackslots test to opaque pointers 2023-03-16 13:46:03 -07:00
Ayke van Laethem
0ddd65658e transform: update allocs test to opaque pointers
Also, rename most of the SSA values while we're at it.
2023-03-16 13:46:03 -07:00
Ayke van Laethem
db08b5aaa5 transform: update reflect-implements test to opaque pointers 2023-03-16 13:46:03 -07:00
deadprogram
383e7ae14a machine, runtime/interrupt: switch to use register definitions from device/gba
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-03-16 15:27:15 +01:00
deadprogram
4f7864b757 device/gba: add mostly complete hand-written register definitions
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-03-16 15:27:15 +01:00
Damian Gryski
833c91fceb builder: fix binary size rodata value 2023-03-15 21:53:57 +01:00
Damian Gryski
344e493ac8 compiler,reflect: fix pkgpath for struct fields 2023-03-15 21:53:57 +01:00
Damian Gryski
1626b50457 reflect: set PkgPath in StructField 2023-03-15 21:53:57 +01:00
Damian Gryski
93fb897feb compiler, reflect: properly handle embedded structs 2023-03-15 21:53:57 +01:00
Damian Gryski
15109a2924 reflect: disable visiblefields test for FieldByIndexErr 2023-03-15 21:53:57 +01:00