Marshal blittable structs via memcpy even if nested within non-blittable struct (#20194)
Marshal blittable structs via memcpy even if nested within non-blittable struct (#20194)

* Add regression test for dotnet/coreclr#18521.

* Add custom marshaler for fixed buffers that acts as a scalar memory copy of the length of the fixed buffer.

* Remove regression test. Moving it to a unit test in corefx.

* Move attribute class name into classnames.h

* Remove unreachable code left over from debugging.

* Marshal fixed buffers by reusing the field marshaler of the single field to pretend that there are multiple fields consecutively in the structure.

* Remove now-dead code paths.

* Use initializers in FieldMarshaler_NestedValueClass constructor where appropriate.

* Clean up IsFixedBuffer implementation.

* Remove unused GC_PROTECTs.

* Specifically check that the attribute exists, not just that there wasn't an error.

* Fix missing else statement.

* Add asserts so we don't corrupt the heap.

* Add unit test for masked bug (incorrect native size of structure calculated).

* Don't use new behavior on non-blittable fixed buffers.

* Revert "Add unit test for masked bug (incorrect native size of structure calculated)."

This reverts commit 496eef5906638c3c2696ede0d922a5e707447b4e.

* Use memcpy instead of field emulation.

* Remove unused forward-declared class.

* Clean up code. Refactor one GetMethodTable call I missed.

* Remove now-unneeded custom attribute includes. More diff cleanup.

* Remove unneeded FixedBufferAttribute define.

cshung/coreclr,krk/coreclr,cshung/coreclr,wtgodbe/coreclr,mmitche/coreclr,mmitche/coreclr,wtgodbe/coreclr,poizan42/coreclr,wtgodbe/coreclr,poizan42/coreclr,krk/coreclr,poizan42/coreclr,cshung/coreclr,cshung/coreclr,wtgodbe/coreclr,mmitche/coreclr,cshung/coreclr,poizan42/coreclr,mmitche/coreclr,krk/coreclr,mmitche/coreclr,krk/coreclr,mmitche/coreclr,krk/coreclr,krk/coreclr,wtgodbe/coreclr,poizan42/coreclr,cshung/coreclr,wtgodbe/coreclr,poizan42/coreclr