1. 14 Nov, 2014 3 commits
  2. 13 Nov, 2014 4 commits
  3. 12 Nov, 2014 8 commits
    • Joel Sing's avatar
      [dev.cc] [dev.cc] runtime: fix freebsd cgo __progname export · 37cae806
      Joel Sing authored
      LGTM=rsc
      R=rsc
      CC=golang-codereviews
      https://golang.org/cl/174050043
      37cae806
    • Russ Cox's avatar
      [dev.cc] runtime: delete scalararg, ptrarg; rename onM to systemstack · 656be317
      Russ Cox authored
      Scalararg and ptrarg are not "signal safe".
      Go code filling them out can be interrupted by a signal,
      and then the signal handler runs, and if it also ends up
      in Go code that uses scalararg or ptrarg, now the old
      values have been smashed.
      For the pieces of code that do need to run in a signal handler,
      we introduced onM_signalok, which is really just onM
      except that the _signalok is meant to convey that the caller
      asserts that scalarg and ptrarg will be restored to their old
      values after the call (instead of the usual behavior, zeroing them).
      
      Scalararg and ptrarg are also untyped and therefore error-prone.
      
      Go code can always pass a closure instead of using scalararg
      and ptrarg; they were only really necessary for C code.
      And there's no more C code.
      
      For all these reasons, delete scalararg and ptrarg, converting
      the few remaining references to use closures.
      
      Once those are gone, there is no need for a distinction between
      onM and onM_signalok, so replace both with a single function
      equivalent to the current onM_signalok (that is, it can be called
      on any of the curg, g0, and gsignal stacks).
      
      The name onM and the phrase 'm stack' are misnomers,
      because on most system an M has two system stacks:
      the main thread stack and the signal handling stack.
      
      Correct the misnomer by naming the replacement function systemstack.
      
      Fix a few references to "M stack" in code.
      
      The main motivation for this change is to eliminate scalararg/ptrarg.
      Rick and I have already seen them cause problems because
      the calling sequence m.ptrarg[0] = p is a heap pointer assignment,
      so it gets a write barrier. The write barrier also uses onM, so it has
      all the same problems as if it were being invoked by a signal handler.
      We worked around this by saving and restoring the old values
      and by calling onM_signalok, but there's no point in keeping this nice
      home for bugs around any longer.
      
      This CL also changes funcline to return the file name as a result
      instead of filling in a passed-in *string. (The *string signature is
      left over from when the code was written in and called from C.)
      That's arguably an unrelated change, except that once I had done
      the ptrarg/scalararg/onM cleanup I started getting false positives
      about the *string argument escaping (not allowed in package runtime).
      The compiler is wrong, but the easiest fix is to write the code like
      Go code instead of like C code. I am a bit worried that the compiler
      is wrong because of some use of uninitialized memory in the escape
      analysis. If that's the reason, it will go away when we convert the
      compiler to Go. (And if not, we'll debug it the next time.)
      
      LGTM=khr
      R=r, khr
      CC=austin, golang-codereviews, iant, rlh
      https://golang.org/cl/174950043
      656be317
    • Russ Cox's avatar
      [dev.cc] runtime/cgo: add comment about import _ "unsafe" · e98f2d59
      Russ Cox authored
      LGTM=bradfitz, r
      R=r, bradfitz
      CC=golang-codereviews
      https://golang.org/cl/167650043
      e98f2d59
    • Russ Cox's avatar
      [dev.cc] runtime/cgo: fix freebsd build? · a9695a5d
      Russ Cox authored
      Last try and then someone with a FreeBSD has to do it.
      
      TBR=r
      CC=golang-codereviews
      https://golang.org/cl/171590043
      a9695a5d
    • Russ Cox's avatar
      [dev.cc] runtime: fix arm5 build · 9e719cee
      Russ Cox authored
      TBR=r
      CC=golang-codereviews
      https://golang.org/cl/168600043
      9e719cee
    • Russ Cox's avatar
      [dev.cc] runtime/cgo: add missing import _ "unsafe" for //go:linkname · 22293bb1
      Russ Cox authored
      Will prod freebsd build along.
      Not claiming it will fix it.
      
      TBR=r
      CC=golang-codereviews
      https://golang.org/cl/171580044
      22293bb1
    • Russ Cox's avatar
      [dev.cc] runtime: convert freebsd to Go · aac17fd4
      Russ Cox authored
      It builds.
      Don't know if it works, but it's a lot closer than having everything in C.
      
      LGTM=r
      R=r
      CC=golang-codereviews
      https://golang.org/cl/168590043
      aac17fd4
    • Russ Cox's avatar
      [dev.cc] runtime: convert softfloat_arm.c to Go + build fixes · c81d248e
      Russ Cox authored
      Also include onM_signalok fix from issue 8995.
      
      Fixes linux/arm build.
      Fixes #8995.
      
      LGTM=r
      R=r, dave
      CC=golang-codereviews
      https://golang.org/cl/168580043
      c81d248e
  4. 11 Nov, 2014 22 commits
    • Russ Cox's avatar
      [dev.cc] runtime: bring back mgc0.h · 8420df62
      Russ Cox authored
      This was recorded as an hg mv instead of an hg cp.
      For now a C version is needed for the Go compiler.
      
      TBR=r
      CC=golang-codereviews
      https://golang.org/cl/174020043
      8420df62
    • Russ Cox's avatar
      [dev.cc] runtime: convert arch-specific .c and .h files to Go · 92048217
      Russ Cox authored
      The conversion was done with an automated tool and then
      modified only as necessary to make it compile and run.
      
      vlrt.c was only called from C. Pure delete.
      
      [This CL is part of the removal of C code from package runtime.
      See golang.org/s/dev.cc for an overview.]
      
      LGTM=r
      R=r, austin
      CC=dvyukov, golang-codereviews, iant, khr
      https://golang.org/cl/174860043
      92048217
    • Russ Cox's avatar
      [dev.cc] runtime: convert operating system support code from C to Go · e785e3ac
      Russ Cox authored
      The conversion was done with an automated tool and then
      modified only as necessary to make it compile and run.
      
      [This CL is part of the removal of C code from package runtime.
      See golang.org/s/dev.cc for an overview.]
      
      LGTM=r
      R=r
      CC=austin, dvyukov, golang-codereviews, iant, khr
      https://golang.org/cl/174830044
      e785e3ac
    • Russ Cox's avatar
      [dev.cc] runtime: convert scheduler from C to Go · b2cdf30e
      Russ Cox authored
      The conversion was done with an automated tool and then
      modified only as necessary to make it compile and run.
      
      [This CL is part of the removal of C code from package runtime.
      See golang.org/s/dev.cc for an overview.]
      
      LGTM=r
      R=r, daniel.morsing
      CC=austin, dvyukov, golang-codereviews, iant, khr
      https://golang.org/cl/172260043
      b2cdf30e
    • Russ Cox's avatar
      [dev.cc] runtime: convert race implementation from C to Go · 59e3e535
      Russ Cox authored
      The conversion was done with an automated tool and then
      modified only as necessary to make it compile and run.
      
      [This CL is part of the removal of C code from package runtime.
      See golang.org/s/dev.cc for an overview.]
      
      LGTM=r
      R=r
      CC=austin, dvyukov, golang-codereviews, iant, khr
      https://golang.org/cl/172250044
      59e3e535
    • Russ Cox's avatar
      [dev.cc] runtime: convert parallel support code from C to Go · ece09790
      Russ Cox authored
      The conversion was done with an automated tool and then
      modified only as necessary to make it compile and run.
      
      [This CL is part of the removal of C code from package runtime.
      See golang.org/s/dev.cc for an overview.]
      
      LGTM=r
      R=r, austin
      CC=dvyukov, golang-codereviews, iant, khr
      https://golang.org/cl/172250043
      ece09790
    • Russ Cox's avatar
      [dev.cc] runtime: convert defs_$GOOS_$GOARCH.h to Go · 580ef3e4
      Russ Cox authored
      The conversion was done with an automated tool and then
      modified only as necessary to make it compile and run.
      
      In a few cases, defs_$GOOS_$GOARCH.go already existed,
      so the target here is defs1_$GOOS_$GOARCH.go.
      
      [This CL is part of the removal of C code from package runtime.
      See golang.org/s/dev.cc for an overview.]
      
      LGTM=r
      R=r
      CC=austin, dvyukov, golang-codereviews, iant, khr
      https://golang.org/cl/171490043
      580ef3e4
    • Russ Cox's avatar
      [dev.cc] runtime: convert basic library routines from C to Go · 0c3c2c17
      Russ Cox authored
      float.c held bit patterns for special float64 values,
      hiding from the real uses. Rewrite Go code not to
      refer to those values directly.
      
      Convert library routines in runtime.c and string.c.
      
      LGTM=r
      R=r, dave
      CC=austin, dvyukov, golang-codereviews, iant, khr
      https://golang.org/cl/170330043
      0c3c2c17
    • Russ Cox's avatar
      [dev.cc] build: disable API check until all systems build · 7b3ebb13
      Russ Cox authored
      Otherwise no system will get an 'ok' until they all do.
      
      LGTM=r, dave
      R=r, dave
      CC=austin, dvyukov, golang-codereviews, iant, khr
      https://golang.org/cl/170320044
      7b3ebb13
    • Russ Cox's avatar
      [dev.cc] runtime: convert assembly files for C to Go transition · 15ced2d0
      Russ Cox authored
      The main change is that #include "zasm_GOOS_GOARCH.h"
      is now #include "go_asm.h" and/or #include "go_tls.h".
      
      Also, because C StackGuard is now Go _StackGuard,
      the assembly name changes from const_StackGuard to
      const__StackGuard.
      
      In asm_$GOARCH.s, add new function getg, formerly
      implemented in C.
      
      The renamed atomics now have Go wrappers, to get
      escape analysis annotations right. Those wrappers
      are in CL 174860043.
      
      LGTM=r, aram
      R=r, aram
      CC=austin, dvyukov, golang-codereviews, iant, khr
      https://golang.org/cl/168510043
      15ced2d0
    • Russ Cox's avatar
      [dev.cc] runtime: convert signal handlers from C to Go · 2d917c0c
      Russ Cox authored
      This code overused macros and could not be
      converted automatically. Instead a new sigctxt
      type had to be defined for each os/arch combination,
      with a common (implicit) interface used by the
      arch-specific signal handler code.
      
      [This CL is part of the removal of C code from package runtime.
      See golang.org/s/dev.cc for an overview.]
      
      LGTM=r
      R=r
      CC=austin, dvyukov, golang-codereviews, iant, khr
      https://golang.org/cl/168500044
      2d917c0c
    • Russ Cox's avatar
      [dev.cc] runtime/cgo: convert from C to Go · 9f99d531
      Russ Cox authored
      The conversion was done with an automated tool and then
      modified only as necessary to make it compile and run.
      
      [This CL is part of the removal of C code from package runtime.
      See golang.org/s/dev.cc for an overview.]
      
      LGTM=r
      R=r
      CC=austin, dvyukov, golang-codereviews, iant, khr
      https://golang.org/cl/168500043
      9f99d531
    • Russ Cox's avatar
      [dev.cc] runtime: convert header files to Go · fee9e475
      Russ Cox authored
      The conversion was done with an automated tool and then
      modified only as necessary to make it compile and run.
      
      [This CL is part of the removal of C code from package runtime.
      See golang.org/s/dev.cc for an overview.]
      
      LGTM=r
      R=r, austin
      CC=dvyukov, golang-codereviews, iant, khr
      https://golang.org/cl/167550043
      fee9e475
    • Russ Cox's avatar
      [dev.cc] runtime: convert memory allocator and garbage collector to Go · 1e2d2f09
      Russ Cox authored
      The conversion was done with an automated tool and then
      modified only as necessary to make it compile and run.
      
      [This CL is part of the removal of C code from package runtime.
      See golang.org/s/dev.cc for an overview.]
      
      LGTM=r
      R=r
      CC=austin, dvyukov, golang-codereviews, iant, khr
      https://golang.org/cl/167540043
      1e2d2f09
    • Russ Cox's avatar
      [dev.cc] runtime: convert panic and stack code from C to Go · d98553a7
      Russ Cox authored
      The conversion was done with an automated tool and then
      modified only as necessary to make it compile and run.
      
      [This CL is part of the removal of C code from package runtime.
      See golang.org/s/dev.cc for an overview.]
      
      LGTM=r
      R=r, dave
      CC=austin, dvyukov, golang-codereviews, iant, khr
      https://golang.org/cl/166520043
      d98553a7
    • Russ Cox's avatar
      [dev.cc] cmd/dist: adjust for build process without cmd/cc · 0d49f7b5
      Russ Cox authored
      [This CL is part of the removal of C code from package runtime.
      See golang.org/s/dev.cc for an overview.]
      
      - Remove references to C compiler directories.
      - Remove generation of special header files.
      - Remove generation of Go source files from C declarations.
      
      - Compile Go sources before rest of package (was after),
        so that Go compiler can write go_asm.h for use in assembly.
      
      - Move TLS information from cmd/dist (was embedding in output)
        to src/runtime/go_tls.h, which it can be maintained directly.
      
      LGTM=r
      R=r, dave
      CC=austin, golang-codereviews, iant, khr
      https://golang.org/cl/172960043
      0d49f7b5
    • Russ Cox's avatar
      [dev.cc] liblink: resolve bss vs other conflict regardless of order found · 0185ba76
      Russ Cox authored
      If the linker finds the same name given a BSS and a non-BSS
      symbol, the assumption is that the non-BSS symbol is the
      true one, and the BSS symbol is just the best Go can do toward
      an "extern" declaration. This has always been the case,
      as long as the object files were read in the right order.
      
      The old code worked when the BSS symbol is found before
      the non-BSS symbol. This CL adds equivalent logic for when
      the non-BSS symbol is found before the BSS symbol.
      This comes up when Go must refer to symbols defined in
      host object files.
      
      LGTM=r
      R=r
      CC=austin, golang-codereviews, iant, khr
      https://golang.org/cl/171480043
      0185ba76
    • Russ Cox's avatar
      [dev.cc] cmd/go: adjust go, cgo builds & disable cc · 729847cf
      Russ Cox authored
      [This CL is part of the removal of C code from package runtime.
      See golang.org/s/dev.cc for an overview.]
      
      Make gcToolchain.cc return an error (no C compiler!).
      
      Adjust expectations of cgo, now that cgo does not write any C files
      (no C compiler!).
      
      For packages with .s files, invoke Go compiler with -asmhdr go_asm.h
      so that assembly files can use it. This applies to all packages but is only
      needed today by package runtime.
      
      LGTM=r
      R=r
      CC=austin, golang-codereviews, iant, khr
      https://golang.org/cl/171470043
      729847cf
    • Russ Cox's avatar
      [dev.cc] cmd/gc: changes for removing runtime C code · fd2bc95d
      Russ Cox authored
      [This CL is part of the removal of C code from package runtime.
      See golang.org/s/dev.cc for an overview.]
      
      export.c, lex.c:
      Add -asmhdr flag to write assembly header file with struct
      field offsets and const values. cmd/dist used to construct this
      file by interpreting output from the C compiler.
      Generate it from the Go definitions instead.
      Also, generate the form we need directly, instead of relying
      on cmd/dist for reprocessing.
      
      lex.c, obj.c:
      If the C compiler accepted #pragma cgo_xxx, recognize
      a directive //go:cgo_xxx instead. The effect is the same as
      in the C compiler: accumulate text into a buffer and emit in the
      output file, where the linker will find and use it.
      
      lex.c, obj.c:
      Accept //go:linkname to control the external symbol name
      used for a particular top-level Go variable. This makes it
      possible to refer to C symbol names but also symbols from
      other packages. It has always been possible to do this from
      C and assembly. To drive home the point that this should not
      be done lightly, require import "unsafe" in any file containing
      //go:linkname.
      
      plive.c, reflect.c, subr.c:
      Hard-code that interfaces contain only pointers.
      This means code handling multiword values in the garbage
      collector and the stack copier can be deleted instead of being
      converted. This change is already present in the dev.garbage
      branch.
      
      LGTM=r
      R=r
      CC=austin, golang-codereviews, iant, khr
      https://golang.org/cl/169360043
      fd2bc95d
    • Russ Cox's avatar
      [dev.cc] cmd/cgo: generate only Go source files · 25f9f5d0
      Russ Cox authored
      [This CL is part of the removal of C code from package runtime.
      See golang.org/s/dev.cc for an overview.]
      
      We changed cgo to write the actual function wrappers in Go
      for Go 1.4. The only code left in C output files was the definitions
      for pointers to C data and the #pragma cgo directives.
      Write both of those to Go outputs instead, using the new
      compiler directives introduced in CL 169360043.
      
      (Still generating C files in gccgo mode.)
      
      LGTM=r
      R=r
      CC=austin, golang-codereviews, iant, khr
      https://golang.org/cl/169330045
      25f9f5d0
    • Russ Cox's avatar
      [dev.cc] reflect: interfaces contain only pointers · 33e91029
      Russ Cox authored
      [This CL is part of the removal of C code from package runtime.
      See golang.org/s/dev.cc for an overview.]
      
      Adjustments for changes made in CL 169360043.
      This change is already present in the dev.garbage branch.
      
      LGTM=r
      R=r
      CC=austin, golang-codereviews, iant, khr
      https://golang.org/cl/167520044
      33e91029
    • Russ Cox's avatar
      [dev.cc] cmd/5c, cmd/6c, cmd/8c, cmd/cc: remove · 4a42fae2
      Russ Cox authored
      Let's just do this up front.
      This will break the build (here on the dev.cc branch).
      The CLs that follow will take care of fixing it.
      
      Leave behind cmd/cc/lexbody and cmd/cc/macbody for the assemblers.
      They'll go away later.
      
      LGTM=dave, r
      R=r, dave
      CC=golang-codereviews
      https://golang.org/cl/172170043
      4a42fae2
  5. 10 Nov, 2014 3 commits