Commit 2fa39ad8 by Ian Lance Taylor

runtime: Merge master revision 19185.

This revision renames several files in the runtime directory
from .c to .goc.

From-SVN: r212472
parent ca76ae5c
50c8fc924389 63484e8b6b76
The first line of this file holds the Mercurial revision number of the The first line of this file holds the Mercurial revision number of the
last merge done from the master library sources. last merge done from the master library sources.
...@@ -446,7 +446,6 @@ runtime_files = \ ...@@ -446,7 +446,6 @@ runtime_files = \
runtime/go-eface-compare.c \ runtime/go-eface-compare.c \
runtime/go-eface-val-compare.c \ runtime/go-eface-val-compare.c \
runtime/go-fieldtrack.c \ runtime/go-fieldtrack.c \
runtime/go-getgoroot.c \
runtime/go-int-array-to-string.c \ runtime/go-int-array-to-string.c \
runtime/go-int-to-string.c \ runtime/go-int-to-string.c \
runtime/go-interface-compare.c \ runtime/go-interface-compare.c \
...@@ -487,16 +486,12 @@ runtime_files = \ ...@@ -487,16 +486,12 @@ runtime_files = \
runtime/go-type-interface.c \ runtime/go-type-interface.c \
runtime/go-type-string.c \ runtime/go-type-string.c \
runtime/go-typedesc-equal.c \ runtime/go-typedesc-equal.c \
runtime/go-typestring.c \
runtime/go-unsafe-new.c \ runtime/go-unsafe-new.c \
runtime/go-unsafe-newarray.c \ runtime/go-unsafe-newarray.c \
runtime/go-unsafe-pointer.c \ runtime/go-unsafe-pointer.c \
runtime/go-unwind.c \ runtime/go-unwind.c \
runtime/go-varargs.c \ runtime/go-varargs.c \
runtime/chan.c \
runtime/cpuprof.c \
runtime/env_posix.c \ runtime/env_posix.c \
runtime/lfstack.c \
$(runtime_lock_files) \ $(runtime_lock_files) \
runtime/mcache.c \ runtime/mcache.c \
runtime/mcentral.c \ runtime/mcentral.c \
...@@ -515,11 +510,15 @@ runtime_files = \ ...@@ -515,11 +510,15 @@ runtime_files = \
runtime/thread.c \ runtime/thread.c \
runtime/yield.c \ runtime/yield.c \
$(rtems_task_variable_add_file) \ $(rtems_task_variable_add_file) \
chan.c \
cpuprof.c \
go-iface.c \ go-iface.c \
lfstack.c \
malloc.c \ malloc.c \
map.c \ map.c \
mprof.c \ mprof.c \
netpoll.c \ netpoll.c \
rdebug.c \
reflect.c \ reflect.c \
runtime1.c \ runtime1.c \
sema.c \ sema.c \
......
...@@ -196,7 +196,7 @@ am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \ ...@@ -196,7 +196,7 @@ am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \
go-check-interface.lo go-construct-map.lo \ go-check-interface.lo go-construct-map.lo \
go-convert-interface.lo go-copy.lo go-defer.lo \ go-convert-interface.lo go-copy.lo go-defer.lo \
go-deferred-recover.lo go-eface-compare.lo \ go-deferred-recover.lo go-eface-compare.lo \
go-eface-val-compare.lo go-fieldtrack.lo go-getgoroot.lo \ go-eface-val-compare.lo go-fieldtrack.lo \
go-int-array-to-string.lo go-int-to-string.lo \ go-int-array-to-string.lo go-int-to-string.lo \
go-interface-compare.lo go-interface-eface-compare.lo \ go-interface-compare.lo go-interface-eface-compare.lo \
go-interface-val-compare.lo go-make-slice.lo go-map-delete.lo \ go-interface-val-compare.lo go-make-slice.lo go-map-delete.lo \
...@@ -209,16 +209,15 @@ am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \ ...@@ -209,16 +209,15 @@ am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \
go-strplus.lo go-strslice.lo go-traceback.lo \ go-strplus.lo go-strslice.lo go-traceback.lo \
go-type-complex.lo go-type-eface.lo go-type-error.lo \ go-type-complex.lo go-type-eface.lo go-type-error.lo \
go-type-float.lo go-type-identity.lo go-type-interface.lo \ go-type-float.lo go-type-identity.lo go-type-interface.lo \
go-type-string.lo go-typedesc-equal.lo go-typestring.lo \ go-type-string.lo go-typedesc-equal.lo go-unsafe-new.lo \
go-unsafe-new.lo go-unsafe-newarray.lo go-unsafe-pointer.lo \ go-unsafe-newarray.lo go-unsafe-pointer.lo go-unwind.lo \
go-unwind.lo go-varargs.lo chan.lo cpuprof.lo env_posix.lo \ go-varargs.lo env_posix.lo $(am__objects_1) mcache.lo \
lfstack.lo $(am__objects_1) mcache.lo mcentral.lo \ mcentral.lo $(am__objects_2) mfixalloc.lo mgc0.lo mheap.lo \
$(am__objects_2) mfixalloc.lo mgc0.lo mheap.lo msize.lo \ msize.lo $(am__objects_3) panic.lo parfor.lo print.lo proc.lo \
$(am__objects_3) panic.lo parfor.lo print.lo proc.lo \
runtime.lo signal_unix.lo thread.lo yield.lo $(am__objects_4) \ runtime.lo signal_unix.lo thread.lo yield.lo $(am__objects_4) \
go-iface.lo malloc.lo map.lo mprof.lo netpoll.lo reflect.lo \ chan.lo cpuprof.lo go-iface.lo lfstack.lo malloc.lo map.lo \
runtime1.lo sema.lo sigqueue.lo string.lo time.lo \ mprof.lo netpoll.lo rdebug.lo reflect.lo runtime1.lo sema.lo \
$(am__objects_5) sigqueue.lo string.lo time.lo $(am__objects_5)
am_libgo_la_OBJECTS = $(am__objects_6) am_libgo_la_OBJECTS = $(am__objects_6)
libgo_la_OBJECTS = $(am_libgo_la_OBJECTS) libgo_la_OBJECTS = $(am_libgo_la_OBJECTS)
libgo_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ libgo_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
...@@ -775,7 +774,6 @@ runtime_files = \ ...@@ -775,7 +774,6 @@ runtime_files = \
runtime/go-eface-compare.c \ runtime/go-eface-compare.c \
runtime/go-eface-val-compare.c \ runtime/go-eface-val-compare.c \
runtime/go-fieldtrack.c \ runtime/go-fieldtrack.c \
runtime/go-getgoroot.c \
runtime/go-int-array-to-string.c \ runtime/go-int-array-to-string.c \
runtime/go-int-to-string.c \ runtime/go-int-to-string.c \
runtime/go-interface-compare.c \ runtime/go-interface-compare.c \
...@@ -816,16 +814,12 @@ runtime_files = \ ...@@ -816,16 +814,12 @@ runtime_files = \
runtime/go-type-interface.c \ runtime/go-type-interface.c \
runtime/go-type-string.c \ runtime/go-type-string.c \
runtime/go-typedesc-equal.c \ runtime/go-typedesc-equal.c \
runtime/go-typestring.c \
runtime/go-unsafe-new.c \ runtime/go-unsafe-new.c \
runtime/go-unsafe-newarray.c \ runtime/go-unsafe-newarray.c \
runtime/go-unsafe-pointer.c \ runtime/go-unsafe-pointer.c \
runtime/go-unwind.c \ runtime/go-unwind.c \
runtime/go-varargs.c \ runtime/go-varargs.c \
runtime/chan.c \
runtime/cpuprof.c \
runtime/env_posix.c \ runtime/env_posix.c \
runtime/lfstack.c \
$(runtime_lock_files) \ $(runtime_lock_files) \
runtime/mcache.c \ runtime/mcache.c \
runtime/mcentral.c \ runtime/mcentral.c \
...@@ -844,11 +838,15 @@ runtime_files = \ ...@@ -844,11 +838,15 @@ runtime_files = \
runtime/thread.c \ runtime/thread.c \
runtime/yield.c \ runtime/yield.c \
$(rtems_task_variable_add_file) \ $(rtems_task_variable_add_file) \
chan.c \
cpuprof.c \
go-iface.c \ go-iface.c \
lfstack.c \
malloc.c \ malloc.c \
map.c \ map.c \
mprof.c \ mprof.c \
netpoll.c \ netpoll.c \
rdebug.c \
reflect.c \ reflect.c \
runtime1.c \ runtime1.c \
sema.c \ sema.c \
...@@ -2428,7 +2426,6 @@ distclean-compile: ...@@ -2428,7 +2426,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-eface-compare.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-eface-compare.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-eface-val-compare.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-eface-val-compare.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-fieldtrack.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-fieldtrack.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-getgoroot.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-iface.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-iface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-int-array-to-string.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-int-array-to-string.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-int-to-string.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-int-to-string.Plo@am__quote@
...@@ -2471,7 +2468,6 @@ distclean-compile: ...@@ -2471,7 +2468,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-type-interface.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-type-interface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-type-string.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-type-string.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-typedesc-equal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-typedesc-equal.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-typestring.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-unsafe-new.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-unsafe-new.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-unsafe-newarray.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-unsafe-newarray.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-unsafe-pointer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-unsafe-pointer.Plo@am__quote@
...@@ -2499,6 +2495,7 @@ distclean-compile: ...@@ -2499,6 +2495,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parfor.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rdebug.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reflect.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reflect.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtems-task-variable-add.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtems-task-variable-add.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtime.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtime.Plo@am__quote@
...@@ -2681,13 +2678,6 @@ go-fieldtrack.lo: runtime/go-fieldtrack.c ...@@ -2681,13 +2678,6 @@ go-fieldtrack.lo: runtime/go-fieldtrack.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-fieldtrack.lo `test -f 'runtime/go-fieldtrack.c' || echo '$(srcdir)/'`runtime/go-fieldtrack.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-fieldtrack.lo `test -f 'runtime/go-fieldtrack.c' || echo '$(srcdir)/'`runtime/go-fieldtrack.c
go-getgoroot.lo: runtime/go-getgoroot.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-getgoroot.lo -MD -MP -MF $(DEPDIR)/go-getgoroot.Tpo -c -o go-getgoroot.lo `test -f 'runtime/go-getgoroot.c' || echo '$(srcdir)/'`runtime/go-getgoroot.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-getgoroot.Tpo $(DEPDIR)/go-getgoroot.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-getgoroot.c' object='go-getgoroot.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-getgoroot.lo `test -f 'runtime/go-getgoroot.c' || echo '$(srcdir)/'`runtime/go-getgoroot.c
go-int-array-to-string.lo: runtime/go-int-array-to-string.c go-int-array-to-string.lo: runtime/go-int-array-to-string.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-int-array-to-string.lo -MD -MP -MF $(DEPDIR)/go-int-array-to-string.Tpo -c -o go-int-array-to-string.lo `test -f 'runtime/go-int-array-to-string.c' || echo '$(srcdir)/'`runtime/go-int-array-to-string.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-int-array-to-string.lo -MD -MP -MF $(DEPDIR)/go-int-array-to-string.Tpo -c -o go-int-array-to-string.lo `test -f 'runtime/go-int-array-to-string.c' || echo '$(srcdir)/'`runtime/go-int-array-to-string.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-int-array-to-string.Tpo $(DEPDIR)/go-int-array-to-string.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-int-array-to-string.Tpo $(DEPDIR)/go-int-array-to-string.Plo
...@@ -2968,13 +2958,6 @@ go-typedesc-equal.lo: runtime/go-typedesc-equal.c ...@@ -2968,13 +2958,6 @@ go-typedesc-equal.lo: runtime/go-typedesc-equal.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-typedesc-equal.lo `test -f 'runtime/go-typedesc-equal.c' || echo '$(srcdir)/'`runtime/go-typedesc-equal.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-typedesc-equal.lo `test -f 'runtime/go-typedesc-equal.c' || echo '$(srcdir)/'`runtime/go-typedesc-equal.c
go-typestring.lo: runtime/go-typestring.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-typestring.lo -MD -MP -MF $(DEPDIR)/go-typestring.Tpo -c -o go-typestring.lo `test -f 'runtime/go-typestring.c' || echo '$(srcdir)/'`runtime/go-typestring.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-typestring.Tpo $(DEPDIR)/go-typestring.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-typestring.c' object='go-typestring.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-typestring.lo `test -f 'runtime/go-typestring.c' || echo '$(srcdir)/'`runtime/go-typestring.c
go-unsafe-new.lo: runtime/go-unsafe-new.c go-unsafe-new.lo: runtime/go-unsafe-new.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-unsafe-new.lo -MD -MP -MF $(DEPDIR)/go-unsafe-new.Tpo -c -o go-unsafe-new.lo `test -f 'runtime/go-unsafe-new.c' || echo '$(srcdir)/'`runtime/go-unsafe-new.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-unsafe-new.lo -MD -MP -MF $(DEPDIR)/go-unsafe-new.Tpo -c -o go-unsafe-new.lo `test -f 'runtime/go-unsafe-new.c' || echo '$(srcdir)/'`runtime/go-unsafe-new.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-unsafe-new.Tpo $(DEPDIR)/go-unsafe-new.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-unsafe-new.Tpo $(DEPDIR)/go-unsafe-new.Plo
...@@ -3010,20 +2993,6 @@ go-varargs.lo: runtime/go-varargs.c ...@@ -3010,20 +2993,6 @@ go-varargs.lo: runtime/go-varargs.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-varargs.lo `test -f 'runtime/go-varargs.c' || echo '$(srcdir)/'`runtime/go-varargs.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-varargs.lo `test -f 'runtime/go-varargs.c' || echo '$(srcdir)/'`runtime/go-varargs.c
chan.lo: runtime/chan.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT chan.lo -MD -MP -MF $(DEPDIR)/chan.Tpo -c -o chan.lo `test -f 'runtime/chan.c' || echo '$(srcdir)/'`runtime/chan.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/chan.Tpo $(DEPDIR)/chan.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/chan.c' object='chan.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o chan.lo `test -f 'runtime/chan.c' || echo '$(srcdir)/'`runtime/chan.c
cpuprof.lo: runtime/cpuprof.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpuprof.lo -MD -MP -MF $(DEPDIR)/cpuprof.Tpo -c -o cpuprof.lo `test -f 'runtime/cpuprof.c' || echo '$(srcdir)/'`runtime/cpuprof.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cpuprof.Tpo $(DEPDIR)/cpuprof.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/cpuprof.c' object='cpuprof.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpuprof.lo `test -f 'runtime/cpuprof.c' || echo '$(srcdir)/'`runtime/cpuprof.c
env_posix.lo: runtime/env_posix.c env_posix.lo: runtime/env_posix.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT env_posix.lo -MD -MP -MF $(DEPDIR)/env_posix.Tpo -c -o env_posix.lo `test -f 'runtime/env_posix.c' || echo '$(srcdir)/'`runtime/env_posix.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT env_posix.lo -MD -MP -MF $(DEPDIR)/env_posix.Tpo -c -o env_posix.lo `test -f 'runtime/env_posix.c' || echo '$(srcdir)/'`runtime/env_posix.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/env_posix.Tpo $(DEPDIR)/env_posix.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/env_posix.Tpo $(DEPDIR)/env_posix.Plo
...@@ -3031,13 +3000,6 @@ env_posix.lo: runtime/env_posix.c ...@@ -3031,13 +3000,6 @@ env_posix.lo: runtime/env_posix.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o env_posix.lo `test -f 'runtime/env_posix.c' || echo '$(srcdir)/'`runtime/env_posix.c @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o env_posix.lo `test -f 'runtime/env_posix.c' || echo '$(srcdir)/'`runtime/env_posix.c
lfstack.lo: runtime/lfstack.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lfstack.lo -MD -MP -MF $(DEPDIR)/lfstack.Tpo -c -o lfstack.lo `test -f 'runtime/lfstack.c' || echo '$(srcdir)/'`runtime/lfstack.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/lfstack.Tpo $(DEPDIR)/lfstack.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/lfstack.c' object='lfstack.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lfstack.lo `test -f 'runtime/lfstack.c' || echo '$(srcdir)/'`runtime/lfstack.c
lock_sema.lo: runtime/lock_sema.c lock_sema.lo: runtime/lock_sema.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lock_sema.lo -MD -MP -MF $(DEPDIR)/lock_sema.Tpo -c -o lock_sema.lo `test -f 'runtime/lock_sema.c' || echo '$(srcdir)/'`runtime/lock_sema.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lock_sema.lo -MD -MP -MF $(DEPDIR)/lock_sema.Tpo -c -o lock_sema.lo `test -f 'runtime/lock_sema.c' || echo '$(srcdir)/'`runtime/lock_sema.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/lock_sema.Tpo $(DEPDIR)/lock_sema.Plo @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/lock_sema.Tpo $(DEPDIR)/lock_sema.Plo
......
...@@ -29,11 +29,11 @@ type LFNode struct { ...@@ -29,11 +29,11 @@ type LFNode struct {
Pushcnt uintptr Pushcnt uintptr
} }
func lfstackpush(head *uint64, node *LFNode) func lfstackpush_go(head *uint64, node *LFNode)
func lfstackpop2(head *uint64) *LFNode func lfstackpop_go(head *uint64) *LFNode
var LFStackPush = lfstackpush var LFStackPush = lfstackpush_go
var LFStackPop = lfstackpop2 var LFStackPop = lfstackpop_go
type ParFor struct { type ParFor struct {
body *byte body *byte
...@@ -46,17 +46,17 @@ type ParFor struct { ...@@ -46,17 +46,17 @@ type ParFor struct {
wait bool wait bool
} }
func parforalloc2(nthrmax uint32) *ParFor func newParFor(nthrmax uint32) *ParFor
func parforsetup2(desc *ParFor, nthr, n uint32, ctx *byte, wait bool, body func(*ParFor, uint32)) func parForSetup(desc *ParFor, nthr, n uint32, ctx *byte, wait bool, body func(*ParFor, uint32))
func parfordo(desc *ParFor) func parForDo(desc *ParFor)
func parforiters(desc *ParFor, tid uintptr) (uintptr, uintptr) func parForIters(desc *ParFor, tid uintptr) (uintptr, uintptr)
var NewParFor = parforalloc2 var NewParFor = newParFor
var ParForSetup = parforsetup2 var ParForSetup = parForSetup
var ParForDo = parfordo var ParForDo = parForDo
func ParForIters(desc *ParFor, tid uint32) (uint32, uint32) { func ParForIters(desc *ParFor, tid uint32) (uint32, uint32) {
begin, end := parforiters(desc, uintptr(tid)) begin, end := parForIters(desc, uintptr(tid))
return uint32(begin), uint32(end) return uint32(begin), uint32(end)
} }
...@@ -78,11 +78,13 @@ var TestSchedLocalQueueSteal1 = testSchedLocalQueueSteal ...@@ -78,11 +78,13 @@ var TestSchedLocalQueueSteal1 = testSchedLocalQueueSteal
// var Int32Hash = int32Hash // var Int32Hash = int32Hash
// var Int64Hash = int64Hash // var Int64Hash = int64Hash
// func GogoBytes() int32
var hashLoad float64 // declared in hashmap.c var hashLoad float64 // declared in hashmap.c
var HashLoad = &hashLoad var HashLoad = &hashLoad
func memclrBytes(b []byte) func memclrBytes(b []byte)
var MemclrBytes = memclrBytes var MemclrBytes = memclrBytes
// func gogoBytes() int32
// var GogoBytes = gogoBytes
...@@ -280,31 +280,31 @@ func TestBlockProfile(t *testing.T) { ...@@ -280,31 +280,31 @@ func TestBlockProfile(t *testing.T) {
tests := [...]TestCase{ tests := [...]TestCase{
{"chan recv", blockChanRecv, ` {"chan recv", blockChanRecv, `
[0-9]+ [0-9]+ @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ [0-9]+ [0-9]+ @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+
# 0x[0-9,a-f]+ runtime\.chanrecv1\+0x[0-9,a-f]+ .*/src/pkg/runtime/chan.c:[0-9]+ # 0x[0-9,a-f]+ runtime\.chanrecv1\+0x[0-9,a-f]+ .*/src/pkg/runtime/chan.goc:[0-9]+
# 0x[0-9,a-f]+ runtime/pprof_test\.blockChanRecv\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+ # 0x[0-9,a-f]+ runtime/pprof_test\.blockChanRecv\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+
# 0x[0-9,a-f]+ runtime/pprof_test\.TestBlockProfile\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+ # 0x[0-9,a-f]+ runtime/pprof_test\.TestBlockProfile\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+
`}, `},
{"chan send", blockChanSend, ` {"chan send", blockChanSend, `
[0-9]+ [0-9]+ @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ [0-9]+ [0-9]+ @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+
# 0x[0-9,a-f]+ runtime\.chansend1\+0x[0-9,a-f]+ .*/src/pkg/runtime/chan.c:[0-9]+ # 0x[0-9,a-f]+ runtime\.chansend1\+0x[0-9,a-f]+ .*/src/pkg/runtime/chan.goc:[0-9]+
# 0x[0-9,a-f]+ runtime/pprof_test\.blockChanSend\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+ # 0x[0-9,a-f]+ runtime/pprof_test\.blockChanSend\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+
# 0x[0-9,a-f]+ runtime/pprof_test\.TestBlockProfile\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+ # 0x[0-9,a-f]+ runtime/pprof_test\.TestBlockProfile\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+
`}, `},
{"chan close", blockChanClose, ` {"chan close", blockChanClose, `
[0-9]+ [0-9]+ @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ [0-9]+ [0-9]+ @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+
# 0x[0-9,a-f]+ runtime\.chanrecv1\+0x[0-9,a-f]+ .*/src/pkg/runtime/chan.c:[0-9]+ # 0x[0-9,a-f]+ runtime\.chanrecv1\+0x[0-9,a-f]+ .*/src/pkg/runtime/chan.goc:[0-9]+
# 0x[0-9,a-f]+ runtime/pprof_test\.blockChanClose\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+ # 0x[0-9,a-f]+ runtime/pprof_test\.blockChanClose\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+
# 0x[0-9,a-f]+ runtime/pprof_test\.TestBlockProfile\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+ # 0x[0-9,a-f]+ runtime/pprof_test\.TestBlockProfile\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+
`}, `},
{"select recv async", blockSelectRecvAsync, ` {"select recv async", blockSelectRecvAsync, `
[0-9]+ [0-9]+ @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ [0-9]+ [0-9]+ @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+
# 0x[0-9,a-f]+ runtime\.selectgo\+0x[0-9,a-f]+ .*/src/pkg/runtime/chan.c:[0-9]+ # 0x[0-9,a-f]+ runtime\.selectgo\+0x[0-9,a-f]+ .*/src/pkg/runtime/chan.goc:[0-9]+
# 0x[0-9,a-f]+ runtime/pprof_test\.blockSelectRecvAsync\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+ # 0x[0-9,a-f]+ runtime/pprof_test\.blockSelectRecvAsync\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+
# 0x[0-9,a-f]+ runtime/pprof_test\.TestBlockProfile\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+ # 0x[0-9,a-f]+ runtime/pprof_test\.TestBlockProfile\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+
`}, `},
{"select send sync", blockSelectSendSync, ` {"select send sync", blockSelectSendSync, `
[0-9]+ [0-9]+ @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ [0-9]+ [0-9]+ @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+
# 0x[0-9,a-f]+ runtime\.selectgo\+0x[0-9,a-f]+ .*/src/pkg/runtime/chan.c:[0-9]+ # 0x[0-9,a-f]+ runtime\.selectgo\+0x[0-9,a-f]+ .*/src/pkg/runtime/chan.goc:[0-9]+
# 0x[0-9,a-f]+ runtime/pprof_test\.blockSelectSendSync\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+ # 0x[0-9,a-f]+ runtime/pprof_test\.blockSelectSendSync\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+
# 0x[0-9,a-f]+ runtime/pprof_test\.TestBlockProfile\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+ # 0x[0-9,a-f]+ runtime/pprof_test\.TestBlockProfile\+0x[0-9,a-f]+ .*/src/pkg/runtime/pprof/pprof_test.go:[0-9]+
`}, `},
......
...@@ -163,7 +163,7 @@ done ...@@ -163,7 +163,7 @@ done
done done
done done
runtime="chan.c cpuprof.c env_posix.c lock_futex.c lock_sema.c mcache.c mcentral.c mfixalloc.c mgc0.c mgc0.h mheap.c msize.c netpoll.goc netpoll_epoll.c netpoll_kqueue.c netpoll_stub.c panic.c print.c proc.c race.h runtime.c runtime.h signal_unix.c signal_unix.h malloc.h malloc.goc mprof.goc parfor.c runtime1.goc sema.goc sigqueue.goc string.goc time.goc" runtime="chan.goc chan.h cpuprof.goc env_posix.c lock_futex.c lfstack.goc lock_sema.c mcache.c mcentral.c mfixalloc.c mgc0.c mgc0.h mheap.c msize.c netpoll.goc netpoll_epoll.c netpoll_kqueue.c netpoll_stub.c panic.c print.c proc.c race.h rdebug.goc runtime.c runtime.h signal_unix.c signal_unix.h malloc.h malloc.goc mprof.goc parfor.c runtime1.goc sema.goc sigqueue.goc string.goc time.goc"
for f in $runtime; do for f in $runtime; do
merge_c $f $f merge_c $f $f
done done
......
...@@ -2,87 +2,16 @@ ...@@ -2,87 +2,16 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
package runtime
#include "runtime.h" #include "runtime.h"
#include "arch.h" #include "arch.h"
#include "go-type.h" #include "go-type.h"
#include "race.h" #include "race.h"
#include "malloc.h" #include "malloc.h"
#include "chan.h"
typedef struct WaitQ WaitQ;
typedef struct SudoG SudoG;
typedef struct Select Select;
typedef struct Scase Scase;
typedef struct __go_type_descriptor Type;
typedef struct __go_channel_type ChanType;
struct SudoG
{
G* g;
uint32* selectdone;
SudoG* link;
int64 releasetime;
byte* elem; // data element
};
struct WaitQ
{
SudoG* first;
SudoG* last;
};
// The garbage collector is assuming that Hchan can only contain pointers into the stack
// and cannot contain pointers into the heap.
struct Hchan
{
uintgo qcount; // total data in the q
uintgo dataqsiz; // size of the circular q
uint16 elemsize;
uint8 elemalign;
uint8 pad; // ensures proper alignment of the buffer that follows Hchan in memory
bool closed;
const Type* elemtype; // element type
uintgo sendx; // send index
uintgo recvx; // receive index
WaitQ recvq; // list of recv waiters
WaitQ sendq; // list of send waiters
Lock;
};
uint32 runtime_Hchansize = sizeof(Hchan); uint32 runtime_Hchansize = sizeof(Hchan);
// Buffer follows Hchan immediately in memory.
// chanbuf(c, i) is pointer to the i'th slot in the buffer.
#define chanbuf(c, i) ((byte*)((c)+1)+(uintptr)(c)->elemsize*(i))
enum
{
debug = 0,
// Scase.kind
CaseRecv,
CaseSend,
CaseDefault,
};
struct Scase
{
SudoG sg; // must be first member (cast to Scase)
Hchan* chan; // chan
uint16 kind;
uint16 index; // index to return
bool* receivedp; // pointer to received bool (recv2)
};
struct Select
{
uint16 tcase; // total count of scase[]
uint16 ncase; // currently filled scase[]
uint16* pollorder; // case poll order
Hchan** lockorder; // channel lock order
Scase scase[1]; // one per case (in order of appearance)
};
static void dequeueg(WaitQ*); static void dequeueg(WaitQ*);
static SudoG* dequeue(WaitQ*); static SudoG* dequeue(WaitQ*);
static void enqueue(WaitQ*, SudoG*); static void enqueue(WaitQ*, SudoG*);
...@@ -120,21 +49,10 @@ makechan(ChanType *t, int64 hint) ...@@ -120,21 +49,10 @@ makechan(ChanType *t, int64 hint)
return c; return c;
} }
// For reflect func reflect.makechan(t *ChanType, size uint64) (c *Hchan) {
// func makechan(typ *ChanType, size uint64) (chan)
Hchan *reflect_makechan(ChanType *, uint64)
__asm__ (GOSYM_PREFIX "reflect.makechan");
Hchan *
reflect_makechan(ChanType *t, uint64 size)
{
Hchan *c;
c = makechan(t, size); c = makechan(t, size);
return c;
} }
// makechan(t *ChanType, hint int64) (hchan *chan any);
Hchan* Hchan*
__go_new_channel(ChanType *t, uintptr hint) __go_new_channel(ChanType *t, uintptr hint)
{ {
...@@ -487,8 +405,6 @@ runtime_chanrecv2(ChanType *t, Hchan* c, byte* v) ...@@ -487,8 +405,6 @@ runtime_chanrecv2(ChanType *t, Hchan* c, byte* v)
return received; return received;
} }
// func selectnbsend(c chan any, elem *any) bool
//
// compiler implements // compiler implements
// //
// select { // select {
...@@ -506,17 +422,10 @@ runtime_chanrecv2(ChanType *t, Hchan* c, byte* v) ...@@ -506,17 +422,10 @@ runtime_chanrecv2(ChanType *t, Hchan* c, byte* v)
// ... bar // ... bar
// } // }
// //
_Bool func selectnbsend(t *ChanType, c *Hchan, elem *byte) (selected bool) {
runtime_selectnbsend(ChanType *t, Hchan *c, byte *val) selected = chansend(t, c, elem, false, runtime_getcallerpc(&t));
{
bool res;
res = chansend(t, c, val, false, runtime_getcallerpc(&t));
return (_Bool)res;
} }
// func selectnbrecv(elem *any, c chan any) bool
//
// compiler implements // compiler implements
// //
// select { // select {
...@@ -534,17 +443,10 @@ runtime_selectnbsend(ChanType *t, Hchan *c, byte *val) ...@@ -534,17 +443,10 @@ runtime_selectnbsend(ChanType *t, Hchan *c, byte *val)
// ... bar // ... bar
// } // }
// //
_Bool func selectnbrecv(t *ChanType, elem *byte, c *Hchan) (selected bool) {
runtime_selectnbrecv(ChanType *t, byte *v, Hchan *c) selected = chanrecv(t, c, elem, false, nil);
{
bool selected;
selected = chanrecv(t, c, v, false, nil);
return (_Bool)selected;
} }
// func selectnbrecv2(elem *any, ok *bool, c chan any) bool
//
// compiler implements // compiler implements
// //
// select { // select {
...@@ -562,76 +464,27 @@ runtime_selectnbrecv(ChanType *t, byte *v, Hchan *c) ...@@ -562,76 +464,27 @@ runtime_selectnbrecv(ChanType *t, byte *v, Hchan *c)
// ... bar // ... bar
// } // }
// //
_Bool func selectnbrecv2(t *ChanType, elem *byte, received *bool, c *Hchan) (selected bool) {
runtime_selectnbrecv2(ChanType *t, byte *v, _Bool *received, Hchan *c)
{
bool selected;
bool r; bool r;
r = false; selected = chanrecv(t, c, elem, false, received == nil ? nil : &r);
selected = chanrecv(t, c, v, false, received == nil ? nil : &r);
if(received != nil) if(received != nil)
*received = r; *received = r;
return selected;
} }
// For reflect: func reflect.chansend(t *ChanType, c *Hchan, elem *byte, nb bool) (selected bool) {
// func chansend(c chan, val *any, nb bool) (selected bool) selected = chansend(t, c, elem, !nb, runtime_getcallerpc(&t));
// where val points to the data to be sent.
//
// The "uintptr selected" is really "bool selected" but saying
// uintptr gets us the right alignment for the output parameter block.
_Bool reflect_chansend(ChanType *, Hchan *, byte *, _Bool)
__asm__ (GOSYM_PREFIX "reflect.chansend");
_Bool
reflect_chansend(ChanType *t, Hchan *c, byte *val, _Bool nb)
{
bool selected;
selected = chansend(t, c, val, !nb, runtime_getcallerpc(&t));
return (_Bool)selected;
} }
// For reflect: func reflect.chanrecv(t *ChanType, c *Hchan, nb bool, elem *byte) (selected bool, received bool) {
// func chanrecv(c chan, nb bool, val *any) (selected, received bool)
// where val points to a data area that will be filled in with the
// received value. val must have the size and type of the channel element type.
struct chanrecv_ret
{
_Bool selected;
_Bool received;
};
struct chanrecv_ret reflect_chanrecv(ChanType *, Hchan *, _Bool, byte *val)
__asm__ (GOSYM_PREFIX "reflect.chanrecv");
struct chanrecv_ret
reflect_chanrecv(ChanType *t, Hchan *c, _Bool nb, byte *val)
{
struct chanrecv_ret ret;
bool selected;
bool received;
received = false; received = false;
selected = chanrecv(t, c, val, !nb, &received); selected = chanrecv(t, c, elem, !nb, &received);
ret.selected = (_Bool)selected;
ret.received = (_Bool)received;
return ret;
} }
static Select* newselect(int32); static Select* newselect(int32);
// newselect(size uint32) (sel *byte); func newselect(size int32) (sel *byte) {
sel = (byte*)newselect(size);
void* runtime_newselect(int32) __asm__ (GOSYM_PREFIX "runtime.newselect");
void*
runtime_newselect(int32 size)
{
return (void*)newselect(size);
} }
static Select* static Select*
...@@ -666,18 +519,9 @@ newselect(int32 size) ...@@ -666,18 +519,9 @@ newselect(int32 size)
// cut in half to give stack a chance to split // cut in half to give stack a chance to split
static void selectsend(Select *sel, Hchan *c, int index, void *elem); static void selectsend(Select *sel, Hchan *c, int index, void *elem);
// selectsend(sel *byte, hchan *chan any, elem *any) (selected bool); func selectsend(sel *Select, c *Hchan, elem *byte, index int32) {
void runtime_selectsend(Select *, Hchan *, void *, int32)
__asm__ (GOSYM_PREFIX "runtime.selectsend");
void
runtime_selectsend(Select *sel, Hchan *c, void *elem, int32 index)
{
// nil cases do not compete // nil cases do not compete
if(c == nil) if(c != nil)
return;
selectsend(sel, c, index, elem); selectsend(sel, c, index, elem);
} }
...@@ -706,33 +550,15 @@ selectsend(Select *sel, Hchan *c, int index, void *elem) ...@@ -706,33 +550,15 @@ selectsend(Select *sel, Hchan *c, int index, void *elem)
// cut in half to give stack a chance to split // cut in half to give stack a chance to split
static void selectrecv(Select *sel, Hchan *c, int index, void *elem, bool*); static void selectrecv(Select *sel, Hchan *c, int index, void *elem, bool*);
// selectrecv(sel *byte, hchan *chan any, elem *any) (selected bool); func selectrecv(sel *Select, c *Hchan, elem *byte, index int32) {
void runtime_selectrecv(Select *, Hchan *, void *, int32)
__asm__ (GOSYM_PREFIX "runtime.selectrecv");
void
runtime_selectrecv(Select *sel, Hchan *c, void *elem, int32 index)
{
// nil cases do not compete // nil cases do not compete
if(c == nil) if(c != nil)
return;
selectrecv(sel, c, index, elem, nil); selectrecv(sel, c, index, elem, nil);
} }
// selectrecv2(sel *byte, hchan *chan any, elem *any, received *bool) (selected bool); func selectrecv2(sel *Select, c *Hchan, elem *byte, received *bool, index int32) {
void runtime_selectrecv2(Select *, Hchan *, void *, bool *, int32)
__asm__ (GOSYM_PREFIX "runtime.selectrecv2");
void
runtime_selectrecv2(Select *sel, Hchan *c, void *elem, bool *received, int32 index)
{
// nil cases do not compete // nil cases do not compete
if(c == nil) if(c != nil)
return;
selectrecv(sel, c, index, elem, received); selectrecv(sel, c, index, elem, received);
} }
...@@ -762,13 +588,7 @@ selectrecv(Select *sel, Hchan *c, int index, void *elem, bool *received) ...@@ -762,13 +588,7 @@ selectrecv(Select *sel, Hchan *c, int index, void *elem, bool *received)
// cut in half to give stack a chance to split // cut in half to give stack a chance to split
static void selectdefault(Select*, int); static void selectdefault(Select*, int);
// selectdefault(sel *byte) (selected bool); func selectdefault(sel *Select, index int32) {
void runtime_selectdefault(Select *, int32) __asm__ (GOSYM_PREFIX "runtime.selectdefault");
void
runtime_selectdefault(Select *sel, int32 index)
{
selectdefault(sel, index); selectdefault(sel, index);
} }
...@@ -844,9 +664,7 @@ selparkcommit(G *gp, void *sel) ...@@ -844,9 +664,7 @@ selparkcommit(G *gp, void *sel)
return true; return true;
} }
void func block() {
runtime_block(void)
{
runtime_park(nil, nil, "select (no cases)"); // forever runtime_park(nil, nil, "select (no cases)"); // forever
} }
...@@ -854,11 +672,7 @@ static int selectgo(Select**); ...@@ -854,11 +672,7 @@ static int selectgo(Select**);
// selectgo(sel *byte); // selectgo(sel *byte);
int runtime_selectgo(Select *) __asm__ (GOSYM_PREFIX "runtime.selectgo"); func selectgo(sel *Select) (ret int32) {
int
runtime_selectgo(Select *sel)
{
return selectgo(&sel); return selectgo(&sel);
} }
...@@ -1196,22 +1010,7 @@ enum SelectDir { ...@@ -1196,22 +1010,7 @@ enum SelectDir {
SelectDefault, SelectDefault,
}; };
// func rselect(cases []runtimeSelect) (chosen int, recvOK bool) func reflect.rselect(cases Slice) (chosen int, recvOK bool) {
struct rselect_ret {
intgo chosen;
_Bool recvOK;
};
struct rselect_ret reflect_rselect(Slice)
__asm__ (GOSYM_PREFIX "reflect.rselect");
struct rselect_ret
reflect_rselect(Slice cases)
{
struct rselect_ret ret;
intgo chosen;
bool recvOK;
int32 i; int32 i;
Select *sel; Select *sel;
runtimeSelect* rcase, *rc; runtimeSelect* rcase, *rc;
...@@ -1242,29 +1041,15 @@ reflect_rselect(Slice cases) ...@@ -1242,29 +1041,15 @@ reflect_rselect(Slice cases)
} }
chosen = (intgo)(uintptr)selectgo(&sel); chosen = (intgo)(uintptr)selectgo(&sel);
ret.chosen = chosen;
ret.recvOK = (_Bool)recvOK;
return ret;
} }
static void closechan(Hchan *c, void *pc); static void closechan(Hchan *c, void *pc);
// closechan(sel *byte); func closechan(c *Hchan) {
void
runtime_closechan(Hchan *c)
{
closechan(c, runtime_getcallerpc(&c)); closechan(c, runtime_getcallerpc(&c));
} }
// For reflect func reflect.chanclose(c *Hchan) {
// func chanclose(c chan)
void reflect_chanclose(Hchan *) __asm__ (GOSYM_PREFIX "reflect.chanclose");
void
reflect_chanclose(Hchan *c)
{
closechan(c, runtime_getcallerpc(&c)); closechan(c, runtime_getcallerpc(&c));
} }
...@@ -1326,21 +1111,11 @@ __go_builtin_close(Hchan *c) ...@@ -1326,21 +1111,11 @@ __go_builtin_close(Hchan *c)
runtime_closechan(c); runtime_closechan(c);
} }
// For reflect func reflect.chanlen(c *Hchan) (len int) {
// func chanlen(c chan) (len int)
intgo reflect_chanlen(Hchan *) __asm__ (GOSYM_PREFIX "reflect.chanlen");
intgo
reflect_chanlen(Hchan *c)
{
intgo len;
if(c == nil) if(c == nil)
len = 0; len = 0;
else else
len = c->qcount; len = c->qcount;
return len;
} }
intgo intgo
...@@ -1349,21 +1124,11 @@ __go_chan_len(Hchan *c) ...@@ -1349,21 +1124,11 @@ __go_chan_len(Hchan *c)
return reflect_chanlen(c); return reflect_chanlen(c);
} }
// For reflect func reflect.chancap(c *Hchan) (cap int) {
// func chancap(c chan) int
intgo reflect_chancap(Hchan *) __asm__ (GOSYM_PREFIX "reflect.chancap");
intgo
reflect_chancap(Hchan *c)
{
intgo cap;
if(c == nil) if(c == nil)
cap = 0; cap = 0;
else else
cap = c->dataqsiz; cap = c->dataqsiz;
return cap;
} }
intgo intgo
......
// 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.
typedef struct WaitQ WaitQ;
typedef struct SudoG SudoG;
typedef struct Select Select;
typedef struct Scase Scase;
typedef struct __go_type_descriptor Type;
typedef struct __go_channel_type ChanType;
struct SudoG
{
G* g;
uint32* selectdone;
SudoG* link;
int64 releasetime;
byte* elem; // data element
};
struct WaitQ
{
SudoG* first;
SudoG* last;
};
// The garbage collector is assuming that Hchan can only contain pointers into the stack
// and cannot contain pointers into the heap.
struct Hchan
{
uintgo qcount; // total data in the q
uintgo dataqsiz; // size of the circular q
uint16 elemsize;
uint16 pad; // ensures proper alignment of the buffer that follows Hchan in memory
bool closed;
const Type* elemtype; // element type
uintgo sendx; // send index
uintgo recvx; // receive index
WaitQ recvq; // list of recv waiters
WaitQ sendq; // list of send waiters
Lock;
};
// Buffer follows Hchan immediately in memory.
// chanbuf(c, i) is pointer to the i'th slot in the buffer.
#define chanbuf(c, i) ((byte*)((c)+1)+(uintptr)(c)->elemsize*(i))
enum
{
debug = 0,
// Scase.kind
CaseRecv,
CaseSend,
CaseDefault,
};
struct Scase
{
SudoG sg; // must be first member (cast to Scase)
Hchan* chan; // chan
uint16 kind;
uint16 index; // index to return
bool* receivedp; // pointer to received bool (recv2)
};
struct Select
{
uint16 tcase; // total count of scase[]
uint16 ncase; // currently filled scase[]
uint16* pollorder; // case poll order
Hchan** lockorder; // channel lock order
Scase scase[1]; // one per case (in order of appearance)
};
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
// in order to let the log closer set the high bit to indicate "EOF" safely // in order to let the log closer set the high bit to indicate "EOF" safely
// in the situation when normally the goroutine "owns" handoff. // in the situation when normally the goroutine "owns" handoff.
package runtime
#include "runtime.h" #include "runtime.h"
#include "arch.h" #include "arch.h"
#include "malloc.h" #include "malloc.h"
...@@ -435,13 +436,8 @@ breakflush: ...@@ -435,13 +436,8 @@ breakflush:
return ret; // set to nil at top of function return ret; // set to nil at top of function
} }
extern Slice runtime_CPUProfile(void)
__asm__ (GOSYM_PREFIX "runtime.CPUProfile");
// CPUProfile returns the next cpu profile block as a []byte. // CPUProfile returns the next cpu profile block as a []byte.
// The user documentation is in debug.go. // The user documentation is in debug.go.
Slice func CPUProfile() (ret Slice) {
runtime_CPUProfile(void) ret = getprofile(prof);
{
return getprofile(prof);
} }
...@@ -177,19 +177,3 @@ _cgo_panic (const char *p) ...@@ -177,19 +177,3 @@ _cgo_panic (const char *p)
__go_panic (e); __go_panic (e);
} }
/* Return the number of CGO calls. */
int64 runtime_NumCgoCall (void) __asm__ (GOSYM_PREFIX "runtime.NumCgoCall");
int64
runtime_NumCgoCall (void)
{
int64 ret;
M* m;
ret = 0;
for (m = runtime_atomicloadp (&runtime_allm); m != NULL; m = m->alllink)
ret += m->ncgocall;
return ret;
}
/* go-getgoroot.c -- getgoroot function for runtime package.
Copyright 2010 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. */
#include <stdlib.h>
#include "runtime.h"
String getgoroot (void) __asm__ (GOSYM_PREFIX "runtime.getgoroot");
String
getgoroot ()
{
const char *p;
String ret;
p = getenv ("GOROOT");
ret.str = (const byte *) p;
if (ret.str == NULL)
ret.len = 0;
else
ret.len = __builtin_strlen (p);
return ret;
}
/* go-typestring.c -- the runtime.typestring function.
Copyright 2010 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. */
#include "runtime.h"
#include "interface.h"
#include "go-type.h"
String typestring(struct __go_empty_interface) __asm__ (GOSYM_PREFIX "runtime.typestring");
String
typestring (struct __go_empty_interface e)
{
return *e.__type_descriptor->__reflection;
}
...@@ -617,9 +617,22 @@ process_file(void) ...@@ -617,9 +617,22 @@ process_file(void)
package = read_package(); package = read_package();
read_preprocessor_lines(); read_preprocessor_lines();
while (read_func_header(&name, &params, &rets)) { while (read_func_header(&name, &params, &rets)) {
write_func_header(package, name, params, rets); char *p;
char *pkg;
char *nm;
p = strchr(name, '.');
if (p == NULL) {
pkg = package;
nm = name;
} else {
pkg = name;
nm = p + 1;
*p = '\0';
}
write_func_header(pkg, nm, params, rets);
copy_body(); copy_body();
write_func_trailer(package, name, rets); write_func_trailer(pkg, nm, rets);
free(name); free(name);
free_params(params); free_params(params);
free_params(rets); free_params(rets);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
// Lock-free stack. // Lock-free stack.
package runtime
#include "runtime.h" #include "runtime.h"
#include "arch.h" #include "arch.h"
...@@ -69,11 +70,10 @@ runtime_lfstackpop(uint64 *head) ...@@ -69,11 +70,10 @@ runtime_lfstackpop(uint64 *head)
} }
} }
LFNode* runtime_lfstackpop2(uint64*) func lfstackpush_go(head *uint64, node *LFNode) {
__asm__ (GOSYM_PREFIX "runtime.lfstackpop2"); runtime_lfstackpush(head, node);
}
LFNode* func lfstackpop_go(head *uint64) (node *LFNode) {
runtime_lfstackpop2(uint64 *head) node = runtime_lfstackpop(head);
{
return runtime_lfstackpop(head);
} }
...@@ -905,10 +905,8 @@ runtime_mal(uintptr n) ...@@ -905,10 +905,8 @@ runtime_mal(uintptr n)
return runtime_mallocgc(n, 0, 0); return runtime_mallocgc(n, 0, 0);
} }
void * func new(typ *Type) (ret *uint8) {
runtime_new(const Type *typ) ret = runtime_mallocgc(typ->__size, (uintptr)typ | TypeInfo_SingleObject, typ->kind&KindNoPointers ? FlagNoScan : 0);
{
return runtime_mallocgc(typ->__size, (uintptr)typ | TypeInfo_SingleObject, typ->kind&KindNoPointers ? FlagNoScan : 0);
} }
static void* static void*
......
...@@ -586,6 +586,7 @@ void runtime_gc_m_ptr(Eface*); ...@@ -586,6 +586,7 @@ void runtime_gc_m_ptr(Eface*);
void runtime_gc_itab_ptr(Eface*); void runtime_gc_itab_ptr(Eface*);
void runtime_memorydump(void); void runtime_memorydump(void);
int32 runtime_setgcpercent(int32);
void runtime_proc_scan(struct Workbuf**, void (*)(struct Workbuf**, Obj)); void runtime_proc_scan(struct Workbuf**, void (*)(struct Workbuf**, Obj));
void runtime_time_scan(struct Workbuf**, void (*)(struct Workbuf**, Obj)); void runtime_time_scan(struct Workbuf**, void (*)(struct Workbuf**, Obj));
......
...@@ -1174,6 +1174,7 @@ scanblock(Workbuf *wbuf, bool keepworking) ...@@ -1174,6 +1174,7 @@ scanblock(Workbuf *wbuf, bool keepworking)
#endif #endif
default: default:
runtime_printf("runtime: invalid GC instruction %p at %p\n", pc[0], pc);
runtime_throw("scanblock: invalid GC instruction"); runtime_throw("scanblock: invalid GC instruction");
return; return;
} }
...@@ -2449,13 +2450,9 @@ runtime_debug_readGCStats(Slice *pauses) ...@@ -2449,13 +2450,9 @@ runtime_debug_readGCStats(Slice *pauses)
pauses->__count = n+3; pauses->__count = n+3;
} }
intgo runtime_debug_setGCPercent(intgo) int32
__asm__("runtime_debug.setGCPercent"); runtime_setgcpercent(int32 in) {
int32 out;
intgo
runtime_debug_setGCPercent(intgo in)
{
intgo out;
runtime_lock(&runtime_mheap); runtime_lock(&runtime_mheap);
if(gcpercent == GcpercentUnknown) if(gcpercent == GcpercentUnknown)
......
...@@ -33,18 +33,6 @@ runtime_parforalloc(uint32 nthrmax) ...@@ -33,18 +33,6 @@ runtime_parforalloc(uint32 nthrmax)
return desc; return desc;
} }
// For testing from Go
// func parforalloc2(nthrmax uint32) *ParFor
ParFor *runtime_parforalloc2(uint32)
__asm__ (GOSYM_PREFIX "runtime.parforalloc2");
ParFor *
runtime_parforalloc2(uint32 nthrmax)
{
return runtime_parforalloc(nthrmax);
}
void void
runtime_parforsetup(ParFor *desc, uint32 nthr, uint32 n, void *ctx, bool wait, void (*body)(ParFor*, uint32)) runtime_parforsetup(ParFor *desc, uint32 nthr, uint32 n, void *ctx, bool wait, void (*body)(ParFor*, uint32))
{ {
...@@ -78,18 +66,6 @@ runtime_parforsetup(ParFor *desc, uint32 nthr, uint32 n, void *ctx, bool wait, v ...@@ -78,18 +66,6 @@ runtime_parforsetup(ParFor *desc, uint32 nthr, uint32 n, void *ctx, bool wait, v
} }
} }
// For testing from Go
// func parforsetup2(desc *ParFor, nthr, n uint32, ctx *byte, wait bool, body func(*ParFor, uint32))
void runtime_parforsetup2(ParFor *, uint32, uint32, void *, bool, void *)
__asm__ (GOSYM_PREFIX "runtime.parforsetup2");
void
runtime_parforsetup2(ParFor *desc, uint32 nthr, uint32 n, void *ctx, bool wait, void *body)
{
runtime_parforsetup(desc, nthr, n, ctx, wait, *(void(**)(ParFor*, uint32))body);
}
void void
runtime_parfordo(ParFor *desc) runtime_parfordo(ParFor *desc)
{ {
...@@ -214,23 +190,10 @@ exit: ...@@ -214,23 +190,10 @@ exit:
me->nsleep = 0; me->nsleep = 0;
} }
// For testing from Go // For testing from Go.
// func parforiters(desc *ParFor, tid uintptr) (uintptr, uintptr) void
runtime_parforiters(ParFor *desc, uintptr tid, uintptr *start, uintptr *end)
struct parforiters_ret {
uintptr start;
uintptr end;
};
struct parforiters_ret runtime_parforiters(ParFor *, uintptr)
__asm__ (GOSYM_PREFIX "runtime.parforiters");
struct parforiters_ret
runtime_parforiters(ParFor *desc, uintptr tid)
{ {
struct parforiters_ret ret; *start = (uint32)desc->thr[tid].pos;
*end = (uint32)(desc->thr[tid].pos>>32);
ret.start = (uint32)desc->thr[tid].pos;
ret.end = (uint32)(desc->thr[tid].pos>>32);
return ret;
} }
...@@ -320,7 +320,7 @@ runtime_printhex(uint64 v) ...@@ -320,7 +320,7 @@ runtime_printhex(uint64 v)
void void
runtime_printpointer(void *p) runtime_printpointer(void *p)
{ {
runtime_printhex((uint64)(uintptr)p); runtime_printhex((uintptr)p);
} }
void void
......
...@@ -2456,26 +2456,6 @@ runtime_lockedOSThread(void) ...@@ -2456,26 +2456,6 @@ runtime_lockedOSThread(void)
return g->lockedm != nil && m->lockedg != nil; return g->lockedm != nil && m->lockedg != nil;
} }
// for testing of callbacks
_Bool runtime_golockedOSThread(void)
__asm__ (GOSYM_PREFIX "runtime.golockedOSThread");
_Bool
runtime_golockedOSThread(void)
{
return runtime_lockedOSThread();
}
intgo runtime_NumGoroutine (void)
__asm__ (GOSYM_PREFIX "runtime.NumGoroutine");
intgo
runtime_NumGoroutine()
{
return runtime_gcount();
}
int32 int32
runtime_gcount(void) runtime_gcount(void)
{ {
...@@ -3321,13 +3301,10 @@ runtime_testSchedLocalQueueSteal(void) ...@@ -3321,13 +3301,10 @@ runtime_testSchedLocalQueueSteal(void)
} }
} }
intgo runtime_debug_setMaxThreads(intgo) int32
__asm__(GOSYM_PREFIX "runtime_debug.setMaxThreads"); runtime_setmaxthreads(int32 in)
intgo
runtime_debug_setMaxThreads(intgo in)
{ {
intgo out; int32 out;
runtime_lock(&runtime_sched); runtime_lock(&runtime_sched);
out = runtime_sched.maxmcount; out = runtime_sched.maxmcount;
...@@ -3370,30 +3347,3 @@ runtime_gcwaiting(void) ...@@ -3370,30 +3347,3 @@ runtime_gcwaiting(void)
{ {
return runtime_sched.gcwaiting; return runtime_sched.gcwaiting;
} }
// func runtime_procPin() int
intgo sync_runtime_procPin(void)
__asm__(GOSYM_PREFIX "sync.runtime_procPin");
intgo
sync_runtime_procPin()
{
M *mp;
mp = m;
// Disable preemption.
mp->locks++;
return mp->p->id;
}
// func runtime_procUnpin()
void sync_runtime_procUnpin(void)
__asm__ (GOSYM_PREFIX "sync.runtime_procUnpin");
void
sync_runtime_procUnpin(void)
{
m->locks--;
}
// Copyright 2013 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 runtime_debug
#include "runtime.h"
#include "arch.h"
#include "malloc.h"
func setMaxStack(in int) (out int) {
out = runtime_maxstacksize;
runtime_maxstacksize = in;
}
func setGCPercent(in int) (out int) {
out = runtime_setgcpercent(in);
}
func setMaxThreads(in int) (out int) {
out = runtime_setmaxthreads(in);
}
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "runtime.h" #include "runtime.h"
#include "array.h" #include "array.h"
#include "go-panic.h"
// The GOTRACEBACK environment variable controls the // The GOTRACEBACK environment variable controls the
// behavior of a Go program that is crashing and exiting. // behavior of a Go program that is crashing and exiting.
...@@ -221,15 +220,6 @@ runtime_tickspersecond(void) ...@@ -221,15 +220,6 @@ runtime_tickspersecond(void)
return res; return res;
} }
int64 runtime_pprof_runtime_cyclesPerSecond(void)
__asm__ (GOSYM_PREFIX "runtime_pprof.runtime_cyclesPerSecond");
int64
runtime_pprof_runtime_cyclesPerSecond(void)
{
return runtime_tickspersecond();
}
// Called to initialize a new m (including the bootstrap m). // Called to initialize a new m (including the bootstrap m).
// Called on the parent thread (main thread in case of bootstrap), can allocate memory. // Called on the parent thread (main thread in case of bootstrap), can allocate memory.
void void
...@@ -341,19 +331,6 @@ runtime_timediv(int64 v, int32 div, int32 *rem) ...@@ -341,19 +331,6 @@ runtime_timediv(int64 v, int32 div, int32 *rem)
uintptr runtime_maxstacksize = 1<<20; // enough until runtime.main sets it for real uintptr runtime_maxstacksize = 1<<20; // enough until runtime.main sets it for real
intgo runtime_debug_setMaxStack(intgo)
__asm__ (GOSYM_PREFIX "runtime_debug.setMaxStack");
intgo
runtime_debug_setMaxStack(intgo in)
{
intgo out;
out = runtime_maxstacksize;
runtime_maxstacksize = in;
return out;
}
void memclrBytes(Slice) void memclrBytes(Slice)
__asm__ (GOSYM_PREFIX "runtime.memclrBytes"); __asm__ (GOSYM_PREFIX "runtime.memclrBytes");
......
...@@ -455,7 +455,7 @@ extern bool runtime_precisestack; ...@@ -455,7 +455,7 @@ extern bool runtime_precisestack;
#define nelem(x) (sizeof(x)/sizeof((x)[0])) #define nelem(x) (sizeof(x)/sizeof((x)[0]))
#define nil ((void*)0) #define nil ((void*)0)
#define USED(v) ((void) v) #define USED(v) ((void) v)
#define ROUND(x, n) (((x)+(n)-1)&~((n)-1)) /* all-caps to mark as macro: it evaluates n twice */ #define ROUND(x, n) (((x)+(n)-1)&~(uintptr)((n)-1)) /* all-caps to mark as macro: it evaluates n twice */
byte* runtime_startup_random_data; byte* runtime_startup_random_data;
uint32 runtime_startup_random_data_len; uint32 runtime_startup_random_data_len;
...@@ -491,6 +491,7 @@ extern int8* runtime_goos; ...@@ -491,6 +491,7 @@ extern int8* runtime_goos;
extern int32 runtime_ncpu; extern int32 runtime_ncpu;
extern void (*runtime_sysargs)(int32, uint8**); extern void (*runtime_sysargs)(int32, uint8**);
extern DebugVars runtime_debug; extern DebugVars runtime_debug;
extern uintptr runtime_maxstacksize;
/* /*
* common functions and data * common functions and data
...@@ -501,9 +502,6 @@ intgo runtime_findnull(const byte*); ...@@ -501,9 +502,6 @@ intgo runtime_findnull(const byte*);
intgo runtime_findnullw(const uint16*); intgo runtime_findnullw(const uint16*);
void runtime_dump(byte*, int32); void runtime_dump(byte*, int32);
/*
* very low level c-called
*/
void runtime_gogo(G*); void runtime_gogo(G*);
struct __go_func_type; struct __go_func_type;
void runtime_args(int32, byte**); void runtime_args(int32, byte**);
...@@ -618,6 +616,7 @@ void runtime_crash(void); ...@@ -618,6 +616,7 @@ void runtime_crash(void);
void runtime_parsedebugvars(void); void runtime_parsedebugvars(void);
void _rt0_go(void); void _rt0_go(void);
void* runtime_funcdata(Func*, int32); void* runtime_funcdata(Func*, int32);
int32 runtime_setmaxthreads(int32);
void runtime_stoptheworld(void); void runtime_stoptheworld(void);
void runtime_starttheworld(void); void runtime_starttheworld(void);
...@@ -690,7 +689,8 @@ LFNode* runtime_lfstackpop(uint64 *head); ...@@ -690,7 +689,8 @@ LFNode* runtime_lfstackpop(uint64 *head);
*/ */
ParFor* runtime_parforalloc(uint32 nthrmax); ParFor* runtime_parforalloc(uint32 nthrmax);
void runtime_parforsetup(ParFor *desc, uint32 nthr, uint32 n, void *ctx, bool wait, void (*body)(ParFor*, uint32)); void runtime_parforsetup(ParFor *desc, uint32 nthr, uint32 n, void *ctx, bool wait, void (*body)(ParFor*, uint32));
void runtime_parfordo(ParFor *desc) __asm__ (GOSYM_PREFIX "runtime.parfordo"); void runtime_parfordo(ParFor *desc);
void runtime_parforiters(ParFor*, uintptr, uintptr*, uintptr*);
/* /*
* low level C-called * low level C-called
...@@ -762,6 +762,7 @@ void runtime_procyield(uint32); ...@@ -762,6 +762,7 @@ void runtime_procyield(uint32);
void runtime_osyield(void); void runtime_osyield(void);
void runtime_lockOSThread(void); void runtime_lockOSThread(void);
void runtime_unlockOSThread(void); void runtime_unlockOSThread(void);
bool runtime_lockedOSThread(void);
bool runtime_showframe(String, bool); bool runtime_showframe(String, bool);
void runtime_printcreatedby(G*); void runtime_printcreatedby(G*);
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
package runtime package runtime
#include "runtime.h" #include "runtime.h"
#include "arch.h"
#include "go-type.h"
func GOMAXPROCS(n int) (ret int) { func GOMAXPROCS(n int) (ret int) {
ret = runtime_gomaxprocsfunc(n); ret = runtime_gomaxprocsfunc(n);
...@@ -12,3 +14,63 @@ func GOMAXPROCS(n int) (ret int) { ...@@ -12,3 +14,63 @@ func GOMAXPROCS(n int) (ret int) {
func NumCPU() (ret int) { func NumCPU() (ret int) {
ret = runtime_ncpu; ret = runtime_ncpu;
} }
func NumCgoCall() (ret int64) {
M *mp;
ret = 0;
for(mp=runtime_atomicloadp(&runtime_allm); mp; mp=mp->alllink)
ret += mp->ncgocall;
}
func newParFor(nthrmax uint32) (desc *ParFor) {
desc = runtime_parforalloc(nthrmax);
}
func parForSetup(desc *ParFor, nthr uint32, n uint32, ctx *byte, wait bool, body *byte) {
runtime_parforsetup(desc, nthr, n, ctx, wait, *(void(**)(ParFor*, uint32))body);
}
func parForDo(desc *ParFor) {
runtime_parfordo(desc);
}
func parForIters(desc *ParFor, tid uintptr) (start uintptr, end uintptr) {
runtime_parforiters(desc, tid, &start, &end);
}
func typestring(e Eface) (s String) {
s = *e.__type_descriptor->__reflection;
}
func golockedOSThread() (ret bool) {
ret = runtime_lockedOSThread();
}
func NumGoroutine() (ret int) {
ret = runtime_gcount();
}
func getgoroot() (out String) {
const byte *p;
p = runtime_getenv("GOROOT");
out = runtime_gostringnocopy(p);
}
func runtime_pprof.runtime_cyclesPerSecond() (res int64) {
res = runtime_tickspersecond();
}
func sync.runtime_procPin() (p int) {
M *mp;
mp = runtime_m();
// Disable preemption.
mp->locks++;
p = mp->p->id;
}
func sync.runtime_procUnpin() {
runtime_m()->locks--;
}
...@@ -73,13 +73,8 @@ runtime_gostringnocopy(const byte *str) ...@@ -73,13 +73,8 @@ runtime_gostringnocopy(const byte *str)
return s; return s;
} }
String runtime_cstringToGo(byte*) func cstringToGo(str *byte) (s String) {
__asm__ (GOSYM_PREFIX "runtime.cstringToGo"); s = runtime_gostringnocopy(str);
String
runtime_cstringToGo(byte *str)
{
return runtime_gostringnocopy(str);
} }
enum enum
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment