Skip to content

Expose Unity FastReflection helpers and attribute argument APIs#2217

Draft
annevanede-unity3d wants to merge 10 commits into
unity-mainfrom
unity-fast-reflection
Draft

Expose Unity FastReflection helpers and attribute argument APIs#2217
annevanede-unity3d wants to merge 10 commits into
unity-mainfrom
unity-fast-reflection

Conversation

@annevanede-unity3d
Copy link
Copy Markdown

  • Should this pull request have release notes?
    • Yes
    • No
  • Do these changes need to be back ported?
    • Yes
    • No
  • Do these changes need to be upstreamed to mono/mono or dotnet/runtime repositories?
    • Yes
    • No

Release notes

Mono: Added native APIs to support Unity's FastReflection path — exposes additional class/type/generic helpers via MONO_API, adds non-allocating accessors for custom attribute argument data (mono_unity_get_attr_args_info and friends), a by-pointer variant of mono_unity_generic_class_get_context, an assembly-name C-string helper, and mono_unity_type_is_unmanaged / mono_unity_type_is_blittable_primitive predicates.

Summary of changes

  • mono/metadata/unity-utils.h, unity-utils.c:
    • New MonoAttrArgsInfo struct and mono_unity_get_attr_args_info / _free / _type_arg_count / _as_class / _as_int / _as_uint64 / mono_unity_get_attr_type_arg for reading custom attribute constructor arguments without managed allocation.
    • New mono_unity_generic_class_get_context_by_ptr to return MonoGenericContext via out-pointer instead of by value.
    • New mono_unity_class_get_assembly_name_cstring helper.
    • New mono_unity_type_is_blittable_primitive and mono_unity_type_is_unmanaged predicates (the latter inspects fields of non-blittable valuetypes).
    • Promoted several existing helpers to MONO_API: mono_unity_class_get_generic_definition, mono_unity_class_is_array, mono_unity_class_is_class_type, mono_unity_type_is_generic_instance, mono_unity_type_get_generic_class, mono_unity_generic_inst_get_type_argc, mono_unity_generic_inst_get_type_argument.
  • mono/metadata/class-internals.h: promote mono_class_has_default_constructor to MONO_API.

@cla-assistant-unity
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ annevanede-unity3d
❌ Christopher Redden


Christopher Redden seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant