[coop handles] Add MONO_HANDLE_SET_FIELD_REF macro
[mono.git] / mono / metadata / handle.h
index eb3175a4f9aca0d9a7b0ddaa88a78775784f057d..5de55eebc824540879dedab9bb5e555c99fc3276 100644 (file)
@@ -423,6 +423,13 @@ This is why we evaluate index and value before any call to MONO_HANDLE_RAW or ot
                *(TYPE*)(mono_handle_unsafe_field_addr (__obj, __field)) = __value; \
        } while (0)
 
+#define MONO_HANDLE_SET_FIELD_REF(HANDLE,FIELD,VALH) do {              \
+               MonoObjectHandle __obj = MONO_HANDLE_CAST (MonoObject, (HANDLE)); \
+               MonoClassField *__field = (FIELD);                      \
+               MonoObjectHandle __value = MONO_HANDLE_CAST (MonoObject, (VALH)); \
+               mono_gc_wbarrier_generic_store (mono_handle_unsafe_field_addr (__obj, __field), MONO_HANDLE_RAW (__value)); \
+       } while (0)
+
 /* Baked typed handles we all want */
 TYPED_HANDLE_DECL (MonoString);
 TYPED_HANDLE_DECL (MonoArray);
@@ -497,6 +504,9 @@ mono_array_handle_pin_with_size (MonoArrayHandle handle, int size, uintptr_t ind
 gunichar2 *
 mono_string_handle_pin_chars (MonoStringHandle s, uint32_t *gchandle_out);
 
+gpointer
+mono_object_handle_pin_unbox (MonoObjectHandle boxed_valuetype_obj, uint32_t *gchandle_out);
+
 void
 mono_error_set_exception_handle (MonoError *error, MonoExceptionHandle exc);