]> Cypherpunks repositories - gostls13.git/commitdiff
no need for compiler to hard-code definition of runtime.
authorRuss Cox <rsc@golang.org>
Tue, 12 May 2009 23:15:52 +0000 (16:15 -0700)
committerRuss Cox <rsc@golang.org>
Tue, 12 May 2009 23:15:52 +0000 (16:15 -0700)
use the actual go source instead.

R=r
DELTA=90  (66 added, 18 deleted, 6 changed)
OCL=28708
CL=28719

src/cmd/gc/Makefile
src/cmd/gc/builtin.c.boot
src/cmd/gc/go.h
src/cmd/gc/lex.c
src/cmd/gc/mkbuiltin
src/cmd/gc/runtime.go [deleted file]
src/lib/Makefile
src/lib/runtime/Makefile [new file with mode: 0644]
src/lib/runtime/runtime.go

index 0083240e468ddd51ff7e44307678fabbbb072f95..0fc15deaa89e8e59c3fc516fc5974108895a3d2a 100644 (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)
 
index 8657944b5627f0491efb565eb78587c4a82ba8e6..8506947e7065637598125a2f57e9819fbbf74a49 100644 (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";
index 657c582f5d7212fa3eb75e0096ee5ee388018e48..270f246c10401c22d5cbba87440f1173f05def1f 100644 (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;
 
index 43cd2f6f8312fea30d92355a7db60a4b5c9a8a63..e7ee30a757ce4e1ad63eb64ceef07cc21839a496 100644 (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);
index b0cb634f50e2a3d0bf37483499daec2e4b33cb07..97d98fd8220594f5feb7810588e6b60ae60b3559 100755 (executable)
@@ -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 (file)
index 6b9722a..0000000
+++ /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);
index fc77a53f20a3e400fdadc9114260b7f2fd7ade7e..4309b21c6c00a4875e084468204defb0903c9574 100644 (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 \
diff --git a/src/lib/runtime/Makefile b/src/lib/runtime/Makefile
new file mode 100644 (file)
index 0000000..1cdc617
--- /dev/null
@@ -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
index e3cf54c7f128a51d06921579002254ec98cfc616..07c674847092a03ea9dc20bfbaecce5357244023 100644 (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()