Commit Graph

21 Commits

Author SHA1 Message Date
Michael McLoughlin
4f7179b08e gotypes,tests: test case for issue #195 (#214)
Adds test cases for the bug in #195, similar to #212.

Updates #195
Updates #191
2021-10-30 13:47:55 -07:00
Michael McLoughlin
7de02518a2 gotypes: fix argument size for signatures without return types (#212)
This fixes a bug in argument size calculation in the case where the function
has no return values. Previously it was padding the argument struct to max
alignment, but this only happens if there are return values following.

Updates #191
2021-10-30 13:32:25 -07:00
Michael McLoughlin
f295bde84c pass: ensure frame pointer register is saved (#174)
Currently `avo` uses `BP` as a standard general-purpose register. However, `BP` is used for the frame pointer and should be callee-save. Under some circumstances, the Go assembler will do this automatically, but not always. At the moment `avo` can produce code that clobbers the `BP` register. Since Go 1.16 this code will also fail a new `go vet` check.

This PR provides a (currently sub-optimal) fix for the issue. It introduces an `EnsureBasePointerCalleeSaved` pass which will check if the base pointer is written to by a function, and if so will artificially ensure that the function has a non-zero frame size. This will trigger the Go assembler to automatically save and restore the BP register.

In addition, we update the `asmdecl` tool to `asmvet`, which includes the `framepointer` vet check.

Updates #156
2021-04-18 18:37:56 -07:00
Michael McLoughlin
f891fe8d97 ci: test on go 1.14 (#138)
Add go 1.14 to CI testing. Upgrade golang.org/x/tools dependency to resolve golang/go#37617.
2020-04-25 01:27:57 -07:00
Michael McLoughlin
3355ecfbfd lint: stop using deprecated go/packages api (#87)
The packages.Load* constants have been deprecated in favor of packages.Need*.
2019-06-13 11:20:49 -07:00
Michael McLoughlin
d0da7e47ad gotypes: add missing Underlying() calls (#78)
Issue #77 pointed out that in the case of named array types, the gotypes Components type fails to recognize the underlying type as an array. In fact this problem was more widespread. This diff fixes the missing calls to Underlying() and adds some test cases.

Fixes #77
2019-04-13 18:50:51 -04:00
Michael McLoughlin
9eb409b935 gotypes,build: pointer dereference (#61)
Provides a method on `gotypes.Component` to allow pointer dereference. This will enable `gotypes` helpers to be used with struct pointer arguments, for example.

Updates #53 
Fixes #54
2019-01-27 19:22:21 -08:00
Michael McLoughlin
eb225e9d2c gotypes,build: add Implement (#58)
By using Implement you can provide a definition of a function, taking the signature from a stub in the package. One major benefit of this approach is it makes it easy to handle external types in the function signature.

Updates #55
2019-01-22 22:35:01 -08:00
Michael McLoughlin
52a501c7be gotypes: doc exported symbols (#9) 2019-01-04 20:38:21 -08:00
Michael McLoughlin
023324a4ec examples/returns: demonstrate return types 2018-12-27 21:38:17 -08:00
Michael McLoughlin
854271d978 examples/stadtx: commit first working example 2018-12-19 22:09:55 -08:00
Michael McLoughlin
48a84b6b13 fix signature size/alignment computation 2018-12-19 13:08:56 -08:00
Michael McLoughlin
bc9a2aa46b gotypes: support struct fields 2018-12-17 23:28:31 -08:00
Michael McLoughlin
34a3ddefcc start example/test for components access 2018-12-17 20:52:26 -08:00
Michael McLoughlin
b89d211ff4 examples/complex: and bugfixes 2018-12-12 00:02:22 -08:00
Michael McLoughlin
2189d38d1e examples: add sum example (its not pretty) 2018-12-11 23:02:50 -08:00
Michael McLoughlin
4dc909a81e remove unused struct field 2018-12-08 22:16:09 -08:00
Michael McLoughlin
5431f2edef support signatures and param load/stores 2018-12-08 21:16:03 -08:00
Michael McLoughlin
69ee0e39cb parameter loading 2018-12-08 20:14:51 -08:00
Michael McLoughlin
bbbf6399a1 gotypes: saving progress (temporarily broken tests) 2018-12-07 18:37:42 -08:00
Michael McLoughlin
c86ef5ecae gotypes 2018-12-06 21:58:51 -08:00