-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Move the thread alloc context off of Thread in CoreCLR #103055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
86e6837
a96039a
e511c4f
d81012e
c2cbeb6
71eb0f4
a87c3af
ce489a8
0d40a74
a4b5ba4
a8eec35
190abb5
f090a19
5ed8f7a
6e74fda
0ee2b52
d895031
1929904
af270e3
bad14bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
; Licensed to the .NET Foundation under one or more agreements. | ||
; The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
; *********************************************************************** | ||
; File: JitHelpers_InlineGetThread.asm, see history in jithelp.asm | ||
; | ||
; *********************************************************************** | ||
|
||
include AsmMacros.inc | ||
include asmconstants.inc | ||
|
||
CopyValueClassUnchecked equ ?CopyValueClassUnchecked@@YAXPEAX0PEAVMethodTable@@@Z | ||
JIT_Box equ ?JIT_Box@@YAPEAVObject@@PEAUCORINFO_CLASS_STRUCT_@@PEAX@Z | ||
|
||
extern CopyValueClassUnchecked:proc | ||
extern JIT_Box:proc | ||
|
||
; HCIMPL2(Object*, JIT_Box, CORINFO_CLASS_HANDLE type, void* unboxedData) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to get rid of this asm implementation and replace it with the portable C++ one. (It can be done in separate change.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was having trouble getting the exact same assembly out of this one with a C++ implementation, so I didn't want to do it in this PR. I'll move it over in another PR and we can review the assembly differences there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The box helper is not super perf critical. The JIT will inline it for all cases that matter. I think it would be fine to have something close enough - anything that does not raise HELPER_METHOD_FRAME on a hot path should be ok. |
||
NESTED_ENTRY JIT_BoxFastMP, _TEXT | ||
|
||
; m_BaseSize is guaranteed to be a multiple of 8. | ||
mov r8d, [rcx + OFFSET__MethodTable__m_BaseSize] | ||
|
||
INLINE_GET_ALLOC_CONTEXT r11 | ||
mov r10, [r11 + OFFSETOF__gc_alloc_context__alloc_limit] | ||
mov rax, [r11 + OFFSETOF__gc_alloc_context__alloc_ptr] | ||
|
||
add r8, rax | ||
|
||
cmp r8, r10 | ||
ja AllocFailed | ||
|
||
test rdx, rdx | ||
je NullRef | ||
|
||
mov [r11 + OFFSETOF__gc_alloc_context__alloc_ptr], r8 | ||
mov [rax], rcx | ||
|
||
; Check whether the object contains pointers | ||
test dword ptr [rcx + OFFSETOF__MethodTable__m_dwFlags], MethodTable__enum_flag_ContainsPointers | ||
jnz ContainsPointers | ||
|
||
; We have no pointers - emit a simple inline copy loop | ||
; Copy the contents from the end | ||
mov ecx, [rcx + OFFSET__MethodTable__m_BaseSize] | ||
sub ecx, 18h ; sizeof(ObjHeader) + sizeof(Object) + last slot | ||
|
||
align 16 | ||
CopyLoop: | ||
mov r8, [rdx+rcx] | ||
mov [rax+rcx+8], r8 | ||
sub ecx, 8 | ||
jge CopyLoop | ||
REPRET | ||
|
||
ContainsPointers: | ||
; Do call to CopyValueClassUnchecked(object, data, pMT) | ||
push_vol_reg rax | ||
alloc_stack 20h | ||
END_PROLOGUE | ||
|
||
mov r8, rcx | ||
lea rcx, [rax + 8] | ||
call CopyValueClassUnchecked | ||
|
||
add rsp, 20h | ||
pop rax | ||
ret | ||
|
||
AllocFailed: | ||
NullRef: | ||
jmp JIT_Box | ||
NESTED_END JIT_BoxFastMP, _TEXT | ||
|
||
end |
Uh oh!
There was an error while loading. Please reload this page.