LOCAL_VAR (ip [1], gpointer) = frame->imethod->data_items [ip [2]];
ip += 3;
MINT_IN_BREAK;
- MINT_IN_CASE(MINT_LDSTR_TOKEN) {
+ MINT_IN_CASE(MINT_LDSTR_DYNAMIC) {
MonoString *s = NULL;
guint32 strtoken = (guint32)(gsize)frame->imethod->data_items [ip [2]];
MonoMethod *method = frame->imethod->method;
- if (method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD) {
- s = (MonoString*)mono_method_get_wrapper_data (method, strtoken);
- } else if (method->wrapper_type != MONO_WRAPPER_NONE) {
- // FIXME push/pop LMF
- s = mono_string_new_wrapper_internal ((const char*)mono_method_get_wrapper_data (method, strtoken));
- } else {
- g_assert_not_reached ();
- }
+ g_assert (method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD);
+ s = (MonoString*)mono_method_get_wrapper_data (method, strtoken);
+ LOCAL_VAR (ip [1], gpointer) = s;
+ ip += 3;
+ MINT_IN_BREAK;
+ }
+ MINT_IN_CASE(MINT_LDSTR_CSTR) {
+ MonoString *s = NULL;
+ const char* cstr = (const char*)frame->imethod->data_items [ip [2]];
+
+ // FIXME push/pop LMF
+ s = mono_string_new_wrapper_internal (cstr);
LOCAL_VAR (ip [1], gpointer) = s;
ip += 3;
MINT_IN_BREAK;
OPDEF(MINT_SWITCH, "switch", 0, 0, 1, MintOpSwitch)
OPDEF(MINT_LDSTR, "ldstr", 3, 1, 0, MintOpShortInt)
-OPDEF(MINT_LDSTR_TOKEN, "ldstr.token", 3, 1, 0, MintOpShortInt)
+OPDEF(MINT_LDSTR_DYNAMIC, "ldstr.dynamic", 3, 1, 0, MintOpShortInt)
+OPDEF(MINT_LDSTR_CSTR, "ldstr.cstr", 3, 1, 0, MintOpShortInt)
OPDEF(MINT_JMP, "jmp", 2, 0, 0, MintOpMethodToken)
interp_add_ins (td, MINT_LDSTR);
interp_ins_set_dreg (td->last_ins, td->sp [-1].local);
td->last_ins->data [0] = get_data_item_index (td, s);
- } else {
- /* defer allocation to execution-time */
- interp_add_ins (td, MINT_LDSTR_TOKEN);
+ } else if (method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD) {
+ /* token is an index into the MonoDynamicMethod:method.method_data
+ * which comes from ReflectionMethodBuilder:refs. See
+ * reflection_methodbuilder_to_mono_method.
+ *
+ * the actual data item is a managed MonoString from the managed DynamicMethod
+ */
+ interp_add_ins (td, MINT_LDSTR_DYNAMIC);
interp_ins_set_dreg (td->last_ins, td->sp [-1].local);
td->last_ins->data [0] = get_data_item_index (td, GUINT_TO_POINTER (token));
+ } else {
+ /* the token is an index into MonoWrapperMethod:method_data that
+ * stores a global or malloc'ed C string. defer MonoString
+ * allocation to execution-time */
+ interp_add_ins (td, MINT_LDSTR_CSTR);
+ interp_ins_set_dreg (td->last_ins, td->sp [-1].local);
+ const char *cstr = (const char*)mono_method_get_wrapper_data (method, token);
+ td->last_ins->data [0] = get_data_item_index (td, (void*)cstr);
}
td->ip += 5;
break;