summaryrefslogtreecommitdiff
path: root/src/vm/fieldmarshaler.h
AgeCommit message (Collapse)AuthorFilesLines
2019-05-28Add null checks before calling ClassLoader::EnsureLoaded (#24818)Jan Kotas1-2/+6
Fixes #24816
2019-05-22Stop compiling fragile NGen support into the runtime (#24625)Jan Kotas1-1/+2
2019-05-20Cuckoo metadata (#24498)David Wrighton1-2/+1
* Basic infra for cuckoo filter of attributes - Implement cuckoo filter lookup logic - Implement new ready to run section - Add dumper to R2RDump - Parse section on load into data structure - Implement function to query filter - Add concept of enum of well known attributes - So that attribute name hashes themselves may be cached * Wrap all even vaguely perf critical uses of attribute by name parsing with use of R2R data * Update emmintrin.h in the PAL header to contain the needed SSE2 intrinsics for the feature - Disable the presence table for non Corelib cases. Current performance data does not warrant the size increase in other generated binaries
2019-05-16Split the phases of EEClassLayoutInfo::CollectLayoutFieldMetadataThrowing ↵Jeremy Koritzinsky1-25/+25
(#23013) * Split the phases of EEClassLayoutInfo::CollectLayoutFieldMetadataThrowing into separate private static functions. * Combine native and managed-sequential field offset and size calculations (since they are the exact same algorithm) * Remove TypeLayoutHelper because it's was only used in CalculateSizeAndFieldOffsets after having combined the offset/size calculations. * Remove unused members in LayoutRawFieldInfo. * Comment boolean parameter. * Add comments to parameters. * Remove unused prototypes. * Make sure we consistently use managed in the managed paths and native in the native paths. * Add to m_numCTMFields instead of setting it (need to make sure we account for fields in a non-trivial parent). * Track native alignment in a field. * Refactor field placement info to remove lots of repeated branching. * PR Feedback.
2019-04-04Fix SystemV AMD64 Explicit structure classification (#22041)Jeremy Koritzinsky1-0/+7
* Don't bail out on enregistering explicit structs if there are no overlapping fields. * Don't enregister if any unaligned fields. * Enable passing explicit structs by-value by enregistering on systemv. Some edge cases are likely still broken, but just removing our blanket opt-out makes the current tests pass. * Enable MarshalstructAsLayoutExp off-Windows. * Start adding additional tests for explicit layout to try to catch edge cases in SystemV classification. * Added a test that spans across multiple eightbytes and has an overlap in the second eightbyte. * Change repro to use an array of floats and an int field in managed and use a float array for padding in native to force an SSE classification on the first byte. * New algorithm to calculate eightbyte classification by going throw the structure byte-by-byte instead of field-by-field. * Fix updating eightbyte classifications in the loop to actually used the iterated-upon variable. * Consider each element of a fixed array as a separate field (to match native implementations). * Implement correct SystemV classification for fixed buffers in non-blittable structures. Fixed buffers in blittable structures have the managed layout assign classifications, which still is buggy. * Add tests. * Correctly classify blittable fixed buffers. Move "is this field a fixed buffer" tracking into one of the unused bits in FieldDesc as code that isn't in marshalers needs to know about it. * Handle the case where we have a struct that has no fields in an eightbyte that contains (i.e. no fields in the first eight bytes of the structure). * PR feedback. * Only look up FixedBufferAttribute when the type is a value class and the type of the field is a value type. * Use heuristic to determine if a type is a fixed buffer for SystemV classification. * Revert tracking if a field is a fixed buffer in the FieldDesc. * Update comments. * Classify aligned, nonoverlapping, float/double only structures as HFAs even if explicitly laid out * Enable overlapping fields in HFAs. Update NativeType HFA to check for alignment. I checked Godbolt to verify that HFAs for overlapping fields are allowed. * Add HFA tests. * Fix compile errors from HFA alignment check. * Non-valuetypes will never have their managed layout used to classify SystemV eightbytes. * Don't classify a struct with no zero-offset field as an HFA. * Remove duplicate semicolon. * PR feedback. * Add test with 2-field double HFA. * Clean up and add static asserts for struct size. * Add define for static_assert_no_msg to the native test headers * Fix build breaks. * Remove unneeded "size = X bytes" comments. They were holdovers from the .NET Framework test tree. * Use GetNumInstanceFieldBytes instead of GetLayoutInfo()->GetManagedSize() * Fix build break. * Centralize FieldMarshaler offsettting in ClassifyEightBytesWithNativeLayout. * Fix signed/unsigned mismatch * Fix condition to also detect arm64. * Change ifdef to if defined. * Remove duplicate declaration (broken in rebase) * Add some logging in one of the unreproable OSX test failures. * Mark System.Numerics.Vector as intrinsic and don't use the eightbyte classifier to enregister it. * Also explicitly opt-out of HFAs for System.Numerics.Vector`1 for consistency. * Update R2R required version to 3.0. * Remove debugging prints.
2019-03-05Move HasLayoutMetadata to methodtablebuilder.cpp (#23015)Jeremy Koritzinsky1-19/+0
* Move HasLayoutMetadata to methodtablebuilder.cpp * Collapse auto case into unicode case. * Remove ancient workaround for Managed C++ compiler bug.
2019-03-04Move EEClassLayoutInfo::CollectLayoutFieldMetadataThrowing to class.cpp (#22932)Jeremy Koritzinsky1-2/+30
Move `EEClassLayoutInfo::CollectLayoutFieldMetadataThrowing` to class.cpp and out of fieldmarshaler.cpp. This change co-locates `EEClassLayoutInfo::CollectLayoutFieldMetadataThrowing` with the rest of the implementation of `EEClassLayoutInfo`. Additionally, this PR separates out the field blittability check into a separate function instead of burying it in `CollectLayoutFieldMetadataThrowing`. Finally, it adds a small optimization in the field marshaler implementations where if a field's native size is statically known, the code returns that value instead of calling into one of the FieldMarshaler "virtual" calls. Originally part of #21415, but extracted out to make that PR smaller.
2019-02-13Remove Marshaling MDA (#22579)Jeremy Koritzinsky1-2/+0
Remove the "marshaling" MDA. In .NET Framework it was off by default and in .NET Core it was commented out in the boilerplate file. Additionally, from what I can tell only half of its functionality was ever implemented in .NET Core. Contributes to #22538.
2019-01-23Remove all traces of FEATURE_STACK_PROBE. (#22149)Filip Navara1-1/+0
2019-01-09Remove extraneous eightbytes check for native structures and add tests. (#21590)Jeremy Koritzinsky1-2/+6
* Remove extraneous eightbytes check and add tests. * Interger -> Integer * Missed Helper.cs * Handle field sizes larger than 8 bytes in AssignClassifiedEightByteTypes * Move CoreFX test case into CoreCLR. Fix the SystemV eightbyte classifier to correctly classify the second eightbyte when a single field crosses the eightbyte boundary (such as an in-place array of three 4-byte enums). * Enable passing user defined structs in in-place arrays in a structure if SystemV ABI expects it. * Correctly handle a field spanning two full eightbytes. * Just directly assign 0 to accumulatedSizeForEightByte * Change multi-eightbyte field handling to be a loop as per PR feedback. * Remove extraneous whitespace.
2018-10-25Fallback to old behavior when marshaling a non-blittable fixed buffer (#20575)Jeremy Koritzinsky1-0/+20
* Throw an exception only when attempting to marshal nonblittable fixed buffers to/from native instead of on all marshalling operations. * Assert in debug and checked builds when trying to marshal a fixed buffer of a non-blittable type.
2018-10-11Enable BSTR Field Marshaller for x-plat (#20264)Luqun Lou1-4/+2
2018-04-16[x86/Linux] Fix marshalling struct with 64-bit types (#17455)Konstantin Baladurin1-0/+6
* [x86/Linux] Fix marshalling struct with 64-bit types The System V ABI for i386 defines 4-byte alignment for 64-bit types. * [Linux/x86] Fix marshalling tests in the case of System V i386 ABI
2018-01-27Updating the VM to properly pack the SIMD hardware intrinsic types.Tanner Gooding1-1/+1
2018-01-27Updating the methodtablebuilder to handle the System V ABI packing ↵Tanner Gooding1-5/+3
requirements for i386
2017-06-27Partially remove relocations from Class section of NGEN-ed images (#11962)Ruben Ayrapetyan1-26/+171
* Remove relocations for ParamTypeDesc::m_TemplateMT. * Remove relocations for LayoutEEClass::m_LayoutInfo.m_pFieldMarshalers. * Prepare RelativeFixupPointer. * Remove relocations for FieldMarshaler::m_pFD and FieldMarshaler_*::m_*.
2017-03-20[x86/Linux] Use 4-byte align for double in struct (#10340)Jonghyun Park1-0/+5
2016-05-06UTF8 Marshaling support(UnmanagedType.LPUTF8Str)Tijoy Tom Kalathiparambil1-0/+13
Usage: [MarshalAs(UnmanagedType.LPUTF8Str)] applied to string and stringbuilder. Implementation mostly use Encoding.UTF8 API to do the byte buffer to string roundtripping. Introducing two new marshalers, UTF8StringMarshaler and UTF8BufferMarshaler which handle string and StringBuilder respectively. [Out] StringBuilder marshaling use builder capacity as the buffer size ie (builder. Capacity + 1) *3 which is enough for any UTF8 char in BMP plane, infact Encoding.UTF8 mscorlib APIs use the same length.All marshaling flags(ThrowOnUnmapable, defaultchar) are ignored since they do not make sense in UTF16 to UTD8 context. The public contracts are not yet updated, the public contracts and public marshaling API (Marshal.PtrToStringUtf8 and StringToHGlobalUtf8) will be added once the implementation is in. The marshal api are anyway going to be a wrapper around Encoding.GetBytes and GetChars.
2016-03-09Delete dead codeJan Kotas1-81/+0
- Delete BINDER, STANDALONE_BINDER and MDIL ifdefs
2016-01-27Update license headersdotnet-bot1-4/+3
2015-10-20Implementation of System V ABI struct passing.Lubomir Litchev1-1/+1
This PR adds support for System V x86_64 ABI classification and calling convention to the VM and the Jit, including, but not limited to Ubuntu Linux and Mac OS X. The general rules outlined in the System V x86_64 ABI (described at http://www.x86-64.org/documentation/abi.pdf) are followed with a few little exceptions, described below: 1. The hidden argument for by-value passed structs is always after the ÎéÎíthisÎéÎí parameter (if there is one.). This is a difference with the Sysetem V ABI and affects only the internal jit calling conventions. For PInvoke calls the hidden argument is always the first parameter since there is no ÎéÎíthisÎéÎí parameter in this case. 2. Managed structs that have no fields are always passed by-value on the stack. 3. The jit proactively generates frame register frames (with RBP as a frame register) in order to aid the native OS tooling for stack unwinding and the like.
2015-01-30Initial commit to populate CoreCLR repo dotnet-bot1-0/+1956
[tfs-changeset: 1407945]