1. 04 Jun, 2015 5 commits
    • Russ Cox's avatar
      cmd/go: detect when package or binary is stale due to removed source file · 7b87631e
      Russ Cox authored
      The go command uses file modification times to decide when a
      package is out of date: if the .a file is older than a source file,
      the .a file needs to be rebuilt. This scheme breaks down when
      multiple source files compile into a single .a file: if one source file
      is removed but no other changes are made, there is no indication
      that the .a file is out of date.
      
      The fix is to store a value called a build ID in the package archive itself.
      The build ID is a hash of the names of all source files compiled into the package.
      A later go command can read the build ID out of the package archive
      and compare to the build ID derived from the list of source files it now
      sees in the directory. If the build IDs differ, the file list has changed,
      and the package must be rebuilt.
      
      There is a cost here: when scanning a package directory, in addition
      to reading the beginning of every source file for build tags and imports,
      the go command now also reads the beginning of the associated
      package archive, for the build ID. This is at most a doubling in the
      number of files read. On my 2012 MacBook Pro, the time for
      'go list std' increases from about 0.215 seconds to about 0.23 seconds.
      
      For executable binaries, the approach is the same except that the
      build ID information is stored in a trailer at the end of the executable file.
      It remains to be seen if anything objects to the trailer.
      I don't expect problems except maybe on Plan 9.
      
      Fixes #3895.
      
      Change-Id: I21b4ebf5890c1a39e4a013eabe1ddbb5f3510c04
      Reviewed-on: https://go-review.googlesource.com/9154Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      7b87631e
    • Russ Cox's avatar
      cmd/compile: merge Node.Opt and Node.Val behind access methods · 81d5810b
      Russ Cox authored
      $ sizeof -p cmd/compile/internal/gc Node
      Node 144
      $
      
      Change-Id: I688e3790964fe42f48c19f697ec38094a92fe1c1
      Reviewed-on: https://go-review.googlesource.com/10531Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      81d5810b
    • Russ Cox's avatar
      cmd/compile: cleanups for Node trimming sequence · a53710ff
      Russ Cox authored
      Suggested during code reviews of last 15 CLs (or so).
      
      Change-Id: If780f6eb47a7a31df133c64d5dcf0eaf04d8447b
      Reviewed-on: https://go-review.googlesource.com/10675Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      a53710ff
    • Josh Bleecher Snyder's avatar
      cmd/link: make stkcheck more flexible · ca19e55f
      Josh Bleecher Snyder authored
      stkcheck is flow-insensitive: It processes calls in PC order.
      Since morestack was always the first call in a function,
      it was a safe, conservative approximation to simply adjust stack
      space as we went, recognizing morestack when it showed up.
      
      Subsequent CLS will rearrange the function prologue;
      morestack may no longer be the first call in a function.
      
      Introducing flow-sensitivity to stkcheck would allow this,
      and possibly allow a smaller stackguard.
      It is also a high risk change and possibly expensive.
      
      Instead, assume that all calls to morestack occur as
      part of the function prologue, no matter where they
      are located in the program text.
      
      Updates #10587.
      
      Change-Id: I4dcdd4256a980fc4bc433a68a10989ff57f7034f
      Reviewed-on: https://go-review.googlesource.com/10496
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      ca19e55f
    • Russ Cox's avatar
      cmd/internal/gc: accept map literals with omitted key type · 73d109c5
      Russ Cox authored
      Fixes #10209.
      
      Change-Id: I248434f9195c868befd1ed8a6000a9cac72d1df8
      Reviewed-on: https://go-review.googlesource.com/10263Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      73d109c5
  2. 03 Jun, 2015 34 commits
  3. 02 Jun, 2015 1 commit
    • Rob Pike's avatar
      text/template: clarify the documentation around template definitions · f9ed2f75
      Rob Pike authored
      Due to the requirements of parsing template definitions that mention
      other templates that are not yet defined, a Template can be in two states:
      defined and undefined. Thus, although one calls New, the resulting
      template has no definition even though it exists as a data structure.
      
      Thus, for example, will return nil for a template that is named but not
      yet defined.
      
      Fixes #10910
      Fixes #10926
      
      Clarify the documentation a little to explain this,
      Also tidy up the code a little and remove a spurious call to init.
      
      Change-Id: I22cc083291500bca424e83dc12807e0de7b00b7a
      Reviewed-on: https://go-review.googlesource.com/10641Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      f9ed2f75