Skip to content

Commit

Permalink
Update mimalloc to v3.0.1 and enable mimalloc for win/arm64 (BCNY)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjyamauchi committed Jan 23, 2025
1 parent 4919907 commit bb1f21c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,14 @@ jobs:
branch_name="release/$branch_version_string"
fi
repo init --quiet --groups default --depth 1 -u https://github.com/compnerd/swift-build -b $branch_name
repo init --quiet --groups default --depth 1 -u https://github.com/compnerd/swift-build -b hiroshi/mimallocarm64
repo sync --quiet --no-clone-bundle --no-tags --jobs $(nproc --all)
if [[ "${{ inputs.swift_tag }}" != "" ]] ; then
tee -a "${GITHUB_OUTPUT}" <<-EOF
indexstore_db_revision=refs/tags/${{ inputs.swift_tag }}
llvm_project_revision=refs/tags/${{ inputs.swift_tag }}
mimalloc_revision=refs/tags/v2.1.7
mimalloc_revision=refs/tags/v3.0.1
sourcekit_lsp_revision=refs/tags/${{ inputs.swift_tag }}
swift_revision=refs/tags/${{ inputs.swift_tag }}
swift_argument_parser_revision=refs/tags/1.4.0
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/swift-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3430,21 +3430,21 @@ jobs:
}
- uses: actions/checkout@v4
if: matrix.arch == 'amd64'
with:
repository: microsoft/mimalloc
ref: ${{ inputs.mimalloc_revision }}
path: ${{ github.workspace }}/SourceCache/mimalloc

- name: Build and apply mimalloc
if: matrix.arch == 'amd64'
run: |
$Arch = if ("${{ matrix.arch }}" -eq "amd64") { "x64" } else { "arm64" }
$ArchSuffix = if ("${{ matrix.arch }}" -eq "amd64") { "" } else { "-arm64" }
# Reference: https://github.com/microsoft/mimalloc/tree/dev/bin#minject
msbuild ${{ github.workspace }}\SourceCache\mimalloc\ide\vs2022\mimalloc.sln -p:Configuration=Release
msbuild ${{ github.workspace }}\SourceCache\mimalloc\ide\vs2022\mimalloc.sln -p:Configuration=Release -p:Platform=$Arch
$ToolchainBin = "${{ github.workspace }}\BuildRoot\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin"
Copy-Item -Path "${{ github.workspace }}\SourceCache\mimalloc\out\msvc-x64\Release\mimalloc-override.dll" `
Copy-Item -Path "${{ github.workspace }}\SourceCache\mimalloc\out\msvc-$Arch\Release\mimalloc.dll" `
-Destination "$ToolchainBin"
Copy-Item -Path "${{ github.workspace }}\SourceCache\mimalloc\out\msvc-x64\Release\mimalloc-redirect.dll" `
Copy-Item -Path "${{ github.workspace }}\SourceCache\mimalloc\out\msvc-$Arch\Release\mimalloc-redirect$ArchSuffix.dll" `
-Destination "$ToolchainBin"
$MimallocExecutables = @("swift.exe",
"swiftc.exe",
Expand All @@ -3459,9 +3459,9 @@ jobs:
"ld64.lld.exe")
foreach ($Exe in $MimallocExecutables) {
# Binary-patch in place
${{ github.workspace }}\SourceCache\mimalloc\bin\minject -f -i -v "$ToolchainBin\$Exe"
& "${{ github.workspace }}\SourceCache\mimalloc\bin\minject$ArchSuffix.exe" -f -i -v "$ToolchainBin\$Exe"
# Log the import table
${{ github.workspace }}\SourceCache\mimalloc\bin\minject -l "$ToolchainBin\$Exe"
& "${{ github.workspace }}\SourceCache\mimalloc\bin\minject$ArchSuffix.exe" -l "$ToolchainBin\$Exe"
}
- name: Package Build Tools
Expand All @@ -3473,7 +3473,7 @@ jobs:
-p:CERTIFICATE=${env:CERTIFICATE} `
-p:PASSPHRASE=${{ secrets.PASSPHRASE }} `
-p:TOOLCHAIN_ROOT=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain `
-p:ENABLE_MIMALLOC=${{ matrix.arch == 'amd64' && 'true' || 'false' }} `
-p:ENABLE_MIMALLOC=true `
-p:ProductArchitecture=${{ matrix.arch }} `
-p:ProductVersion=${{ inputs.swift_version }} `
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/bld/bld.wixproj
Expand Down
2 changes: 1 addition & 1 deletion default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

<project remote="github" name="madler/zlib" path="zlib" revision="refs/tags/v1.3.1" />

<project remote="github" name="microsoft/mimalloc" path="mimalloc" revision="refs/tags/v2.1.7" />
<project remote="github" name="microsoft/mimalloc" path="mimalloc" revision="refs/tags/v3.0.1" />

<project remote="github" name="ninja-build/ninja" path="ninja" groups="notdefault,dependencies" revision="master" />
</manifest>

0 comments on commit bb1f21c

Please sign in to comment.