diff options
author | Jay Krell <jay.krell@cornell.edu> | 2018-10-08 17:38:35 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2018-10-08 17:38:35 +0300 |
commit | b7c18caf0c758d2d81f0d83224d031073e4e5618 (patch) | |
tree | 74dd01e4ef5a3947ce5c36178b808be42f890451 | |
parent | 58925baab1aa4148ac452aa8e81d932593cd8461 (diff) |
Significant disambiguation between host and target. (#10969)
50 files changed, 430 insertions, 424 deletions
diff --git a/mono/mini/aot-runtime.c b/mono/mini/aot-runtime.c index ad469fb69bb..d14f2f881ad 100644 --- a/mono/mini/aot-runtime.c +++ b/mono/mini/aot-runtime.c @@ -2905,7 +2905,7 @@ decode_llvm_mono_eh_frame (MonoAotModule *amodule, MonoDomain *domain, MonoJitIn if (is_thumb_code (amodule, code_start)) /* Clear thumb flag */ - code_start = (guint8*)(((mgreg_t)code_start) & ~1); + code_start = (guint8*)(((gsize)code_start) & ~1); fde = amodule->mono_eh_frame + table [(pos * 2) + 1]; /* This won't overflow because there is +1 entry in the table */ @@ -2976,10 +2976,10 @@ decode_llvm_mono_eh_frame (MonoAotModule *amodule, MonoDomain *domain, MonoJitIn jei->clause_index = clause_index; if (is_thumb_code (amodule, (guint8 *)jei->try_start)) { - jei->try_start = (void*)((mgreg_t)jei->try_start & ~1); - jei->try_end = (void*)((mgreg_t)jei->try_end & ~1); + jei->try_start = (void*)((gsize)jei->try_start & ~1); + jei->try_end = (void*)((gsize)jei->try_end & ~1); /* Make sure we transition to thumb when a handler starts */ - jei->handler_start = (void*)((mgreg_t)jei->handler_start + 1); + jei->handler_start = (void*)((gsize)jei->handler_start + 1); } } @@ -4975,7 +4975,7 @@ find_aot_module (guint8 *code) } void -mono_aot_patch_plt_entry (guint8 *code, guint8 *plt_entry, gpointer *got, mgreg_t *regs, guint8 *addr) +mono_aot_patch_plt_entry (guint8 *code, guint8 *plt_entry, gpointer *got, host_mgreg_t *regs, guint8 *addr) { MonoAotModule *amodule; @@ -5175,7 +5175,7 @@ mono_aot_get_plt_entry (guint8 *code) * Return the PLT info offset belonging to the plt entry called by CODE. */ guint32 -mono_aot_get_plt_info_offset (mgreg_t *regs, guint8 *code) +mono_aot_get_plt_info_offset (host_mgreg_t *regs, guint8 *code) { guint8 *plt_entry = mono_aot_get_plt_entry (code); @@ -6182,7 +6182,7 @@ mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code } void -mono_aot_patch_plt_entry (guint8 *code, guint8 *plt_entry, gpointer *got, mgreg_t *regs, guint8 *addr) +mono_aot_patch_plt_entry (guint8 *code, guint8 *plt_entry, gpointer *got, host_mgreg_t *regs, guint8 *addr) { } @@ -6195,7 +6195,7 @@ mono_aot_get_method_from_vt_slot (MonoDomain *domain, MonoVTable *vtable, int sl } guint32 -mono_aot_get_plt_info_offset (mgreg_t *regs, guint8 *code) +mono_aot_get_plt_info_offset (host_mgreg_t *regs, guint8 *code) { g_assert_not_reached (); diff --git a/mono/mini/aot-runtime.h b/mono/mini/aot-runtime.h index 3594e600880..90de7b12754 100644 --- a/mono/mini/aot-runtime.h +++ b/mono/mini/aot-runtime.h @@ -220,12 +220,12 @@ gpointer mono_aot_get_method (MonoDomain *domain, gpointer mono_aot_get_method_from_token (MonoDomain *domain, MonoImage *image, guint32 token, MonoError *error); gboolean mono_aot_is_got_entry (guint8 *code, guint8 *addr); guint8* mono_aot_get_plt_entry (guint8 *code); -guint32 mono_aot_get_plt_info_offset (mgreg_t *regs, guint8 *code); +guint32 mono_aot_get_plt_info_offset (host_mgreg_t *regs, guint8 *code); gboolean mono_aot_get_cached_class_info (MonoClass *klass, MonoCachedClassInfo *res); gboolean mono_aot_get_class_from_name (MonoImage *image, const char *name_space, const char *name, MonoClass **klass); MonoJitInfo* mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr); gpointer mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code, MonoError *error); -void mono_aot_patch_plt_entry (guint8 *code, guint8 *plt_entry, gpointer *got, mgreg_t *regs, guint8 *addr); +void mono_aot_patch_plt_entry (guint8 *code, guint8 *plt_entry, gpointer *got, host_mgreg_t *regs, guint8 *addr); gpointer mono_aot_get_method_from_vt_slot (MonoDomain *domain, MonoVTable *vtable, int slot, MonoError *error); gpointer mono_aot_create_specific_trampoline (MonoImage *image, gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len); gpointer mono_aot_get_trampoline (const char *name); diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c index 918b3f2f3f2..ae594e96ec6 100644 --- a/mono/mini/debugger-agent.c +++ b/mono/mini/debugger-agent.c @@ -137,7 +137,7 @@ typedef struct MonoInterpFrameHandle interp_frame; gpointer frame_addr; int flags; - mgreg_t *reg_locations [MONO_MAX_IREGS]; + host_mgreg_t *reg_locations [MONO_MAX_IREGS]; /* * Whenever ctx is set. This is FALSE for the last frame of running threads, since * the frame can become invalid. @@ -3172,7 +3172,7 @@ process_frame (StackFrameInfo *info, MonoContext *ctx, gpointer user_data) frame->interp_frame = info->interp_frame; frame->frame_addr = info->frame_addr; if (info->reg_locations) - memcpy (frame->reg_locations, info->reg_locations, MONO_MAX_IREGS * sizeof (mgreg_t*)); + memcpy (frame->reg_locations, info->reg_locations, MONO_MAX_IREGS * sizeof (host_mgreg_t*)); if (ctx) { frame->ctx = *ctx; frame->has_ctx = TRUE; @@ -5579,7 +5579,7 @@ add_var (Buffer *buf, MonoDebugMethodJitInfo *jit, MonoType *t, MonoDebugVarInfo guint32 flags; int reg; guint8 *addr, *gaddr; - mgreg_t reg_val; + host_mgreg_t reg_val; flags = var->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS; reg = var->index & ~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS; @@ -5661,7 +5661,7 @@ add_var (Buffer *buf, MonoDebugMethodJitInfo *jit, MonoType *t, MonoDebugVarInfo } static void -set_var (MonoType *t, MonoDebugVarInfo *var, MonoContext *ctx, MonoDomain *domain, guint8 *val, mgreg_t **reg_locations, MonoContext *restore_ctx) +set_var (MonoType *t, MonoDebugVarInfo *var, MonoContext *ctx, MonoDomain *domain, guint8 *val, host_mgreg_t **reg_locations, MonoContext *restore_ctx) { guint32 flags; int reg, size; @@ -5678,7 +5678,7 @@ set_var (MonoType *t, MonoDebugVarInfo *var, MonoContext *ctx, MonoDomain *domai switch (flags) { case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER: { #ifdef MONO_ARCH_HAVE_CONTEXT_SET_INT_REG - mgreg_t v; + host_mgreg_t v; gboolean is_signed = FALSE; if (t->byref) { @@ -6066,7 +6066,7 @@ do_invoke_method (DebuggerTlsData *tls, Buffer *buf, InvokeData *invoke, guint8 NOT_IMPLEMENTED; if (sig->params [i]->byref) { - arg_buf [i] = (guint8 *)g_alloca (sizeof (mgreg_t)); + arg_buf [i] = g_newa (guint8, sizeof (gpointer)); *(gpointer*)arg_buf [i] = args [i]; args [i] = arg_buf [i]; } diff --git a/mono/mini/exceptions-amd64.c b/mono/mini/exceptions-amd64.c index 1cefe97f180..353b90a82f8 100644 --- a/mono/mini/exceptions-amd64.c +++ b/mono/mini/exceptions-amd64.c @@ -451,13 +451,13 @@ get_throw_trampoline (MonoTrampInfo **info, gboolean rethrow, gboolean corlib, g guint8 *code; MonoJumpInfo *ji = NULL; GSList *unwind_ops = NULL; - int i, stack_size, arg_offsets [16], ctx_offset, regs_offset, dummy_stack_space; + int i, stack_size, arg_offsets [16], ctx_offset, regs_offset; const guint kMaxCodeSize = 256; #ifdef TARGET_WIN32 - dummy_stack_space = 6 * sizeof(mgreg_t); /* Windows expects stack space allocated for all 6 dummy args. */ + const int dummy_stack_space = 6 * sizeof(mgreg_t); /* Windows expects stack space allocated for all 6 dummy args. */ #else - dummy_stack_space = 0; + const int dummy_stack_space = 0; #endif if (info) @@ -612,7 +612,7 @@ gboolean mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *ji, MonoContext *ctx, MonoContext *new_ctx, MonoLMF **lmf, - mgreg_t **save_locations, + host_mgreg_t **save_locations, StackFrameInfo *frame) { gpointer ip = MONO_CONTEXT_GET_IP (ctx); @@ -624,7 +624,7 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, *new_ctx = *ctx; if (ji != NULL) { - mgreg_t regs [MONO_MAX_IREGS + 1]; + host_mgreg_t regs [MONO_MAX_IREGS + 1]; guint8 *cfa; guint32 unwind_info_len; guint8 *unwind_info; @@ -660,7 +660,7 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, new_ctx->gregs [i] = regs [i]; /* The CFA becomes the new SP value */ - new_ctx->gregs [AMD64_RSP] = (mgreg_t)cfa; + new_ctx->gregs [AMD64_RSP] = (host_mgreg_t)(gsize)cfa; /* Adjust IP */ new_ctx->gregs [AMD64_RIP] --; @@ -683,7 +683,7 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, * The rsp field is set just before the call which transitioned to native * code. Obtain the rip from the stack. */ - rip = *(guint64*)((*lmf)->rsp - sizeof(mgreg_t)); + rip = *(guint64*)((*lmf)->rsp - sizeof(host_mgreg_t)); } ji = mini_jit_info_table_find (domain, (char *)rip, NULL); @@ -754,7 +754,7 @@ mono_arch_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), g { guint64 sp = ctx->gregs [AMD64_RSP]; - ctx->gregs [AMD64_RDI] = (guint64)user_data; + ctx->gregs [AMD64_RDI] = (gsize)user_data; /* Allocate a stack frame below the red zone */ sp -= 128; @@ -766,7 +766,7 @@ mono_arch_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), g *(guint64*)sp = ctx->gregs [AMD64_RIP]; #endif ctx->gregs [AMD64_RSP] = sp; - ctx->gregs [AMD64_RIP] = (guint64)async_cb; + ctx->gregs [AMD64_RIP] = (gsize)async_cb; } /** @@ -1347,7 +1347,6 @@ validate_table_no_lock (void) static inline void validate_table_no_lock (void) { - ; } #endif /* ENABLE_CHECKED_BUILD_UNWINDINFO */ @@ -1593,7 +1592,6 @@ validate_rt_funcs_in_table_no_lock (DynamicFunctionTableEntry *entry) static inline void validate_rt_funcs_in_table_no_lock (DynamicFunctionTableEntry *entry) { - ; } #endif /* ENABLE_CHECKED_BUILD_UNWINDINFO */ @@ -1627,10 +1625,10 @@ mono_arch_unwindinfo_insert_rt_func_in_table (const gpointer code, gsize code_si new_rt_func_data.BeginAddress = code_offset; new_rt_func_data.EndAddress = code_offset + code_size; - gsize aligned_unwind_data = ALIGN_TO(end_range, sizeof (mgreg_t)); + gsize aligned_unwind_data = ALIGN_TO(end_range, sizeof(host_mgreg_t)); new_rt_func_data.UnwindData = aligned_unwind_data - found_entry->begin_range; - g_assert_checked (new_rt_func_data.UnwindData == ALIGN_TO(new_rt_func_data.EndAddress, sizeof (mgreg_t))); + g_assert_checked (new_rt_func_data.UnwindData == ALIGN_TO(new_rt_func_data.EndAddress, sizeof (host_mgreg_t))); PRUNTIME_FUNCTION new_rt_funcs = NULL; @@ -1807,7 +1805,7 @@ mono_arch_unwindinfo_install_method_unwind_info (PUNWIND_INFO *monoui, gpointer unwindinfo = *monoui; targetlocation = (guint64)&(((guchar*)code)[code_size]); - targetinfo = (PUNWIND_INFO) ALIGN_TO(targetlocation, sizeof (mgreg_t)); + targetinfo = (PUNWIND_INFO) ALIGN_TO(targetlocation, sizeof (host_mgreg_t)); memcpy (targetinfo, unwindinfo, sizeof (UNWIND_INFO) - (sizeof (UNWIND_CODE) * MONO_MAX_UNWIND_CODES)); diff --git a/mono/mini/exceptions-arm.c b/mono/mini/exceptions-arm.c index ed822d20608..b7638ca4e0b 100644 --- a/mono/mini/exceptions-arm.c +++ b/mono/mini/exceptions-arm.c @@ -144,7 +144,7 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot) } void -mono_arm_throw_exception (MonoObject *exc, mgreg_t pc, mgreg_t sp, mgreg_t *int_regs, gdouble *fp_regs, gboolean preserve_ips) +mono_arm_throw_exception (MonoObject *exc, host_mgreg_t pc, host_mgreg_t sp, host_mgreg_t *int_regs, gdouble *fp_regs, gboolean preserve_ips) { ERROR_DECL (error); MonoContext ctx; @@ -159,7 +159,7 @@ mono_arm_throw_exception (MonoObject *exc, mgreg_t pc, mgreg_t sp, mgreg_t *int_ MONO_CONTEXT_SET_BP (&ctx, int_regs [ARMREG_FP - 4]); MONO_CONTEXT_SET_SP (&ctx, sp); MONO_CONTEXT_SET_IP (&ctx, pc); - memcpy (((guint8*)&ctx.regs) + (ARMREG_R4 * sizeof (mgreg_t)), int_regs, 8 * sizeof (mgreg_t)); + memcpy (((guint8*)&ctx.regs) + (ARMREG_R4 * sizeof (host_mgreg_t)), int_regs, 8 * sizeof (host_mgreg_t)); memcpy (&ctx.fregs, fp_regs, sizeof (double) * 16); if (mono_object_isinst_checked (exc, mono_defaults.exception_class, error)) { @@ -178,7 +178,7 @@ mono_arm_throw_exception (MonoObject *exc, mgreg_t pc, mgreg_t sp, mgreg_t *int_ } void -mono_arm_throw_exception_by_token (guint32 ex_token_index, mgreg_t pc, mgreg_t sp, mgreg_t *int_regs, gdouble *fp_regs) +mono_arm_throw_exception_by_token (guint32 ex_token_index, host_mgreg_t pc, host_mgreg_t sp, host_mgreg_t *int_regs, gdouble *fp_regs) { guint32 ex_token = MONO_TOKEN_TYPE_DEF | ex_token_index; /* Clear thumb bit */ @@ -188,7 +188,7 @@ mono_arm_throw_exception_by_token (guint32 ex_token_index, mgreg_t pc, mgreg_t s } void -mono_arm_resume_unwind (guint32 dummy1, mgreg_t pc, mgreg_t sp, mgreg_t *int_regs, gdouble *fp_regs) +mono_arm_resume_unwind (guint32 dummy1, host_mgreg_t pc, host_mgreg_t sp, host_mgreg_t *int_regs, gdouble *fp_regs) { MonoContext ctx; @@ -199,7 +199,7 @@ mono_arm_resume_unwind (guint32 dummy1, mgreg_t pc, mgreg_t sp, mgreg_t *int_reg MONO_CONTEXT_SET_BP (&ctx, int_regs [ARMREG_FP - 4]); MONO_CONTEXT_SET_SP (&ctx, sp); MONO_CONTEXT_SET_IP (&ctx, pc); - memcpy (((guint8*)&ctx.regs) + (ARMREG_R4 * sizeof (mgreg_t)), int_regs, 8 * sizeof (mgreg_t)); + memcpy (((guint8*)&ctx.regs) + (ARMREG_R4 * sizeof (host_mgreg_t)), int_regs, 8 * sizeof (host_mgreg_t)); mono_resume_unwind (&ctx); } @@ -430,7 +430,7 @@ gboolean mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *ji, MonoContext *ctx, MonoContext *new_ctx, MonoLMF **lmf, - mgreg_t **save_locations, + host_mgreg_t **save_locations, StackFrameInfo *frame) { gpointer ip = MONO_CONTEXT_GET_IP (ctx); @@ -493,7 +493,7 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, frame->type = FRAME_TYPE_MANAGED_TO_NATIVE; - if ((ji = mini_jit_info_table_find (domain, (gpointer)(*lmf)->ip, NULL))) { + if ((ji = mini_jit_info_table_find (domain, (gpointer)(gsize)(*lmf)->ip, NULL))) { frame->ji = ji; } else { if (!(*lmf)->method) @@ -509,7 +509,7 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, * produce the register state which existed at the time of the call which * transitioned to native call, so we save the sp/fp/ip in the LMF. */ - memcpy (&new_ctx->regs [0], &(*lmf)->iregs [0], sizeof (mgreg_t) * 13); + memcpy (&new_ctx->regs [0], &(*lmf)->iregs [0], sizeof (host_mgreg_t) * 13); new_ctx->pc = (*lmf)->ip; new_ctx->regs [ARMREG_SP] = (*lmf)->sp; new_ctx->regs [ARMREG_FP] = (*lmf)->fp; @@ -623,7 +623,7 @@ mono_arch_ip_from_context (void *sigctx) void mono_arch_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data) { - mgreg_t sp = (mgreg_t)MONO_CONTEXT_GET_SP (ctx); + host_mgreg_t sp = (host_mgreg_t)MONO_CONTEXT_GET_SP (ctx); // FIXME: g_assert (!user_data); @@ -644,7 +644,7 @@ void mono_arch_setup_resume_sighandler_ctx (MonoContext *ctx, gpointer func) { MONO_CONTEXT_SET_IP (ctx,func); - if ((mgreg_t)MONO_CONTEXT_GET_IP (ctx) & 1) + if ((host_mgreg_t)MONO_CONTEXT_GET_IP (ctx) & 1) /* Transition to thumb */ ctx->cpsr |= (1 << 5); else diff --git a/mono/mini/exceptions-arm64.c b/mono/mini/exceptions-arm64.c index 6aa1a53afd4..03a4d9fd187 100644 --- a/mono/mini/exceptions-arm64.c +++ b/mono/mini/exceptions-arm64.c @@ -390,7 +390,7 @@ mono_arch_exceptions_init (void) * FP_REGS points to the 8 callee saved fp regs. */ void -mono_arm_throw_exception (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble *fp_regs, gboolean corlib, gboolean rethrow, gboolean preserve_ips) +mono_arm_throw_exception (gpointer arg, host_mgreg_t pc, host_mgreg_t *int_regs, gdouble *fp_regs, gboolean corlib, gboolean rethrow, gboolean preserve_ips) { ERROR_DECL (error); MonoContext ctx; @@ -410,7 +410,7 @@ mono_arm_throw_exception (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble * /* Initialize a ctx based on the arguments */ memset (&ctx, 0, sizeof (MonoContext)); - memcpy (&(ctx.regs [0]), int_regs, sizeof (mgreg_t) * 32); + memcpy (&(ctx.regs [0]), int_regs, sizeof (host_mgreg_t) * 32); for (int i = 0; i < 8; i++) *((gdouble*)&ctx.fregs [ARMREG_D8 + i]) = fp_regs [i]; ctx.has_fregs = 1; @@ -433,7 +433,7 @@ mono_arm_throw_exception (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble * } void -mono_arm_resume_unwind (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble *fp_regs, gboolean corlib, gboolean rethrow) +mono_arm_resume_unwind (gpointer arg, host_mgreg_t pc, host_mgreg_t *int_regs, gdouble *fp_regs, gboolean corlib, gboolean rethrow) { MonoContext ctx; @@ -442,7 +442,7 @@ mono_arm_resume_unwind (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble *fp /* Initialize a ctx based on the arguments */ memset (&ctx, 0, sizeof (MonoContext)); - memcpy (&(ctx.regs [0]), int_regs, sizeof (mgreg_t) * 32); + memcpy (&(ctx.regs [0]), int_regs, sizeof (host_mgreg_t) * 32); for (int i = 0; i < 8; i++) *((gdouble*)&ctx.fregs [ARMREG_D8 + i]) = fp_regs [i]; ctx.has_fregs = 1; @@ -460,7 +460,7 @@ gboolean mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *ji, MonoContext *ctx, MonoContext *new_ctx, MonoLMF **lmf, - mgreg_t **save_locations, + host_mgreg_t **save_locations, StackFrameInfo *frame) { gpointer ip = MONO_CONTEXT_GET_IP (ctx); @@ -471,7 +471,7 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, *new_ctx = *ctx; if (ji != NULL) { - mgreg_t regs [MONO_MAX_IREGS + 8 + 1]; + host_mgreg_t regs [MONO_MAX_IREGS + 8 + 1]; guint8 *cfa; guint32 unwind_info_len; guint8 *unwind_info; @@ -484,22 +484,22 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, unwind_info = mono_jinfo_get_unwind_info (ji, &unwind_info_len); - memcpy (regs, &new_ctx->regs, sizeof (mgreg_t) * 32); + memcpy (regs, &new_ctx->regs, sizeof (host_mgreg_t) * 32); /* v8..v15 are callee saved */ for (int i = 0; i < 8; i++) - (regs + MONO_MAX_IREGS) [i] = *((mgreg_t*)&new_ctx->fregs [8 + i]); + (regs + MONO_MAX_IREGS) [i] = *((host_mgreg_t*)&new_ctx->fregs [8 + i]); mono_unwind_frame (unwind_info, unwind_info_len, (guint8*)ji->code_start, (guint8*)ji->code_start + ji->code_size, (guint8*)ip, NULL, regs, MONO_MAX_IREGS + 8, save_locations, MONO_MAX_IREGS, (guint8**)&cfa); - memcpy (&new_ctx->regs, regs, sizeof (mgreg_t) * 32); + memcpy (&new_ctx->regs, regs, sizeof (host_mgreg_t) * 32); for (int i = 0; i < 8; i++) - *((mgreg_t*)&new_ctx->fregs [8 + i]) = (regs + MONO_MAX_IREGS) [i]; + *((host_mgreg_t*)&new_ctx->fregs [8 + i]) = (regs + MONO_MAX_IREGS) [i]; new_ctx->pc = regs [ARMREG_LR]; - new_ctx->regs [ARMREG_SP] = (mgreg_t)cfa; + new_ctx->regs [ARMREG_SP] = (host_mgreg_t)(gsize)cfa; if (*lmf && (*lmf)->gregs [MONO_ARCH_LMF_REG_SP] && (MONO_CONTEXT_GET_SP (ctx) >= (gpointer)(*lmf)->gregs [MONO_ARCH_LMF_REG_SP])) { /* remove any unused lmf */ @@ -520,7 +520,7 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, return FALSE; g_assert (MONO_ARCH_LMF_REGS == ((0x3ff << 19) | (1 << ARMREG_FP) | (1 << ARMREG_SP))); - memcpy (&new_ctx->regs [ARMREG_R19], &(*lmf)->gregs [0], sizeof (mgreg_t) * 10); + memcpy (&new_ctx->regs [ARMREG_R19], &(*lmf)->gregs [0], sizeof (host_mgreg_t) * 10); new_ctx->regs [ARMREG_FP] = (*lmf)->gregs [MONO_ARCH_LMF_REG_FP]; new_ctx->regs [ARMREG_SP] = (*lmf)->gregs [MONO_ARCH_LMF_REG_SP]; new_ctx->pc = (*lmf)->pc; @@ -597,7 +597,7 @@ mono_arch_ip_from_context (void *sigctx) void mono_arch_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data) { - mgreg_t sp = (mgreg_t)MONO_CONTEXT_GET_SP (ctx); + host_mgreg_t sp = (host_mgreg_t)MONO_CONTEXT_GET_SP (ctx); // FIXME: g_assert (!user_data); diff --git a/mono/mini/exceptions-mips.c b/mono/mini/exceptions-mips.c index 3bd173d7f6a..6715ba7c081 100644 --- a/mono/mini/exceptions-mips.c +++ b/mono/mini/exceptions-mips.c @@ -422,7 +422,7 @@ gboolean mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *ji, MonoContext *ctx, MonoContext *new_ctx, MonoLMF **lmf, - mgreg_t **save_locations, + host_mgreg_t **save_locations, StackFrameInfo *frame) { memset (frame, 0, sizeof (StackFrameInfo)); @@ -433,7 +433,7 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, if (ji != NULL) { int i; gpointer ip = MONO_CONTEXT_GET_IP (ctx); - mgreg_t regs [MONO_MAX_IREGS + 1]; + host_mgreg_t regs [MONO_MAX_IREGS + 1]; guint8 *cfa; guint32 unwind_info_len; guint8 *unwind_info; @@ -456,7 +456,7 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, for (i = 0; i < MONO_MAX_IREGS; ++i) new_ctx->sc_regs [i] = regs [i]; new_ctx->sc_pc = regs [mips_ra]; - new_ctx->sc_regs [mips_sp] = (mgreg_t)cfa; + new_ctx->sc_regs [mips_sp] = (host_mgreg_t)(gsize)cfa; /* we substract 8, so that the IP points into the call instruction */ MONO_CONTEXT_SET_IP (new_ctx, new_ctx->sc_pc - 8); diff --git a/mono/mini/exceptions-ppc.c b/mono/mini/exceptions-ppc.c index 52456bf0938..f0f5de9d34c 100644 --- a/mono/mini/exceptions-ppc.c +++ b/mono/mini/exceptions-ppc.c @@ -322,7 +322,7 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot) } void -mono_ppc_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, mgreg_t *int_regs, gdouble *fp_regs, gboolean rethrow, gboolean preserve_ips) +mono_ppc_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, host_mgreg_t *int_regs, gdouble *fp_regs, gboolean rethrow, gboolean preserve_ips) { ERROR_DECL (error); MonoContext ctx; @@ -335,7 +335,7 @@ mono_ppc_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, /*printf ("stack in throw: %p\n", esp);*/ MONO_CONTEXT_SET_BP (&ctx, esp); MONO_CONTEXT_SET_IP (&ctx, eip); - memcpy (&ctx.regs, int_regs, sizeof (mgreg_t) * MONO_MAX_IREGS); + memcpy (&ctx.regs, int_regs, sizeof (host_mgreg_t) * MONO_MAX_IREGS); memcpy (&ctx.fregs, fp_regs, sizeof (double) * MONO_MAX_FREGS); if (mono_object_isinst_checked (exc, mono_defaults.exception_class, error)) { @@ -538,7 +538,7 @@ gboolean mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *ji, MonoContext *ctx, MonoContext *new_ctx, MonoLMF **lmf, - mgreg_t **save_locations, + host_mgreg_t **save_locations, StackFrameInfo *frame) { gpointer ip = MONO_CONTEXT_GET_IP (ctx); @@ -552,7 +552,7 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, if (ji != NULL) { int i; - mgreg_t regs [ppc_lr + 1]; + host_mgreg_t regs [ppc_lr + 1]; guint8 *cfa; guint32 unwind_info_len; guint8 *unwind_info; @@ -570,7 +570,7 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, /* sframe->sp points just past the end of the LMF */ guint8 *lmf_addr = (guint8*)sframe->sp - sizeof (MonoLMF); memcpy (&new_ctx->fregs [MONO_PPC_FIRST_SAVED_FREG], lmf_addr + G_STRUCT_OFFSET (MonoLMF, fregs), sizeof (double) * MONO_SAVED_FREGS); - memcpy (&new_ctx->regs [MONO_PPC_FIRST_SAVED_GREG], lmf_addr + G_STRUCT_OFFSET (MonoLMF, iregs), sizeof (mgreg_t) * MONO_SAVED_GREGS); + memcpy (&new_ctx->regs [MONO_PPC_FIRST_SAVED_GREG], lmf_addr + G_STRUCT_OFFSET (MonoLMF, iregs), sizeof (host_mgreg_t) * MONO_SAVED_GREGS); /* the calling IP is in the parent frame */ sframe = (MonoPPCStackFrame*)sframe->sp; /* we substract 4, so that the IP points into the call instruction */ @@ -611,7 +611,7 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, MONO_CONTEXT_SET_IP (new_ctx, sframe->lr);*/ MONO_CONTEXT_SET_BP (new_ctx, (*lmf)->ebp); MONO_CONTEXT_SET_IP (new_ctx, (*lmf)->eip); - memcpy (&new_ctx->regs [MONO_PPC_FIRST_SAVED_GREG], (*lmf)->iregs, sizeof (mgreg_t) * MONO_SAVED_GREGS); + memcpy (&new_ctx->regs [MONO_PPC_FIRST_SAVED_GREG], (*lmf)->iregs, sizeof (host_mgreg_t) * MONO_SAVED_GREGS); memcpy (&new_ctx->fregs [MONO_PPC_FIRST_SAVED_FREG], (*lmf)->fregs, sizeof (double) * MONO_SAVED_FREGS); frame->ji = ji; @@ -770,7 +770,7 @@ mono_arch_handle_exception (void *ctx, gpointer obj) * resume into the normal stack and do most work there if possible. */ MonoJitTlsData *jit_tls = mono_tls_get_jit_tls (); - mgreg_t sp; + host_mgreg_t sp; void *sigctx = ctx; int frame_size; void *uc = sigctx; @@ -785,9 +785,9 @@ mono_arch_handle_exception (void *ctx, gpointer obj) frame_size = 224; frame_size += 15; frame_size &= ~15; - sp = (mgreg_t)(UCONTEXT_REG_Rn(uc, 1) & ~15); - sp = (mgreg_t)(sp - frame_size); - UCONTEXT_REG_Rn(uc, 1) = (mgreg_t)sp; + sp = (host_mgreg_t)(UCONTEXT_REG_Rn(uc, 1) & ~15); + sp = (host_mgreg_t)(sp - frame_size); + UCONTEXT_REG_Rn(uc, 1) = (host_mgreg_t)sp; setup_ucontext_return (uc, handle_signal_exception); return TRUE; diff --git a/mono/mini/exceptions-s390x.c b/mono/mini/exceptions-s390x.c index a9fe4d0d029..86f37429594 100644 --- a/mono/mini/exceptions-s390x.c +++ b/mono/mini/exceptions-s390x.c @@ -240,7 +240,7 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot) static void throw_exception (MonoObject *exc, unsigned long ip, unsigned long sp, - gulong *int_regs, gdouble *fp_regs, gint32 *acc_regs, + host_mgreg_t *int_regs, gdouble *fp_regs, gint32 *acc_regs, guint fpc, gboolean rethrow, gboolean preserve_ips) { ERROR_DECL (error); @@ -397,7 +397,6 @@ mono_arch_get_throw_exception_generic (int size, MonoTrampInfo **info, gpointer mono_arch_get_throw_exception (MonoTrampInfo **info, gboolean aot) { - g_assert (!aot); if (info) *info = NULL; @@ -489,7 +488,7 @@ gboolean mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *ji, MonoContext *ctx, MonoContext *new_ctx, MonoLMF **lmf, - mgreg_t **save_locations, + host_mgreg_t **save_locations, StackFrameInfo *frame) { gpointer ip = (gpointer) MONO_CONTEXT_GET_IP (ctx); @@ -504,7 +503,7 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, guint8 *cfa; guint32 unwind_info_len; guint8 *unwind_info; - mgreg_t regs[16]; + host_mgreg_t regs[16]; if (ji->is_trampoline) frame->type = FRAME_TYPE_TRAMPOLINE; @@ -627,12 +626,12 @@ mono_arch_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), g { uintptr_t sp = (uintptr_t) MONO_CONTEXT_GET_SP(ctx); - ctx->uc_mcontext.gregs[2] = (unsigned long) user_data; + ctx->uc_mcontext.gregs[2] = (gsize)user_data; sp -= S390_MINIMAL_STACK_SIZE; *(unsigned long *)sp = MONO_CONTEXT_GET_SP(ctx); MONO_CONTEXT_SET_BP(ctx, sp); - MONO_CONTEXT_SET_IP(ctx, (unsigned long) async_cb); + MONO_CONTEXT_SET_IP(ctx, (gsize)async_cb); } /*========================= End of Function ========================*/ diff --git a/mono/mini/exceptions-sparc.c b/mono/mini/exceptions-sparc.c index 4f55e028d49..1b69ec3ba1d 100644 --- a/mono/mini/exceptions-sparc.c +++ b/mono/mini/exceptions-sparc.c @@ -367,7 +367,7 @@ gboolean mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *ji, MonoContext *ctx, MonoContext *new_ctx, MonoLMF **lmf, - mgreg_t **save_locations, + host_mgreg_t **save_locations, StackFrameInfo *frame) { gpointer *window; diff --git a/mono/mini/exceptions-wasm.c b/mono/mini/exceptions-wasm.c index c6d70a04e33..605474cb5c6 100644 --- a/mono/mini/exceptions-wasm.c +++ b/mono/mini/exceptions-wasm.c @@ -40,7 +40,7 @@ gboolean mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *ji, MonoContext *ctx, MonoContext *new_ctx, MonoLMF **lmf, - mgreg_t **save_locations, + host_mgreg_t **save_locations, StackFrameInfo *frame) { if (ji) diff --git a/mono/mini/exceptions-x86.c b/mono/mini/exceptions-x86.c index 4e2c88f2b12..415b9ba20cf 100644 --- a/mono/mini/exceptions-x86.c +++ b/mono/mini/exceptions-x86.c @@ -452,8 +452,8 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot) * C function called from the throw trampolines. */ void -mono_x86_throw_exception (mgreg_t *regs, MonoObject *exc, - mgreg_t eip, gboolean rethrow, gboolean preserve_ips) +mono_x86_throw_exception (host_mgreg_t *regs, MonoObject *exc, + host_mgreg_t eip, gboolean rethrow, gboolean preserve_ips) { ERROR_DECL (error); MonoContext ctx; @@ -495,8 +495,8 @@ mono_x86_throw_exception (mgreg_t *regs, MonoObject *exc, } void -mono_x86_throw_corlib_exception (mgreg_t *regs, guint32 ex_token_index, - mgreg_t eip, gint32 pc_offset) +mono_x86_throw_corlib_exception (host_mgreg_t *regs, guint32 ex_token_index, + host_mgreg_t eip, gint32 pc_offset) { guint32 ex_token = MONO_TOKEN_TYPE_DEF | ex_token_index; MonoException *ex; @@ -512,8 +512,8 @@ mono_x86_throw_corlib_exception (mgreg_t *regs, guint32 ex_token_index, } static void -mono_x86_resume_unwind (mgreg_t *regs, MonoObject *exc, - mgreg_t eip, gboolean rethrow) +mono_x86_resume_unwind (host_mgreg_t *regs, MonoObject *exc, + host_mgreg_t eip, gboolean rethrow) { MonoContext ctx; @@ -800,7 +800,7 @@ gboolean mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *ji, MonoContext *ctx, MonoContext *new_ctx, MonoLMF **lmf, - mgreg_t **save_locations, + host_mgreg_t **save_locations, StackFrameInfo *frame) { gpointer ip = MONO_CONTEXT_GET_IP (ctx); @@ -811,7 +811,7 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, *new_ctx = *ctx; if (ji != NULL) { - mgreg_t regs [MONO_MAX_IREGS + 1]; + host_mgreg_t regs [MONO_MAX_IREGS + 1]; guint8 *cfa; guint32 unwind_info_len; guint8 *unwind_info; @@ -994,13 +994,13 @@ mono_arch_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), g * So put it into a register, and branch to a trampoline which * pushes it. */ - ctx->eax = (mgreg_t)user_data; + ctx->eax = (host_mgreg_t)(gsize)user_data; ctx->ecx = ctx->eip; - ctx->edx = (mgreg_t)async_cb; + ctx->edx = (host_mgreg_t)(gsize)async_cb; /*align the stack*/ ctx->esp = (ctx->esp - 16) & ~15; - ctx->eip = (mgreg_t)signal_exception_trampoline; + ctx->eip = (host_mgreg_t)(gsize)signal_exception_trampoline; } gboolean @@ -1050,7 +1050,7 @@ mono_arch_handle_exception (void *sigctx, gpointer obj) } static MonoObject* -restore_soft_guard_pages () +restore_soft_guard_pages (void) { MonoJitTlsData *jit_tls = mono_tls_get_jit_tls (); diff --git a/mono/mini/ir-emit.h b/mono/mini/ir-emit.h index 2c556688f1b..ea7bac67747 100644 --- a/mono/mini/ir-emit.h +++ b/mono/mini/ir-emit.h @@ -714,7 +714,7 @@ handle_gsharedvt_ldaddr (MonoCompile *cfg) #define MONO_EMIT_NEW_ICOMPARE_IMM(cfg,sr1,imm) do { \ MonoInst *inst; \ - MONO_INST_NEW ((cfg), (inst), sizeof (mgreg_t) == 8 ? OP_ICOMPARE_IMM : OP_COMPARE_IMM); \ + MONO_INST_NEW ((cfg), (inst), sizeof (target_mgreg_t) == 8 ? OP_ICOMPARE_IMM : OP_COMPARE_IMM); \ inst->sreg1 = sr1; \ inst->inst_imm = (imm); \ MONO_ADD_INS ((cfg)->cbb, inst); \ @@ -758,7 +758,7 @@ handle_gsharedvt_ldaddr (MonoCompile *cfg) MONO_INST_NEW ((cfg), (inst), (op)); \ inst->inst_destbasereg = base; \ inst->inst_offset = offset; \ - inst->inst_imm = (mgreg_t)(imm); \ + inst->inst_imm = (target_mgreg_t)(imm); \ MONO_ADD_INS ((cfg)->cbb, inst); \ } while (0) diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c index 0b8734b4755..3c0d6eb0453 100644 --- a/mono/mini/method-to-ir.c +++ b/mono/mini/method-to-ir.c @@ -3606,7 +3606,7 @@ mini_emit_check_array_type (MonoCompile *cfg, MonoInst *obj, MonoClass *array_cl mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR); return; } - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, vtable_reg, vtable); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, vtable_reg, (gssize)vtable); } } @@ -4305,7 +4305,7 @@ handle_constrained_gsharedvt_call (MonoCompile *cfg, MonoMethod *cmethod, MonoMe /* Pass the arguments using a localloc-ed array using the format expected by runtime_invoke () */ MONO_INST_NEW (cfg, ins, OP_LOCALLOC_IMM); ins->dreg = alloc_preg (cfg); - ins->inst_imm = fsig->param_count * sizeof (mgreg_t); + ins->inst_imm = fsig->param_count * sizeof (target_mgreg_t); MONO_ADD_INS (cfg->cbb, ins); args [4] = ins; diff --git a/mono/mini/mini-amd64.c b/mono/mini/mini-amd64.c index 51bbf82964a..5da5c110257 100644 --- a/mono/mini/mini-amd64.c +++ b/mono/mini/mini-amd64.c @@ -1108,7 +1108,7 @@ mono_arch_set_native_call_context_args (CallContext *ccontext, gpointer frame, M if (sig->ret->type != MONO_TYPE_VOID) { if (cinfo->ret.storage == ArgValuetypeAddrInIReg) { gpointer ret_storage = interp_cb->frame_arg_to_storage ((MonoInterpFrameHandle)frame, sig, -1); - ccontext->gregs [cinfo->ret.reg] = (mgreg_t)ret_storage; + ccontext->gregs [cinfo->ret.reg] = (host_mgreg_t)ret_storage; } } @@ -7809,7 +7809,7 @@ mono_arch_get_this_arg_reg (guint8 *code) } gpointer -mono_arch_get_this_arg_from_call (mgreg_t *regs, guint8 *code) +mono_arch_get_this_arg_from_call (host_mgreg_t *regs, guint8 *code) { return (gpointer)regs [mono_arch_get_this_arg_reg (code)]; } @@ -8222,13 +8222,13 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC } MonoMethod* -mono_arch_find_imt_method (mgreg_t *regs, guint8 *code) +mono_arch_find_imt_method (host_mgreg_t *regs, guint8 *code) { return (MonoMethod*)regs [MONO_ARCH_IMT_REG]; } MonoVTable* -mono_arch_find_static_call_vtable (mgreg_t *regs, guint8 *code) +mono_arch_find_static_call_vtable (host_mgreg_t *regs, guint8 *code) { return (MonoVTable*) regs [MONO_ARCH_RGCTX_REG]; } @@ -8336,14 +8336,14 @@ mono_arch_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMetho } #endif -mgreg_t +host_mgreg_t mono_arch_context_get_int_reg (MonoContext *ctx, int reg) { return ctx->gregs [reg]; } void -mono_arch_context_set_int_reg (MonoContext *ctx, int reg, mgreg_t val) +mono_arch_context_set_int_reg (MonoContext *ctx, int reg, host_mgreg_t val) { ctx->gregs [reg] = val; } diff --git a/mono/mini/mini-amd64.h b/mono/mini/mini-amd64.h index 71e276f6216..a89dd580959 100644 --- a/mono/mini/mini-amd64.h +++ b/mono/mini/mini-amd64.h @@ -342,7 +342,7 @@ struct CallInfo { typedef struct { /* General registers */ - mgreg_t gregs [AMD64_NREG]; + host_mgreg_t gregs [AMD64_NREG]; /* Floating registers */ double fregs [AMD64_XMM_NREG]; /* Stack usage, used for passing params on stack */ diff --git a/mono/mini/mini-arm.c b/mono/mini/mini-arm.c index 6bef0cbbfb7..107d9f2a3f9 100644 --- a/mono/mini/mini-arm.c +++ b/mono/mini/mini-arm.c @@ -773,7 +773,7 @@ mono_arch_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod } gpointer -mono_arch_get_this_arg_from_call (mgreg_t *regs, guint8 *code) +mono_arch_get_this_arg_from_call (host_mgreg_t *regs, guint8 *code) { return (gpointer)regs [ARMREG_R0]; } @@ -1666,19 +1666,19 @@ arg_get_storage (CallContext *ccontext, ArgInfo *ainfo) static void arg_get_val (CallContext *ccontext, ArgInfo *ainfo, gpointer dest) { - int reg_size = ainfo->size * sizeof (mgreg_t); + int reg_size = ainfo->size * sizeof (host_mgreg_t); g_assert (arg_need_temp (ainfo)); memcpy (dest, &ccontext->gregs [ainfo->reg], reg_size); - memcpy ((mgreg_t*)dest + ainfo->size, ccontext->stack + ainfo->offset, ainfo->struct_size - reg_size); + memcpy ((host_mgreg_t*)dest + ainfo->size, ccontext->stack + ainfo->offset, ainfo->struct_size - reg_size); } static void arg_set_val (CallContext *ccontext, ArgInfo *ainfo, gpointer src) { - int reg_size = ainfo->size * sizeof (mgreg_t); + int reg_size = ainfo->size * sizeof (host_mgreg_t); g_assert (arg_need_temp (ainfo)); memcpy (&ccontext->gregs [ainfo->reg], src, reg_size); - memcpy (ccontext->stack + ainfo->offset, (mgreg_t*)src + ainfo->size, ainfo->struct_size - reg_size); + memcpy (ccontext->stack + ainfo->offset, (host_mgreg_t*)src + ainfo->size, ainfo->struct_size - reg_size); } /* Set arguments in the ccontext (for i2n entry) */ @@ -1700,7 +1700,7 @@ mono_arch_set_native_call_context_args (CallContext *ccontext, gpointer frame, M ainfo = &cinfo->ret; if (ainfo->storage == RegTypeStructByAddr) { storage = interp_cb->frame_arg_to_storage ((MonoInterpFrameHandle)frame, sig, -1); - ccontext->gregs [cinfo->ret.reg] = (mgreg_t)storage; + ccontext->gregs [cinfo->ret.reg] = (host_mgreg_t)(gsize)storage; } } @@ -1757,7 +1757,7 @@ mono_arch_get_native_call_context_args (CallContext *ccontext, gpointer frame, M if (sig->ret->type != MONO_TYPE_VOID) { ainfo = &cinfo->ret; if (ainfo->storage == RegTypeStructByAddr) { - storage = (gpointer) ccontext->gregs [cinfo->ret.reg]; + storage = (gpointer)(gsize)ccontext->gregs [cinfo->ret.reg]; interp_cb->frame_arg_set_storage ((MonoInterpFrameHandle)frame, sig, -1, storage); } } @@ -2952,20 +2952,20 @@ mono_arch_start_dyn_call (MonoDynCallInfo *info, gpointer **args, guint8 *ret, g p->res = 0; p->ret = ret; p->has_fpregs = 0; - p->n_stackargs = cinfo->stack_usage / sizeof (mgreg_t); + p->n_stackargs = cinfo->stack_usage / sizeof (host_mgreg_t); arg_index = 0; greg = 0; pindex = 0; if (sig->hasthis || dinfo->cinfo->vret_arg_index == 1) { - p->regs [greg ++] = (mgreg_t)*(args [arg_index ++]); + p->regs [greg ++] = (host_mgreg_t)(gsize)*(args [arg_index ++]); if (!sig->hasthis) pindex = 1; } if (dinfo->cinfo->ret.storage == RegTypeStructByAddr) - p->regs [greg ++] = (mgreg_t)ret; + p->regs [greg ++] = (host_mgreg_t)(gsize)ret; for (i = pindex; i < sig->param_count; i++) { MonoType *t = dinfo->param_types [i]; @@ -2986,7 +2986,7 @@ mono_arch_start_dyn_call (MonoDynCallInfo *info, gpointer **args, guint8 *ret, g } if (t->byref) { - p->regs [slot] = (mgreg_t)*arg; + p->regs [slot] = (host_mgreg_t)(gsize)*arg; continue; } @@ -2995,7 +2995,7 @@ mono_arch_start_dyn_call (MonoDynCallInfo *info, gpointer **args, guint8 *ret, g case MONO_TYPE_PTR: case MONO_TYPE_I: case MONO_TYPE_U: - p->regs [slot] = (mgreg_t)*arg; + p->regs [slot] = (host_mgreg_t)(gsize)*arg; break; case MONO_TYPE_U1: p->regs [slot] = *(guint8*)arg; @@ -3017,8 +3017,8 @@ mono_arch_start_dyn_call (MonoDynCallInfo *info, gpointer **args, guint8 *ret, g break; case MONO_TYPE_I8: case MONO_TYPE_U8: - p->regs [slot ++] = (mgreg_t)arg [0]; - p->regs [slot] = (mgreg_t)arg [1]; + p->regs [slot ++] = (host_mgreg_t)(gsize)arg [0]; + p->regs [slot] = (host_mgreg_t)(gsize)arg [1]; break; case MONO_TYPE_R4: if (ainfo->storage == RegTypeFP) { @@ -3026,7 +3026,7 @@ mono_arch_start_dyn_call (MonoDynCallInfo *info, gpointer **args, guint8 *ret, g p->fpregs [ainfo->reg / 2] = *(double*)&f; p->has_fpregs = 1; } else { - p->regs [slot] = *(mgreg_t*)arg; + p->regs [slot] = *(host_mgreg_t*)arg; } break; case MONO_TYPE_R8: @@ -3034,13 +3034,13 @@ mono_arch_start_dyn_call (MonoDynCallInfo *info, gpointer **args, guint8 *ret, g p->fpregs [ainfo->reg / 2] = *(double*)arg; p->has_fpregs = 1; } else { - p->regs [slot ++] = (mgreg_t)arg [0]; - p->regs [slot] = (mgreg_t)arg [1]; + p->regs [slot ++] = (host_mgreg_t)(gsize)arg [0]; + p->regs [slot] = (host_mgreg_t)(gsize)arg [1]; } break; case MONO_TYPE_GENERICINST: if (MONO_TYPE_IS_REFERENCE (t)) { - p->regs [slot] = (mgreg_t)*arg; + p->regs [slot] = (host_mgreg_t)(gsize)*arg; break; } else { if (t->type == MONO_TYPE_GENERICINST && mono_class_is_nullable (mono_class_from_mono_type (t))) { @@ -3070,7 +3070,7 @@ mono_arch_start_dyn_call (MonoDynCallInfo *info, gpointer **args, guint8 *ret, g slot = ainfo->reg; for (j = 0; j < ainfo->size + ainfo->vtsize; ++j) - p->regs [slot ++] = ((mgreg_t*)arg) [j]; + p->regs [slot ++] = ((host_mgreg_t*)arg) [j]; break; default: g_assert_not_reached (); @@ -3085,8 +3085,8 @@ mono_arch_finish_dyn_call (MonoDynCallInfo *info, guint8 *buf) DynCallArgs *p = (DynCallArgs*)buf; MonoType *ptype = ainfo->rtype; guint8 *ret = p->ret; - mgreg_t res = p->res; - mgreg_t res2 = p->res2; + host_mgreg_t res = p->res; + host_mgreg_t res2 = p->res2; switch (ptype->type) { case MONO_TYPE_VOID: @@ -3096,7 +3096,7 @@ mono_arch_finish_dyn_call (MonoDynCallInfo *info, guint8 *buf) case MONO_TYPE_I: case MONO_TYPE_U: case MONO_TYPE_PTR: - *(gpointer*)ret = (gpointer)res; + *(gpointer*)ret = (gpointer)(gsize)res; break; case MONO_TYPE_I1: *(gint8*)ret = res; @@ -3141,7 +3141,7 @@ mono_arch_finish_dyn_call (MonoDynCallInfo *info, guint8 *buf) *(float*)ret = *(float*)&res; break; case MONO_TYPE_R8: { - mgreg_t regs [2]; + host_mgreg_t regs [2]; g_assert (IS_VFP); if (IS_HARD_FLOAT) { @@ -3170,9 +3170,9 @@ mono_arch_instrument_prolog (MonoCompile *cfg, void *func, void *p, gboolean ena { guchar *code = (guchar*)p; - code = mono_arm_emit_load_imm (code, ARMREG_R0, (guint32)cfg->method); + code = mono_arm_emit_load_imm (code, ARMREG_R0, (guint32)(gsize)cfg->method); ARM_MOV_REG_IMM8 (code, ARMREG_R1, 0); /* NULL ebp for now */ - code = mono_arm_emit_load_imm (code, ARMREG_R2, (guint32)func); + code = mono_arm_emit_load_imm (code, ARMREG_R2, (guint32)(gsize)func); code = emit_call_reg (code, ARMREG_R2); return code; } @@ -3278,8 +3278,8 @@ mono_arch_instrument_epilog (MonoCompile *cfg, void *func, void *p, gboolean ena break; } - code = mono_arm_emit_load_imm (code, ARMREG_R0, (guint32)cfg->method); - code = mono_arm_emit_load_imm (code, ARMREG_IP, (guint32)func); + code = mono_arm_emit_load_imm (code, ARMREG_R0, (guint32)(gsize)cfg->method); + code = mono_arm_emit_load_imm (code, ARMREG_IP, (guint32)(gsize)func); code = emit_call_reg (code, ARMREG_IP); switch (save_mode) { @@ -3902,7 +3902,7 @@ emit_thunk (guint8 *code, gconstpointer target) ARM_BX (code, ARMREG_IP); else ARM_MOV_REG_REG (code, ARMREG_PC, ARMREG_IP); - *(guint32*)code = (guint32)target; + *(guint32*)code = (guint32)(gsize)target; code += 4; mono_arch_flush_icache (p, code - p); } @@ -3966,7 +3966,7 @@ handle_thunk (MonoCompile *cfg, MonoDomain *domain, guchar *code, const guchar * /* Free entry */ target_thunk = p; break; - } else if (((guint32*)p) [2] == (guint32)target) { + } else if (((guint32*)p) [2] == (guint32)(gsize)target) { /* Thunk already points to target */ target_thunk = p; break; @@ -4084,7 +4084,7 @@ arm_patch_general (MonoCompile *cfg, MonoDomain *domain, guchar *code, const guc g_assert (code32 [-4] == ccode [0]); g_assert (code32 [-3] == ccode [1]); g_assert (code32 [-1] == ccode [2]); - code32 [-2] = (guint32)target; + code32 [-2] = (guint32)(gsize)target; return; } /*patching from JIT*/ @@ -4092,7 +4092,7 @@ arm_patch_general (MonoCompile *cfg, MonoDomain *domain, guchar *code, const guc g_assert (code32 [1] == ccode [1]); g_assert (code32 [3] == ccode [2]); g_assert (code32 [4] == ccode [3]); - code32 [2] = (guint32)target; + code32 [2] = (guint32)(gsize)target; return; } g_assert_not_reached (); @@ -4113,7 +4113,7 @@ arm_patch_general (MonoCompile *cfg, MonoDomain *domain, guchar *code, const guc g_assert (code32 [-2] == ccode [1]); g_assert (code32 [0] == ccode [2]); - code32 [-1] = (guint32)target; + code32 [-1] = (guint32)(gsize)target; } else { guint32 ccode [4]; guint32 *tmp = ccode; @@ -4124,12 +4124,12 @@ arm_patch_general (MonoCompile *cfg, MonoDomain *domain, guchar *code, const guc ARM_BX (emit, ARMREG_IP); if (ins == ccode [2]) { g_assert_not_reached (); // should be -2 ... - code32 [-1] = (guint32)target; + code32 [-1] = (guint32)(gsize)target; return; } if (ins == ccode [0]) { /* handles both thunk jump code and the far call sequence */ - code32 [2] = (guint32)target; + code32 [2] = (guint32)(gsize)target; return; } g_assert_not_reached (); @@ -4779,7 +4779,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) } else { ARM_LDR_IMM (code, dreg, ARMREG_PC, 0); ARM_B (code, 0); - *(int*)code = (int)ss_trigger_page; + *(int*)code = (int)(gsize)ss_trigger_page; code += 4; } ARM_LDR_IMM (code, dreg, dreg, 0); @@ -5676,7 +5676,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) /* FIXME: we can optimize the imm load by dealing with part of * the displacement in LDFD (aligning to 512). */ - code = mono_arm_emit_load_imm (code, ARMREG_LR, (guint32)ins->inst_p0); + code = mono_arm_emit_load_imm (code, ARMREG_LR, (guint32)(gsize)ins->inst_p0); ARM_FLDD (code, ins->dreg, ARMREG_LR, 0); } break; @@ -5689,7 +5689,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) if (!cfg->r4fp) ARM_CVTS (code, ins->dreg, ins->dreg); } else { - code = mono_arm_emit_load_imm (code, ARMREG_LR, (guint32)ins->inst_p0); + code = mono_arm_emit_load_imm (code, ARMREG_LR, (guint32)(gsize)ins->inst_p0); ARM_FLDS (code, ins->dreg, ARMREG_LR, 0); if (!cfg->r4fp) ARM_CVTS (code, ins->dreg, ins->dreg); @@ -6188,8 +6188,8 @@ mono_arch_register_lowlevel_calls (void) #define patch_lis_ori(ip,val) do {\ guint16 *__lis_ori = (guint16*)(ip); \ - __lis_ori [1] = (((guint32)(val)) >> 16) & 0xffff; \ - __lis_ori [3] = ((guint32)(val)) & 0xffff; \ + __lis_ori [1] = (((guint32)(gsize)(val)) >> 16) & 0xffff; \ + __lis_ori [3] = ((guint32)(gsize)(val)) & 0xffff; \ } while (0) void @@ -6209,7 +6209,7 @@ mono_arch_patch_code_new (MonoCompile *cfg, MonoDomain *domain, guint8 *code, Mo * otherwise the displacements. */ for (i = 0; i < ji->data.table->table_size; i++) - jt [i] = code + (int)ji->data.table->table [i]; + jt [i] = code + (int)(gsize)ji->data.table->table [i]; break; } case MONO_PATCH_INFO_IP: @@ -7008,15 +7008,15 @@ mono_arch_flush_register_windows (void) } MonoMethod* -mono_arch_find_imt_method (mgreg_t *regs, guint8 *code) +mono_arch_find_imt_method (host_mgreg_t *regs, guint8 *code) { return (MonoMethod*)regs [MONO_ARCH_IMT_REG]; } MonoVTable* -mono_arch_find_static_call_vtable (mgreg_t *regs, guint8 *code) +mono_arch_find_static_call_vtable (host_mgreg_t *regs, guint8 *code) { - return (MonoVTable*) regs [MONO_ARCH_RGCTX_REG]; + return (MonoVTable*)(gsize)regs [MONO_ARCH_RGCTX_REG]; } GSList* @@ -7036,7 +7036,7 @@ mono_arch_get_cie_program (void) #define BRANCH_SIZE (1 * 4) #define CALL_SIZE (2 * 4) #define WMC_SIZE (8 * 4) -#define DISTANCE(A, B) (((gint32)(B)) - ((gint32)(A))) +#define DISTANCE(A, B) (((gint32)(gssize)(B)) - ((gint32)(gssize)(A))) static arminstr_t * arm_emit_value_and_patch_ldr (arminstr_t *code, arminstr_t *target, guint32 value) @@ -7128,10 +7128,10 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC if (large_offsets) { ARM_PUSH4 (code, ARMREG_R0, ARMREG_R1, ARMREG_IP, ARMREG_PC); - mono_add_unwind_op_def_cfa_offset (unwind_ops, code, start, 4 * sizeof (mgreg_t)); + mono_add_unwind_op_def_cfa_offset (unwind_ops, code, start, 4 * sizeof (host_mgreg_t)); } else { ARM_PUSH2 (code, ARMREG_R0, ARMREG_R1); - mono_add_unwind_op_def_cfa_offset (unwind_ops, code, start, 2 * sizeof (mgreg_t)); + mono_add_unwind_op_def_cfa_offset (unwind_ops, code, start, 2 * sizeof (host_mgreg_t)); } ARM_LDR_IMM (code, ARMREG_R0, ARMREG_LR, -4); vtable_target = code; @@ -7209,8 +7209,8 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC } else { ARM_POP2 (code, ARMREG_R0, ARMREG_R1); if (large_offsets) { - mono_add_unwind_op_def_cfa_offset (unwind_ops, code, start, 2 * sizeof (mgreg_t)); - ARM_ADD_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, 2 * sizeof (target_mgreg_t)); + mono_add_unwind_op_def_cfa_offset (unwind_ops, code, start, 2 * sizeof (host_mgreg_t)); + ARM_ADD_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, 2 * sizeof (host_mgreg_t)); } mono_add_unwind_op_def_cfa_offset (unwind_ops, code, start, 0); ARM_LDR_IMM (code, ARMREG_PC, ARMREG_IP, vtable_offset); @@ -7224,7 +7224,7 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC /* Load target address */ ARM_LDR_IMM (code, ARMREG_R1, ARMREG_PC, 0); /* Save it to the fourth slot */ - ARM_STR_IMM (code, ARMREG_R1, ARMREG_SP, 3 * sizeof (target_mgreg_t)); + ARM_STR_IMM (code, ARMREG_R1, ARMREG_SP, 3 * sizeof (host_mgreg_t)); /* Restore registers and branch */ ARM_POP4 (code, ARMREG_R0, ARMREG_R1, ARMREG_IP, ARMREG_PC); @@ -7233,11 +7233,11 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC } if (imt_method) - code = arm_emit_value_and_patch_ldr (code, imt_method, (guint32)item->key); + code = arm_emit_value_and_patch_ldr (code, imt_method, (guint32)(gsize)item->key); /*must emit after unconditional branch*/ if (vtable_target) { - code = arm_emit_value_and_patch_ldr (code, vtable_target, (guint32)vtable); + code = arm_emit_value_and_patch_ldr (code, vtable_target, (guint32)(gsize)vtable); item->chunk_size += 4; vtable_target = NULL; } @@ -7268,7 +7268,7 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC int j; arminstr_t *space_start = constant_pool_starts [i]; for (j = i - 1; j >= 0 && !imt_entries [j]->is_equals; --j) { - space_start = arm_emit_value_and_patch_ldr (space_start, (arminstr_t*)imt_entries [j]->code_target, (guint32)imt_entries [j]->key); + space_start = arm_emit_value_and_patch_ldr (space_start, (arminstr_t*)imt_entries [j]->code_target, (guint32)(gsize)imt_entries [j]->key); } } } @@ -7294,14 +7294,14 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC return start; } -mgreg_t +host_mgreg_t mono_arch_context_get_int_reg (MonoContext *ctx, int reg) { return ctx->regs [reg]; } void -mono_arch_context_set_int_reg (MonoContext *ctx, int reg, mgreg_t val) +mono_arch_context_set_int_reg (MonoContext *ctx, int reg, host_mgreg_t val) { ctx->regs [reg] = val; } @@ -7351,7 +7351,7 @@ mono_arch_set_breakpoint (MonoJitInfo *ji, guint8 *ip) /* Read from another trigger page */ ARM_LDR_IMM (code, dreg, ARMREG_PC, 0); ARM_B (code, 0); - *(int*)code = (int)bp_trigger_page; + *(int*)code = (int)(gssize)bp_trigger_page; code += 4; ARM_LDR_IMM (code, dreg, dreg, 0); diff --git a/mono/mini/mini-arm.h b/mono/mini/mini-arm.h index e851d6d11b5..74428799858 100644 --- a/mono/mini/mini-arm.h +++ b/mono/mini/mini-arm.h @@ -228,7 +228,7 @@ struct CallInfo { typedef struct { /* General registers */ - mgreg_t gregs [PARAM_REGS]; + host_mgreg_t gregs [PARAM_REGS]; /* Floating registers */ float fregs [FP_PARAM_REGS * 2]; /* Stack usage, used for passing params on stack */ @@ -246,12 +246,12 @@ struct SeqPointInfo { typedef struct { double fpregs [FP_PARAM_REGS]; - mgreg_t res, res2; + host_mgreg_t res, res2; guint8 *ret; guint32 has_fpregs; guint32 n_stackargs; /* This should come last as the structure is dynamically extended */ - mgreg_t regs [PARAM_REGS]; + host_mgreg_t regs [PARAM_REGS]; } DynCallArgs; void arm_patch (guchar *code, const guchar *target); @@ -259,7 +259,7 @@ guint8* mono_arm_emit_load_imm (guint8 *code, int dreg, guint32 val); int mono_arm_is_rotated_imm8 (guint32 val, gint *rot_amount); void -mono_arm_throw_exception_by_token (guint32 type_token, mgreg_t pc, mgreg_t sp, mgreg_t *int_regs, gdouble *fp_regs); +mono_arm_throw_exception_by_token (guint32 type_token, host_mgreg_t pc, host_mgreg_t sp, host_mgreg_t *int_regs, gdouble *fp_regs); gpointer mono_arm_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpointer *callee, gpointer mrgctx_reg, double *caller_fregs, double *callee_fregs); @@ -280,9 +280,9 @@ struct MonoLMF { gpointer lmf_addr; /* This is only set in trampoline LMF frames */ MonoMethod *method; - mgreg_t sp; - mgreg_t ip; - mgreg_t fp; + host_mgreg_t sp; + host_mgreg_t ip; + host_mgreg_t fp; /* Currently only used in trampolines on armhf to hold d0-d15. We don't really * need to put d0-d7 in the LMF, but it simplifies the trampoline code. */ @@ -291,7 +291,7 @@ struct MonoLMF { * 0-4 should be considered undefined (execpt in the magic tramp) * sp is saved at IP. */ - mgreg_t iregs [14]; + host_mgreg_t iregs [14]; }; typedef struct MonoCompileArch { @@ -397,13 +397,13 @@ typedef struct MonoCompileArch { #define MONO_ARCH_INIT_TOP_LMF_ENTRY(lmf) void -mono_arm_throw_exception (MonoObject *exc, mgreg_t pc, mgreg_t sp, mgreg_t *int_regs, gdouble *fp_regs, gboolean preserve_ips); +mono_arm_throw_exception (MonoObject *exc, host_mgreg_t pc, host_mgreg_t sp, host_mgreg_t *int_regs, gdouble *fp_regs, gboolean preserve_ips); void -mono_arm_throw_exception_by_token (guint32 type_token, mgreg_t pc, mgreg_t sp, mgreg_t *int_regs, gdouble *fp_regs); +mono_arm_throw_exception_by_token (guint32 type_token, host_mgreg_t pc, host_mgreg_t sp, host_mgreg_t *int_regs, gdouble *fp_regs); void -mono_arm_resume_unwind (guint32 dummy1, mgreg_t pc, mgreg_t sp, mgreg_t *int_regs, gdouble *fp_regs); +mono_arm_resume_unwind (guint32 dummy1, host_mgreg_t pc, host_mgreg_t sp, host_mgreg_t *int_regs, gdouble *fp_regs); gboolean mono_arm_thumb_supported (void); diff --git a/mono/mini/mini-arm64.c b/mono/mini/mini-arm64.c index 1ac54f8a0f6..a369e4fbbee 100644 --- a/mono/mini/mini-arm64.c +++ b/mono/mini/mini-arm64.c @@ -223,7 +223,7 @@ mono_arch_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod } gpointer -mono_arch_get_this_arg_from_call (mgreg_t *regs, guint8 *code) +mono_arch_get_this_arg_from_call (host_mgreg_t *regs, guint8 *code) { return (gpointer)regs [ARMREG_R0]; } @@ -1022,25 +1022,25 @@ mono_arch_flush_register_windows (void) } MonoMethod* -mono_arch_find_imt_method (mgreg_t *regs, guint8 *code) +mono_arch_find_imt_method (host_mgreg_t *regs, guint8 *code) { return (MonoMethod*)regs [MONO_ARCH_RGCTX_REG]; } MonoVTable* -mono_arch_find_static_call_vtable (mgreg_t *regs, guint8 *code) +mono_arch_find_static_call_vtable (host_mgreg_t *regs, guint8 *code) { return (MonoVTable*)regs [MONO_ARCH_RGCTX_REG]; } -mgreg_t +host_mgreg_t mono_arch_context_get_int_reg (MonoContext *ctx, int reg) { return ctx->regs [reg]; } void -mono_arch_context_set_int_reg (MonoContext *ctx, int reg, mgreg_t val) +mono_arch_context_set_int_reg (MonoContext *ctx, int reg, host_mgreg_t val) { ctx->regs [reg] = val; } @@ -1453,7 +1453,7 @@ mono_arch_set_native_call_context_args (CallContext *ccontext, gpointer frame, M ainfo = &cinfo->ret; if (ainfo->storage == ArgVtypeByRef) { storage = interp_cb->frame_arg_to_storage ((MonoInterpFrameHandle)frame, sig, -1); - ccontext->gregs [cinfo->ret.reg] = (mgreg_t)storage; + ccontext->gregs [cinfo->ret.reg] = (gsize)storage; } } @@ -5544,4 +5544,3 @@ mono_arch_get_call_info (MonoMemPool *mp, MonoMethodSignature *sig) { return get_call_info (mp, sig); } - diff --git a/mono/mini/mini-arm64.h b/mono/mini/mini-arm64.h index f1c7c2e52a4..ca09c157c43 100644 --- a/mono/mini/mini-arm64.h +++ b/mono/mini/mini-arm64.h @@ -73,8 +73,8 @@ struct MonoLMF { */ gpointer previous_lmf; gpointer lmf_addr; - mgreg_t pc; - mgreg_t gregs [MONO_ARCH_NUM_LMF_REGS]; + host_mgreg_t pc; + host_mgreg_t gregs [MONO_ARCH_NUM_LMF_REGS]; }; /* Structure used by the sequence points in AOTed code */ @@ -233,7 +233,7 @@ struct CallInfo { typedef struct { /* General registers + ARMREG_R8 for indirect returns */ - mgreg_t gregs [PARAM_REGS + 1]; + host_mgreg_t gregs [PARAM_REGS + 1]; /* Floating registers */ double fregs [FP_PARAM_REGS]; /* Stack usage, used for passing params on stack */ @@ -258,13 +258,13 @@ guint8* mono_arm_emit_aotconst (gpointer ji, guint8 *code, guint8 *code_start, i void mono_arm_patch (guint8 *code, guint8 *target, int relocation); -void mono_arm_throw_exception (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble *fp_regs, gboolean corlib, gboolean rethrow, gboolean preserve_ips); +void mono_arm_throw_exception (gpointer arg, host_mgreg_t pc, host_mgreg_t *int_regs, gdouble *fp_regs, gboolean corlib, gboolean rethrow, gboolean preserve_ips); void mono_arm_gsharedvt_init (void); GSList* mono_arm_get_exception_trampolines (gboolean aot); -void mono_arm_resume_unwind (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble *fp_regs, gboolean corlib, gboolean rethrow); +void mono_arm_resume_unwind (gpointer arg, host_mgreg_t pc, host_mgreg_t *int_regs, gdouble *fp_regs, gboolean corlib, gboolean rethrow); CallInfo* mono_arch_get_call_info (MonoMemPool *mp, MonoMethodSignature *sig); diff --git a/mono/mini/mini-exceptions.c b/mono/mini/mini-exceptions.c index 8dc5816d792..fcd1cf8bd20 100644 --- a/mono/mini/mini-exceptions.c +++ b/mono/mini/mini-exceptions.c @@ -407,7 +407,7 @@ static gboolean arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *ji, MonoContext *ctx, MonoContext *new_ctx, MonoLMF **lmf, - mgreg_t **save_locations, + host_mgreg_t **save_locations, StackFrameInfo *frame) { if (!ji && *lmf) { @@ -606,7 +606,7 @@ gboolean mono_find_jit_info_ext (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *prev_ji, MonoContext *ctx, MonoContext *new_ctx, char **trace, MonoLMF **lmf, - mgreg_t **save_locations, + host_mgreg_t **save_locations, StackFrameInfo *frame) { gboolean err; @@ -629,7 +629,7 @@ mono_find_jit_info_ext (MonoDomain *domain, MonoJitTlsData *jit_tls, target_domain = domain; if (save_locations) - memset (save_locations, 0, MONO_MAX_IREGS * sizeof (mgreg_t*)); + memset (save_locations, 0, MONO_MAX_IREGS * sizeof (host_mgreg_t*)); err = arch_unwind_frame (target_domain, jit_tls, ji, ctx, new_ctx, lmf, save_locations, frame); if (!err) @@ -723,7 +723,7 @@ unwinder_unwind_frame (Unwinder *unwinder, MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *prev_ji, MonoContext *ctx, MonoContext *new_ctx, char **trace, MonoLMF **lmf, - mgreg_t **save_locations, + host_mgreg_t **save_locations, StackFrameInfo *frame) { gpointer parent; @@ -788,7 +788,7 @@ get_generic_info_from_stack_frame (MonoJitInfo *ji, MonoContext *ctx) * its prolog. */ if (gi->nlocs) { - int offset = (mgreg_t)MONO_CONTEXT_GET_IP (ctx) - (mgreg_t)ji->code_start; + int offset = (gsize)MONO_CONTEXT_GET_IP (ctx) - (gsize)ji->code_start; int i; for (i = 0; i < gi->nlocs; ++i) { @@ -1178,8 +1178,8 @@ mono_walk_stack_full (MonoJitStackWalk func, MonoContext *start_ctx, MonoDomain MonoContext ctx, new_ctx; StackFrameInfo frame; gboolean res; - mgreg_t *reg_locations [MONO_MAX_IREGS]; - mgreg_t *new_reg_locations [MONO_MAX_IREGS]; + host_mgreg_t *reg_locations [MONO_MAX_IREGS]; + host_mgreg_t *new_reg_locations [MONO_MAX_IREGS]; gboolean get_reg_locations = unwind_options & MONO_UNWIND_REG_LOCATIONS; gboolean async = mono_thread_info_is_async_context (); Unwinder unwinder; diff --git a/mono/mini/mini-gc.c b/mono/mini/mini-gc.c index 42f3007c1ee..a1091e7db96 100644 --- a/mono/mini/mini-gc.c +++ b/mono/mini/mini-gc.c @@ -698,7 +698,7 @@ slot_type_to_string (GCSlotType type) } } -static inline mgreg_t +static inline host_mgreg_t get_frame_pointer (MonoContext *ctx, int frame_reg) { #if defined(TARGET_AMD64) @@ -713,14 +713,14 @@ get_frame_pointer (MonoContext *ctx, int frame_reg) return ctx->ebp; #elif defined(TARGET_ARM) if (frame_reg == ARMREG_SP) - return (mgreg_t)MONO_CONTEXT_GET_SP (ctx); + return (host_mgreg_t)MONO_CONTEXT_GET_SP (ctx); else if (frame_reg == ARMREG_FP) - return (mgreg_t)MONO_CONTEXT_GET_BP (ctx); + return (host_mgreg_t)MONO_CONTEXT_GET_BP (ctx); #elif defined(TARGET_S390X) if (frame_reg == S390_SP) - return (mgreg_t)MONO_CONTEXT_GET_SP (ctx); + return (host_mgreg_t)MONO_CONTEXT_GET_SP (ctx); else if (frame_reg == S390_FP) - return (mgreg_t)MONO_CONTEXT_GET_BP (ctx); + return (host_mgreg_t)MONO_CONTEXT_GET_BP (ctx); #endif g_assert_not_reached (); return 0; @@ -748,8 +748,8 @@ conservative_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end) int scanned = 0, scanned_precisely, scanned_conservatively, scanned_registers; gboolean res; StackFrameInfo frame; - mgreg_t *reg_locations [MONO_MAX_IREGS]; - mgreg_t *new_reg_locations [MONO_MAX_IREGS]; + host_mgreg_t *reg_locations [MONO_MAX_IREGS]; + host_mgreg_t *new_reg_locations [MONO_MAX_IREGS]; guint8 *bitmaps; FrameInfo *fi; guint32 precise_regmask; @@ -814,7 +814,7 @@ conservative_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end) } } - g_assert ((mgreg_t)stack_limit % SIZEOF_SLOT == 0); + g_assert ((gsize)stack_limit % SIZEOF_SLOT == 0); res = mono_find_jit_info_ext (frame.domain ? frame.domain : tls->unwind_state.unwind_data [MONO_UNWIND_DATA_DOMAIN], tls->unwind_state.unwind_data [MONO_UNWIND_DATA_JIT_TLS], NULL, &ctx, &new_ctx, NULL, &lmf, new_reg_locations, &frame); if (!res) @@ -919,7 +919,7 @@ conservative_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end) } /* The embedded callsite table requires this */ - g_assert (((mgreg_t)emap % 4) == 0); + g_assert (((gsize)emap % 4) == 0); /* * Debugging aid to control the number of frames scanned precisely @@ -1231,10 +1231,10 @@ precise_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end, void *gc_dat * Debugging aid to check for missed refs. */ if (tls->ref_to_track) { - mgreg_t *p; + gpointer *p; - for (p = (mgreg_t*)stack_start; p < (mgreg_t*)stack_end; ++p) - if (*p == (mgreg_t)tls->ref_to_track) + for (p = (gpointer*)stack_start; p < (gpointer*)stack_end; ++p) + if (*p == tls->ref_to_track) printf ("REF AT %p.\n", p); } } @@ -2418,7 +2418,7 @@ create_map (MonoCompile *cfg) p += encoded_size; /* Callsite table */ - p = (guint8*)ALIGN_TO ((mgreg_t)p, map->callsite_entry_size); + p = (guint8*)ALIGN_TO ((gsize)p, map->callsite_entry_size); if (map->callsite_entry_size == 1) { guint8 *offsets = p; for (i = 0; i < ncallsites; ++i) diff --git a/mono/mini/mini-mips.c b/mono/mini/mini-mips.c index 3e321d0017d..0d63d8e20fd 100644 --- a/mono/mini/mini-mips.c +++ b/mono/mini/mini-mips.c @@ -655,7 +655,7 @@ mono_arch_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod } gpointer -mono_arch_get_this_arg_from_call (mgreg_t *regs, guint8 *code) +mono_arch_get_this_arg_from_call (host_mgreg_t *regs, guint8 *code) { g_assert(regs); return (gpointer)regs [mips_a0]; @@ -5525,7 +5525,7 @@ mono_arch_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMetho return NULL; } -mgreg_t +host_mgreg_t mono_arch_context_get_int_reg (MonoContext *ctx, int reg) { return ctx->sc_regs [reg]; @@ -5684,13 +5684,13 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC } MonoMethod* -mono_arch_find_imt_method (mgreg_t *regs, guint8 *code) +mono_arch_find_imt_method (host_mgreg_t *regs, guint8 *code) { return (MonoMethod*) regs [MONO_ARCH_IMT_REG]; } MonoVTable* -mono_arch_find_static_call_vtable (mgreg_t *regs, guint8 *code) +mono_arch_find_static_call_vtable (host_mgreg_t *regs, guint8 *code) { return (MonoVTable*) regs [MONO_ARCH_RGCTX_REG]; } diff --git a/mono/mini/mini-mips.h b/mono/mini/mini-mips.h index 8c15a494441..007c6370095 100644 --- a/mono/mini/mini-mips.h +++ b/mono/mini/mini-mips.h @@ -210,7 +210,7 @@ struct MonoLMF { gpointer lmf_addr; MonoMethod *method; gpointer eip; - mgreg_t iregs [MONO_SAVED_GREGS]; + host_mgreg_t iregs [MONO_SAVED_GREGS]; mips_freg fregs [MONO_SAVED_FREGS]; gulong magic; }; diff --git a/mono/mini/mini-ppc.c b/mono/mini/mini-ppc.c index d65f2874e96..758ebb06049 100644 --- a/mono/mini/mini-ppc.c +++ b/mono/mini/mini-ppc.c @@ -468,10 +468,8 @@ mono_arch_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod } gpointer -mono_arch_get_this_arg_from_call (mgreg_t *regs, guint8 *code) +mono_arch_get_this_arg_from_call (host_mgreg_t *r, guint8 *code) { - mgreg_t *r = (mgreg_t*)regs; - return (gpointer)(gsize)r [ppc_r3]; } @@ -5737,19 +5735,17 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC } MonoMethod* -mono_arch_find_imt_method (mgreg_t *regs, guint8 *code) +mono_arch_find_imt_method (host_mgreg_t *regs, guint8 *code) { - mgreg_t *r = (mgreg_t*)regs; + host_mgreg_t *r = (host_mgreg_t*)regs; return (MonoMethod*)(gsize) r [MONO_ARCH_IMT_REG]; } MonoVTable* -mono_arch_find_static_call_vtable (mgreg_t *regs, guint8 *code) +mono_arch_find_static_call_vtable (host_mgreg_t *regs, guint8 *code) { - mgreg_t *r = (mgreg_t*)regs; - - return (MonoVTable*)(gsize) r [MONO_ARCH_RGCTX_REG]; + return (MonoVTable*)(gsize) regs [MONO_ARCH_RGCTX_REG]; } GSList* @@ -5769,11 +5765,11 @@ mono_arch_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMetho return NULL; } -mgreg_t +host_mgreg_t mono_arch_context_get_int_reg (MonoContext *ctx, int reg) { if (reg == ppc_r1) - return (mgreg_t)MONO_CONTEXT_GET_SP (ctx); + return (mgreg_t)(gsize)MONO_CONTEXT_GET_SP (ctx); return ctx->regs [reg]; } diff --git a/mono/mini/mini-ppc.h b/mono/mini/mini-ppc.h index 47de3b525c8..802ddc66a10 100644 --- a/mono/mini/mini-ppc.h +++ b/mono/mini/mini-ppc.h @@ -52,7 +52,7 @@ struct MonoLMF { gulong eip; /* Add a dummy field to force iregs to be aligned when cross compiling from x86 */ gulong dummy; - mgreg_t iregs [MONO_SAVED_GREGS]; /* 13..31 */ + host_mgreg_t iregs [MONO_SAVED_GREGS]; /* 13..31 */ gdouble fregs [MONO_SAVED_FREGS]; /* 14..31 */ }; @@ -384,7 +384,7 @@ void mono_ppc_patch (guchar *code, const guchar *target); void -mono_ppc_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, mgreg_t *int_regs, gdouble *fp_regs, gboolean rethrow, gboolean preserve_ips); +mono_ppc_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, host_mgreg_t *int_regs, gdouble *fp_regs, gboolean rethrow, gboolean preserve_ips); #ifdef __mono_ppc64__ #define MONO_PPC_32_64_CASE(c32,c64) c64 diff --git a/mono/mini/mini-profiler.c b/mono/mini/mini-profiler.c index 319bbcce982..eb67e817cc4 100644 --- a/mono/mini/mini-profiler.c +++ b/mono/mini/mini-profiler.c @@ -179,7 +179,7 @@ memdup_with_type (gpointer data, MonoType *t) static guint8 * get_int_reg (MonoContext *ctx, guint32 reg) { - return (guint8 *) mono_arch_context_get_int_reg (ctx, reg); + return (guint8 *)(gsize)mono_arch_context_get_int_reg (ctx, reg); } static gpointer @@ -193,9 +193,9 @@ get_variable_buffer (MonoDebugMethodJitInfo *jit, MonoDebugVarInfo *var, MonoCon /* * This is kind of a special case: All other address modes ultimately * produce an address to where the actual value is located, but this - * address mode gets us the value itself as an mgreg_t value. + * address mode gets us the value itself as an host_mgreg_t value. */ - mgreg_t value = (mgreg_t) get_int_reg (ctx, reg); + host_mgreg_t value = (host_mgreg_t) get_int_reg (ctx, reg); return memdup_with_type (&value, var->type); } diff --git a/mono/mini/mini-runtime.c b/mono/mini/mini-runtime.c index 51b7dc1913a..a863f426e84 100644 --- a/mono/mini/mini-runtime.c +++ b/mono/mini/mini-runtime.c @@ -1639,7 +1639,7 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, mono_gc_get_nursery (&shift_bits, &size); - target = (gpointer)(mgreg_t)shift_bits; + target = (gpointer)(gssize)shift_bits; break; } case MONO_PATCH_INFO_CASTCLASS_CACHE: { diff --git a/mono/mini/mini-s390x.c b/mono/mini/mini-s390x.c index 962a6e0999e..311e8006dbf 100644 --- a/mono/mini/mini-s390x.c +++ b/mono/mini/mini-s390x.c @@ -6871,10 +6871,10 @@ mono_arch_get_patch_offset (guint8 *code) /* */ /*------------------------------------------------------------------*/ -mgreg_t +host_mgreg_t mono_arch_context_get_int_reg (MonoContext *ctx, int reg) { - return ((mgreg_t) ctx->uc_mcontext.gregs[reg]); + return ctx->uc_mcontext.gregs[reg]; } /*========================= End of Function ========================*/ @@ -6888,7 +6888,7 @@ mono_arch_context_get_int_reg (MonoContext *ctx, int reg) /*------------------------------------------------------------------*/ void -mono_arch_context_set_int_reg (MonoContext *ctx, int reg, mgreg_t val) +mono_arch_context_set_int_reg (MonoContext *ctx, int reg, host_mgreg_t val) { ctx->uc_mcontext.gregs[reg] = val; } @@ -6904,7 +6904,7 @@ mono_arch_context_set_int_reg (MonoContext *ctx, int reg, mgreg_t val) /*------------------------------------------------------------------*/ gpointer -mono_arch_get_this_arg_from_call (mgreg_t *regs, guint8 *code) +mono_arch_get_this_arg_from_call (host_mgreg_t *regs, guint8 *code) { return (gpointer) regs [s390_r2]; } @@ -7268,7 +7268,7 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, /*------------------------------------------------------------------*/ MonoMethod* -mono_arch_find_imt_method (mgreg_t *regs, guint8 *code) +mono_arch_find_imt_method (host_mgreg_t *regs, guint8 *code) { return ((MonoMethod *) regs [MONO_ARCH_IMT_REG]); } @@ -7284,11 +7284,9 @@ mono_arch_find_imt_method (mgreg_t *regs, guint8 *code) /*------------------------------------------------------------------*/ MonoVTable* -mono_arch_find_static_call_vtable (mgreg_t *regs, guint8 *code) +mono_arch_find_static_call_vtable (host_mgreg_t *regs, guint8 *code) { - mgreg_t *r = (mgreg_t*)regs; - - return (MonoVTable*)(gsize) r [MONO_ARCH_RGCTX_REG]; + return (MonoVTable*)(gsize) regs [MONO_ARCH_RGCTX_REG]; } /*========================= End of Function ========================*/ diff --git a/mono/mini/mini-sparc.c b/mono/mini/mini-sparc.c index b1ddd698daf..03390c17cc4 100644 --- a/mono/mini/mini-sparc.c +++ b/mono/mini/mini-sparc.c @@ -2368,7 +2368,7 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC } MonoMethod* -mono_arch_find_imt_method (mgreg_t *regs, guint8 *code) +mono_arch_find_imt_method (host_mgreg_t *regs, guint8 *code) { #ifdef SPARCV9 g_assert_not_reached (); @@ -2378,7 +2378,7 @@ mono_arch_find_imt_method (mgreg_t *regs, guint8 *code) } gpointer -mono_arch_get_this_arg_from_call (mgreg_t *regs, guint8 *code) +mono_arch_get_this_arg_from_call (host_mgreg_t *regs, guint8 *code) { mono_sparc_flushw (); @@ -4391,7 +4391,7 @@ mono_arch_get_argument_info (MonoMethodSignature *csig, int param_count, MonoJit return 0; } -mgreg_t +host_mgreg_t mono_arch_context_get_int_reg (MonoContext *ctx, int reg) { /* FIXME: implement */ diff --git a/mono/mini/mini-trampolines.c b/mono/mini/mini-trampolines.c index 1b80aafd28c..5fa39151ce7 100644 --- a/mono/mini/mini-trampolines.c +++ b/mono/mini/mini-trampolines.c @@ -538,7 +538,7 @@ mini_add_method_wrappers_llvmonly (MonoMethod *m, gpointer compiled_method, gboo * from JITted and LLVM compiled code. */ static gpointer -common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *vt, gpointer *vtable_slot, MonoError *error) +common_call_trampoline (host_mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *vt, gpointer *vtable_slot, MonoError *error) { gpointer addr, compiled_method; gboolean generic_shared = FALSE; @@ -877,7 +877,7 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable * * This trampoline handles normal calls from JITted code. */ gpointer -mono_magic_trampoline (mgreg_t *regs, guint8 *code, gpointer arg, guint8* tramp) +mono_magic_trampoline (host_mgreg_t *regs, guint8 *code, gpointer arg, guint8* tramp) { gpointer res; ERROR_DECL (error); @@ -904,7 +904,7 @@ mono_magic_trampoline (mgreg_t *regs, guint8 *code, gpointer arg, guint8* tramp) * This trampoline handles virtual calls. */ static gpointer -mono_vcall_trampoline (mgreg_t *regs, guint8 *code, int slot, guint8 *tramp) +mono_vcall_trampoline (host_mgreg_t *regs, guint8 *code, int slot, guint8 *tramp) { gpointer res; MONO_ENTER_GC_UNSAFE; @@ -983,7 +983,7 @@ leave: #ifndef DISABLE_REMOTING gpointer -mono_generic_virtual_remoting_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, guint8 *tramp) +mono_generic_virtual_remoting_trampoline (host_mgreg_t *regs, guint8 *code, MonoMethod *m, guint8 *tramp) { MONO_REQ_GC_UNSAFE_MODE; @@ -1036,7 +1036,7 @@ mono_generic_virtual_remoting_trampoline (mgreg_t *regs, guint8 *code, MonoMetho */ #ifdef MONO_ARCH_AOT_SUPPORTED gpointer -mono_aot_trampoline (mgreg_t *regs, guint8 *code, guint8 *token_info, +mono_aot_trampoline (host_mgreg_t *regs, guint8 *code, guint8 *token_info, guint8* tramp) { MONO_REQ_GC_UNSAFE_MODE; @@ -1083,7 +1083,7 @@ mono_aot_trampoline (mgreg_t *regs, guint8 *code, guint8 *token_info, * This trampoline handles calls made from AOT code through the PLT table. */ gpointer -mono_aot_plt_trampoline (mgreg_t *regs, guint8 *code, guint8 *aot_module, +mono_aot_plt_trampoline (host_mgreg_t *regs, guint8 *code, guint8 *aot_module, guint8* tramp) { MONO_REQ_GC_UNSAFE_MODE; @@ -1109,13 +1109,12 @@ mono_aot_plt_trampoline (mgreg_t *regs, guint8 *code, guint8 *aot_module, #endif static gpointer -mono_rgctx_lazy_fetch_trampoline (mgreg_t *regs, guint8 *code, gpointer data, guint8 *tramp) +mono_rgctx_lazy_fetch_trampoline (host_mgreg_t *regs, guint8 *code, gpointer data, guint8 *tramp) { MONO_REQ_GC_UNSAFE_MODE; guint32 slot = GPOINTER_TO_UINT (data); - mgreg_t *r = (mgreg_t*)regs; - gpointer arg = (gpointer)(gssize)r [MONO_ARCH_VTABLE_REG]; + gpointer arg = (gpointer)(gssize)regs [MONO_ARCH_VTABLE_REG]; guint32 index = MONO_RGCTX_SLOT_INDEX (slot); gboolean mrgctx = MONO_RGCTX_SLOT_IS_MRGCTX (slot); ERROR_DECL (error); @@ -1142,7 +1141,7 @@ mono_rgctx_lazy_fetch_trampoline (mgreg_t *regs, guint8 *code, gpointer data, gu * This is called once the first time a delegate is invoked, so it must be fast. */ gpointer -mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tramp) +mono_delegate_trampoline (host_mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tramp) { MONO_REQ_GC_UNSAFE_MODE; diff --git a/mono/mini/mini-unwind.h b/mono/mini/mini-unwind.h index cdcebec8214..02ad7626d99 100644 --- a/mono/mini/mini-unwind.h +++ b/mono/mini/mini-unwind.h @@ -13,9 +13,9 @@ #include "mini.h" -/* This is the same as mgreg_t, except on 32 bit bit platforms with callee saved fp regs */ +/* This is the same as host_mgreg_t, except on 32 bit bit platforms with callee saved fp regs */ #ifndef mono_unwind_reg_t -#define mono_unwind_reg_t mgreg_t +#define mono_unwind_reg_t host_mgreg_t #endif /* @@ -181,7 +181,7 @@ void mono_unwind_frame (guint8 *unwind_info, guint32 unwind_info_len, guint8 *start_ip, guint8 *end_ip, guint8 *ip, guint8 **mark_locations, mono_unwind_reg_t *regs, int nregs, - mgreg_t **save_locations, int save_locations_len, + host_mgreg_t **save_locations, int save_locations_len, guint8 **out_cfa); void mono_unwind_init (void); diff --git a/mono/mini/mini-wasm.c b/mono/mini/mini-wasm.c index 66543f59738..ce10c793957 100644 --- a/mono/mini/mini-wasm.c +++ b/mono/mini/mini-wasm.c @@ -395,7 +395,7 @@ G_END_DECLS #endif // HOST_WASM gpointer -mono_arch_get_this_arg_from_call (mgreg_t *regs, guint8 *code) +mono_arch_get_this_arg_from_call (host_mgreg_t *regs, guint8 *code) { g_error ("mono_arch_get_this_arg_from_call"); } @@ -447,14 +447,14 @@ mono_arch_free_jit_tls_data (MonoJitTlsData *tls) MonoMethod* -mono_arch_find_imt_method (mgreg_t *regs, guint8 *code) +mono_arch_find_imt_method (host_mgreg_t *regs, guint8 *code) { g_error ("mono_arch_find_static_call_vtable"); return (MonoMethod*) regs [MONO_ARCH_IMT_REG]; } MonoVTable* -mono_arch_find_static_call_vtable (mgreg_t *regs, guint8 *code) +mono_arch_find_static_call_vtable (host_mgreg_t *regs, guint8 *code) { g_error ("mono_arch_find_static_call_vtable"); return (MonoVTable*) regs [MONO_ARCH_RGCTX_REG]; @@ -480,7 +480,7 @@ mono_arch_cpu_optimizations (guint32 *exclude_mask) return 0; } -mgreg_t +host_mgreg_t mono_arch_context_get_int_reg (MonoContext *ctx, int reg) { g_error ("mono_arch_context_get_int_reg"); diff --git a/mono/mini/mini-x86.c b/mono/mini/mini-x86.c index e1fcfc49b3e..0a1719d62be 100644 --- a/mono/mini/mini-x86.c +++ b/mono/mini/mini-x86.c @@ -5759,13 +5759,13 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC } MonoMethod* -mono_arch_find_imt_method (mgreg_t *regs, guint8 *code) +mono_arch_find_imt_method (host_mgreg_t *regs, guint8 *code) { return (MonoMethod*) regs [MONO_ARCH_IMT_REG]; } MonoVTable* -mono_arch_find_static_call_vtable (mgreg_t *regs, guint8 *code) +mono_arch_find_static_call_vtable (host_mgreg_t *regs, guint8 *code) { return (MonoVTable*) regs [MONO_ARCH_RGCTX_REG]; } @@ -6168,7 +6168,7 @@ mono_arch_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod return code; } -mgreg_t +host_mgreg_t mono_arch_context_get_int_reg (MonoContext *ctx, int reg) { switch (reg) { @@ -6187,7 +6187,7 @@ mono_arch_context_get_int_reg (MonoContext *ctx, int reg) } void -mono_arch_context_set_int_reg (MonoContext *ctx, int reg, mgreg_t val) +mono_arch_context_set_int_reg (MonoContext *ctx, int reg, host_mgreg_t val) { switch (reg) { case X86_EAX: diff --git a/mono/mini/mini.h b/mono/mini/mini.h index 38d4a5f0952..748fe5ebfa2 100644 --- a/mono/mini/mini.h +++ b/mono/mini/mini.h @@ -2120,20 +2120,20 @@ gpointer mono_create_static_rgctx_trampoline (MonoMethod *m, gpointer a gpointer mono_create_ftnptr_arg_trampoline (gpointer arg, gpointer addr); MonoVTable* mono_find_class_init_trampoline_by_addr (gconstpointer addr); guint32 mono_find_rgctx_lazy_fetch_trampoline_by_addr (gconstpointer addr); -gpointer mono_magic_trampoline (mgreg_t *regs, guint8 *code, gpointer arg, guint8* tramp); +gpointer mono_magic_trampoline (host_mgreg_t *regs, guint8 *code, gpointer arg, guint8* tramp); #ifndef DISABLE_REMOTING -gpointer mono_generic_virtual_remoting_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, guint8 *tramp); +gpointer mono_generic_virtual_remoting_trampoline (host_mgreg_t *regs, guint8 *code, MonoMethod *m, guint8 *tramp); #endif -gpointer mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *tramp_data, guint8* tramp); -gpointer mono_aot_trampoline (mgreg_t *regs, guint8 *code, guint8 *token_info, +gpointer mono_delegate_trampoline (host_mgreg_t *regs, guint8 *code, gpointer *tramp_data, guint8* tramp); +gpointer mono_aot_trampoline (host_mgreg_t *regs, guint8 *code, guint8 *token_info, guint8* tramp); -gpointer mono_aot_plt_trampoline (mgreg_t *regs, guint8 *code, guint8 *token_info, +gpointer mono_aot_plt_trampoline (host_mgreg_t *regs, guint8 *code, guint8 *token_info, guint8* tramp); -void mono_class_init_trampoline (mgreg_t *regs, guint8 *code, MonoVTable *vtable, guint8 *tramp); -void mono_generic_class_init_trampoline (mgreg_t *regs, guint8 *code, MonoVTable *vtable, guint8 *tramp); -void mono_monitor_enter_trampoline (mgreg_t *regs, guint8 *code, MonoObject *obj, guint8 *tramp); -void mono_monitor_enter_v4_trampoline (mgreg_t *regs, guint8 *code, MonoObject *obj, guint8 *tramp); -void mono_monitor_exit_trampoline (mgreg_t *regs, guint8 *code, MonoObject *obj, guint8 *tramp); +void mono_class_init_trampoline (host_mgreg_t *regs, guint8 *code, MonoVTable *vtable, guint8 *tramp); +void mono_generic_class_init_trampoline (host_mgreg_t *regs, guint8 *code, MonoVTable *vtable, guint8 *tramp); +void mono_monitor_enter_trampoline (host_mgreg_t *regs, guint8 *code, MonoObject *obj, guint8 *tramp); +void mono_monitor_enter_v4_trampoline (host_mgreg_t *regs, guint8 *code, MonoObject *obj, guint8 *tramp); +void mono_monitor_exit_trampoline (host_mgreg_t *regs, guint8 *code, MonoObject *obj, guint8 *tramp); gconstpointer mono_get_trampoline_func (MonoTrampolineType tramp_type); gpointer mini_get_vtable_trampoline (MonoVTable *vt, int slot_index); const char* mono_get_generic_trampoline_simple_name (MonoTrampolineType tramp_type); @@ -2343,7 +2343,7 @@ gboolean mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *ji, MonoContext *ctx, MonoContext *new_ctx, MonoLMF **lmf, - mgreg_t **save_locations, + host_mgreg_t **save_locations, StackFrameInfo *frame_info); gpointer mono_arch_get_throw_exception_by_name (void); gpointer mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot); @@ -2360,14 +2360,14 @@ void mono_handle_hard_stack_ovf (MonoJitTlsData *jit_tls, MonoJi void mono_arch_undo_ip_adjustment (MonoContext *ctx); void mono_arch_do_ip_adjustment (MonoContext *ctx); gpointer mono_arch_ip_from_context (void *sigctx); -mgreg_t mono_arch_context_get_int_reg (MonoContext *ctx, int reg); -void mono_arch_context_set_int_reg (MonoContext *ctx, int reg, mgreg_t val); +host_mgreg_t mono_arch_context_get_int_reg (MonoContext *ctx, int reg); +void mono_arch_context_set_int_reg (MonoContext *ctx, int reg, host_mgreg_t val); void mono_arch_flush_register_windows (void); gboolean mono_arch_is_inst_imm (int opcode, int imm_opcode, gint64 imm); gboolean mono_arch_is_int_overflow (void *sigctx, void *info); void mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg); guint32 mono_arch_get_patch_offset (guint8 *code); -gpointer*mono_arch_get_delegate_method_ptr_addr (guint8* code, mgreg_t *regs); +gpointer*mono_arch_get_delegate_method_ptr_addr (guint8* code, host_mgreg_t *regs); void mono_arch_create_vars (MonoCompile *cfg) MONO_LLVM_INTERNAL; void mono_arch_save_unwind_info (MonoCompile *cfg); void mono_arch_register_lowlevel_calls (void); @@ -2377,19 +2377,19 @@ gpointer mono_arch_get_ftnptr_arg_trampoline (gpointer arg, gpointer addr); gpointer mono_arch_get_llvm_imt_trampoline (MonoDomain *domain, MonoMethod *method, int vt_offset); gpointer mono_arch_get_gsharedvt_arg_trampoline (MonoDomain *domain, gpointer arg, gpointer addr); void mono_arch_patch_callsite (guint8 *method_start, guint8 *code, guint8 *addr); -void mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr); -void mono_arch_nullify_class_init_trampoline(guint8 *code, mgreg_t *regs); +void mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guint8 *addr); +void mono_arch_nullify_class_init_trampoline(guint8 *code, host_mgreg_t *regs); int mono_arch_get_this_arg_reg (guint8 *code); -gpointer mono_arch_get_this_arg_from_call (mgreg_t *regs, guint8 *code); +gpointer mono_arch_get_this_arg_from_call (host_mgreg_t *regs, guint8 *code); gpointer mono_arch_get_delegate_invoke_impl (MonoMethodSignature *sig, gboolean has_target); gpointer mono_arch_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod *method, int offset, gboolean load_imt_reg); gpointer mono_arch_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len); -MonoMethod* mono_arch_find_imt_method (mgreg_t *regs, guint8 *code); -MonoVTable* mono_arch_find_static_call_vtable (mgreg_t *regs, guint8 *code); +MonoMethod* mono_arch_find_imt_method (host_mgreg_t *regs, guint8 *code); +MonoVTable* mono_arch_find_static_call_vtable (host_mgreg_t *regs, guint8 *code); gpointer mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp); void mono_arch_notify_pending_exc (MonoThreadInfo *info); guint8* mono_arch_get_call_target (guint8 *code); -guint32 mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code); +guint32 mono_arch_get_plt_info_offset (guint8 *plt_entry, host_mgreg_t *regs, guint8 *code); GSList *mono_arch_get_trampolines (gboolean aot); gpointer mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info); gpointer mono_arch_get_native_to_interp_trampoline (MonoTrampInfo **info); @@ -2430,7 +2430,7 @@ gboolean mono_thread_state_init_from_monoctx (MonoThreadUnwindState *ctx, Mon void mono_setup_altstack (MonoJitTlsData *tls); void mono_free_altstack (MonoJitTlsData *tls); -gpointer mono_altstack_restore_prot (mgreg_t *regs, guint8 *code, gpointer *tramp_data, guint8* tramp); +gpointer mono_altstack_restore_prot (host_mgreg_t *regs, guint8 *code, gpointer *tramp_data, guint8* tramp); MonoJitInfo* mini_jit_info_table_find (MonoDomain *domain, gpointer addr, MonoDomain **out_domain); MonoJitInfo* mini_jit_info_table_find_ext (MonoDomain *domain, gpointer addr, gboolean allow_trampolines, MonoDomain **out_domain); G_EXTERN_C void mono_resume_unwind (MonoContext *ctx) MONO_LLVM_INTERNAL; @@ -2457,7 +2457,7 @@ gboolean mono_find_jit_info_ext (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *prev_ji, MonoContext *ctx, MonoContext *new_ctx, char **trace, MonoLMF **lmf, - mgreg_t **save_locations, + host_mgreg_t **save_locations, StackFrameInfo *frame); gpointer mono_get_throw_exception (void); diff --git a/mono/mini/tramp-amd64-gsharedvt.c b/mono/mini/tramp-amd64-gsharedvt.c index 24bf1fe6f27..aa0371279a5 100644 --- a/mono/mini/tramp-amd64-gsharedvt.c +++ b/mono/mini/tramp-amd64-gsharedvt.c @@ -91,21 +91,21 @@ mono_amd64_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpoi case GSHAREDVT_ARG_BYREF_TO_BYVAL_U1: { guint8 *addr = (guint8*)caller [source_reg]; - callee [dest_reg] = (gpointer)(mgreg_t)*addr; + callee [dest_reg] = (gpointer)(host_mgreg_t)*addr; DEBUG_AMD64_GSHAREDVT_PRINT ("[%d] <- (u1) [%d] (%p) <- (%p)\n", dest_reg, source_reg, &callee [dest_reg], &caller [source_reg]); break; } case GSHAREDVT_ARG_BYREF_TO_BYVAL_U2: { guint16 *addr = (guint16*)caller [source_reg]; - callee [dest_reg] = (gpointer)(mgreg_t)*addr; + callee [dest_reg] = (gpointer)(host_mgreg_t)*addr; DEBUG_AMD64_GSHAREDVT_PRINT ("[%d] <- (u2) [%d] (%p) <- (%p)\n", dest_reg, source_reg, &callee [dest_reg], &caller [source_reg]); break; } case GSHAREDVT_ARG_BYREF_TO_BYVAL_U4: { guint32 *addr = (guint32*)caller [source_reg]; - callee [dest_reg] = (gpointer)(mgreg_t)*addr; + callee [dest_reg] = (gpointer)(host_mgreg_t)*addr; DEBUG_AMD64_GSHAREDVT_PRINT ("[%d] <- (u4) [%d] (%p) <- (%p)\n", dest_reg, source_reg, &callee [dest_reg], &caller [source_reg]); break; } diff --git a/mono/mini/tramp-amd64.c b/mono/mini/tramp-amd64.c index 002a4f7ed81..8d98010516e 100644 --- a/mono/mini/tramp-amd64.c +++ b/mono/mini/tramp-amd64.c @@ -203,7 +203,7 @@ mono_arch_create_llvm_native_thunk (MonoDomain *domain, guint8 *addr) #endif /* !DISABLE_JIT */ void -mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) +mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guint8 *addr) { gint32 disp; gpointer *plt_jump_table_entry; @@ -810,7 +810,7 @@ mono_arch_get_call_target (guint8 *code) * Return the PLT info offset belonging to the plt entry PLT_ENTRY. */ guint32 -mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code) +mono_arch_get_plt_info_offset (guint8 *plt_entry, host_mgreg_t *regs, guint8 *code) { return *(guint32*)(plt_entry + 6); } diff --git a/mono/mini/tramp-arm.c b/mono/mini/tramp-arm.c index fa53a53a924..21a9ae01ed6 100644 --- a/mono/mini/tramp-arm.c +++ b/mono/mini/tramp-arm.c @@ -61,7 +61,7 @@ mono_arch_patch_callsite (guint8 *method_start, guint8 *code_ptr, guint8 *addr) } void -mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) +mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guint8 *addr) { guint8 *jump_entry; @@ -534,7 +534,7 @@ mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr) ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 4); ARM_ADD_REG_IMM8 (code, ARMREG_R0, ARMREG_R0, MONO_ABI_SIZEOF (MonoObject)); code = emit_bx (code, ARMREG_IP); - *(guint32*)code = (guint32)addr; + *(guint32*)code = (guint32)(gsize)addr; code += 4; mono_arch_flush_icache (start, code - start); MONO_PROFILER_RAISE (jit_code_buffer, (start, code - start, MONO_PROFILER_CODE_BUFFER_UNBOX_TRAMPOLINE, m)); @@ -561,9 +561,9 @@ mono_arch_get_static_rgctx_trampoline (gpointer arg, gpointer addr) ARM_LDR_IMM (code, MONO_ARCH_RGCTX_REG, ARMREG_PC, 0); ARM_LDR_IMM (code, ARMREG_PC, ARMREG_PC, 0); - *(guint32*)code = (guint32)arg; + *(guint32*)code = (guint32)(gsize)arg; code += 4; - *(guint32*)code = (guint32)addr; + *(guint32*)code = (guint32)(gsize)addr; code += 4; g_assert ((code - start) <= buf_len); @@ -591,9 +591,9 @@ mono_arch_get_ftnptr_arg_trampoline (gpointer arg, gpointer addr) ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 0); ARM_LDR_IMM (code, ARMREG_PC, ARMREG_PC, 0); - *(guint32*)code = (guint32)arg; + *(guint32*)code = (guint32)(gsize)arg; code += 4; - *(guint32*)code = (guint32)addr; + *(guint32*)code = (guint32)(gsize)addr; code += 4; g_assert ((code - start) <= buf_len); @@ -1103,7 +1103,7 @@ mono_arch_get_call_target (guint8 *code) } guint32 -mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code) +mono_arch_get_plt_info_offset (guint8 *plt_entry, host_mgreg_t *regs, guint8 *code) { /* The offset is stored as the 4th word of the plt entry */ return ((guint32*)plt_entry) [3]; @@ -1121,8 +1121,8 @@ mono_arm_get_thumb_plt_entry (guint8 *code) guint8 *target; /* code should be right after a BL */ - code = (guint8*)((mgreg_t)code & ~1); - base = (guint8*)((mgreg_t)code & ~3); + code = (guint8*)((gsize)code & ~1); + base = (guint8*)((gsize)code & ~3); bl = code - 4; t1 = ((guint16*)bl) [0]; t2 = ((guint16*)bl) [1]; diff --git a/mono/mini/tramp-arm64.c b/mono/mini/tramp-arm64.c index d4c9606e9ad..86431e9036c 100644 --- a/mono/mini/tramp-arm64.c +++ b/mono/mini/tramp-arm64.c @@ -35,7 +35,7 @@ mono_arch_patch_callsite (guint8 *method_start, guint8 *code_ptr, guint8 *addr) } void -mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) +mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guint8 *addr) { guint32 ins; guint64 slot_addr; @@ -90,7 +90,7 @@ mono_arch_get_call_target (guint8 *code) } guint32 -mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code) +mono_arch_get_plt_info_offset (guint8 *plt_entry, host_mgreg_t *regs, guint8 *code) { /* The offset is stored as the 5th word of the plt entry */ return ((guint32*)plt_entry) [4]; @@ -644,13 +644,13 @@ mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) start = code = (guint8 *) mono_global_codeman_reserve (buf_len); /* allocate frame */ - framesize += 2 * sizeof (mgreg_t); + framesize += 2 * sizeof (host_mgreg_t); off_methodargs = framesize; - framesize += sizeof (mgreg_t); + framesize += sizeof (host_mgreg_t); off_targetaddr = framesize; - framesize += sizeof (mgreg_t); + framesize += sizeof (host_mgreg_t); framesize = ALIGN_TO (framesize, MONO_ARCH_FRAME_ALIGNMENT); @@ -681,9 +681,9 @@ mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) arm_bcc (code, ARMCOND_EQ, 0); arm_ldrx (code, ARMREG_R2, ARMREG_IP1, 0); arm_strx (code, ARMREG_R2, ARMREG_IP0, 0); - arm_addx_imm (code, ARMREG_IP0, ARMREG_IP0, sizeof (mgreg_t)); - arm_addx_imm (code, ARMREG_IP1, ARMREG_IP1, sizeof (mgreg_t)); - arm_subx_imm (code, ARMREG_R0, ARMREG_R0, sizeof (mgreg_t)); + arm_addx_imm (code, ARMREG_IP0, ARMREG_IP0, sizeof (host_mgreg_t)); + arm_addx_imm (code, ARMREG_IP1, ARMREG_IP1, sizeof (host_mgreg_t)); + arm_subx_imm (code, ARMREG_R0, ARMREG_R0, sizeof (host_mgreg_t)); arm_b (code, label_start_copy); mono_arm_patch (label_exit_copy, code, MONO_R_ARM64_BCC); @@ -692,7 +692,7 @@ mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) /* set all general purpose registers from CallContext */ for (i = 0; i < PARAM_REGS + 1; i++) - arm_ldrx (code, i, ARMREG_IP0, MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (mgreg_t)); + arm_ldrx (code, i, ARMREG_IP0, MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (host_mgreg_t)); /* set all floating registers from CallContext */ for (i = 0; i < FP_PARAM_REGS; i++) @@ -709,7 +709,7 @@ mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) /* set all general purpose registers to CallContext */ for (i = 0; i < PARAM_REGS; i++) - arm_strx (code, i, ARMREG_IP0, MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (mgreg_t)); + arm_strx (code, i, ARMREG_IP0, MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (host_mgreg_t)); /* set all floating registers to CallContext */ for (i = 0; i < FP_PARAM_REGS; i++) @@ -749,7 +749,7 @@ mono_arch_get_native_to_interp_trampoline (MonoTrampInfo **info) start = code = (guint8 *) mono_global_codeman_reserve (buf_len); /* Allocate frame (FP + LR + CallContext) */ - offset = 2 * sizeof (mgreg_t); + offset = 2 * sizeof (host_mgreg_t); ccontext_offset = offset; offset += sizeof (CallContext); framesize = ALIGN_TO (offset, MONO_ARCH_FRAME_ALIGNMENT); @@ -768,7 +768,7 @@ mono_arch_get_native_to_interp_trampoline (MonoTrampInfo **info) /* save all general purpose registers into the CallContext */ for (i = 0; i < PARAM_REGS + 1; i++) - arm_strx (code, i, ARMREG_FP, ccontext_offset + MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (mgreg_t)); + arm_strx (code, i, ARMREG_FP, ccontext_offset + MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (host_mgreg_t)); /* save all floating registers into the CallContext */ for (i = 0; i < FP_PARAM_REGS; i++) @@ -786,7 +786,7 @@ mono_arch_get_native_to_interp_trampoline (MonoTrampInfo **info) /* load the return values from the context */ for (i = 0; i < PARAM_REGS; i++) - arm_ldrx (code, i, ARMREG_FP, ccontext_offset + MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (mgreg_t)); + arm_ldrx (code, i, ARMREG_FP, ccontext_offset + MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (host_mgreg_t)); for (i = 0; i < FP_PARAM_REGS; i++) arm_ldrfpx (code, i, ARMREG_FP, ccontext_offset + MONO_STRUCT_OFFSET (CallContext, fregs) + i * sizeof (double)); diff --git a/mono/mini/tramp-mips.c b/mono/mini/tramp-mips.c index 1da1cc2f980..bb583d9a844 100644 --- a/mono/mini/tramp-mips.c +++ b/mono/mini/tramp-mips.c @@ -102,7 +102,7 @@ mono_arch_patch_callsite (guint8 *method_start, guint8 *orig_code, guint8 *addr) } void -mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) +mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guint8 *addr) { g_assert_not_reached (); } diff --git a/mono/mini/tramp-ppc.c b/mono/mini/tramp-ppc.c index a12e04fc636..750af1434cd 100644 --- a/mono/mini/tramp-ppc.c +++ b/mono/mini/tramp-ppc.c @@ -189,7 +189,7 @@ mono_arch_patch_callsite (guint8 *method_start, guint8 *code_ptr, guint8 *addr) } void -mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) +mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guint8 *addr) { guint32 ins1, ins2, offset; @@ -682,7 +682,7 @@ mono_arch_get_call_target (guint8 *code) } guint32 -mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code) +mono_arch_get_plt_info_offset (guint8 *plt_entry, host_mgreg_t *regs, guint8 *code) { #ifdef PPC_USES_FUNCTION_DESCRIPTOR return ((guint32*)plt_entry) [8]; diff --git a/mono/mini/tramp-s390x.c b/mono/mini/tramp-s390x.c index 166b63c1b65..83ed347c90b 100644 --- a/mono/mini/tramp-s390x.c +++ b/mono/mini/tramp-s390x.c @@ -159,7 +159,7 @@ mono_arch_patch_callsite (guint8 *method_start, guint8 *orig_code, guint8 *addr) /*------------------------------------------------------------------*/ void -mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) +mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guint8 *addr) { g_assert_not_reached (); } @@ -289,7 +289,7 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf /* Set arguments */ - /* Arg 1: mgreg_t *regs */ + /* Arg 1: host_mgreg_t *regs */ s390_la (buf, s390_r2, 0, LMFReg, G_STRUCT_OFFSET(MonoLMF, gregs[0])); /* Arg 2: code (next address to the instruction that called us) */ diff --git a/mono/mini/tramp-sparc.c b/mono/mini/tramp-sparc.c index 5885d5f4e0c..480a0930de6 100644 --- a/mono/mini/tramp-sparc.c +++ b/mono/mini/tramp-sparc.c @@ -68,7 +68,7 @@ mono_arch_patch_callsite (guint8 *method_start, guint8 *code, guint8 *addr) } void -mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) +mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guint8 *addr) { g_assert_not_reached (); } diff --git a/mono/mini/tramp-wasm.c b/mono/mini/tramp-wasm.c index a1c7d78018a..38e82048a7e 100644 --- a/mono/mini/tramp-wasm.c +++ b/mono/mini/tramp-wasm.c @@ -25,7 +25,7 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot, MonoTrampInfo **info } void -mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) +mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guint8 *addr) { g_error ("mono_arch_patch_plt_entry"); } @@ -89,7 +89,7 @@ mono_arch_get_call_target (guint8 *code) * Return the PLT info offset belonging to the plt entry PLT_ENTRY. */ guint32 -mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code) +mono_arch_get_plt_info_offset (guint8 *plt_entry, host_mgreg_t *regs, guint8 *code) { g_error ("mono_arch_get_plt_info_offset"); return *(guint32*)(plt_entry + 6); diff --git a/mono/mini/tramp-x86.c b/mono/mini/tramp-x86.c index 7a87ba67e31..9ddcce6ef4e 100644 --- a/mono/mini/tramp-x86.c +++ b/mono/mini/tramp-x86.c @@ -124,7 +124,7 @@ mono_arch_patch_callsite (guint8 *method_start, guint8 *orig_code, guint8 *addr) } void -mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) +mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guint8 *addr) { guint32 offset; @@ -576,7 +576,7 @@ mono_arch_get_call_target (guint8 *code) } guint32 -mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code) +mono_arch_get_plt_info_offset (guint8 *plt_entry, host_mgreg_t *regs, guint8 *code) { return *(guint32*)(plt_entry + 6); } @@ -648,7 +648,7 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo mono_add_unwind_op_offset (unwind_ops, code, buf, X86_NREG, -cfa_offset); x86_push_reg (code, X86_EBP); - cfa_offset += sizeof(mgreg_t); + cfa_offset += sizeof(host_mgreg_t); mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset); mono_add_unwind_op_offset (unwind_ops, code, buf, X86_EBP, - cfa_offset); diff --git a/mono/mini/type-checking.c b/mono/mini/type-checking.c index 085c880f8c9..e950d573bcc 100644 --- a/mono/mini/type-checking.c +++ b/mono/mini/type-checking.c @@ -123,7 +123,7 @@ mini_emit_isninst_cast_inst (MonoCompile *cfg, int klass_reg, MonoClass *klass, MONO_EMIT_NEW_CLASSCONST (cfg, const_reg, klass); MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, -1, stype, const_reg); } else { - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, stype, klass); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, stype, (gsize)klass); } MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_PBEQ, true_target); } @@ -240,7 +240,7 @@ mini_emit_class_check_branch (MonoCompile *cfg, int klass_reg, MonoClass *klass, MONO_EMIT_NEW_CLASSCONST (cfg, const_reg, klass); MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, -1, klass_reg, const_reg); } else { - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, klass_reg, klass); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, klass_reg, (gsize)klass); } MONO_EMIT_NEW_BRANCH_BLOCK (cfg, branch_op, target); } @@ -511,10 +511,10 @@ handle_castclass (MonoCompile *cfg, MonoClass *klass, MonoInst *src, int context mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR); return NULL; } - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, vtable_reg, vt); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, vtable_reg, (gsize)vt); } else { MONO_EMIT_NEW_LOAD_MEMBASE (cfg, klass_reg, vtable_reg, MONO_STRUCT_OFFSET (MonoVTable, klass)); - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, klass_reg, klass); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, klass_reg, (gsize)klass); } MONO_EMIT_NEW_COND_EXC (cfg, NE_UN, "InvalidCastException"); } else { @@ -715,10 +715,10 @@ handle_isinst (MonoCompile *cfg, MonoClass *klass, MonoInst *src, int context_us mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR); return NULL; } - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, vtable_reg, vt); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, vtable_reg, (gsize)vt); } else { MONO_EMIT_NEW_LOAD_MEMBASE (cfg, klass_reg, vtable_reg, MONO_STRUCT_OFFSET (MonoVTable, klass)); - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, klass_reg, klass); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, klass_reg, (gsize)klass); } MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_PBNE_UN, false_bb); MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, is_null_bb); diff --git a/mono/mini/unwind.c b/mono/mini/unwind.c index b75fd558cf2..263cba2505c 100644 --- a/mono/mini/unwind.c +++ b/mono/mini/unwind.c @@ -520,7 +520,7 @@ void mono_unwind_frame (guint8 *unwind_info, guint32 unwind_info_len, guint8 *start_ip, guint8 *end_ip, guint8 *ip, guint8 **mark_locations, mono_unwind_reg_t *regs, int nregs, - mgreg_t **save_locations, int save_locations_len, + host_mgreg_t **save_locations, int save_locations_len, guint8 **out_cfa) { Loc locations [NUM_HW_REGS]; @@ -635,7 +635,7 @@ mono_unwind_frame (guint8 *unwind_info, guint32 unwind_info_len, } if (save_locations) - memset (save_locations, 0, save_locations_len * sizeof (mgreg_t*)); + memset (save_locations, 0, save_locations_len * sizeof (host_mgreg_t*)); g_assert (cfa_reg != -1); cfa_val = (guint8*)regs [mono_dwarf_reg_to_hw_reg (cfa_reg)] + cfa_offset; @@ -646,9 +646,9 @@ mono_unwind_frame (guint8 *unwind_info, guint32 unwind_info_len, if (IS_DOUBLE_REG (dwarfreg)) regs [hwreg] = *(guint64*)(cfa_val + locations [hwreg].offset); else - regs [hwreg] = *(mgreg_t*)(cfa_val + locations [hwreg].offset); + regs [hwreg] = *(host_mgreg_t*)(cfa_val + locations [hwreg].offset); if (save_locations && hwreg < save_locations_len) - save_locations [hwreg] = (mgreg_t*)(cfa_val + locations [hwreg].offset); + save_locations [hwreg] = (host_mgreg_t*)(cfa_val + locations [hwreg].offset); } } @@ -909,7 +909,7 @@ decode_lsda (guint8 *lsda, guint8 *code, MonoJitExceptionInfo *ex_info, gpointer *this_offset = -1; } ncall_sites = decode_uleb128 (p, &p); - p = (guint8*)ALIGN_TO ((mgreg_t)p, 4); + p = (guint8*)ALIGN_TO ((gsize)p, 4); if (ex_info_len) *ex_info_len = ncall_sites; diff --git a/mono/utils/mono-context.h b/mono/utils/mono-context.h index 75e01583b9f..9bfb607565d 100644 --- a/mono/utils/mono-context.h +++ b/mono/utils/mono-context.h @@ -62,20 +62,20 @@ typedef __uint128_t MonoContextSimdReg; #if defined (TARGET_WASM) typedef struct { - mgreg_t wasm_sp; - mgreg_t wasm_bp; - mgreg_t llvm_exc_reg; - mgreg_t wasm_ip; - mgreg_t wasm_pc; + host_mgreg_t wasm_sp; + host_mgreg_t wasm_bp; + host_mgreg_t llvm_exc_reg; + host_mgreg_t wasm_ip; + host_mgreg_t wasm_pc; } MonoContext; -#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->wasm_ip = (mgreg_t)(ip); } while (0); -#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->wasm_bp = (mgreg_t)(bp); } while (0); -#define MONO_CONTEXT_SET_SP(ctx,sp) do { (ctx)->wasm_sp = (mgreg_t)(sp); } while (0); +#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->wasm_ip = (host_mgreg_t)(gsize)(ip); } while (0); +#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->wasm_bp = (host_mgreg_t)(gsize)(bp); } while (0); +#define MONO_CONTEXT_SET_SP(ctx,sp) do { (ctx)->wasm_sp = (host_mgreg_t)(gsize)(sp); } while (0); -#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->wasm_ip)) -#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->wasm_bp)) -#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->wasm_sp)) +#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)(gsize)((ctx)->wasm_ip)) +#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)(gsize)((ctx)->wasm_bp)) +#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)(gsize)((ctx)->wasm_sp)) #elif (defined(__i386__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_X86)) @@ -144,27 +144,27 @@ struct sigcontext { #include <mono/arch/x86/x86-codegen.h> typedef struct { - mgreg_t eax; - mgreg_t ebx; - mgreg_t ecx; - mgreg_t edx; - mgreg_t ebp; - mgreg_t esp; - mgreg_t esi; - mgreg_t edi; - mgreg_t eip; + host_mgreg_t eax; + host_mgreg_t ebx; + host_mgreg_t ecx; + host_mgreg_t edx; + host_mgreg_t ebp; + host_mgreg_t esp; + host_mgreg_t esi; + host_mgreg_t edi; + host_mgreg_t eip; #ifdef __APPLE__ MonoContextSimdReg fregs [X86_XMM_NREG]; #endif } MonoContext; -#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->eip = (mgreg_t)(ip); } while (0); -#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->ebp = (mgreg_t)(bp); } while (0); -#define MONO_CONTEXT_SET_SP(ctx,sp) do { (ctx)->esp = (mgreg_t)(sp); } while (0); +#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->eip = (host_mgreg_t)(gsize)(ip); } while (0); +#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->ebp = (host_mgreg_t)(gsize)(bp); } while (0); +#define MONO_CONTEXT_SET_SP(ctx,sp) do { (ctx)->esp = (host_mgreg_t)(gsize)(sp); } while (0); -#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->eip)) -#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->ebp)) -#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->esp)) +#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)(gsize)((ctx)->eip)) +#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)(gsize)((ctx)->ebp)) +#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)(gsize)((ctx)->esp)) /*We set EAX to zero since we are clobering it anyway*/ #ifdef _MSC_VER @@ -201,14 +201,14 @@ typedef struct { "1: pop 0x20(%0)\n" \ : \ : "a" (&(ctx)), \ - [eax] MONO_CONTEXT_OFFSET (eax, 0, mgreg_t), \ - [ebx] MONO_CONTEXT_OFFSET (ebx, 0, mgreg_t), \ - [ecx] MONO_CONTEXT_OFFSET (ecx, 0, mgreg_t), \ - [edx] MONO_CONTEXT_OFFSET (edx, 0, mgreg_t), \ - [ebp] MONO_CONTEXT_OFFSET (ebp, 0, mgreg_t), \ - [esp] MONO_CONTEXT_OFFSET (esp, 0, mgreg_t), \ - [esi] MONO_CONTEXT_OFFSET (esi, 0, mgreg_t), \ - [edi] MONO_CONTEXT_OFFSET (edi, 0, mgreg_t) \ + [eax] MONO_CONTEXT_OFFSET (eax, 0, host_mgreg_t), \ + [ebx] MONO_CONTEXT_OFFSET (ebx, 0, host_mgreg_t), \ + [ecx] MONO_CONTEXT_OFFSET (ecx, 0, host_mgreg_t), \ + [edx] MONO_CONTEXT_OFFSET (edx, 0, host_mgreg_t), \ + [ebp] MONO_CONTEXT_OFFSET (ebp, 0, host_mgreg_t), \ + [esp] MONO_CONTEXT_OFFSET (esp, 0, host_mgreg_t), \ + [esi] MONO_CONTEXT_OFFSET (esi, 0, host_mgreg_t), \ + [edi] MONO_CONTEXT_OFFSET (edi, 0, host_mgreg_t) \ : "memory") #ifdef UCONTEXT_REG_XMM @@ -272,7 +272,7 @@ struct sigcontext { #endif typedef struct { - mgreg_t gregs [AMD64_NREG]; + host_mgreg_t gregs [AMD64_NREG]; #if defined(MONO_HAVE_SIMD_REG) MonoContextSimdReg fregs [AMD64_XMM_NREG]; #else @@ -280,13 +280,13 @@ typedef struct { #endif } MonoContext; -#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->gregs [AMD64_RIP] = (mgreg_t)(ip); } while (0); -#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->gregs [AMD64_RBP] = (mgreg_t)(bp); } while (0); -#define MONO_CONTEXT_SET_SP(ctx,esp) do { (ctx)->gregs [AMD64_RSP] = (mgreg_t)(esp); } while (0); +#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->gregs [AMD64_RIP] = (host_mgreg_t)(gsize)(ip); } while (0); +#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->gregs [AMD64_RBP] = (host_mgreg_t)(gsize)(bp); } while (0); +#define MONO_CONTEXT_SET_SP(ctx,esp) do { (ctx)->gregs [AMD64_RSP] = (host_mgreg_t)(gsize)(esp); } while (0); -#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->gregs [AMD64_RIP])) -#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->gregs [AMD64_RBP])) -#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->gregs [AMD64_RSP])) +#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)(gsize)((ctx)->gregs [AMD64_RIP])) +#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)(gsize)((ctx)->gregs [AMD64_RBP])) +#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)(gsize)((ctx)->gregs [AMD64_RSP])) #if defined (HOST_WIN32) && !defined(__GNUC__) /* msvc doesn't support inline assembly, so have to use a separate .asm file */ @@ -320,23 +320,23 @@ G_EXTERN_C void mono_context_get_current (void *); "movq %%rdx, %c[rip](%0)\n" \ : \ : "a" (&(ctx)), \ - [rax] MONO_CONTEXT_OFFSET (gregs, AMD64_RAX, mgreg_t), \ - [rcx] MONO_CONTEXT_OFFSET (gregs, AMD64_RCX, mgreg_t), \ - [rdx] MONO_CONTEXT_OFFSET (gregs, AMD64_RDX, mgreg_t), \ - [rbx] MONO_CONTEXT_OFFSET (gregs, AMD64_RBX, mgreg_t), \ - [rsp] MONO_CONTEXT_OFFSET (gregs, AMD64_RSP, mgreg_t), \ - [rbp] MONO_CONTEXT_OFFSET (gregs, AMD64_RBP, mgreg_t), \ - [rsi] MONO_CONTEXT_OFFSET (gregs, AMD64_RSI, mgreg_t), \ - [rdi] MONO_CONTEXT_OFFSET (gregs, AMD64_RDI, mgreg_t), \ - [r8] MONO_CONTEXT_OFFSET (gregs, AMD64_R8, mgreg_t), \ - [r9] MONO_CONTEXT_OFFSET (gregs, AMD64_R9, mgreg_t), \ - [r10] MONO_CONTEXT_OFFSET (gregs, AMD64_R10, mgreg_t), \ - [r11] MONO_CONTEXT_OFFSET (gregs, AMD64_R11, mgreg_t), \ - [r12] MONO_CONTEXT_OFFSET (gregs, AMD64_R12, mgreg_t), \ - [r13] MONO_CONTEXT_OFFSET (gregs, AMD64_R13, mgreg_t), \ - [r14] MONO_CONTEXT_OFFSET (gregs, AMD64_R14, mgreg_t), \ - [r15] MONO_CONTEXT_OFFSET (gregs, AMD64_R15, mgreg_t), \ - [rip] MONO_CONTEXT_OFFSET (gregs, AMD64_RIP, mgreg_t) \ + [rax] MONO_CONTEXT_OFFSET (gregs, AMD64_RAX, host_mgreg_t), \ + [rcx] MONO_CONTEXT_OFFSET (gregs, AMD64_RCX, host_mgreg_t), \ + [rdx] MONO_CONTEXT_OFFSET (gregs, AMD64_RDX, host_mgreg_t), \ + [rbx] MONO_CONTEXT_OFFSET (gregs, AMD64_RBX, host_mgreg_t), \ + [rsp] MONO_CONTEXT_OFFSET (gregs, AMD64_RSP, host_mgreg_t), \ + [rbp] MONO_CONTEXT_OFFSET (gregs, AMD64_RBP, host_mgreg_t), \ + [rsi] MONO_CONTEXT_OFFSET (gregs, AMD64_RSI, host_mgreg_t), \ + [rdi] MONO_CONTEXT_OFFSET (gregs, AMD64_RDI, host_mgreg_t), \ + [r8] MONO_CONTEXT_OFFSET (gregs, AMD64_R8, host_mgreg_t), \ + [r9] MONO_CONTEXT_OFFSET (gregs, AMD64_R9, host_mgreg_t), \ + [r10] MONO_CONTEXT_OFFSET (gregs, AMD64_R10, host_mgreg_t), \ + [r11] MONO_CONTEXT_OFFSET (gregs, AMD64_R11, host_mgreg_t), \ + [r12] MONO_CONTEXT_OFFSET (gregs, AMD64_R12, host_mgreg_t), \ + [r13] MONO_CONTEXT_OFFSET (gregs, AMD64_R13, host_mgreg_t), \ + [r14] MONO_CONTEXT_OFFSET (gregs, AMD64_R14, host_mgreg_t), \ + [r15] MONO_CONTEXT_OFFSET (gregs, AMD64_R15, host_mgreg_t), \ + [rip] MONO_CONTEXT_OFFSET (gregs, AMD64_RIP, host_mgreg_t) \ : "rdx", "memory"); \ } while (0) @@ -397,26 +397,26 @@ G_EXTERN_C void mono_context_get_current (void *); #include <mono/arch/arm/arm-codegen.h> typedef struct { - mgreg_t pc; - mgreg_t regs [16]; + host_mgreg_t pc; + host_mgreg_t regs [16]; double fregs [16]; - mgreg_t cpsr; + host_mgreg_t cpsr; } MonoContext; /* we have the stack pointer, not the base pointer in sigcontext */ -#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->pc = (mgreg_t)ip; } while (0); -#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->regs [ARMREG_FP] = (mgreg_t)bp; } while (0); -#define MONO_CONTEXT_SET_SP(ctx,bp) do { (ctx)->regs [ARMREG_SP] = (mgreg_t)bp; } while (0); +#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->pc = (host_mgreg_t)(gsize)ip; } while (0); +#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->regs [ARMREG_FP] = (host_mgreg_t)(gsize)bp; } while (0); +#define MONO_CONTEXT_SET_SP(ctx,bp) do { (ctx)->regs [ARMREG_SP] = (host_mgreg_t)(gsize)bp; } while (0); -#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->pc)) -#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->regs [ARMREG_FP])) -#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->regs [ARMREG_SP])) +#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)(gsize)((ctx)->pc)) +#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)(gsize)((ctx)->regs [ARMREG_FP])) +#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)(gsize)((ctx)->regs [ARMREG_SP])) #if defined(HOST_WATCHOS) #define MONO_CONTEXT_GET_CURRENT(ctx) do { \ gpointer _dummy; \ - ctx.regs [ARMREG_SP] = (mgreg_t)&_dummy; \ + ctx.regs [ARMREG_SP] = (host_mgreg_t)(gsize)&_dummy; \ } while (0); #else @@ -453,24 +453,24 @@ typedef struct { #include <mono/arch/arm64/arm64-codegen.h> typedef struct { - mgreg_t regs [32]; + host_mgreg_t regs [32]; /* FIXME not fully saved in trampolines */ MonoContextSimdReg fregs [32]; - mgreg_t pc; + host_mgreg_t pc; /* * fregs might not be initialized if this context was created from a * ucontext. */ - mgreg_t has_fregs; + host_mgreg_t has_fregs; } MonoContext; -#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->pc = (mgreg_t)ip; } while (0) -#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->regs [ARMREG_FP] = (mgreg_t)bp; } while (0); -#define MONO_CONTEXT_SET_SP(ctx,bp) do { (ctx)->regs [ARMREG_SP] = (mgreg_t)bp; } while (0); +#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->pc = (host_mgreg_t)(gsize)ip; } while (0) +#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->regs [ARMREG_FP] = (host_mgreg_t)(gsize)bp; } while (0); +#define MONO_CONTEXT_SET_SP(ctx,bp) do { (ctx)->regs [ARMREG_SP] = (host_mgreg_t)(gsize)bp; } while (0); -#define MONO_CONTEXT_GET_IP(ctx) (gpointer)((ctx)->pc) -#define MONO_CONTEXT_GET_BP(ctx) (gpointer)((ctx)->regs [ARMREG_FP]) -#define MONO_CONTEXT_GET_SP(ctx) (gpointer)((ctx)->regs [ARMREG_SP]) +#define MONO_CONTEXT_GET_IP(ctx) (gpointer)(gsize)((ctx)->pc) +#define MONO_CONTEXT_GET_BP(ctx) (gpointer)(gsize)((ctx)->regs [ARMREG_FP]) +#define MONO_CONTEXT_GET_SP(ctx) (gpointer)(gsize)((ctx)->regs [ARMREG_SP]) #if defined (HOST_APPLETVOS) @@ -559,18 +559,18 @@ typedef struct { typedef struct { gulong sc_ir; // pc gulong sc_sp; // r1 - mgreg_t regs [32]; + host_mgreg_t regs [32]; double fregs [32]; } MonoContext; /* we have the stack pointer, not the base pointer in sigcontext */ -#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->sc_ir = (gulong)ip; } while (0); -#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->sc_sp = (gulong)bp; } while (0); -#define MONO_CONTEXT_SET_SP(ctx,sp) do { (ctx)->sc_sp = (gulong)sp; } while (0); +#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->sc_ir = (gulong)(gsize)ip; } while (0); +#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->sc_sp = (gulong)(gsize)bp; } while (0); +#define MONO_CONTEXT_SET_SP(ctx,sp) do { (ctx)->sc_sp = (gulong)(gsize)sp; } while (0); -#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->sc_ir)) -#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->regs [ppc_r31])) -#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->sc_sp)) +#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)(gsize)((ctx)->sc_ir)) +#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)(gsize)((ctx)->regs [ppc_r31])) +#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)(gsize)((ctx)->sc_sp)) #define MONO_CONTEXT_GET_CURRENT(ctx) \ __asm__ __volatile__( \ @@ -647,21 +647,21 @@ typedef struct { #else /* !defined(__mono_ppc64__) */ typedef struct { - mgreg_t sc_ir; // pc - mgreg_t sc_sp; // r1 - mgreg_t regs [32]; + host_mgreg_t sc_ir; // pc + host_mgreg_t sc_sp; // r1 + host_mgreg_t regs [32]; double fregs [32]; } MonoContext; /* we have the stack pointer, not the base pointer in sigcontext */ -#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->sc_ir = (mgreg_t)ip; } while (0); +#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->sc_ir = (host_mgreg_t)(gsize)ip; } while (0); /* FIXME: should be called SET_SP */ -#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->sc_sp = (mgreg_t)bp; } while (0); -#define MONO_CONTEXT_SET_SP(ctx,sp) do { (ctx)->sc_sp = (mgreg_t)sp; } while (0); +#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->sc_sp = (host_mgreg_t)(gsize)bp; } while (0); +#define MONO_CONTEXT_SET_SP(ctx,sp) do { (ctx)->sc_sp = (host_mgreg_t)(gsize)sp; } while (0); -#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->sc_ir)) -#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->regs [ppc_r31])) -#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->sc_sp)) +#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)(gsize)((ctx)->sc_ir)) +#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)(gsize)((ctx)->regs [ppc_r31])) +#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)(gsize)((ctx)->sc_sp)) #define MONO_CONTEXT_GET_CURRENT(ctx) \ __asm__ __volatile__( \ @@ -742,7 +742,7 @@ typedef struct { #elif defined(__sparc__) || defined(sparc) /* defined(__mono_ppc__) */ typedef struct MonoContext { - mgreg_t regs [15]; + host_mgreg_t regs [15]; guint8 *ip; gpointer *sp; gpointer *fp; @@ -811,18 +811,18 @@ typedef struct MonoContext { #include <mono/arch/mips/mips-codegen.h> typedef struct { - mgreg_t sc_pc; - mgreg_t sc_regs [32]; + host_mgreg_t sc_pc; + host_mgreg_t sc_regs [32]; gfloat sc_fpregs [32]; } MonoContext; -#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->sc_pc = (mgreg_t)(ip); } while (0); -#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->sc_regs[mips_fp] = (mgreg_t)(bp); } while (0); -#define MONO_CONTEXT_SET_SP(ctx,sp) do { (ctx)->sc_regs[mips_sp] = (mgreg_t)(sp); } while (0); +#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->sc_pc = (host_mgreg_t)(gsize)(ip); } while (0); +#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->sc_regs[mips_fp] = (host_mgreg_t)(gsize)(bp); } while (0); +#define MONO_CONTEXT_SET_SP(ctx,sp) do { (ctx)->sc_regs[mips_sp] = (host_mgreg_t)(gsize)(sp); } while (0); -#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->sc_pc)) -#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->sc_regs[mips_fp])) -#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->sc_regs[mips_sp])) +#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)(gsize)((ctx)->sc_pc)) +#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)(gsize)((ctx)->sc_regs[mips_fp])) +#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)(gsize)((ctx)->sc_regs[mips_sp])) #define MONO_CONTEXT_GET_CURRENT(ctx) \ __asm__ __volatile__( \ diff --git a/mono/utils/mono-machine.h b/mono/utils/mono-machine.h index dc180c91d29..08250c57b42 100644 --- a/mono/utils/mono-machine.h +++ b/mono/utils/mono-machine.h @@ -20,6 +20,23 @@ #include "config.h" #include <glib.h> +// __ILP32__ means integer, long, and pointers are 32bits, and nothing about registers. +// __mono_ilp32__ means integer, long, and pointers are 32bits, and 64bit registers. +// This is for example x32, arm6432, mipsn32, Alpha/NT. +#ifdef __mono_ilp32__ +typedef gint64 host_mgreg_t; +typedef guint64 host_umgreg_t; +#else +typedef gssize host_mgreg_t; +typedef gsize host_umgreg_t; +#endif + +// SIZEOF_REGISTER is target. mgreg_t is usually target, sometimes host. +// There is a mismatch in cross (AOT) compilers, and the +// never executed JIT and runtime truncate pointers. +// When casting to/from pointers, use gsize or gssize. +// When dealing with register context, use host_mgreg_t. +// Or ifndef MONO_CROSS_COMPILE out runtime code. #if SIZEOF_REGISTER == 4 typedef gint32 mgreg_t; #elif SIZEOF_REGISTER == 8 diff --git a/mono/utils/mono-stack-unwinding.h b/mono/utils/mono-stack-unwinding.h index 3225ac50694..cb1d6322d83 100644 --- a/mono/utils/mono-stack-unwinding.h +++ b/mono/utils/mono-stack-unwinding.h @@ -100,7 +100,7 @@ typedef struct { guint32 unwind_info_len; guint8 *unwind_info; - mgreg_t **reg_locations; + host_mgreg_t **reg_locations; } MonoStackFrameInfo; /*Index into MonoThreadState::unwind_data. */ |