Commit Graph

34 Commits

Author SHA1 Message Date
Ian Lance Taylor fbe9724cc3 runtime: fixes for -buildmode=c-archive
With -buildmode=c-archive, initsig is called before the memory
    allocator has been initialized.  The code was doing a memory
    allocation because of the call to funcPC(sigtramp).  When escape
    analysis is fully implemented, that call should not allocate.  For
    now, finesse the issue by calling a C function to get the C function
    pointer value of sigtramp.
    
    When returning from a call from C to a Go function, a deferred
    function is run to go back to syscall mode.  When the call occurs on a
    non-Go thread, that call sets g to nil, making it impossible to add
    the _defer struct back to the pool.  Just drop it and let the garbage
    collector clean it up.
    
    Reviewed-on: https://go-review.googlesource.com/33675

From-SVN: r242992
2016-11-30 02:09:24 +00:00
Ian Lance Taylor 9d1e3afb54 runtime: rewrite panic/defer code from C to Go
The actual stack unwind code is still in C, but the rest of the code,
    notably all the memory allocation, is now in Go.  The names are changed
    to the names used in the Go 1.7 runtime, but the code is necessarily
    somewhat different.
    
    The __go_makefunc_can_recover function is dropped, as the uses of it
    were removed in https://golang.org/cl/198770044.
    
    Reviewed-on: https://go-review.googlesource.com/33414

From-SVN: r242715
2016-11-22 17:58:04 +00:00
Ian Lance Taylor 7b9f5ceef1 runtime: don't crash if signal handler info argument is nil
Apparently on Solaris 10 a SA_SIGINFO signal handler can be invoked with
    a nil info argument.  I would not have believed it but I've now seen it
    happen, and the sigaction man page actually says "If the second argument
    is not equal to NULL, it points to a siginfo_t structure...."  So, if
    that happens, don't crash.
    
    Also fix another case where we want to make sure that &T{} does not
    allocate.
    
    Reviewed-on: https://go-review.googlesource.com/33150

From-SVN: r242403
2016-11-14 23:16:04 +00:00
Ian Lance Taylor 980f9a0a4b runtime: copy signal code from Go 1.7 runtime
Add a little shell script to auto-generate runtime.sigtable from the
    known signal names.
    
    Force the main package to always import the runtime package.  Otherwise
    some runtime package global variables may never be initialized.
    
    Set the syscallsp and syscallpc fields of g when entering a syscall, so
    that the runtime package knows when a g is executing a syscall.
    
    Fix runtime.funcPC to avoid dead store elimination of the interface
    value when the function is inlined.
    
    Reviewed-on: https://go-review.googlesource.com/33025

From-SVN: r242060
2016-11-10 22:53:23 +00:00
Ian Lance Taylor 8cce07d1dd runtime: copy rdebug code from Go 1.7 runtime
While we're at it, update the runtime/debug package, and start running
    its testsuite by default.  I'm not sure why runtime/debug was not
    previously updated to 1.7.  Doing that led me to fix some minor aspects
    of runtime.Stack and the C function runtime/debug.readGCStats.
    
    Reviewed-on: https://go-review.googlesource.com/31251

From-SVN: r241261
2016-10-17 16:54:25 +00:00
Ian Lance Taylor 238fc3441c runtime: copy cpuprof code from Go 1.7 runtime
This replaces runtime/cpuprof.goc with go/runtime/cpuprof.go and adjusts
    the supporting code in runtime/proc.c.
    
    This adds another case where the compiler needs to avoid heap allocation
    in the runtime package: when evaluating a method expression into a
    closure.  Implementing this required moving the relevant code from
    do_get_backend to do_flatten, so that I could easily add a temporary
    variable.  Doing that let me get rid of Bound_method_expression::do_lower.
    
    Reviewed-on: https://go-review.googlesource.com/31050

From-SVN: r241163
2016-10-14 13:36:35 +00:00
Ian Lance Taylor 75791bab05 runtime: use -fgo-c-header to build C header file
Use the new -fgo-c-header option to build a header file for the Go
    runtime code in libgo/go/runtime, and use the new header file in the C
    runtime code in libgo/runtime.  This will ensure that the Go code and C
    code share the same data structures as we convert the runtime from C to
    Go.
    
    The new file libgo/go/runtime/runtime2.go is copied from the Go 1.7
    release, and then edited to remove unnecessary data structures and
    modify others for use with libgo.
    
    The new file libgo/go/runtime/mcache.go is an initial version of the
    same files in the Go 1.7 release, and will be replaced by the Go 1.7
    file when we convert to the new memory allocator.
    
    The new file libgo/go/runtime/type.go describes the gccgo version of the
    reflection data structures, and replaces the Go 1.7 runtime file which
    describes the gc version of those structures.
    
    Using the new header file means changing a number of struct fields to
    use Go naming conventions (that is, no underscores) and to rename
    constants to have a leading underscore so that they are not exported
    from the Go package.  These names were updated in the C code.
    
    The C code was also changed to drop the thread-local variable m, as was
    done some time ago in the gc sources.  Now the m field is always
    accessed using g->m, where g is the single remaining thread-local
    variable.  This in turn required some adjustments to set g->m correctly
    in all cases.
    
    Also pass the new -fgo-compiling-runtime option when compiling the
    runtime package, although that option doesn't do anything yet.
    
    Reviewed-on: https://go-review.googlesource.com/28051

From-SVN: r239872
2016-08-30 21:07:47 +00:00
Ian Lance Taylor f98dd1a338 libgo: Update to go1.6rc1.
Reviewed-on: https://go-review.googlesource.com/19200

