Marshal blittable structs via memcpy even if nested within non-blittable struct ...
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>
Wed, 3 Oct 2018 16:32:34 +0000 (09:32 -0700)
committerGitHub <noreply@github.com>
Wed, 3 Oct 2018 16:32:34 +0000 (09:32 -0700)
commit302630ed5a3730470e9ffeeebcd38c737c03963d
tree2e505233d6172d86cfdbb8fb29d6951e8d0cf244
parentb68296ce2c56188cf2a7bd263903e27c67717702
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.
src/vm/fieldmarshaler.cpp