Giter Club home page Giter Club logo

babygo's Issues

build babygo error

i clone the project, compile it locally use go build -o babygo main.go, and the compiler output:
image

local machine go env:

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/dingwenjiang/Library/Caches/go-build"
GOENV="/Users/dingwenjiang/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY="*.byted.org,*.everphoto.cn,git.smartisan.com"
GONOSUMDB="*.byted.org,*.everphoto.cn,git.smartisan.com"
GOOS="darwin"
GOPATH="/Users/dingwenjiang/go"
GOPRIVATE="*.byted.org,*.everphoto.cn,git.smartisan.com"
GOPROXY="https://goproxy.byted.org,https://goproxy.cn,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.google.cn"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/b1/c9m_f9ds2d15433dvj3b24n00000gp/T/go-build018035766=/tmp/go-build -gno-record-gcc-switches -fno-common"

Implement Atoi()

Currently, array of which length is more than 9 cannot be compiled.

slice == nil comparison

Currently in some cases slice == nil gives false even if slice is nil.

Expected results

when slice is nil,

expression value
slice == nil true
nil == slice true
slice =! nil false
nil != slice false

when slice is non-nil,

expression value
slice == nil false
nil == slice false
slice =! nil true
nil != slice true

Pass arguments in packed layout

	var a uint8 = 'a'
	var b uint8 = 'b'
	var c uint8 = 'c'
	d := receiveBytes(a, b, c)
	0x001d 00029 (sample.go:14)	MOVB	$97, "".a+23(SP)
	0x0022 00034 (sample.go:15)	MOVB	$98, "".b+22(SP)
	0x0027 00039 (sample.go:16)	MOVB	$99, "".c+21(SP)
	0x002c 00044 (sample.go:17)	MOVBLZX	"".a+23(SP), AX
	0x0031 00049 (sample.go:17)	MOVB	AL, (SP)
	0x0034 00052 (sample.go:17)	MOVBLZX	"".b+22(SP), AX
	0x0039 00057 (sample.go:17)	MOVB	AL, 1(SP)
	0x003d 00061 (sample.go:17)	MOVB	$99, 2(SP)
	0x0042 00066 (sample.go:17)	PCDATA	$1, $0
	0x0042 00066 (sample.go:17)	CALL	"".receiveBytes(SB)
	0x0047 00071 (sample.go:17)	MOVBLZX	8(SP), AX
	0x004c 00076 (sample.go:17)	MOVB	AL, "".d+20(SP)

reflect.TypeOf(x).String()

package main

import "reflect"
import "fmt"

type MyType struct {
	id int
}

func main() {
	fmt.Printf("%s\n", reflect.TypeOf(&MyType{}).String())
}
*main.MyType

Return values on stack

Same as the official go

func multiVars(a uint8, b uint8, c uint8) (uint8, uint8, uint8) {
	return a, b, c
}
"".multiVars STEXT nosplit size=43 args=0x10 locals=0x0
	0x0000 00000 (sample/sample.go:5)	TEXT	"".multiVars(SB), NOSPLIT|ABIInternal, $0-16
	0x0000 00000 (sample/sample.go:5)	FUNCDATA	$0, gclocals路33cdeccccebe80329f1fdbee7f5874cb(SB)
	0x0000 00000 (sample/sample.go:5)	FUNCDATA	$1, gclocals路33cdeccccebe80329f1fdbee7f5874cb(SB)
	0x0000 00000 (sample/sample.go:5)	MOVB	$0, "".~r3+16(SP)
	0x0005 00005 (sample/sample.go:5)	MOVB	$0, "".~r4+17(SP)
	0x000a 00010 (sample/sample.go:5)	MOVB	$0, "".~r5+18(SP)
	0x000f 00015 (sample/sample.go:6)	MOVBLZX	"".a+8(SP), AX
	0x0014 00020 (sample/sample.go:6)	MOVB	AL, "".~r3+16(SP)
	0x0018 00024 (sample/sample.go:6)	MOVBLZX	"".b+9(SP), AX
	0x001d 00029 (sample/sample.go:6)	MOVB	AL, "".~r4+17(SP)
	0x0021 00033 (sample/sample.go:6)	MOVBLZX	"".c+10(SP), AX
	0x0026 00038 (sample/sample.go:6)	MOVB	AL, "".~r5+18(SP)
	0x002a 00042 (sample/sample.go:6)	RET
	0x0000 c6 44 24 10 00 c6 44 24 11 00 c6 44 24 12 00 0f  .D$...D$...D$...
	0x0010 b6 44 24 08 88 44 24 10 0f b6 44 24 09 88 44 24  .D$..D$...D$..D$
	0x0020 11 0f b6 44 24 0a 88 44 24 12 c3                 ...D$..D$..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 馃搳馃搱馃帀

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google 鉂わ笍 Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.