1
0
mirror of https://github.com/golang/go synced 2024-11-26 17:56:55 -07:00

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
This commit is contained in:
Russ Cox 2009-05-12 16:15:52 -07:00
parent c7d30bceb2
commit d06a79e31b
9 changed files with 76 additions and 28 deletions

View File

@ -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)

View File

@ -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";

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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 \

68
src/lib/runtime/Makefile Normal file
View File

@ -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

View File

@ -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()