From-SVN: r233110
2016-02-03 21:58:02 +00:00
Ian Lance Taylor 00d86ac99f libgo: Update to Go 1.3 release.
From-SVN: r212837
2014-07-19 08:53:52 +00:00
Ian Lance Taylor 50312b2ff0 runtime: Use pthread_sigmask instead of sigprocmask.
From-SVN: r205652
2013-12-04 01:35:53 +00:00
Ian Lance Taylor e8d8443d22 runtime: Fix prototype and one use of runtime_traceback.
From Richard Biener.

From-SVN: r205634
2013-12-03 14:51:07 +00:00
Ian Lance Taylor f038dae646 libgo: Update to October 24 version of master library.
From-SVN: r204466
2013-11-06 19:49:01 +00:00
Ian Lance Taylor c187e58fa2 runtime: Fix build on systems without split stack.
From Uros Bizjak.

From-SVN: r203703
2013-10-16 13:37:35 +00:00
Ian Lance Taylor 8088e1beb2 runtime: Don't clobber saved context when catching signal.
From-SVN: r203577
2013-10-14 21:02:52 +00:00
Ian Lance Taylor 5f9ae7f2d6 runtime: Ignore SIGPROF if not on a Go thread.
From-SVN: r201154
2013-07-23 04:42:09 +00:00
Ian Lance Taylor be47d6ecef libgo: Update to Go 1.1.1.
From-SVN: r200974
2013-07-16 06:54:42 +00:00
Ian Lance Taylor f6b1e65ec3 re PR go/46986 (Go is not supported on Darwin)
PR go/46986
all: prepend #__USER_LABEL_PREFIX__ to mangled Go symbols
For old-fashioned Darwin.

From-SVN: r195438
2013-01-24 19:44:23 +00:00
Ian Lance Taylor 4731f878b7 runtime: Fix build failures with -D_FORTIFY_SOURCE=2.
From-SVN: r194116
2012-12-04 06:18:07 +00:00
Ian Lance Taylor 4ccad563d2 libgo: Update to current sources.
From-SVN: r192704
2012-10-23 04:31:11 +00:00
Ian Lance Taylor 1fae9801e4 runtime, runtime/pprof: Fix runtime/pprof test to pass, enable it.
From-SVN: r189878
2012-07-26 01:57:04 +00:00
Ian Lance Taylor d7b8f2b781 runtime: Print stack trace on panic or signal.
From-SVN: r187623
2012-05-17 05:30:25 +00:00
Ian Lance Taylor f3ab5720f7 libgo: Use -fgo-pkgpath.
From-SVN: r187485
2012-05-14 22:08:42 +00:00
Ian Lance Taylor cbb6491d76 libgo: Update to weekly.2012-02-14 release.
From-SVN: r184798
2012-03-02 16:38:43 +00:00
Ian Lance Taylor a05fe19071 runtime: Fix missing USING_SPLIT_STACK ifdef.
From Uros Bizjak.

From-SVN: r182633
2011-12-22 19:07:12 +00:00
Ian Lance Taylor a6dcb7d465 runtime: Catch signals on altstack, disable splitstack signal blocking.
From-SVN: r182607
2011-12-21 22:24:47 +00:00
Ian Lance Taylor 03eee7f75c runtime: RTEMS build fixes.
From Joel Sherrill.

From-SVN: r182309
2011-12-13 21:59:26 +00:00
Ian Lance Taylor 17dcf07581 runtime: Rename sigignore to sig_ignore for Solaris.
From-SVN: r181885
2011-12-01 17:08:12 +00:00
Ian Lance Taylor b87974949f runtime: Copy runtime_panicstring from master library.
From-SVN: r181830
2011-11-30 00:21:52 +00:00
Ian Lance Taylor 737087cbc8 runtime: Multiplex goroutines onto OS threads.
From-SVN: r181772
2011-11-28 05:45:49 +00:00
Ian Lance Taylor 9ff56c9570 Update to current version of Go library.
From-SVN: r173931
2011-05-20 00:18:15 +00:00
Ian Lance Taylor c29301d6b1 Add runtime profiling infrastructure, not yet working.
From-SVN: r171579
2011-03-27 19:14:55 +00:00
Ian Lance Taylor 7b5da51d4f Don't catch LIBPROF in Go code.
From-SVN: r171077
2011-03-16 23:18:40 +00:00
Ian Lance Taylor 646abff51d Better error message if malloc gets a SIGSEGV.
From-SVN: r167785
2010-12-14 05:19:51 +00:00
Ian Lance Taylor 7a9389330e Add Go frontend, libgo library, and Go testsuite.
gcc/:
	* gcc.c (default_compilers): Add entry for ".go".
	* common.opt: Add -static-libgo as a driver option.
	* doc/install.texi (Configuration): Mention libgo as an option for
	--enable-shared.  Mention go as an option for --enable-languages.
	* doc/invoke.texi (Overall Options): Mention .go as a file name
	suffix.  Mention go as a -x option.
	* doc/frontends.texi (G++ and GCC): Mention Go as a supported
	language.
	* doc/sourcebuild.texi (Top Level): Mention libgo.
	* doc/standards.texi (Standards): Add section on Go language.
	Move references for other languages into their own section.
	* doc/contrib.texi (Contributors): Mention that I contributed the
	Go frontend.
gcc/testsuite/:
	* lib/go.exp: New file.
	* lib/go-dg.exp: New file.
	* lib/go-torture.exp: New file.
	* lib/target-supports.exp (check_compile): Match // Go.

From-SVN: r167407
2010-12-03 04:34:57 +00:00