From 243fc9e3743e862ca413e6755c8452a612e21443 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Sat, 5 Jul 2014 21:51:56 +0200 Subject: [PATCH] [jit] Rename MonoJitInfo.used_regs to 'unwind_info' to better reflect its current purpose. --- mono/metadata/domain-internals.h | 3 +-- mono/mini/aot-compiler.c | 6 +----- mono/mini/aot-runtime.c | 21 +++++++++------------ mono/mini/exceptions-amd64.c | 2 +- mono/mini/mini-exceptions.c | 4 ++-- mono/mini/mini.c | 16 +++++++--------- mono/mini/unwind.c | 2 +- 7 files changed, 22 insertions(+), 32 deletions(-) diff --git a/mono/metadata/domain-internals.h b/mono/metadata/domain-internals.h index 09c6479c03d..a9031eb97ea 100644 --- a/mono/metadata/domain-internals.h +++ b/mono/metadata/domain-internals.h @@ -197,8 +197,7 @@ struct _MonoJitInfo { } d; struct _MonoJitInfo *next_jit_code_hash; gpointer code_start; - /* This might contain an id for the unwind info instead of a register mask */ - guint32 used_regs; + guint32 unwind_info; int code_size; guint32 num_clauses:15; /* Whenever the code is domain neutral or 'shared' */ diff --git a/mono/mini/aot-compiler.c b/mono/mini/aot-compiler.c index 2a0547f729d..2cfa0b5e0eb 100644 --- a/mono/mini/aot-compiler.c +++ b/mono/mini/aot-compiler.c @@ -5327,10 +5327,6 @@ emit_exception_debug_info (MonoAotCompile *acfg, MonoCompile *cfg) guint8 *encoded; guint32 unwind_desc; - /* - * This is a duplicate of the data in the .debug_frame section, but that - * section cannot be accessed using the dl interface. - */ encoded = mono_unwind_ops_encode (cfg->unwind_ops, &encoded_len); unwind_desc = get_unwind_info_offset (acfg, encoded, encoded_len); @@ -5347,7 +5343,7 @@ emit_exception_debug_info (MonoAotCompile *acfg, MonoCompile *cfg) encode_value (unwind_desc, p, &p); } } else { - encode_value (jinfo->used_regs, p, &p); + encode_value (jinfo->unwind_info, p, &p); } /*Encode the number of holes before the number of clauses to make decoding easier*/ diff --git a/mono/mini/aot-runtime.c b/mono/mini/aot-runtime.c index 3c9064b885d..297fec6ed95 100644 --- a/mono/mini/aot-runtime.c +++ b/mono/mini/aot-runtime.c @@ -2292,11 +2292,11 @@ decode_llvm_mono_eh_frame (MonoAotModule *amodule, MonoDomain *domain, mono_domain_alloc0_lock_free (domain, MONO_SIZEOF_JIT_INFO + (sizeof (MonoJitExceptionInfo) * (ei_len + nested_len)) + extra_size); jinfo->code_size = code_len; - jinfo->used_regs = mono_cache_unwind_info (info.unw_info, info.unw_info_len); + jinfo->unwind_info = mono_cache_unwind_info (info.unw_info, info.unw_info_len); jinfo->d.method = method; jinfo->code_start = code; jinfo->domain_neutral = 0; - /* This signals that used_regs points to a normal cached unwind info */ + /* This signals that unwind_info points to a normal cached unwind info */ jinfo->from_aot = 0; jinfo->num_clauses = ei_len + nested_len; @@ -2378,7 +2378,7 @@ decode_exception_debug_info (MonoAotModule *amodule, MonoDomain *domain, { int i, buf_len, num_clauses, len; MonoJitInfo *jinfo; - guint used_int_regs, flags; + guint unwind_info, flags; gboolean has_generic_jit_info, has_dwarf_unwind_info, has_clauses, has_seq_points, has_try_block_holes, has_arch_eh_jit_info; gboolean from_llvm, has_gc_map; guint8 *p; @@ -2401,13 +2401,10 @@ decode_exception_debug_info (MonoAotModule *amodule, MonoDomain *domain, has_arch_eh_jit_info = (flags & 128) != 0; if (has_dwarf_unwind_info) { - guint32 offset; - - offset = decode_value (p, &p); - g_assert (offset < (1 << 30)); - used_int_regs = offset; + unwind_info = decode_value (p, &p); + g_assert (unwind_info < (1 << 30)); } else { - used_int_regs = decode_value (p, &p); + unwind_info = decode_value (p, &p); } if (has_generic_jit_info) generic_info_size = sizeof (MonoGenericJitInfo); @@ -2499,7 +2496,7 @@ decode_exception_debug_info (MonoAotModule *amodule, MonoDomain *domain, } jinfo->code_size = code_len; - jinfo->used_regs = used_int_regs; + jinfo->unwind_info = unwind_info; jinfo->d.method = method; jinfo->code_start = code; jinfo->domain_neutral = 0; @@ -2700,8 +2697,8 @@ mono_aot_get_unwind_info (MonoJitInfo *ji, guint32 *unwind_info_len) mono_aot_unlock (); } - /* The upper 16 bits of ji->used_regs might contain the epilog offset */ - p = amodule->unwind_info + (ji->used_regs & 0xffff); + /* The upper 16 bits of ji->unwind_info might contain the epilog offset */ + p = amodule->unwind_info + (ji->unwind_info & 0xffff); *unwind_info_len = decode_value (p, &p); return p; } diff --git a/mono/mini/exceptions-amd64.c b/mono/mini/exceptions-amd64.c index 5a030740915..c48aceb454c 100644 --- a/mono/mini/exceptions-amd64.c +++ b/mono/mini/exceptions-amd64.c @@ -603,7 +603,7 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, printf ("%s %p %p\n", ji->d.method->name, ji->code_start, ip); mono_print_unwind_info (unwind_info, unwind_info_len); */ - epilog = (guint8*)ji->code_start + ji->code_size - (ji->used_regs >> 16); + epilog = (guint8*)ji->code_start + ji->code_size - (ji->unwind_info >> 16); regs [AMD64_RAX] = new_ctx->rax; regs [AMD64_RBX] = new_ctx->rbx; diff --git a/mono/mini/mini-exceptions.c b/mono/mini/mini-exceptions.c index 706577b5024..4486c3b689d 100644 --- a/mono/mini/mini-exceptions.c +++ b/mono/mini/mini-exceptions.c @@ -2747,6 +2747,6 @@ mono_jinfo_get_unwind_info (MonoJitInfo *ji, guint32 *unwind_info_len) if (ji->from_aot) return mono_aot_get_unwind_info (ji, unwind_info_len); else - /* The upper 16 bits of ji->used_regs might contain the epilog offset */ - return mono_get_cached_unwind_info (ji->used_regs & 0xffff, unwind_info_len); + /* The upper 16 bits of ji->unwind_info might contain the epilog offset */ + return mono_get_cached_unwind_info (ji->unwind_info & 0xffff, unwind_info_len); } diff --git a/mono/mini/mini.c b/mono/mini/mini.c index cae9683bdcb..17407241849 100644 --- a/mono/mini/mini.c +++ b/mono/mini/mini.c @@ -4299,7 +4299,7 @@ create_jit_info_for_trampoline (MonoMethod *wrapper, MonoTrampInfo *info) jinfo->d.method = wrapper; jinfo->code_start = info->code; jinfo->code_size = info->code_size; - jinfo->used_regs = mono_cache_unwind_info (uw_info, info_len); + jinfo->unwind_info = mono_cache_unwind_info (uw_info, info_len); if (!info->uw_info) g_free (uw_info); @@ -4382,7 +4382,6 @@ create_jit_info (MonoCompile *cfg, MonoMethod *method_to_compile) jinfo->d.method = cfg->method_to_register; jinfo->code_start = cfg->native_code; jinfo->code_size = cfg->code_len; - jinfo->used_regs = cfg->used_int_regs; jinfo->domain_neutral = (cfg->opt & MONO_OPT_SHARED) != 0; jinfo->num_clauses = num_clauses; @@ -4628,12 +4627,9 @@ create_jit_info (MonoCompile *cfg, MonoMethod *method_to_compile) } } - /* - * Its possible to generate dwarf unwind info for xdebug etc, but not actually - * using it during runtime, hence the define. - */ if (cfg->encoded_unwind_ops) { - jinfo->used_regs = mono_cache_unwind_info (cfg->encoded_unwind_ops, cfg->encoded_unwind_ops_len); + /* Generated by LLVM */ + jinfo->unwind_info = mono_cache_unwind_info (cfg->encoded_unwind_ops, cfg->encoded_unwind_ops_len); g_free (cfg->encoded_unwind_ops); } else if (cfg->unwind_ops) { guint32 info_len; @@ -4649,11 +4645,13 @@ create_jit_info (MonoCompile *cfg, MonoMethod *method_to_compile) */ g_assert (unwind_desc < 0xffff); g_assert (cfg->code_size - cfg->epilog_begin < 0xffff); - jinfo->used_regs = ((cfg->code_size - cfg->epilog_begin) << 16) | unwind_desc; + jinfo->unwind_info = ((cfg->code_size - cfg->epilog_begin) << 16) | unwind_desc; } else { - jinfo->used_regs = unwind_desc; + jinfo->unwind_info = unwind_desc; } g_free (unwind_info); + } else { + jinfo->unwind_info = cfg->used_int_regs; } return jinfo; diff --git a/mono/mini/unwind.c b/mono/mini/unwind.c index d9f4778c0e7..a993350aefd 100644 --- a/mono/mini/unwind.c +++ b/mono/mini/unwind.c @@ -646,7 +646,7 @@ mono_unwind_cleanup (void) * A copy is made of the unwind info. * This function is useful for two reasons: * - many methods have the same unwind info - * - MonoJitInfo->used_regs is an int so it can't store the pointer to the unwind info + * - MonoJitInfo->unwind_info is an int so it can't store the pointer to the unwind info */ guint32 mono_cache_unwind_info (guint8 *unwind_info, guint32 unwind_info_len) -- 2.11.4.GIT