A Golang SSA Interpreter




package main

import (


var souce = `
package main

import "fmt"

func main() {

func init() {
	interp.RegisterExternal("fmt.init", func() {})
	interp.RegisterExternal("fmt.Println", fmt.Println)

func main() {
	err := interp.RunSource(interp.EnableTracing, souce)
	if err != nil {

  • 0.9.1 version cannot be compiled

    0.9.1 version cannot be compiled

    igop 0.9.1

    \load\embed_go116.go:94:29: not enough arguments in call to r.Load

    r.Load(bp.Dir, v) 

    \go\pkg\mod\github.com\visualfc\[email protected]\resolve.go

    Load(dir string, fset *token.FileSet, em *Embed) ([]*File, error)
    opened by fly-studio 1
  • how to execute with custom environment variables

    how to execute with custom environment variables

    like exec/cmd cmd := exec.CommandContext(...) cmd.Env = ....

    env := map[string]string{"X": "Y"}
    ctx := igop.NewContext(0)
    ctx.Env = env
    opened by fly-studio 1
  • what's package name of subfolder that import it

    what's package name of subfolder that import it

    - io_extra/
      - file.go
    - main.go

    how to import io_extra/file.go in main.go?

    import "io_extra"


    could not import io_extra (not found provider for types.Importer)

    opened by fly-studio 1
  • pkg: default remove net/rpc net/rpc/jsonrpc

    pkg: default remove net/rpc net/rpc/jsonrpc

    igop default load net/rpc and net/rpc/jsonrpc from source

    igop hook reflect api

    • reflect.Type.Method => reflectx.MethodByIndex
    • reflect.Type.MethodByName => reflectx.MethodByName
    opened by visualfc 0
  • qexp: fast export

    qexp: fast export

    fix https://github.com/goplus/igop/issues/153

    • remove ssa builder
    • fast export multiple pkgs
    • support pkg/...
    • support empty exported pkg. eg time/tzdata
    • igop: add sub cmd export
    opened by visualfc 0
  • check unsafe.Slice len out of range

    check unsafe.Slice len out of range

    fix https://github.com/goplus/igop/issues/178


    func unsafeslice(et *_type, ptr unsafe.Pointer, len int) {
    	if len < 0 {
    	mem, overflow := math.MulUintptr(et.size, uintptr(len))
    	if overflow || mem > -uintptr(ptr) {
    		if ptr == nil {
    			panic(errorString("unsafe.Slice: ptr is nil and len is not zero"))
    opened by visualfc 0
  • unsafe.Slice for go1.18

    unsafe.Slice for go1.18


    // sliced memory overflows address space
    last := (*byte)(unsafe.Pointer(^uintptr(0)))
    _ = unsafe.Slice(last, 1)
    mustPanic(func() { _ = unsafe.Slice(last, 2) })
    opened by visualfc 0
  • implement runtime callers

    implement runtime callers

    implement runtime func


    *runtime.Stack(bug []uint8, all bool) always = runtime.Stack(buf, false)

    ssa method wrapper

    func$bound T(0).f -> runtime main.T.f-fm func$thunk T.f -> runtime main.T.f func$thunk (struct{ T }).f -> runtime go.struct { main.T }.main.f 1

    type T int
    func (T) f() int
    func (*T) g()
    var (
    	// thunks
    	a = T.f
    	b = T.f
    	c = (struct{ T }).f
    	d = (struct{ T }).f
    	e = (*T).g
    	f = (*T).g
    	g = (struct{ *T }).g
    	h = (struct{ *T }).g
    	// bounds
    	i = T(0).f
    	j = T(0).f
    	k = new(T).g
    	l = new(T).g
    opened by visualfc 0
  • support nested type-parameterized declarations

    support nested type-parameterized declarations


    typeparam func

    • named sig: pkgpath.name[farg1,frag2;targ1,targ2]


    • types.Type->reflect.Type: use types scope
    opened by visualfc 0
  • bug: ssa select case call expr order

    bug: ssa select case call expr order


    bug: golang.org/x/tools/go/ssa build order fp, fc

    package main
    var c = make(chan int, 1)
    var nilch chan int
    var n = 1
    var x int
    var i interface{}
    var dummy = make(chan int)
    var m = make(map[int]int)
    var order = 0
    // check order of operations by ensuring that
    // successive calls to checkorder have increasing o values.
    func checkorder(o int) {
    	if o <= order {
    		println("invalid order", o, "after", order)
    	order = o
    func fc(c chan int, o int) chan int {
    	return c
    func fp(p *int, o int) *int {
    	return p
    func init() {
    	order = 0
    	c <- n
    	select {
    	case *fp(&x, 100) = <-fc(c, 1):
    	if x != n {
    func die(x int) {
    	println("have", x, "want", n)
    func main() {
    func init#1():
    0:                                                                entry P:0 S:2
    	*order = 0:int
    	t0 = *c                                                        chan int
    	t1 = *n                                                             int
    	send t0 <- t1
    	t2 = fp(x, 100:int)                                                *int
    	t3 = *c                                                        chan int
    	t4 = fc(t3, 1:int)                                             chan int
    	t5 = <-t4                                                           int
    	*t2 = t5
    	t6 = *x                                                             int
    	t7 = *n                                                             int
    	t8 = t6 != t7                                                      bool
    	if t8 goto 1 else 2
    1:                                                              if.then P:1 S:1
    	t9 = *x                                                             int
    	t10 = die(t9)                                                        ()
    	jump 2
    2:                                                              if.done P:2 S:0
    	t11 = *n                                                            int
    	t12 = t11 + 1:int                                                   int
    	*n = t12
    opened by visualfc 0
  • bug: golang fixedbugs/issue23017.go

    bug: golang fixedbugs/issue23017.go

    package main
    import (
    func main() {
    	type P struct{ i int }
    	var m = map[int]int{}
    	var p *P
    	defer func() {
    		check(1, len(m))
    		check(3, m[2])
    	m[2], p.i = 3, 2
    func check(want, got int) {
    	if want != got {
    		panic(fmt.Sprintf("wanted %d, but got %d", want, got))
    opened by visualfc 1
  • TODO: $GOROOT/test/fixedbugs

    TODO: $GOROOT/test/fixedbugs


    func init() {
    	if runtime.GOARCH == "386" {
    		gorootTestSkips["printbig.go"] = "load failed"
    		gorootTestSkips["peano.go"] = "stack overflow"
    	gorootTestSkips["closure.go"] = "runtime.ReadMemStats"
    	gorootTestSkips["divmod.go"] = "slow, 1m18s"
    	gorootTestSkips["copy.go"] = "slow, 13s"
    	gorootTestSkips["finprofiled.go"] = "slow, 21s"
    	gorootTestSkips["gcgort.go"] = "slow, 2s"
    	gorootTestSkips["nilptr.go"] = "skip drawin"
    	gorootTestSkips["heapsampling.go"] = "runtime.MemProfileRecord"
    	gorootTestSkips["makeslice.go"] = "TODO, panic info, allocation size out of range"
    	gorootTestSkips["stackobj.go"] = "skip gc"
    	gorootTestSkips["stackobj3.go"] = "skip gc"
    	gorootTestSkips["nilptr_aix.go"] = "skip"
    	gorootTestSkips["init1.go"] = "skip gc"
    	gorootTestSkips["ken/divconst.go"] = "slow, 3.5s"
    	gorootTestSkips["ken/modconst.go"] = "slow, 3.3s"
    	gorootTestSkips["fixedbugs/issue24491b.go"] = "timeout"
    	gorootTestSkips["fixedbugs/issue16249.go"] = "slow, 4.5s"
    	gorootTestSkips["fixedbugs/issue13169.go"] = "slow, 5.9s"
    	gorootTestSkips["fixedbugs/issue11656.go"] = "ignore"
    	gorootTestSkips["fixedbugs/issue15281.go"] = "runtime.ReadMemStats"
    	gorootTestSkips["fixedbugs/issue18149.go"] = "runtime.Caller macos //line not support c:/foo/bar.go:987"
    	gorootTestSkips["fixedbugs/issue22662.go"] = "runtime.Caller got $goroot/test/fixedbugs/foo.go:1; want foo.go:1"
    	gorootTestSkips["fixedbugs/issue27518b.go"] = "BUG, runtime.SetFinalizer"
    	gorootTestSkips["fixedbugs/issue32477.go"] = "BUG, runtime.SetFinalizer"
    	gorootTestSkips["fixedbugs/issue41239.go"] = "BUG, reflect.Append: different capacity on append"
    	gorootTestSkips["fixedbugs/issue32477.go"] = "BUG, runtime.SetFinalizer"
    	gorootTestSkips["fixedbugs/issue45175.go"] = "BUG, ssa.Phi call order"
    	gorootTestSkips["fixedbugs/issue4618.go"] = "testing.AllocsPerRun"
    	gorootTestSkips["fixedbugs/issue4667.go"] = "testing.AllocsPerRun"
    	gorootTestSkips["fixedbugs/issue8606b.go"] = "BUG, optimization check"
    	gorootTestSkips["fixedbugs/issue30116u.go"] = "BUG, slice bound check"
    	gorootTestSkips["chan/select5.go"] = "bug, select case expr call order"
    	// fixedbugs/issue7740.go
    	// const ulp = (1.0 + (2.0 / 3.0)) - (5.0 / 3.0)
    	// Go 1.14 1.15 1.16 ulp = 1.4916681462400413e-154
    	// Go 1.17 1.18 ulp = 0
    	ver := runtime.Version()[:6]
    	switch ver {
    	case "go1.17", "go1.18", "go1.19":
    		gorootTestSkips["fixedbugs/issue45045.go"] = "runtime.SetFinalizer"
    		gorootTestSkips["fixedbugs/issue46725.go"] = "runtime.SetFinalizer"
    		gorootTestSkips["abi/fibish.go"] = "slow, 34s"
    		gorootTestSkips["abi/fibish_closure.go"] = "slow, 35s"
    		gorootTestSkips["abi/uglyfib.go"] = "5m48s"
    		gorootTestSkips["fixedbugs/issue23017.go"] = "BUG"
    		gorootTestSkips["typeparam/chans.go"] = "runtime.SetFinalizer"
    		gorootTestSkips["typeparam/issue376214.go"] = "build SSA package error: variadic parameter must be of unnamed slice type"
    		gorootTestSkips["typeparam/nested.go"] = "FAIL"
    	case "go1.16":
    		gorootTestSkips["fixedbugs/issue7740.go"] = "BUG, const float"
    	case "go1.15":
    		gorootTestSkips["fixedbugs/issue15039.go"] = "BUG, uint64 -> string"
    		gorootTestSkips["fixedbugs/issue9355.go"] = "TODO, chdir"
    		gorootTestSkips["fixedbugs/issue7740.go"] = "BUG, const float"
    	case "go1.14":
    		gorootTestSkips["fixedbugs/issue9355.go"] = "TODO, chdir"
    		gorootTestSkips["fixedbugs/issue7740.go"] = "BUG, const float"
    	if runtime.GOOS == "windows" {
    		gorootTestSkips["env.go"] = "skip GOARCH"
    		gorootTestSkips["fixedbugs/issue15002.go"] = "skip windows"
    		gorootTestSkips["fixedbugs/issue5493.go"] = "skip windows"
    		gorootTestSkips["fixedbugs/issue5963.go"] = "skip windows"
    		skips := make(map[string]string)
    		for k, v := range gorootTestSkips {
    			skips[filepath.FromSlash(k)] = v
    		gorootTestSkips = skips
    	} else if runtime.GOOS == "darwin" {
    		gorootTestSkips["locklinear.go"] = "skip github"
    opened by visualfc 0
The GoPlus (Go+) Programming Language
bf.go - A dead simple brainfuck interpreter Slow and simple

bf.go - A dead simple brainfuck interpreter Slow and simple. Can execute pretty much all tested Brainfuck scripts. Installation If you have Go install

Chris 0 Oct 15, 2021
Official vilmos visual language interpreter!

vilmos interpreter - let's put software in museums ?? Uninstall all your IDE's, close the terminal, install your favourite drawing software and start

null 29 May 23, 2022
Golang CS:GO external base. Development currently halted due to compiler/runtime Golang bugs.

gogo Golang CS:GO External cheat/base. Also, my first Golang project. Wait! Development momentarily halted due to compiler/runtime bugs. Disclaimer Th

cristei 2 Jun 25, 2022
Belajar Golang Install Golang

Golang belajar Golang Install Golang = download di https://golang.org/dl/ = pilih yg Zip = extract file zipnya = buka foldernya - copy folder go = pas

Arif Fadilah 1 Nov 15, 2021
Golang-module-references - A reference for how to setup a Golang project with modules - Task Management + Math Examples

Golang Module Project The purpose of this project is to act as a reference for setting up future Golang projects using modules. This project has a mat

Bob Bass 0 Jan 2, 2022
Golang-echo-sample - Make an out-of-the-box backend based on golang-echo

Golang-echo-sample - Make an out-of-the-box backend based on golang-echo

Haitwang 0 Dec 31, 2021
Minimalistic, pluggable Golang evloop/timer handler with dependency-injection

Anagent Minimalistic, pluggable Golang evloop/timer handler with dependency-injection - based on codegangsta/inject - go-macaron/inject and chuckpresl

Ettore Di Giacinto 15 Sep 27, 2022
GoLang Library for Browser Capabilities Project

Browser Capabilities GoLang Project PHP has get_browser() function which tells what the user's browser is capable of. You can check original documenta

Maksim N. 43 Sep 27, 2022
Golang counters for readers/writers

Datacounter Golang counters for readers/writers. Examples ReaderCounter buf := bytes.Buffer{} buf.Write(data) counter := datacounter.NewReaderCounter(

Artem Andreenko 44 Oct 9, 2022
Golang beautify data display for Humans

Golang beautify data display for Humans English 简体中文 Install # Stable version go get -u -v gopkg.in/ffmt.v1 # Latest version go get -u -v github.com/

ffmt 285 Dec 22, 2022
a generic object pool for golang

Go Commons Pool The Go Commons Pool is a generic object pool for Golang, direct rewrite from Apache Commons Pool. Features Support custom PooledObject

jolestar 1.1k Jan 5, 2023
Resiliency patterns for golang

go-resiliency Resiliency patterns for golang. Based in part on Hystrix, Semian, and others. Currently implemented patterns include: circuit-breaker (i

Evan Huus 1.7k Jan 3, 2023
psutil for golang

gopsutil: psutil for golang This is a port of psutil (https://github.com/giampaolo/psutil). The challenge is porting all psutil functions on some arch

shirou 8.5k Jan 2, 2023
Type-safe Prometheus metrics builder library for golang

gotoprom A Prometheus metrics builder gotoprom offers an easy to use declarative API with type-safe labels for building and using Prometheus metrics.

Cabify 98 Dec 5, 2022
Simple licensing library for golang.

license-key A simple licensing library in Golang, that generates license files containing arbitrary data. Note that this implementation is quite basic

Hyperboloide 270 Dec 24, 2022
Some utilities for Persian language in Go (Golang)

persian Some utilities for Persian language in Go (Golang). Installation go get github.com/mavihq/persian API .ToPersianDigits Converts all English d

هلو | آموزش زبان با بازی 68 Oct 22, 2022
A Golang library to manipulate strings according to the word parsing rules of the UNIX Bourne shell.

shellwords A Golang library to manipulate strings according to the word parsing rules of the UNIX Bourne shell. Installation go get github.com/Wing924

Wei He 18 Sep 27, 2022
A golang URL Shortener

url-shortener A golang URL Shortener with mysql support. Using Bijective conversion between natural numbers (IDs) and short strings Installation Using

Leonidas Maroulis 40 Dec 10, 2022
:guardsman: A teeny tiny and somewhat opinionated generator for your next golang project

A Yeoman Golang Generator We are very sorry Gophers, but other names for the generator where taken, so we choose go-lang. But we have gocreate as an a

Axel Springer SE 25 Sep 27, 2022