Help with assembly of builtin go functions

In the recent days I have been working on developing a Golang compiler. I am almost done with the laxer+parser and will soon start on the typechecking phase. However, when I get to the IR phase (which I admit is maybe a few weeks away) I realised I might not know certain things related to it. So here are the things I have:

  1. How are things like defer, go etc implemented in golang (from a low level perspective)? Like how do I write IR/assembly to do threading etc?
  2. How are the builtin functions here implemented in IR/assembly?
  3. Also, it would be of great help if I could find links to existing assembly routines of a golang compiler as reference, though perhaps I would be able to implement the simpler ones myself.
    A reference to a source / any direction in general is greatly appreciated. Thanks in advance.

Hi, @Test_Zero, the Go reference implementation source code is available from

Functions like append, make, and len are implemented as compiler intrinsics, though. You’ll have to look at the compiler implementation here and/or inspect emitted assembly of compiled sources emitted by the reference implementation.

1 Like

Thanks a lot. I will look into the sources you mentioned :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.