Skip to content

Package host assembly into runtime artifact - #48

Merged
joncham merged 1 commit into
unity-mainfrom
build-managed-artifact
Mar 2, 2022
Merged

Package host assembly into runtime artifact#48
joncham merged 1 commit into
unity-mainfrom
build-managed-artifact

Conversation

@joncham

@jonchamjoncham commented Mar 1, 2022

Copy link
Copy Markdown
Member

Avoid an extra artifact as the runtimes need this to function in Unity anyway.

This will require changes to the Unity integration once this lands.

@jonchamjoncham self-assigned this Mar 1, 2022
@joncham
jonchamforce-pushed the build-managed-artifact branch 2 times, most recently from 8ee36f0 to 31b4cf5CompareMarch 2, 2022 16:01
@joncham
joncham requested a review from UnityAlexMarch 2, 2022 17:52
@joncham
joncham marked this pull request as ready for review March 2, 2022 17:52
@joncham
jonchamforce-pushed the build-managed-artifact branch from 31b4cf5 to ecb5927CompareMarch 2, 2022 18:42
@joncham
joncham merged commit 1c65862 into unity-mainMar 2, 2022
@joncham
joncham deleted the build-managed-artifact branch March 2, 2022 20:27
joshpeterson pushed a commit that referenced this pull request Mar 10, 2022
# Local heap optimizations on Arm64
1. When not required to zero the allocated space for local heap (for sizes up to 64 bytes) - do not emit zeroing sequence. Instead do stack probing and adjust stack pointer:
```diff
- stp xzr, xzr, [sp,#-16]!
- stp xzr, xzr, [sp,#-16]!
- stp xzr, xzr, [sp,#-16]!
- stp xzr, xzr, [sp,#-16]!
+ ldr wzr, [sp],#-64
```
2. For sizes less than one `PAGE_SIZE` use `ldr wzr, [sp], #-amount` that does probing at `[sp]` and allocates the space at the same time. This saves one instruction for such local heap allocations:
```diff
- ldr wzr, [sp]
- sub sp, sp, #208
+ ldr wzr, [sp],#-208
```
Use `ldp tmpReg, xzr, [sp], #-amount` when the offset not encodable by post-index variant of `ldr`:
```diff
- ldr wzr, [sp]
- sub sp, sp, dotnet#512
+ ldp x0, xzr, [sp],#-512
```
3. Allow non-loop zeroing (i.e. unrolled sequence) for sizes up to 128 bytes (i.e. up to `LCLHEAP_UNROLL_LIMIT`). This frees up two internal integer registers for such cases:
```diff
- mov w11, #128
- ;; bbWeight=0.50 PerfScore 0.25
-G_M44913_IG19: ; gcrefRegs=00F9 {x0 x3 x4 x5 x6 x7}, byrefRegs=0000 {}, byref, isz
stp xzr, xzr, [sp,#-16]!
- subs x11, x11, #16
- bne G_M44913_IG19
+ stp xzr, xzr, [sp,#-112]!
+ stp xzr, xzr, [sp,#16]
+ stp xzr, xzr, [sp,#32]
+ stp xzr, xzr, [sp,#48]
+ stp xzr, xzr, [sp,#64]
+ stp xzr, xzr, [sp,#80]
+ stp xzr, xzr, [sp,#96]
```
4. Do zeroing in ascending order of the effective address:
```diff
- mov w7, #96
-G_M49279_IG13:
stp xzr, xzr, [sp,#-16]!
- subs x7, x7, #16
- bne G_M49279_IG13
+ stp xzr, xzr, [sp,#-80]!
+ stp xzr, xzr, [sp,#16]
+ stp xzr, xzr, [sp,#32]
+ stp xzr, xzr, [sp,#48]
+ stp xzr, xzr, [sp,#64]
```
In the example, the zeroing is done at `[initialSp-16], [initialSp-96], [initialSp-80], [initialSp-64], [initialSp-48], [initialSp-32]` addresses. The idea here is to allow a CPU to detect the sequential `memset` to `0` pattern and switch into write streaming mode.
mrvoorhe pushed a commit that referenced this pull request Apr 17, 2026
* Support for TypeSpec sginature
* Name changes
* adding test
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@joncham@UnityAlex