gopar

command
v0.0.0-...-9662d31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2013 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Access pass function propogation

Alias accesses to function parameters passed by pointers, and record global variable accesses. Propogate accesses upwards through the blocks.

func foo(ptr *DataA, val DataB) {
  // Read ptr
  // Write ptr
  // Read val
  // Write val
}
func bar(index int, val []DataB) int {
  return val[index]
}
func main() {
  a := &DataA{}
  foo(a, DataB{}) // bubble up the reads and writes to "a" (ptr)
  i := 0
  aList := []DataA{a}
  bar(i, aList) // bubble up val[index] -> aList[i] access
}

Access pass propogation

Pass accesses up through the blocks to the function declaration

Invalid constructs pass

Types

Supports operations on types, such as figuring out the type of a struct field or array access. Also figures out the result of a binary expression between two types, or a dereference (*) or address-of (&) operation.

Type definitions are fully-defined (Type.final = true), all other types are references to them.

Write kernels pass

Generate the kernel source for loops, and write them to a text constant

Conversion between Go and C: If, range, for, switch init declarations are wrapped in another closure:

{
   a = 1
   if a {

   }
}

Assign := statements declare their variable type first int a; a = 1; // a := 1

Function call return values are passed as pointer arguments on the end of a call. a, b, c := func(1, 2) int a, b, c; func(1, 2, &a, &b, &c);

Switch statements have implicit breaks in Go, and explicitly declare "fallthrough"

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL