diff options
author | Russ Cox <rsc@golang.org> | 2009-05-12 16:15:52 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-05-12 16:15:52 -0700 |
commit | c9fa02039c9db3a86701a85211706e9347bf34a2 (patch) | |
tree | ef92e390dab8969784d91793950a4793be7b3d32 | |
parent | 1c9f8f6ad6be63103be47733f9c39163d04964e5 (diff) | |
download | golang-c9fa02039c9db3a86701a85211706e9347bf34a2.tar.gz |
no need for compiler to hard-code definition of runtime.
use the actual go source instead.
R=r
DELTA=90 (66 added, 18 deleted, 6 changed)
OCL=28708
CL=28719
-rw-r--r-- | src/cmd/gc/Makefile | 2 | ||||
-rw-r--r-- | src/cmd/gc/builtin.c.boot | 8 | ||||
-rw-r--r-- | src/cmd/gc/go.h | 1 | ||||
-rw-r--r-- | src/cmd/gc/lex.c | 4 | ||||
-rwxr-xr-x | src/cmd/gc/mkbuiltin | 2 | ||||
-rw-r--r-- | src/cmd/gc/runtime.go | 9 | ||||
-rw-r--r-- | src/lib/Makefile | 8 | ||||
-rw-r--r-- | src/lib/runtime/Makefile | 68 | ||||
-rw-r--r-- | src/lib/runtime/runtime.go | 2 |
9 files changed, 76 insertions, 28 deletions
diff --git a/src/cmd/gc/Makefile b/src/cmd/gc/Makefile index 0083240e4..0fc15deaa 100644 --- a/src/cmd/gc/Makefile +++ b/src/cmd/gc/Makefile @@ -44,7 +44,7 @@ y.tab.h: $(YFILES) y.tab.c: y.tab.h test -f y.tab.c && touch y.tab.c -builtin.c: sys.go unsafe.go runtime.go mkbuiltin1.c mkbuiltin +builtin.c: sys.go unsafe.go mkbuiltin1.c mkbuiltin ./mkbuiltin >builtin.c || \ (echo 'mkbuiltin failed; using bootstrap copy of builtin.c'; cp builtin.c.boot builtin.c) diff --git a/src/cmd/gc/builtin.c.boot b/src/cmd/gc/builtin.c.boot index 8657944b5..8506947e7 100644 --- a/src/cmd/gc/builtin.c.boot +++ b/src/cmd/gc/builtin.c.boot @@ -67,11 +67,3 @@ char *unsafeimport = "func unsafe.Unreflect (? uint64, ? string, ? bool) (ret interface { })\n" "\n" "$$\n"; -char *runtimeimport = - "package runtime\n" - "func runtime.Breakpoint ()\n" - "func runtime.Gosched ()\n" - "func runtime.Goexit ()\n" - "func runtime.Caller (n int) (pc uint64, file string, line int, ok bool)\n" - "\n" - "$$\n"; diff --git a/src/cmd/gc/go.h b/src/cmd/gc/go.h index 657c582f5..270f246c1 100644 --- a/src/cmd/gc/go.h +++ b/src/cmd/gc/go.h @@ -540,7 +540,6 @@ EXTERN Sym* pkgimportname; // package name from imported package EXTERN int tptr; // either TPTR32 or TPTR64 extern char* sysimport; extern char* unsafeimport; -extern char* runtimeimport; EXTERN char* filename; // name to uniqify names EXTERN Idir* idirs; diff --git a/src/cmd/gc/lex.c b/src/cmd/gc/lex.c index 43cd2f6f8..e7ee30a75 100644 --- a/src/cmd/gc/lex.c +++ b/src/cmd/gc/lex.c @@ -265,10 +265,6 @@ importfile(Val *f) cannedimports("unsafe.6", unsafeimport); return; } - if(strcmp(f->u.sval->s, "runtime") == 0) { - cannedimports("runtime.6", runtimeimport); - return; - } if(!findpkg(f->u.sval)) fatal("can't find import: %Z", f->u.sval); diff --git a/src/cmd/gc/mkbuiltin b/src/cmd/gc/mkbuiltin index b0cb634f5..97d98fd82 100755 --- a/src/cmd/gc/mkbuiltin +++ b/src/cmd/gc/mkbuiltin @@ -6,7 +6,7 @@ set -e gcc -o mkbuiltin1 mkbuiltin1.c rm -f _builtin.c -for i in sys unsafe runtime +for i in sys unsafe do 6g $i.go ./mkbuiltin1 $i >>_builtin.c diff --git a/src/cmd/gc/runtime.go b/src/cmd/gc/runtime.go deleted file mode 100644 index 6b9722ac5..000000000 --- a/src/cmd/gc/runtime.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package PACKAGE -func Breakpoint(); -func Gosched(); -func Goexit(); -func Caller(n int) (pc uint64, file string, line int, ok bool); diff --git a/src/lib/Makefile b/src/lib/Makefile index fc77a53f2..4309b21c6 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -116,11 +116,11 @@ bufio.install: io.install os.install exec.install: os.install strings.install exvar.install: fmt.install http.install log.install strconv.install sync.install flag.install: fmt.install os.install strconv.install -log.install: fmt.install io.install os.install time.install +log.install: fmt.install io.install os.install runtime.install time.install path.install: io.install once.install: sync.install strings.install: utf8.install -testing.install: flag.install fmt.install +testing.install: flag.install fmt.install runtime.install fmt.install: io.install reflect.install strconv.install GODEPS=fmt.install io.install once.install regexp.install sort.install \ @@ -142,13 +142,13 @@ json.install: container/vector.install fmt.install io.install math.install \ # TODO(rsc): net is not supposed to depend on fmt or strings or strconv net.install: fmt.install once.install os.install strconv.install strings.install os.install: syscall.install once.install -regexp.install: os.install +regexp.install: os.install runtime.install reflect.install: strconv.install sync.install strconv.install: math.install os.install utf8.install sync.install: syscall.install: sync.install tabwriter.install: os.install io.install container/vector.install -template.install: container/vector.install fmt.install io.install os.install reflect.install strings.install +template.install: container/vector.install fmt.install io.install os.install reflect.install runtime.install strings.install time.install: once.install os.install io.install once.install os.install sort.install strings.install sync.install template.install time.install \ diff --git a/src/lib/runtime/Makefile b/src/lib/runtime/Makefile new file mode 100644 index 000000000..1cdc617df --- /dev/null +++ b/src/lib/runtime/Makefile @@ -0,0 +1,68 @@ +# Copyright 2009 The Go Authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +# DO NOT EDIT. Automatically generated by gobuild. +# gobuild -m >Makefile + +D= + +O_arm=5 +O_amd64=6 +O_386=8 +OS=568vq + +O=$(O_$(GOARCH)) +GC=$(O)g -I_obj +CC=$(O)c -FVw +AS=$(O)a +AR=6ar + +default: packages + +clean: + rm -rf *.[$(OS)] *.a [$(OS)].out _obj + +test: packages + gotest + +coverage: packages + gotest + 6cov -g `pwd` | grep -v '_test\.go:' + +%.$O: %.go + $(GC) $*.go + +%.$O: %.c + $(CC) $*.c + +%.$O: %.s + $(AS) $*.s + +O1=\ + runtime.$O\ + + +phases: a1 +_obj$D/runtime.a: phases + +a1: $(O1) + $(AR) grc _obj$D/runtime.a runtime.$O + rm -f $(O1) + + +newpkg: clean + mkdir -p _obj$D + $(AR) grc _obj$D/runtime.a + +$(O1): newpkg +$(O2): a1 + +nuke: clean + rm -f $(GOROOT)/pkg$D/runtime.a + +packages: _obj$D/runtime.a + +install: packages + test -d $(GOROOT)/pkg && mkdir -p $(GOROOT)/pkg$D + cp _obj$D/runtime.a $(GOROOT)/pkg$D/runtime.a diff --git a/src/lib/runtime/runtime.go b/src/lib/runtime/runtime.go index e3cf54c7f..07c674847 100644 --- a/src/lib/runtime/runtime.go +++ b/src/lib/runtime/runtime.go @@ -8,6 +8,8 @@ */ package runtime +// These functions are implemented in the base runtime library, ../../runtime/. + // Gosched yields the processor, allowing other goroutines to run. It does not // suspend the current goroutine, so execution resumes automatically. func Gosched() |