Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Go support #59

@aykevl

Description

@aykevl

I'm not from the Go team, but I've been working on an alternative implementation of the Go compiler+runtime that works well on microcontrollers and WebAssembly called TinyGo. It already supports WebAssembly but does not have a usable GC there. Hence my interest.

I would really like to use a built-in memory manager, but I'm afraid that the current spec would be a very poor fit for the Go language. I've listed the issues here in order of importance.

  • Interior pointers are absolutely required to get reasonable performance out of the GC. Without interior pointers, literally every struct member would have to be boxed killing performance and blowing up memory usage. Even a system with fat pointers would be much better than not having interior pointers at all. Also, if it turns out inref is commonly used in WebAssembly, implementations may decide to switch to a GC that supports interior pointers transparently to improve performance. Also think of non-browser environments that may be optimized to run Go compiled to WebAssembly, for example.
  • Nested structs would also be very important, both because Go supports nesting structs (which may have their address taken) but more importantly because many Go types are commonly implemented as aggregate types: slices, strings, interfaces, complex numbers, and (in my implementation) function values.
  • Fixed size arrays that are dynamically indexed would again avoid some unnecessary boxing. Go supports fixed size arrays (which are different from slices) that can be struct members, and it would be useful to not need to box those as dynamically-sized array types.
  • Go supports arrays and slices of structs, which are normally stored sequentially in memory for efficiency reasons. They aren't used as much as some of the other things I listed, but it would be unfortunate to need to box all of those structs just to get good performance.

There are also some parts of the spec that I think are more complicated than needed, but I should probably write that down in a separate issue to keep things focused.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions