+
+/* print_stats *****************************************************************
+
+ outputs detailed compiler statistics
+
+*******************************************************************************/
+
+void print_stats(void)
+{
+ s4 i;
+ float f;
+ s4 sum;
+
+
+ dolog("Number of JIT compiler calls: %6d", count_jit_calls);
+ dolog("Number of compiled methods: %6d", count_methods);
+
+ dolog("Number of compiled basic blocks: %6d",
+ count_basic_blocks);
+ dolog("Number of max. basic blocks per method: %6d",
+ count_max_basic_blocks);
+
+ dolog("Number of compiled JavaVM instructions: %6d",
+ count_javainstr);
+ dolog("Number of max. JavaVM instructions per method: %6d",
+ count_max_javainstr);
+ dolog("Size of compiled JavaVM instructions: %6d(%d)",
+ count_javacodesize, count_javacodesize - count_methods * 18);
+
+ dolog("Size of compiled Exception Tables: %d", count_javaexcsize);
+ dolog("Number of Machine-Instructions: %d", count_code_len >> 2);
+ dolog("Number of Spills (write to memory) <all [i/l/a|flt|dbl]>: %d [%d|%d|%d]",
+ count_spills_write_ila + count_spills_write_flt + count_spills_write_dbl,
+ count_spills_write_ila, count_spills_write_flt, count_spills_write_dbl);
+ dolog("Number of Spills (read from memory) <all [i/l/a|flt|dbl]>: %d [%d|%d|%d]",
+ count_spills_read_ila + count_spills_read_flt + count_spills_read_dbl,
+ count_spills_read_ila, count_spills_read_flt, count_spills_read_dbl);
+ dolog("Number of Activ Pseudocommands: %6d", count_pcmd_activ);
+ dolog("Number of Drop Pseudocommands: %6d", count_pcmd_drop);
+ dolog("Number of Const Pseudocommands: %6d (zero:%5d)",
+ count_pcmd_load, count_pcmd_zero);
+ dolog("Number of ConstAlu Pseudocommands: %6d (cmp: %5d, store:%5d)",
+ count_pcmd_const_alu, count_pcmd_const_bra, count_pcmd_const_store);
+ dolog("Number of Move Pseudocommands: %6d", count_pcmd_move);
+ dolog("Number of Load Pseudocommands: %6d", count_load_instruction);
+ dolog("Number of Store Pseudocommands: %6d (combined: %5d)",
+ count_pcmd_store, count_pcmd_store - count_pcmd_store_comb);
+ dolog("Number of OP Pseudocommands: %6d", count_pcmd_op);
+ dolog("Number of DUP Pseudocommands: %6d", count_dup_instruction);
+ dolog("Number of Mem Pseudocommands: %6d", count_pcmd_mem);
+ dolog("Number of Method Pseudocommands: %6d", count_pcmd_met);
+ dolog("Number of Branch Pseudocommands: %6d (rets:%5d, Xrets: %5d)",
+ count_pcmd_bra, count_pcmd_return, count_pcmd_returnx);
+ log_println(" resolved branches: %6d", count_branches_resolved);
+ log_println(" unresolved branches: %6d", count_branches_unresolved);
+ dolog("Number of Table Pseudocommands: %6d", count_pcmd_table);
+ dolog("Number of Useful Pseudocommands: %6d", count_pcmd_table +
+ count_pcmd_bra + count_pcmd_load + count_pcmd_mem + count_pcmd_op);
+ dolog("Number of Null Pointer Checks: %6d", count_check_null);
+ dolog("Number of Array Bound Checks: %6d", count_check_bound);
+ dolog("Number of Try-Blocks: %d", count_tryblocks);
+
+ dolog("Number of branch_emit (total, 8bit/16bit/32bit/64bit offset): %d, %d/%d/%d/%d",
+ count_emit_branch, count_emit_branch_8bit, count_emit_branch_16bit,
+ count_emit_branch_32bit, count_emit_branch_64bit);
+
+ dolog("Maximal count of stack elements: %d", count_max_new_stack);
+ dolog("Upper bound of max stack elements: %d", count_upper_bound_new_stack);
+ dolog("Distribution of stack sizes at block boundary");
+ dolog(" 0 1 2 3 4 5 6 7 8 9 >=10");
+ dolog("%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d",
+ count_block_stack[0], count_block_stack[1], count_block_stack[2],
+ count_block_stack[3], count_block_stack[4], count_block_stack[5],
+ count_block_stack[6], count_block_stack[7], count_block_stack[8],
+ count_block_stack[9], count_block_stack[10]);
+ dolog("Distribution of store stack depth");
+ dolog(" 0 1 2 3 4 5 6 7 8 9 >=10");
+ dolog("%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d",
+ count_store_depth[0], count_store_depth[1], count_store_depth[2],
+ count_store_depth[3], count_store_depth[4], count_store_depth[5],
+ count_store_depth[6], count_store_depth[7], count_store_depth[8],
+ count_store_depth[9], count_store_depth[10]);
+ dolog("Distribution of store creator chains first part");
+ dolog(" 0 1 2 3 4 5 6 7 8 9");
+ dolog("%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d",
+ count_store_length[0], count_store_length[1], count_store_length[2],
+ count_store_length[3], count_store_length[4], count_store_length[5],
+ count_store_length[6], count_store_length[7], count_store_length[8],
+ count_store_length[9]);
+ dolog("Distribution of store creator chains second part");
+ dolog(" 10 11 12 13 14 15 16 17 18 19 >=20");
+ dolog("%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d",
+ count_store_length[10], count_store_length[11],
+ count_store_length[12], count_store_length[13],
+ count_store_length[14], count_store_length[15],
+ count_store_length[16], count_store_length[17],
+ count_store_length[18], count_store_length[19],
+ count_store_length[20]);
+ dolog("Distribution of analysis iterations");
+ dolog(" 1 2 3 4 >=5");
+ dolog("%6d%6d%6d%6d%6d",
+ count_analyse_iterations[0], count_analyse_iterations[1],
+ count_analyse_iterations[2], count_analyse_iterations[3],
+ count_analyse_iterations[4]);
+
+
+ /* Distribution of basic blocks per method ********************************/
+
+ log_println("Distribution of basic blocks per method:");
+ log_println(" <=5 <=10 <=15 <=20 <=30 <=40 <=50 <=75 >75");
+
+ log_start();
+ for (i = 0; i <= 8; i++)
+ log_print("%6d", count_method_bb_distribution[i]);
+ log_finish();
+
+ /* print ratio */
+
+ f = (float) count_methods;
+
+ log_start();
+ for (i = 0; i <= 8; i++)
+ log_print("%6.2f", (float) count_method_bb_distribution[i] / f);
+ log_finish();
+
+ /* print cumulated ratio */
+
+ log_start();
+ for (i = 0, sum = 0; i <= 8; i++) {
+ sum += count_method_bb_distribution[i];
+ log_print("%6.2f", (float) sum / f);
+ }
+ log_finish();
+
+
+ /* Distribution of basic block sizes **************************************/
+
+ log_println("Distribution of basic block sizes:");
+ log_println(" 0 1 2 3 4 5 6 7 8 9 <13 <15 <17 <19 <21 <26 <31 >30");
+
+ /* print block sizes */
+
+ log_start();
+ for (i = 0; i <= 17; i++)
+ log_print("%6d", count_block_size_distribution[i]);
+ log_finish();
+
+ /* print ratio */
+
+ f = (float) count_basic_blocks;
+
+ log_start();
+ for (i = 0; i <= 17; i++)
+ log_print("%6.2f", (float) count_block_size_distribution[i] / f);
+ log_finish();
+
+ /* print cumulated ratio */
+
+ log_start();
+ for (i = 0, sum = 0; i <= 17; i++) {
+ sum += count_block_size_distribution[i];
+ log_print("%6.2f", (float) sum / f);
+ }
+ log_finish();
+
+ statistics_print_memory_usage();
+
+ dolog("Number of class loads: %6d", count_class_loads);
+ dolog("Number of class inits: %6d", count_class_inits);
+ dolog("Number of loaded Methods: %6d\n", count_all_methods);
+
+ dolog("Calls of utf_new: %6d", count_utf_new);
+ dolog("Calls of utf_new (element found): %6d\n", count_utf_new_found);
+
+
+ /* LSRA statistics ********************************************************/
+
+ dolog("Moves reg -> reg: %6d", count_mov_reg_reg);
+ dolog("Moves mem -> reg: %6d", count_mov_mem_reg);
+ dolog("Moves reg -> mem: %6d", count_mov_reg_mem);
+ dolog("Moves mem -> mem: %6d", count_mov_mem_mem);
+
+ dolog("Methods allocated by LSRA: %6d",
+ count_methods_allocated_by_lsra);
+ dolog("Conflicts between local Variables: %6d", count_locals_conflicts);
+ dolog("Local Variables held in Memory: %6d", count_locals_spilled);
+ dolog("Local Variables held in Registers: %6d", count_locals_register);
+ dolog("Stackslots held in Memory: %6d", count_ss_spilled);
+ dolog("Stackslots held in Registers: %6d", count_ss_register);
+ dolog("Memory moves at BB Boundaries: %6d", count_mem_move_bb);
+ dolog("Number of interface slots: %6d\n", count_interface_size);
+ dolog("Number of Argument stack slots in register: %6d",
+ count_argument_reg_ss);
+ dolog("Number of Argument stack slots in memory: %6d\n",
+ count_argument_mem_ss);
+ dolog("Number of Methods kept in registers: %6d\n",
+ count_method_in_register);
+
+
+ /* instruction scheduler statistics ***************************************/
+
+#if defined(USE_SCHEDULER)
+ dolog("Instruction scheduler statistics:");
+ dolog("Number of basic blocks: %7d", count_schedule_basic_blocks);
+ dolog("Number of nodes: %7d", count_schedule_nodes);
+ dolog("Number of leaders nodes: %7d", count_schedule_leaders);
+ dolog("Number of max. leaders nodes: %7d", count_schedule_max_leaders);
+ dolog("Length of critical path: %7d\n", count_schedule_critical_path);