+
+Mon Jun 16 18:13:29 CEST 2003 Paolo Molaro <lupus@ximian.com>
+
+ * driver.c, mini-ppc.c, mini-x86.c, mini.c, mini.h: the coverage stuff
+ is now implemented in the profiling API. Get rid of a couple of
+ unnecessary global variables.
+
2003-06-15 Nick Drochak <ndrochak@gol.com>
* basic-long.cs: tests for negative values for bigmul, and unsigned.
code_size += cfg->code_len;
mono_destroy_compile (cfg);
- if (mono_trace_coverage) {
- MonoCoverageInfo *cov = mono_get_coverage_info (method);
-
- if (cov) {
- int k;
- printf ("COVERAGE INFO %s\n", mono_method_full_name (method, TRUE));
-
- for (k = 0; k < cov->entries; k++) {
- printf (" BBLOCK %3d %d\n", cov->data [k].iloffset, cov->data [k].count);
- }
- }
- }
-
} else {
cfailed++;
if (verbose)
"Development:\n"
" --statfile FILE Sets the stat file to FILE\n"
" --aot Compiles the assembly to native code\n"
- " --coverage Performs coverage analysis\n"
" --profile[=profiler] Runs in profiling mode with the specified profiler module\n"
" --graph[=TYPE] METHOD Draws a graph of the specified method:\n");
mono_jit_stats.enabled = TRUE;
} else if (strcmp (argv [i], "--aot") == 0) {
mono_compile_aot = TRUE;
- } else if (strcmp (argv [i], "--coverage") == 0) {
- mono_trace_coverage = TRUE;
} else if (strcmp (argv [i], "--compile-all") == 0) {
action = DO_COMPILE;
} else if (strcmp (argv [i], "--profile") == 0) {
- mono_jit_profile = TRUE;
mono_profiler_load (NULL);
} else if (strncmp (argv [i], "--profile=", 10) == 0) {
- mono_jit_profile = TRUE;
mono_profiler_load (argv [i] + 10);
} else if (strcmp (argv [i], "--compile") == 0) {
mname = argv [++i];
} else if (strcmp (argv [i], "--debug") == 0) {
enable_debugging = TRUE;
} else {
- fprintf (stderr, "Unknown command line option: %s\n", argv [i]);
+ fprintf (stderr, "Unknown command line option: '%s'\n", argv [i]);
return 1;
}
}
cpos = bb->max_offset;
- if (mono_trace_coverage) {
+ if (cfg->prof_options & MONO_PROFILE_COVERAGE) {
//MonoCoverageInfo *cov = mono_get_coverage_info (cfg->method);
//g_assert (!mono_compile_aot);
//cpos += 6;
if (mono_jit_trace_calls)
max_epilog_size += 50;
- if (mono_jit_profile)
+ if (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE)
max_epilog_size += 50;
/* count the number of exception infos */
MonoInst *ins = bb->code;
bb->max_offset = max_offset;
- if (mono_trace_coverage)
+ if (cfg->prof_options & MONO_PROFILE_COVERAGE)
max_offset += 6;
while (ins) {
cpos = bb->max_offset;
- if (mono_trace_coverage) {
- MonoCoverageInfo *cov = mono_get_coverage_info (cfg->method);
+ if (cfg->prof_options & MONO_PROFILE_COVERAGE) {
+ MonoProfileCoverageInfo *cov = cfg->coverage_info;
g_assert (!mono_compile_aot);
cpos += 6;
- // fixme: make this work with inlining
- g_assert_not_reached ();
- //if (bb->cil_code)
- //cov->data [bb->dfn].iloffset = bb->cil_code - cfg->cil_code;
+ cov->data [bb->dfn].cil_code = bb->cil_code;
/* this is not thread save, but good enough */
- /* fixme: howto handle overflows? */
x86_inc_mem (code, &cov->data [bb->dfn].count);
}
int pos = 0;
/* FIXME: no tracing support... */
- if (mono_jit_profile)
+ if (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE)
code = mono_arch_instrument_epilog (cfg, mono_profiler_method_leave, code, FALSE);
/* reset offset to make max_len work */
offset = code - cfg->native_code;
if (mono_jit_trace_calls)
max_epilog_size += 50;
- if (mono_jit_profile)
+ if (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE)
max_epilog_size += 50;
/* count the number of exception infos */
MonoInst *ins = bb->code;
bb->max_offset = max_offset;
- if (mono_trace_coverage)
+ if (cfg->prof_options & MONO_PROFILE_COVERAGE)
max_offset += 6;
while (ins) {
gboolean mono_jit_trace_calls = FALSE;
gboolean mono_break_on_exc = FALSE;
gboolean mono_compile_aot = FALSE;
-gboolean mono_trace_coverage = FALSE;
-gboolean mono_jit_profile = FALSE;
CRITICAL_SECTION *metadata_section = NULL;
(dest)->inst_right = (el2); \
} while (0)
-static GHashTable *coverage_hash = NULL;
-
-MonoCoverageInfo *
-mono_allocate_coverage_info (MonoMethod *method, int size)
-{
- MonoCoverageInfo *res;
-
- if (!coverage_hash)
- coverage_hash = g_hash_table_new (NULL, NULL);
-
- res = g_malloc0 (sizeof (MonoCoverageInfo) + sizeof (int) * size * 2);
-
- res->entries = size;
-
- g_hash_table_insert (coverage_hash, method, res);
-
- return res;
-}
-
-MonoCoverageInfo *
-mono_get_coverage_info (MonoMethod *method)
-{
- if (!coverage_hash)
- return NULL;
-
- return g_hash_table_lookup (coverage_hash, method);
-}
-
#if 0
static gint
compare_bblock (gconstpointer a, gconstpointer b)
mono_arch_local_regalloc (cfg, bb);
}
- if (mono_trace_coverage)
- mono_allocate_coverage_info (cfg->method, cfg->num_bblocks);
+ if (cfg->prof_options & MONO_PROFILE_COVERAGE)
+ cfg->coverage_info = mono_profiler_coverage_alloc (cfg->method, cfg->num_bblocks);
code = mono_arch_emit_prolog (cfg);
- if (mono_jit_profile)
+ if (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE)
code = mono_arch_instrument_prolog (cfg, mono_profiler_method_enter, code, FALSE);
cfg->code_len = code - cfg->native_code;
cfg->epilog_begin = cfg->code_len;
- if (mono_jit_profile)
+ if (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE)
code = mono_arch_instrument_epilog (cfg, mono_profiler_method_leave, code, FALSE);
cfg->code_len = code - cfg->native_code;
int dfn = 0, i, code_size_ratio;
mono_jit_stats.methods_compiled++;
- if (mono_jit_profile)
+ if (mono_profiler_get_events () & MONO_PROFILE_JIT_COMPILATION)
mono_profiler_method_jit (method);
cfg = g_new0 (MonoCompile, 1);
cfg->method = method;
cfg->mempool = mono_mempool_new ();
cfg->opt = opts;
+ cfg->prof_options = mono_profiler_get_events ();
cfg->bb_hash = g_hash_table_new (g_direct_hash, NULL);
cfg->domain = domain;
cfg->verbose_level = mini_verbose;
g_print ("converting method %s\n", mono_method_full_name (method, TRUE));
if ((i = mono_method_to_ir (cfg, method, NULL, NULL, cfg->locals_start, NULL, NULL, NULL, 0, FALSE)) < 0) {
- mono_destroy_compile (cfg);
- if (mono_jit_profile)
+ if (cfg->prof_options & MONO_PROFILE_JIT_COMPILATION)
mono_profiler_method_end_jit (method, MONO_PROFILE_FAILED);
+ mono_destroy_compile (cfg);
return NULL;
}
}
mono_jit_stats.native_code_size += cfg->code_len;
- if (mono_jit_profile)
+ if (cfg->prof_options & MONO_PROFILE_JIT_COMPILATION)
mono_profiler_method_end_jit (method, MONO_PROFILE_OK);
return cfg;
extern gboolean mono_break_on_exc;
extern int mono_exc_esp_offset;
extern gboolean mono_compile_aot;
-extern gboolean mono_trace_coverage;
-extern gboolean mono_jit_profile;
extern CRITICAL_SECTION *metadata_section;
guint epilog_begin;
guint32 used_int_regs;
guint32 opt;
+ guint32 prof_options;
guint32 flags;
guint32 comp_done;
guint32 verbose_level;
gboolean disable_aot;
gboolean disable_ssa;
gpointer debug_info;
+ gpointer coverage_info;
guint16 *intvars;
} MonoCompile;
MONO_CFG_HAS_CALLS = 1 << 1
} MonoCompileFlags;
-typedef struct {
- int entries;
- struct {
- int iloffset;
- int count;
- } data [0];
-} MonoCoverageInfo;
-
typedef struct {
gulong methods_compiled;
gulong methods_aot;
MonoJitICallInfo *mono_register_jit_icall (gconstpointer func, const char *name, MonoMethodSignature *sig, gboolean is_save);
gconstpointer mono_icall_get_wrapper (MonoJitICallInfo* callinfo);
-MonoCoverageInfo *mono_allocate_coverage_info (MonoMethod *method, int size);
-MonoCoverageInfo *mono_get_coverage_info (MonoMethod *method);
-
/* methods that must be provided by the arch-specific port */
guint32 mono_arch_cpu_optimizazions (guint32 *exclude_mask);
void mono_arch_instrument_mem_needs (MonoMethod *method, int *stack, int *code);