<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                [TOC] ## 格式 其實是給go tool compile 的參數, 查看文檔:`go tool compile —help` ``` -gcflags '[pattern=]arg list': -%: 調試非靜態初始化器(debug non-static initializers) -+:編譯 go runtime -B:禁用邊界檢查 -C:禁用錯誤消息中的列打印 -D path:設置local import的相對路徑 -E 調試符號表導出 -I directory:添加 import的搜索路徑 -K:調試缺少的行號 -L:在錯誤消息中顯示文件的全路徑 -N:禁止編譯優化 -S:打印匯編碼 -V:打印版本號并退出 -W:類型檢查之后調試解析樹 -asmhdr file:把匯編頭(assemply header)寫進文件file -bench file:把benchmark時間添加到文件file -blockprofile file:把 阻塞(block) profile信息寫進文件file -buildid id: 設置構建ID,寫進導出的元信息中 (record id as the build id in the export metadata) -c int:指定編譯時期的并發數量,1表示無并發(默認是1) -complete:編譯完整的軟件包(無C和匯編代碼) -cpuprofile file: 寫 cpu profile到file -d list: 打印列表中iterm的調試信息(debug information about items in list) -dwarf: 生成 DWARF符號(默認開啟) -dwarfbasentries:使用DWARF中的基地址選擇條目(use base address selection entries in DWARF) -dwarflocationlists:在優化模式下將位置列表添加到DWARF(默認開啟) -dynlink: 引用在其他go 共享庫里定義的符號 -e:顯示詳細錯誤信息,不限制錯誤信息行數 -gendwarfinl int:生成DWARF內聯信息記錄(默認是 2) -goversion string: 所需的運行時版本 -h:在遇到錯誤時停止 -importcfg file:從file中讀取import配置信息 -importmap definition:添加source=actual形式的定義到 import map -installsuffix suffix: 設置 pkg目錄前綴 -j:調試運行時初始化的(runtime-initialized)變量。 -l:禁止內聯 -gcflags=-l: 禁止內聯 不指定該選項: 開啟一般的內聯優化 -gcflags=’-l -l’: 開啟level 2的內聯優化,內聯優化更加激進,有可能能優化目標文件執行速度,也有可能生成更大的二進制文件。 -gcflags=’-l -l -l’: 開啟level3的內聯優化,更加更加激進,目標文件可能執行的更快,一定會生成更大的二進制文件,而且還可能引入bug。 -gcflags=-l=4(4個l), Go 1.11中將開啟處于試驗階段的mid-stack inlining優化。 -lang string: release to compile for -linkobj file:將鏈接器特定的對象寫入文件file -live: 調試活性(liveness)分析 -m:打印優化決策 -memprofile file:將memory profile寫入文件file -memprofilerate rate:設置runtime.MemProfileRate為rate -mutexprofile file: 將mutex profile寫入文件file -newescape: 開啟 new escape分析(默認開啟),具體含義參考上面編譯優化部分“逃逸分析”。 -nolocalimports: 禁止本地(相對)路徑import -o file: 將生成的目標文件寫到file -p path: 設置包導入路徑 -pack:構建目標文件成 .a文件而非.o文件 -r: 調試生成的包裝器 -race: 開啟競態檢測 -s: 警告可以簡化的復合文字 -shared: 生成共享庫 -smallframes:減小棧分配對象的大小上限 -std: 編譯標準庫 -symabis file:從文件file讀取ABIs符號信息 -traceprofile file: 將執行trace信息寫入文件file -trimpath prefix: 從記錄的源代碼文件中刪除 prefix文件路徑前綴 -v: 增加顯示調試信息的詳細程度 -w: 調試類型檢查 -wb: 啟用寫屏障(默認開啟) ``` ## 參數 ## gcflags=-m 進行逃逸分析 ``` // main_pointer.go package main import "fmt" type Demo struct { name string } func createDemo(name string) *Demo { d := new(Demo) // 局部變量 d 逃逸到堆 d.name = name return d } func main() { demo := createDemo("demo") fmt.Println(demo) } ``` 結果 ``` $ go build -gcflags=-m main_pointer.go ./main_pointer.go:10:6: can inline createDemo ./main_pointer.go:17:20: inlining call to createDemo ./main_pointer.go:18:13: inlining call to fmt.Println ./main_pointer.go:10:17: leaking param: name ./main_pointer.go:11:10: new(Demo) escapes to heap ./main_pointer.go:17:20: new(Demo) escapes to heap ./main_pointer.go:18:13: demo escapes to heap ./main_pointer.go:18:13: main []interface {} literal does not escape ./main_pointer.go:18:13: io.Writer(os.Stdout) escapes to heap <autogenerated>:1: (*File).close .this does not escape ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看