Skip to content
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

[mono] unify and vectorize implementation of decode_value metadata API #100048

Closed
wants to merge 9 commits into from
Prev Previous commit
Next Next commit
Address PR feedback
kg committed Apr 9, 2024
commit eb4b9f5c8e2ead3229a4669c86be9c4498466d5b
2 changes: 1 addition & 1 deletion src/mono/mono/metadata/metadata.c
Original file line number Diff line number Diff line change
@@ -1538,7 +1538,7 @@ decode_value_scalar (const guint8 *ptr, const guint8 **new_ptr)
MONO_ALWAYS_INLINE guint32
mono_metadata_decode_value_simd (const guint8 *ptr, const guint8 **new_ptr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in some cases, the callers of mono_metadata_decode_blob_size and mono_metadata_decode_value have already done a bounds check (for example the custom attribute parsing code does it). in other cases it's probably cheap to add a bounds check. maybe we can have the simd version on other platforms for those cases?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would make sense, i'll look into how hard it would be to be certain we've bounds-checked. The cost of the bounds check may outweigh the benefit of the SIMD, though.

{
#if defined(__clang__) && __LITTLE_ENDIAN__
#if defined(__clang__) && (G_BYTE_ORDER == G_LITTLE_ENDIAN)
guint32 result;

typedef guint8 v64_u1 __attribute__ ((vector_size (8)));