[sre] Add MonoDynamicImageTokCollision arg to mono_dynamic_image_register_token
authorAleksey Kliger <aleksey@xamarin.com>
Wed, 26 Jul 2017 15:39:36 +0000 (11:39 -0400)
committerAleksey Kliger <aleksey@xamarin.com>
Thu, 27 Jul 2017 15:41:28 +0000 (11:41 -0400)
commit792b5367cd3a6ffa1a192c4d2d7ace3509cbb646
tree17a9a0a1943584ae31830bbbda59a7741b47cfc7
parentd6141be2ef66d1aa789ebec692a85eeb69a2ca31
[sre] Add MonoDynamicImageTokCollision arg to mono_dynamic_image_register_token

The new argument controls what should happen when the given token is already
present.

In some situations it's expected that we either see the same object, or we
unconditionally want to replace it (for example if we previously registered a
TypeBuilder or a MethodBuilder, after the type or method is created, we will
re-register the RuntimeType or MonoMethod in its place).  In other cases (for
example when a module references a MonoMethod from a different assembly), we
may still call `mono_image_create_token()` multiple times but we expect to see
the same MonoMethod object.
mono/metadata/dynamic-image-internals.h
mono/metadata/dynamic-image.c
mono/metadata/sre-encode.c
mono/metadata/sre.c