Skip to content

Instantly share code, notes, and snippets.

@EgorBo
Last active January 16, 2023 18:29
Show Gist options
  • Select an option

  • Save EgorBo/a72bfa70f08a4d890241037c0fc1fb93 to your computer and use it in GitHub Desktop.

Select an option

Save EgorBo/a72bfa70f08a4d890241037c0fc1fb93 to your computer and use it in GitHub Desktop.

Revisions

  1. EgorBo revised this gist Mar 28, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion jit-diffs for changes in C# code.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ All commands are in powershell, should be pretty much the same for bash and non-

    1) build everything we're going to need:
    ```
    .\build.cmd Clr+Libs -c Release ;; .\build.cmd Clr -c Checked -msbuild ;; cd .\src\tests\ ;; .\build.cmd Release generatelayoutonly ;; cd ..\..
    .\build.cmd Clr+Libs -c Release ;; .\build.cmd Clr -c Checked ;; cd .\src\tests\ ;; .\build.cmd Release generatelayoutonly ;; cd ..\..
    ```
    2) Make a copy of the test core_root (will be a baseline):
    ```
  2. EgorBo revised this gist Mar 28, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion jit-diffs for changes in C# code.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ### How to run jit-diffs for changes in the managed code

    All commands are in powershell
    All commands are in powershell, should be pretty much the same for bash and non-windows platforms

    1) build everything we're going to need:
    ```
  3. EgorBo revised this gist Mar 28, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions jit-diffs for changes in C# code.md
    Original file line number Diff line number Diff line change
    @@ -31,4 +31,5 @@ jit-analyze -b C:\prj\jit-diffs\dasmset_1\base -d C:\prj\jit-diffs\dasmset_2\bas
    ```

    NOTE: I'd recommend to clear `C:\prj\jit-diffs` content before every run (this script is hardcoded to dasmset_1 and dasmset_2)

    NOTE2: replace `--corelib` with `-f` if you want to run diffs for the whole BCL
  4. EgorBo revised this gist Mar 28, 2022. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions jit-diffs for changes in C# code.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    ### How to run jit-diffs for changes in managed code
    ### How to run jit-diffs for changes in the managed code

    All commands are for powershell
    All commands are in powershell

    1) Step 1: build everything
    1) build everything we're going to need:
    ```
    .\build.cmd Clr+Libs -c Release ;; .\build.cmd Clr -c Checked -msbuild ;; cd .\src\tests\ ;; .\build.cmd Release generatelayoutonly ;; cd ..\..
    ```
    @@ -30,4 +30,5 @@ jit-diff diff --output C:\prj\jit-diffs --corelib --core_root C:\prj\runtime\art
    jit-analyze -b C:\prj\jit-diffs\dasmset_1\base -d C:\prj\jit-diffs\dasmset_2\base -r -c 100
    ```

    note: I'd recommend to clear `C:\prj\jit-diffs` content before every run (this script is hardcoded to dasmset_1 and dasmset_2)
    NOTE: I'd recommend to clear `C:\prj\jit-diffs` content before every run (this script is hardcoded to dasmset_1 and dasmset_2)
    NOTE2: replace `--corelib` with `-f` if you want to run diffs for the whole BCL
  5. EgorBo revised this gist Mar 28, 2022. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion jit-diffs for changes in C# code.md
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,6 @@ Copy-Item .\artifacts\bin\coreclr\windows.x64.Release\IL\System.Private.CoreLib.
    ```

    Now we can run some jit-diffs:
    Run for the baseline:
    ```
    New-Item -ItemType Directory -Force -Path C:\prj\jit-diffs
  6. EgorBo revised this gist Mar 28, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion jit-diffs for changes in C# code.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ All commands are for powershell
    ```
    .\build.cmd Clr+Libs -c Release ;; .\build.cmd Clr -c Checked -msbuild ;; cd .\src\tests\ ;; .\build.cmd Release generatelayoutonly ;; cd ..\..
    ```
    2) Make a copy of core_root:
    2) Make a copy of the test core_root (will be a baseline):
    ```
    Copy-Item .\artifacts\tests\coreclr\windows.x64.Release\Tests\Core_Root -Destination .\artifacts\tests\coreclr\windows.x64.Release\Tests\Core_Root_base -Recurse
    ```
  7. EgorBo revised this gist Mar 28, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion jit-diffs for changes in C# code.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ All commands are for powershell
    ```
    Copy-Item .\artifacts\tests\coreclr\windows.x64.Release\Tests\Core_Root -Destination .\artifacts\tests\coreclr\windows.x64.Release\Tests\Core_Root_base -Recurse
    ```
    3) Apply your changes to the corelib or any managed library and rebuild them, e.g. in case of corelib:
    3) Apply your changes to the corelib or any managed library and rebuild them, e.g. change `String.IsNullOrEmpty` impl and do:
    ```
    .\build.cmd Clr.CoreLib -c Release
    ```
  8. EgorBo revised this gist Mar 28, 2022. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion jit-diffs for changes in C# code.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    ### How to run jit-diffs for changes in managed code

    All commands are for powershell

    1) Step 1: build everything
    ```
    .\build.cmd Clr+Libs -c Release ;; .\build.cmd Clr -c Checked -msbuild ;; cd .\src\tests\ ;; .\build.cmd Release generatelayoutonly ;; cd ..\..
    @@ -6,9 +10,12 @@
    ```
    Copy-Item .\artifacts\tests\coreclr\windows.x64.Release\Tests\Core_Root -Destination .\artifacts\tests\coreclr\windows.x64.Release\Tests\Core_Root_base -Recurse
    ```
    3) Apply your change to corelib or any managed library and rebuild it, e.g. in case of corelib:
    3) Apply your changes to the corelib or any managed library and rebuild them, e.g. in case of corelib:
    ```
    .\build.cmd Clr.CoreLib -c Release
    ```
    4) Copy your lib to the "diff" core_root:
    ```
    Copy-Item .\artifacts\bin\coreclr\windows.x64.Release\IL\System.Private.CoreLib.dll -Destination artifacts\tests\coreclr\windows.x64.Release\Tests\Core_Root
    ```

  9. EgorBo renamed this gist Mar 28, 2022. 1 changed file with 0 additions and 0 deletions.
  10. EgorBo created this gist Mar 28, 2022.
    27 changes: 27 additions & 0 deletions jit-diffs for changes in C# code.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    1) Step 1: build everything
    ```
    .\build.cmd Clr+Libs -c Release ;; .\build.cmd Clr -c Checked -msbuild ;; cd .\src\tests\ ;; .\build.cmd Release generatelayoutonly ;; cd ..\..
    ```
    2) Make a copy of core_root:
    ```
    Copy-Item .\artifacts\tests\coreclr\windows.x64.Release\Tests\Core_Root -Destination .\artifacts\tests\coreclr\windows.x64.Release\Tests\Core_Root_base -Recurse
    ```
    3) Apply your change to corelib or any managed library and rebuild it, e.g. in case of corelib:
    ```
    .\build.cmd Clr.CoreLib -c Release
    Copy-Item .\artifacts\bin\coreclr\windows.x64.Release\IL\System.Private.CoreLib.dll -Destination artifacts\tests\coreclr\windows.x64.Release\Tests\Core_Root
    ```

    Now we can run some jit-diffs:
    Run for the baseline:
    ```
    New-Item -ItemType Directory -Force -Path C:\prj\jit-diffs

    jit-diff diff --output C:\prj\jit-diffs --corelib --core_root C:\prj\runtime\artifacts\tests\coreclr\windows.x64.Release\Tests\Core_Root_base --base C:\prj\runtime\artifacts\bin\coreclr\windows.x64.Checked --crossgen C:\prj\runtime\artifacts\tests\coreclr\windows.x64.Release\Tests\Core_Root_base\crossgen2\crossgen2.exe

    jit-diff diff --output C:\prj\jit-diffs --corelib --core_root C:\prj\runtime\artifacts\tests\coreclr\windows.x64.Release\Tests\Core_Root --base C:\prj\runtime\artifacts\bin\coreclr\windows.x64.Checked --crossgen C:\prj\runtime\artifacts\tests\coreclr\windows.x64.Release\Tests\Core_Root\crossgen2\crossgen2.exe

    jit-analyze -b C:\prj\jit-diffs\dasmset_1\base -d C:\prj\jit-diffs\dasmset_2\base -r -c 100
    ```

    note: I'd recommend to clear `C:\prj\jit-diffs` content before every run (this script is hardcoded to dasmset_1 and dasmset_2)