Link Details

Link 1042241 thumbnail
User 448255 avatar

By dotCore
via docs.google.com
Submitted: Oct 01 2013 / 22:51

The Go 1.0 runtime uses dynamic code generation to implement closures. I took this approach primarily out of expedience: it avoided toolchain-wide changes to the representation of function values and to the function calling convention. However, it is clear that in the long term we should not depend on dynamic code generation, since it limits the environments in which Go can run. It also complicates minor parts of the toolchain: the stack trace code has ugly heuristics to handle closures, and the gdb support cannot get past a closure in a stack trace. The canonical solution is to represent a closure as a pair of pointers, one to static code and one to a dynamic context pointer giving access to the captured variables.
  • 2
  • 0
  • 69
  • 13

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (2)



Voters Against This Link (0)



    Reactive Programming with Akka
    Written by: Ryan Knight
    Featured Refcardz: Top Refcardz:
    1. Design Patterns
    2. OO JS
    3. Cont. Delivery
    4. Java Performance
    5. HTML5 Mobile
    1. Java Performance
    2. Node.js
    3. Debugging JavaScript
    4. Java
    5. Java Concurrency