1. 22 May, 2015 8 commits
    • Robert Griesemer's avatar
      math/big: add more Float.Float64 conversion tests · 8de8925c
      Robert Griesemer authored
      - structure the Float64 conversion tests the same way as for Float32
      - add additional test cases, including one that exposes a current issue
        (currently disabled, same issue as was fixed for Float32)
      
      The Float64 fix will be in a subsequent change for easier reviewing.
      
      Change-Id: I95dc9e8d1f6b6073a98c7bc2289e6d3248fc3420
      Reviewed-on: https://go-review.googlesource.com/10351Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      8de8925c
    • Robert Griesemer's avatar
      math/big: fix Float.Float32 conversion for denormal corner cases · 79afb43a
      Robert Griesemer authored
      The existing code was incorrect for numbers that after rounding would
      become the smallest denormal float32 (instead the result was 0). This
      caused all.bash to fail if Float32() were used in the compiler for
      constant arithmetic (there's currently a work-around - see also issue
      10321.
      
      This change fixes the implementation of Float.Float32 and adds
      corresponding test cases. Float32 and Float64 diverge at this point.
      For ease of review, this change only fixes Float32. Float64 will be
      made to match in a subsequent change.
      
      Fixes #10321.
      
      Change-Id: Iccafe37c1593a4946bc552e4ad2045f69be62d80
      Reviewed-on: https://go-review.googlesource.com/10350Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      79afb43a
    • Elias Naur's avatar
      runtime: don't always unblock all signals · 84cfba17
      Elias Naur authored
      Ian proposed an improved way of handling signals masks in Go, motivated
      by a problem where the Android java runtime expects certain signals to
      be blocked for all JVM threads. Discussion here
      
      https://groups.google.com/forum/#!topic/golang-dev/_TSCkQHJt6g
      
      Ian's text is used in the following:
      
      A Go program always needs to have the synchronous signals enabled.
      These are the signals for which _SigPanic is set in sigtable, namely
      SIGSEGV, SIGBUS, SIGFPE.
      
      A Go program that uses the os/signal package, and calls signal.Notify,
      needs to have at least one thread which is not blocking that signal,
      but it doesn't matter much which one.
      
      Unix programs do not change signal mask across execve.  They inherit
      signal masks across fork.  The shell uses this fact to some extent;
      for example, the job control signals (SIGTTIN, SIGTTOU, SIGTSTP) are
      blocked for commands run due to backquote quoting or $().
      
      Our current position on signal masks was not thought out.  We wandered
      into step by step, e.g., http://golang.org/cl/7323067 .
      
      This CL does the following:
      
      Introduce a new platform hook, msigsave, that saves the signal mask of
      the current thread to m.sigsave.
      
      Call msigsave from needm and newm.
      
      In minit grab set up the signal mask from m.sigsave and unblock the
      essential synchronous signals, and SIGILL, SIGTRAP, SIGPROF, SIGSTKFLT
      (for systems that have it).
      
      In unminit, restore the signal mask from m.sigsave.
      
      The first time that os/signal.Notify is called, start a new thread whose
      only purpose is to update its signal mask to make sure signals for
      signal.Notify are unblocked on at least one thread.
      
      The effect on Go programs will be that if they are invoked with some
      non-synchronous signals blocked, those signals will normally be
      ignored.  Previously, those signals would mostly be ignored.  A change
      in behaviour will occur for programs started with any of these signals
      blocked, if they receive the signal: SIGHUP, SIGINT, SIGQUIT, SIGABRT,
      SIGTERM.  Previously those signals would always cause a crash (unless
      using the os/signal package); with this change, they will be ignored
      if the program is started with the signal blocked (and does not use
      the os/signal package).
      
      ./all.bash completes successfully on linux/amd64.
      
      OpenBSD is missing the implementation.
      
      Change-Id: I188098ba7eb85eae4c14861269cc466f2aa40e8c
      Reviewed-on: https://go-review.googlesource.com/10173Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      84cfba17
    • Dave Cheney's avatar
      net: fix panic in TestDialerDualStack · 994b2d46
      Dave Cheney authored
      This change ensures that the test does not try to close dual stack
      listeners which have not yet been opened.
      
      Spotted in crash here
      http://build.golang.org/log/e5843777df400868ce708b7f00c50dc32c2ec478
      
      Change-Id: I79d513e166effb3e018e2b9dfc23751d92fcbe4b
      Reviewed-on: https://go-review.googlesource.com/10371Reviewed-by: default avatarMikio Hara <mikioh.mikioh@gmail.com>
      Run-TryBot: Dave Cheney <dave@cheney.net>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      994b2d46
    • David Chase's avatar
      cmd/internal/gc: move check for large-hence-heap-allocated types into escape analysis · e5060c7f
      David Chase authored
      Before this change, the check for too-large arrays (and other large
      types) occurred after escape analysis.  If the data moved off stack
      and onto the heap contained any pointers, it would therefore escape,
      but because the too-large check occurred after escape analysis this
      would not be recorded and a stack pointer would leak to the heap
      (see the modified escape_array.go for an example).
      
      Some of these appear to remain, in calls to typecheck from within walk.
      
      Also corrected a few comments in escape_array.go about "BAD"
      analysis that is now done correctly.
      
      Enhanced to move aditional EscNone-but-large-so-heap checks into esc.c.
      
      Change-Id: I770c111baff28a9ed5f8beb601cf09dacc561b83
      Reviewed-on: https://go-review.googlesource.com/10268Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      e5060c7f
    • David Chase's avatar
      cmd/internal/gc: make indirect calls properly escape-y · b19ec684
      David Chase authored
      Indirect function and method calls should leak everything,
      but they didn't.
      
      This fix had no particular effect on the cost of running the
      compiler on html/template/*.go and added a single new "escape"
      to the standard library:
      
          syscall/syscall_unix.go:85: &b[0] escapes to heap
      in
      	if errno := m.munmap(uintptr(unsafe.Pointer(&b[0])),
      	                     uintptr(len(b))); errno != nil {
      
      Added specific escape testing to escape_calls.go
      (and verified that it fails without this patch)
      
      I also did a little code cleanup around the changes in esc.c.
      
      Fixes #10925
      
      Change-Id: I9984b701621ad4c49caed35b01e359295c210033
      Reviewed-on: https://go-review.googlesource.com/10295Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      b19ec684
    • Robert Griesemer's avatar
      math/big: gofmt nat_test.go · c344f751
      Robert Griesemer authored
      Was apparently checked in by https://go-review.googlesource.com/#/c/9253/
      without being gofmt-ed.
      
      TBR: agl
      
      Change-Id: I4d011dbaa15b7c5e73ca71f724f32951a0302dae
      Reviewed-on: https://go-review.googlesource.com/10353Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      c344f751
    • Vlad Krasnov's avatar
      math/big: Simple Montgomery Multiplication to accelerate Mod-Exp · 92796849
      Vlad Krasnov authored
      On Haswell I measure anywhere between 2X to 3.5X speedup for RSA.
      I believe other architectures will also greatly improve.
      In the future may be upgraded by dedicated assembly routine.
      
      Built-in benchmarks i5-4278U turbo off:
      
      benchmark                         old ns/op     new ns/op     delta
      BenchmarkRSA2048Decrypt           6696649       3073769       -54.10%
      Benchmark3PrimeRSA2048Decrypt     4472340       1669080       -62.68%
      
      Change-Id: I17df84f85e34208f990665f9f90ea671695b2add
      Reviewed-on: https://go-review.googlesource.com/9253Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarAdam Langley <agl@golang.org>
      Reviewed-by: default avatarVlad Krasnov <vlad@cloudflare.com>
      Run-TryBot: Adam Langley <agl@golang.org>
      92796849
  2. 21 May, 2015 11 commits
    • Russ Cox's avatar
      runtime: fix callwritebarrier · 001438bd
      Russ Cox authored
      Given a call frame F of size N where the return values start at offset R,
      callwritebarrier was instructing heapBitsBulkBarrier to scan the block
      of memory [F+R, F+R+N). It should only scan [F+R, F+N). The extra N-R
      bytes scanned might lead into the next allocated block in memory.
      Because the scan was consulting the heap bitmap for type information,
      scanning into the next block normally "just worked" in the sense of
      not crashing.
      
      Scanning the extra N-R bytes of memory is a problem mainly because
      it causes the GC to consider pointers that might otherwise not be
      considered, leading it to retain objects that should actually be freed.
      This is very difficult to detect.
      
      Luckily, juju turned up a case where the heap bitmap and the memory
      were out of sync for the block immediately after the call frame, so that
      heapBitsBulkBarrier saw an obvious non-pointer where it expected a
      pointer, causing a loud crash.
      
      Why is there a non-pointer in memory that the heap bitmap records as
      a pointer? That is more difficult to answer. At least one way that it
      could happen is that allocations containing no pointers at all do not
      update the heap bitmap. So if heapBitsBulkBarrier walked out of the
      current object and into a no-pointer object and consulted those bitmap
      bits, it would be misled. This doesn't happen in general because all
      the paths to heapBitsBulkBarrier first check for the no-pointer case.
      This may or may not be what happened, but it's the only scenario
      I've been able to construct.
      
      I tried for quite a while to write a simple test for this and could not.
      It does fix the juju crash, and it is clearly an improvement over the
      old code.
      
      Fixes #10844.
      
      Change-Id: I53982c93ef23ef93155c4086bbd95a4c4fdaac9a
      Reviewed-on: https://go-review.googlesource.com/10317Reviewed-by: default avatarAustin Clements <austin@google.com>
      001438bd
    • Austin Clements's avatar
      runtime: eliminate write barrier from adjustpointers · a5c3bbe0
      Austin Clements authored
      Currently adjustpointers invokes a write barrier for every stack slot
      it updates. This is safe---the write barrier always does nothing
      because the new value is never a heap pointer---but it's unnecessary
      overhead in performance and complexity.
      
      Fix this by rewriting adjustpointers to work with *uintptrs instead of
      *unsafe.Pointers. As an added bonus, this makes the code cleaner.
      
      name                   old mean              new mean              delta
      BinaryTree17            3.35s × (0.98,1.01)   3.33s × (0.99,1.02)    ~    (p=0.095 n=20+19)
      Fannkuch11              2.49s × (1.00,1.01)   2.52s × (0.99,1.01)  +1.23% (p=0.000 n=19+20)
      FmtFprintfEmpty        52.2ns × (0.99,1.02)  52.2ns × (0.99,1.02)    ~    (p=0.766 n=19+19)
      FmtFprintfString        181ns × (0.99,1.02)   179ns × (0.99,1.01)  -1.06% (p=0.000 n=20+19)
      FmtFprintfInt           177ns × (0.99,1.01)   173ns × (0.99,1.02)  -2.26% (p=0.000 n=17+20)
      FmtFprintfIntInt        300ns × (0.99,1.01)   302ns × (0.99,1.01)  +0.76% (p=0.000 n=19+20)
      FmtFprintfPrefixedInt   253ns × (0.99,1.02)   256ns × (0.99,1.01)  +0.96% (p=0.000 n=20+19)
      FmtFprintfFloat         334ns × (0.99,1.02)   334ns × (1.00,1.01)    ~    (p=0.243 n=20+19)
      FmtManyArgs            1.16µs × (0.99,1.01)  1.17µs × (0.99,1.02)  +0.88% (p=0.000 n=20+20)
      GobDecode              9.16ms × (0.99,1.02)  9.18ms × (1.00,1.00)  +0.21% (p=0.048 n=20+17)
      GobEncode              7.03ms × (0.99,1.01)  7.05ms × (0.99,1.01)    ~    (p=0.091 n=19+19)
      Gzip                    374ms × (0.99,1.01)   372ms × (0.99,1.02)  -0.50% (p=0.008 n=18+20)
      Gunzip                 92.9ms × (0.99,1.01)  92.5ms × (1.00,1.01)  -0.47% (p=0.002 n=19+19)
      HTTPClientServer       53.1µs × (0.98,1.01)  52.5µs × (0.99,1.01)  -0.98% (p=0.000 n=20+19)
      JSONEncode             17.4ms × (0.99,1.02)  17.5ms × (0.99,1.01)    ~    (p=0.061 n=19+20)
      JSONDecode             66.0ms × (0.99,1.02)  64.7ms × (0.99,1.01)  -1.87% (p=0.000 n=20+20)
      Mandelbrot200          3.94ms × (1.00,1.01)  3.95ms × (1.00,1.01)    ~    (p=0.799 n=18+19)
      GoParse                3.89ms × (0.99,1.02)  3.86ms × (0.99,1.01)  -0.70% (p=0.016 n=20+19)
      RegexpMatchEasy0_32     102ns × (0.99,1.02)   102ns × (1.00,1.01)    ~    (p=0.557 n=20+18)
      RegexpMatchEasy0_1K     353ns × (0.99,1.02)   341ns × (0.99,1.01)  -3.38% (p=0.000 n=20+20)
      RegexpMatchEasy1_32    85.0ns × (0.99,1.02)  85.0ns × (0.99,1.01)    ~    (p=0.851 n=19+20)
      RegexpMatchEasy1_1K     521ns × (0.99,1.02)   506ns × (1.00,1.01)  -2.85% (p=0.000 n=20+18)
      RegexpMatchMedium_32    142ns × (0.99,1.02)   141ns × (1.00,1.01)  -1.17% (p=0.000 n=20+19)
      RegexpMatchMedium_1K   42.8µs × (0.99,1.01)  42.3µs × (0.99,1.01)  -1.07% (p=0.000 n=20+19)
      RegexpMatchHard_32     2.17µs × (0.99,1.01)  2.16µs × (1.00,1.01)  -0.51% (p=0.042 n=20+18)
      RegexpMatchHard_1K     65.6µs × (0.99,1.01)  64.8µs × (1.00,1.00)  -1.21% (p=0.000 n=20+17)
      Revcomp                 581ms × (0.99,1.04)   536ms × (1.00,1.01)  -7.71% (p=0.000 n=20+18)
      Template               77.2ms × (0.99,1.01)  76.8ms × (0.99,1.01)    ~    (p=0.426 n=20+18)
      TimeParse               369ns × (0.99,1.02)   371ns × (1.00,1.01)    ~    (p=0.117 n=20+19)
      TimeFormat              371ns × (0.99,1.02)   391ns × (0.99,1.01)  +5.33% (p=0.000 n=20+19)
      
      Change-Id: I5b952ba577ac4365c8c87db837c5804a1e30b7be
      Reviewed-on: https://go-review.googlesource.com/10293Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      a5c3bbe0
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj: remove F3t field from Prog · 13781737
      Josh Bleecher Snyder authored
      F3t was effectively a local variable.
      Remove it.
      
      This shrinks obj.Prog from 456 to 448 bytes,
      which places it in a smaller malloc class.
      
      This reduces the memory usage of the compiler
      while compiling the rotate tests by ~2.75%.
      
      Change-Id: I31cc9dd67269851a430b56bcc7d255c9349eb522
      Reviewed-on: https://go-review.googlesource.com/10255Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      13781737
    • Russ Cox's avatar
      cmd/go: set correct install location for cmd/compile and cmd/link · 216e5c74
      Russ Cox authored
      Without this, they install to $GOROOT/bin.
      
      Change-Id: Iae4b8f59c8392f6abd841490e56922738089f8d4
      Reviewed-on: https://go-review.googlesource.com/10297Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      216e5c74
    • Russ Cox's avatar
      all: retire architecture letter in file names, public API · cf932cd8
      Russ Cox authored
      This CL removes the remaining visible uses of the "architecture letter" concept.
      (They are no longer in tool names nor in source directory names.)
      
      Because the architecture letter concept is now gone, delete GOCHAR
      from "go env" output, and change go/build.ArchChar to return an
      error always.
      
      The architecture letter is still used in the compiler and linker sources
      as a clumsy architecture enumeration, but that use is not visible to
      Go users and can be cleaned up separately.
      
      Change-Id: I4d97a38f372003fb610c9c5241bea440d9dbeb8d
      Reviewed-on: https://go-review.googlesource.com/10289Reviewed-by: default avatarRob Pike <r@golang.org>
      cf932cd8
    • Russ Cox's avatar
      all: build and use go tool compile, go tool link · 0f4132c9
      Russ Cox authored
      This CL fixes the build to use the newly created go tool compile
      and go tool link in place of go tool 5g, go tool 5l, and so on.
      
      See golang-dev thread titled "go tool compile, etc" for background.
      
      Although it was not a primary motivation, this conversion does
      reduce the wall clock time and cpu time required for make.bash
      by about 10%.
      
      Change-Id: I79cbbdb676cab029db8aeefb99a53178ff55f98d
      Reviewed-on: https://go-review.googlesource.com/10288Reviewed-by: default avatarRob Pike <r@golang.org>
      0f4132c9
    • Russ Cox's avatar
      cmd/compile, cmd/link: create from 5g, 5l, etc · 17eba6e6
      Russ Cox authored
      Trivial merging of 5g, 6g, ... into go tool compile,
      and similarlly 5l, 6l, ... into go tool link.
      The files compile/main.go and link/main.go are new.
      Everything else in those directories is a move followed by
      change of imports and package name.
      
      This CL breaks the build. Manual fixups are in the next CL.
      
      See golang-dev thread titled "go tool compile, etc" for background.
      
      Change-Id: Id35ff5a5859ad9037c61275d637b1bd51df6828b
      Reviewed-on: https://go-review.googlesource.com/10287Reviewed-by: default avatarDave Cheney <dave@cheney.net>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      17eba6e6
    • Russ Cox's avatar
      cmd/link: move to cmd/newlink · 2a141ded
      Russ Cox authored
      In preparation for making the current linker cmd/link.
      If cmd/newlink is ever completed, it can be moved back.
      
      See golang-dev thread titled "go tool compile, etc" for background.
      
      Change-Id: I4029580f470038240c5181a37ea4202ba971f9ef
      Reviewed-on: https://go-review.googlesource.com/10286Reviewed-by: default avatarRob Pike <r@golang.org>
      2a141ded
    • Ryan Brown's avatar
      cmd/internal/ld: output dwarf in external link mode on darwin · be59731d
      Ryan Brown authored
      Fixes #8973
      
      Change-Id: I746fae430db6d8f9ebd33586b8cffcb31d688cc8
      Reviewed-on: https://go-review.googlesource.com/10284
      Run-TryBot: Minux Ma <minux@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      be59731d
    • Rick Hudson's avatar
      runtime: turn work buffer tracing off by default · 5b66e5d0
      Rick Hudson authored
      During development we ran with monitoring code turned
      on by default. This CL turns the work buffer monitoring
      off. Performance change on most go1 benchmarks is small
      or insignificant.
      
      name                   old mean              new mean              delta
      BinaryTree17            3.35s × (0.99,1.01)   3.35s × (0.99,1.01)    ~    (p=0.841 n=5+5)
      Fannkuch11              2.59s × (1.00,1.01)   2.55s × (1.00,1.00)  -1.65% (p=0.008 n=5+5)
      FmtFprintfEmpty        52.5ns × (0.99,1.02)  53.2ns × (0.98,1.01)    ~    (p=0.063 n=5+5)
      FmtFprintfString        181ns × (1.00,1.00)   180ns × (1.00,1.00)  -0.55% (p=0.029 n=4+4)
      FmtFprintfInt           176ns × (1.00,1.01)   174ns × (1.00,1.00)  -0.91% (p=0.000 n=5+4)
      FmtFprintfIntInt        298ns × (1.00,1.00)   299ns × (1.00,1.00)    ~    (p=0.143 n=4+4)
      FmtFprintfPrefixedInt   250ns × (1.00,1.01)   246ns × (1.00,1.00)  -1.68% (p=0.000 n=5+4)
      FmtFprintfFloat         340ns × (1.00,1.00)   340ns × (1.00,1.01)    ~    (p=0.643 n=5+5)
      FmtManyArgs            1.16µs × (1.00,1.00)  1.15µs × (1.00,1.00)  -0.47% (p=0.016 n=5+5)
      GobDecode              9.22ms × (1.00,1.00)  9.23ms × (1.00,1.00)    ~    (p=0.841 n=5+5)
      GobEncode              7.00ms × (1.00,1.01)  7.09ms × (0.99,1.01)  +1.26% (p=0.016 n=5+5)
      Gzip                    387ms × (1.00,1.00)   389ms × (0.99,1.02)    ~    (p=1.000 n=5+5)
      Gunzip                 97.8ms × (1.00,1.00)  98.3ms × (1.00,1.00)  +0.51% (p=0.016 n=5+4)
      HTTPClientServer       52.6µs × (1.00,1.01)  52.7µs × (1.00,1.01)    ~    (p=1.000 n=5+5)
      JSONEncode             18.0ms × (0.99,1.02)  17.9ms × (1.00,1.00)    ~    (p=0.310 n=5+5)
      JSONDecode             64.8ms × (0.99,1.02)  63.6ms × (1.00,1.00)  -1.94% (p=0.008 n=5+5)
      Mandelbrot200          4.05ms × (1.00,1.00)  4.05ms × (1.00,1.00)    ~    (p=0.421 n=5+5)
      GoParse                3.86ms × (1.00,1.01)  3.84ms × (0.99,1.01)    ~    (p=0.421 n=5+5)
      RegexpMatchEasy0_32     101ns × (1.00,1.00)   102ns × (0.99,1.02)    ~    (p=0.238 n=4+5)
      RegexpMatchEasy0_1K     346ns × (1.00,1.01)   345ns × (1.00,1.00)    ~    (p=0.333 n=5+4)
      RegexpMatchEasy1_32    87.3ns × (0.99,1.02)  87.4ns × (1.00,1.00)    ~    (p=0.190 n=5+4)
      RegexpMatchEasy1_1K     520ns × (1.00,1.00)   520ns × (1.00,1.01)    ~    (p=1.000 n=4+5)
      RegexpMatchMedium_32    143ns × (1.00,1.00)   142ns × (1.00,1.00)  -0.70% (p=0.029 n=4+4)
      RegexpMatchMedium_1K   43.2µs × (1.00,1.01)  43.2µs × (1.00,1.00)    ~    (p=0.841 n=5+5)
      RegexpMatchHard_32     2.24µs × (1.00,1.01)  2.23µs × (1.00,1.01)  -0.63% (p=0.048 n=5+5)
      RegexpMatchHard_1K     68.7µs × (1.00,1.00)  68.3µs × (1.00,1.00)  -0.56% (p=0.008 n=5+5)
      Revcomp                 577ms × (1.00,1.01)   579ms × (1.00,1.00)    ~    (p=0.151 n=5+5)
      Template               74.9ms × (1.00,1.00)  76.5ms × (1.00,1.00)  +2.11% (p=0.008 n=5+5)
      TimeParse               359ns × (1.00,1.00)   362ns × (1.00,1.00)  +0.72% (p=0.008 n=5+5)
      TimeFormat              369ns × (1.00,1.00)   371ns × (1.00,1.01)    ~    (p=0.071 n=5+5)
      
      Change-Id: I4206a3f77a3d1450966b7a62ea7597aec44cb72f
      Reviewed-on: https://go-review.googlesource.com/10294Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      5b66e5d0
    • Austin Clements's avatar
      runtime: make runtime.callers walk calling G, not g0 · 719efc70
      Austin Clements authored
      Currently runtime.callers invokes gentraceback with the pc and sp of
      the G it is called from, but always passes g0 even if it was called
      from a regular g. Right now this has no ill effects because
      runtime.callers does not use either callback argument or the
      _TraceJumpStack flag, but it makes the code fragile and will break
      some upcoming changes.
      
      Fix this by lifting the getg() call outside of the systemstack in
      runtime.callers.
      
      Change-Id: I4e1e927961c0e0cd4dcf28693be47df7bae9e122
      Reviewed-on: https://go-review.googlesource.com/10292Reviewed-by: default avatarDaniel Morsing <daniel.morsing@gmail.com>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      719efc70
  3. 20 May, 2015 8 commits
  4. 19 May, 2015 13 commits
    • Josh Bleecher Snyder's avatar
      Revert "cmd/internal/ld: output dwarf in external link mode on darwin" · 7bdb4a28
      Josh Bleecher Snyder authored
      This reverts commit 8b83306c.
      
      Change-Id: I3fb998bdf11eceef13e3997e336d86e7c5d47a60
      Reviewed-on: https://go-review.googlesource.com/10254Reviewed-by: default avatarMinux Ma <minux@golang.org>
      7bdb4a28
    • Shenghou Ma's avatar
      misc/cgo/testshared: when checking for RPATHs also look for DT_RUNPATH · c013417a
      Shenghou Ma authored
      On my systems, ld -rpath sets DT_RUNPATH instead of DT_RPATH.
      
      Change-Id: I5047e795fb7ef9336f5fa13ba24bb6245c0b0582
      Reviewed-on: https://go-review.googlesource.com/10260Reviewed-by: default avatarMichael Hudson-Doyle <michael.hudson@canonical.com>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      c013417a
    • Shenghou Ma's avatar
      cmd/internal/gc: handle 64-bit const i/j/k in cgen_slice on ARM · 791bb4f5
      Shenghou Ma authored
      386 is not affected because it doesn't use ginscmp.
      
      Fixes #10843.
      
      Change-Id: I1b3a133bd1e5fabc85236f15d060dbaa4c391cf3
      Reviewed-on: https://go-review.googlesource.com/10116Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      791bb4f5
    • Didier Spezia's avatar
      html/template: fix string iteration in replacement operations · a1c1a763
      Didier Spezia authored
      In css, js, and html, the replacement operations are implemented
      by iterating on strings (rune by rune). The for/range
      statement is used. The length of the rune is required
      and added to the index to properly slice the string.
      
      This is potentially wrong because there is a discrepancy between
      the result of utf8.RuneLen and the increment of the index
      (set by the for/range statement). For invalid strings,
      utf8.RuneLen('\ufffd') == 3, while the index is incremented
      only by 1 byte.
      
      htmlReplacer triggers a panic at slicing time for some
      invalid strings.
      
      Use a more robust iteration mechanism based on
      utf8.DecodeRuneInString, and make sure the same
      pattern is used for all similar functions in this
      package.
      
      Fixes #10799
      
      Change-Id: Ibad3857b2819435d9fa564f06fc2ca8774102841
      Reviewed-on: https://go-review.googlesource.com/10105Reviewed-by: default avatarRob Pike <r@golang.org>
      a1c1a763
    • Shenghou Ma's avatar
      cmd/go: fix build · d6bbcea2
      Shenghou Ma authored
      Change-Id: Ib6c121414c74f8a40eb87a52af8737502ce7216d
      Reviewed-on: https://go-review.googlesource.com/10265Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      d6bbcea2
    • Austin Clements's avatar
      cmd/internal/gc: remove incorrect "write barrier prohibited" error · f763da3d
      Austin Clements authored
      Commit 9c9e36b3 pushed these errors down to where the write barriers
      are actually emitted, but forgot to remove the original error that was
      being pushed down.
      
      Change-Id: I751752a896e78fb9e63d69f88e7fb8d1ff5d344c
      Reviewed-on: https://go-review.googlesource.com/10264Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      f763da3d
    • Alexander Zolotov's avatar
      cmd/go: run gofmt from current GOROOT · b3241912
      Alexander Zolotov authored
      The existing implementation executes `gofmt` binary from PATH
      environment variable on invocation `go fmt` command.
      Relying on PATH might lead to confusions for users with several Go installations.
      It's more appropriate to run `gofmt` from GOBIN (if defined) or GOROOT.
      
      Fixes #10755
      
      Change-Id: I56d42a747319c766f2911508fab3994c3a366d12
      Reviewed-on: https://go-review.googlesource.com/9900Reviewed-by: default avatarRob Pike <r@golang.org>
      b3241912
    • Ryan Brown's avatar
      cmd/internal/ld: output dwarf in external link mode on darwin · 8b83306c
      Ryan Brown authored
      Fixes #8973
      
      Change-Id: Idd53fc6d9e6971ae31ed72a3df3cfdce0bfbc1fd
      Reviewed-on: https://go-review.googlesource.com/8661Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      Run-TryBot: Russ Cox <rsc@golang.org>
      8b83306c
    • Russ Cox's avatar
      cmd/internal/gc: sync nowritebarrier checks and write barrier insertion · 9c9e36b3
      Russ Cox authored
      Change-Id: I348223d0336e28d95b8e68d7653aa547acc7c9c3
      Reviewed-on: https://go-review.googlesource.com/10262Reviewed-by: default avatarAustin Clements <austin@google.com>
      9c9e36b3
    • Russ Cox's avatar
      cmd/internal/gc: type of str[i] is byte, not uint8 · c735064c
      Russ Cox authored
      Fixes #8745.
      
      Change-Id: Id0641e3c0f259812b41ed871e83c68740feb2b19
      Reviewed-on: https://go-review.googlesource.com/10261Reviewed-by: default avatarAustin Clements <austin@google.com>
      c735064c
    • Rick Hudson's avatar
      runtime: run background mark helpers only if work is available · 913db768
      Rick Hudson authored
      Prior to this CL whenever the GC marking was enabled and
      a P was looking for work we supplied a G to help
      the GC do its marking tasks. Once this G finished all
      the marking available it would release the P to find another
      available G. In the case where there was no work the P would drop
      into findrunnable which would execute the mark helper G which would
      immediately return and the P would drop into findrunnable again repeating
      the process. Since the P was always given a G to run it never blocks.
      This CL first checks if the GC mark helper G has available work and if
      not the P immediately falls through to its blocking logic.
      
      Fixes #10901
      
      Change-Id: I94ac9646866ba64b7892af358888bc9950de23b5
      Reviewed-on: https://go-review.googlesource.com/10189Reviewed-by: default avatarAustin Clements <austin@google.com>
      913db768
    • Austin Clements's avatar
      runtime: minor clean up to heapminimum · f4d51eb2
      Austin Clements authored
      Currently setGCPercent sets heapminimum to heapminimum*GOGC/100. The
      real intent is to set heapminimum to a scaled multiple of a fixed
      default heap minimum, not to scale heapminimum based on its current
      value. This turns out to be okay because setGCPercent is only called
      once and heapminimum is initially set to this default heap minimum.
      However, the code as written is confusing, especially since
      setGCPercent is otherwise written so it could be called again to
      change GOGC. Fix this by introducing a defaultHeapMinimum constant and
      using this instead of the current value of heapminimum to compute the
      scaled heap minimum.
      
      As part of this, this commit improves the documentation on
      heapminimum.
      
      Change-Id: I4eb82c73dc2eb44a6e5a17c780a747a2e73d7493
      Reviewed-on: https://go-review.googlesource.com/10181Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      f4d51eb2
    • Russ Cox's avatar
      runtime: add fast check for self-loop pointer in scanobject · 8903b3db
      Russ Cox authored
      Addresses a problem reported on the mailing list.
      
      This will come up mainly in programs custom allocators that batch allocations,
      but it still helps in our programs, which mainly do not have such allocations.
      
      name                   old mean              new mean              delta
      BinaryTree17            5.95s × (0.97,1.03)   5.93s × (0.97,1.04)    ~    (p=0.613)
      Fannkuch11              4.46s × (0.98,1.04)   4.33s × (0.99,1.01)  -2.93% (p=0.000)
      FmtFprintfEmpty        86.6ns × (0.98,1.03)  86.8ns × (0.98,1.02)    ~    (p=0.523)
      FmtFprintfString        290ns × (0.98,1.05)   287ns × (0.98,1.03)    ~    (p=0.061)
      FmtFprintfInt           271ns × (0.98,1.04)   286ns × (0.99,1.01)  +5.54% (p=0.000)
      FmtFprintfIntInt        495ns × (0.98,1.04)   489ns × (0.99,1.01)  -1.24% (p=0.015)
      FmtFprintfPrefixedInt   391ns × (0.99,1.02)   407ns × (0.99,1.01)  +4.00% (p=0.000)
      FmtFprintfFloat         578ns × (0.99,1.01)   559ns × (0.99,1.01)  -3.35% (p=0.000)
      FmtManyArgs            1.96µs × (0.98,1.05)  1.94µs × (0.99,1.01)  -1.33% (p=0.030)
      GobDecode              15.9ms × (0.97,1.05)  15.7ms × (0.99,1.01)  -1.35% (p=0.044)
      GobEncode              11.4ms × (0.97,1.05)  11.3ms × (0.98,1.03)    ~    (p=0.141)
      Gzip                    658ms × (0.98,1.05)   648ms × (0.99,1.01)  -1.59% (p=0.009)
      Gunzip                  144ms × (0.99,1.03)   144ms × (0.99,1.01)    ~    (p=0.867)
      HTTPClientServer       92.1µs × (0.97,1.05)  90.3µs × (0.99,1.01)  -1.89% (p=0.005)
      JSONEncode             31.0ms × (0.96,1.07)  30.2ms × (0.98,1.03)  -2.66% (p=0.001)
      JSONDecode              110ms × (0.97,1.04)   107ms × (0.99,1.01)  -2.59% (p=0.000)
      Mandelbrot200          6.15ms × (0.98,1.04)  6.07ms × (0.99,1.02)  -1.32% (p=0.045)
      GoParse                6.79ms × (0.97,1.04)  6.74ms × (0.97,1.04)    ~    (p=0.242)
      RegexpMatchEasy0_32     158ns × (0.98,1.05)   155ns × (0.99,1.01)  -1.64% (p=0.010)
      RegexpMatchEasy0_1K     548ns × (0.97,1.04)   540ns × (0.99,1.01)  -1.34% (p=0.042)
      RegexpMatchEasy1_32     133ns × (0.97,1.04)   132ns × (0.97,1.05)    ~    (p=0.466)
      RegexpMatchEasy1_1K     899ns × (0.96,1.05)   878ns × (0.99,1.01)  -2.32% (p=0.002)
      RegexpMatchMedium_32    250ns × (0.96,1.03)   243ns × (0.99,1.01)  -2.90% (p=0.000)
      RegexpMatchMedium_1K   73.4µs × (0.98,1.04)  73.0µs × (0.98,1.04)    ~    (p=0.411)
      RegexpMatchHard_32     3.87µs × (0.97,1.07)  3.84µs × (0.98,1.04)    ~    (p=0.273)
      RegexpMatchHard_1K      120µs × (0.97,1.08)   117µs × (0.99,1.01)  -2.06% (p=0.010)
      Revcomp                 940ms × (0.96,1.07)   924ms × (0.97,1.07)    ~    (p=0.071)
      Template                128ms × (0.96,1.05)   128ms × (0.99,1.01)    ~    (p=0.502)
      TimeParse               632ns × (0.96,1.07)   616ns × (0.99,1.01)  -2.58% (p=0.001)
      TimeFormat              671ns × (0.97,1.06)   657ns × (0.99,1.02)  -2.10% (p=0.002)
      
      In contrast to the one in test/bench/go1 (above), the binarytree program on the
      shootout site uses more goroutines, batches allocations, and sets GOMAXPROCS
      to runtime.NumCPU()*2.
      
      Using that version, before vs after:
      
      name          old mean             new mean             delta
      BinaryTree20  18.6s × (0.96,1.05)  11.3s × (0.98,1.02)  -39.46% (p=0.000)
      
      And Go 1.4 vs after:
      
      name          old mean             new mean             delta
      BinaryTree20  13.0s × (0.97,1.02)  11.3s × (0.98,1.02)  -13.21% (p=0.000)
      
      There is still a scheduling problem - the raw run times are hiding the fact that
      this chews up 2x the CPU - but we'll take care of that separately.
      
      Change-Id: I3f5da879b24ae73a0d06745381ffb88c3744948b
      Reviewed-on: https://go-review.googlesource.com/10220Reviewed-by: default avatarAustin Clements <austin@google.com>
      8903b3db