Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 5.6k
Enable "Allocate on stack" for NAOT/R2R#104411
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
000b52867b495d8e0e9eb2a62eeb741e4fa396677b19936e7b07c1a0ea65a0162b67d1ebd8f9ab5985a51ef6ccf4f9ff46ac65ff6203593c001b01cac0e6e8ed2568cd6a32b385340aeFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -2352,14 +2352,8 @@ private uint getClassGClayout(CORINFO_CLASS_STRUCT_* cls, byte* gcPtrs) | ||
| uint result = 0; | ||
| MetadataType type = (MetadataType)HandleToObject(cls); | ||
| int pointerSize = PointerSize; | ||
| int ptrsCount = AlignmentHelper.AlignUp(type.InstanceFieldSize.AsInt, pointerSize) / pointerSize; | ||
| // Assume no GC pointers at first | ||
| for (int i = 0; i < ptrsCount; i++) | ||
| gcPtrs[i] = (byte)CorInfoGCType.TYPE_GC_NONE; | ||
| uint size = type.IsValueType ? getClassSize(cls) : getHeapClassSize(cls); | ||
Member 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 stack allocation should be disabled for non-valuetype types that are not fixed in the current version bubble. How is it achieved? MemberAuthor 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. @jkotas it's checked via a separate JIT-EE API: canAllocateOnStack so JIT will never call this function if | ||
| new Span<byte>(gcPtrs, (int)((size + PointerSize - 1) / PointerSize)).Clear(); | ||
MemberAuthor 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. This was copied from CoreCLR impl, it does a similar memset (see this) Previously, | ||
| if (type.ContainsGCPointers || type.IsByRefLike) | ||
| { | ||
| @@ -2606,9 +2600,26 @@ private CorInfoHelpFunc getSharedCCtorHelper(CORINFO_CLASS_STRUCT_* clsHnd) | ||
| private CORINFO_CLASS_STRUCT_* getTypeForBoxOnStack(CORINFO_CLASS_STRUCT_* cls) | ||
| { | ||
| // Todo: implement... | ||
| _ = HandleToObject(cls); | ||
| return null; | ||
| TypeDesc clsTypeDesc = HandleToObject(cls); | ||
| if (clsTypeDesc.IsNullable) | ||
| { | ||
| clsTypeDesc = clsTypeDesc.Instantiation[0]; | ||
| } | ||
| if (clsTypeDesc.RequiresAlign8()) | ||
| { | ||
| // Conservatively give up on such types (32bit) | ||
| return null; | ||
| } | ||
| // Instantiate StackAllocatedBox<T> helper type with the type we're boxing | ||
| MetadataType placeholderType = _compilation.TypeSystemContext.SystemModule.GetType("System.Runtime.CompilerServices", "StackAllocatedBox`1", throwIfNotFound: false); | ||
| if (placeholderType == null) | ||
| { | ||
| // Give up if corelib does not have support for stackallocation | ||
| return null; | ||
| } | ||
| return ObjectToHandle(placeholderType.MakeInstantiatedType(clsTypeDesc)); | ||
| } | ||
| private CorInfoHelpFunc getBoxHelper(CORINFO_CLASS_STRUCT_* cls) | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.