Mark Probst EMAIL: cacao@complang.tuwien.ac.at
Philipp Tomsich EMAIL: cacao@complang.tuwien.ac.at
- Last Change: $Id: main.c 88 1998-11-25 11:45:40Z phil $
+ Last Change: $Id: main.c 145 1999-11-18 18:29:54Z schani $
*******************************************************************************/
static bool showmethods = false;
static bool showconstantpool = false;
-static bool showunicode = false;
+static bool showutf = false;
static classinfo *topclass;
#ifndef USE_THREADS
#define OPT_GC1 22
#define OPT_GC2 23
#endif
+#define OPT_OLOOP 24
struct {char *name; bool arg; int value;} opts[] = {
{"classpath", true, OPT_CLASSPATH},
{"gc1", false, OPT_GC1},
{"gc2", false, OPT_GC2},
#endif
+ {"oloop", false, OPT_OLOOP},
{NULL, false, 0}
};
printf (" -log logfile ......... specify a name for the logfile\n");
printf (" -c(heck)b(ounds) ..... don't check array bounds\n");
printf (" s(ync) ....... don't check for synchronization\n");
+ printf (" -oloop ............... optimize array accesses in loops\n");
printf (" -l ................... don't start the class after loading\n");
printf (" -all ................. compile all methods, no execution\n");
#ifdef OLD_COMPILER
#ifdef OLD_COMPILER
printf (" s(tack) ....... show stack for every javaVM-command\n");
#endif
- printf (" u(nicode) ..... show the unicode - hash\n");
+ printf (" u(tf) ......... show the utf - hash\n");
}
sprintf (logtext, "Distribution of basic block sizes");
dolog();
sprintf (logtext,
- " 1 2 3 4 5 6 7 8 9 10 <13 <15 <17 <19 <21 <26 <31 >30");
+ " 0 1 2 3 4 5 6 7 8 9 <13 <15 <17 <19 <21 <26 <31 >30");
dolog();
sprintf (logtext, "%3d%5d%5d%5d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d%4d",
count_block_size_distribution[0], count_block_size_distribution[1], count_block_size_distribution[2],
dolog();
sprintf (logtext, "Size of Class Infos (Kb):%10.3f", (float) (count_class_infos) / 1024);
dolog();
- sprintf (logtext, "Size of Const Pool (Kb): %10.3f", (float) (count_const_pool_len + count_unicode_len) / 1024);
+ sprintf (logtext, "Size of Const Pool (Kb): %10.3f", (float) (count_const_pool_len + count_utf_len) / 1024);
dolog();
sprintf (logtext, "Size of Vftbl (Kb): %10.3f", (float) count_vftbl_len / 1024);
dolog();
dolog();
sprintf (logtext, "Size of native stub (Kb):%10.3f", (float) count_nstub_len / 1024);
dolog();
- sprintf (logtext, "Size of Unicode (Kb): %10.3f", (float) count_unicode_len / 1024);
+ sprintf (logtext, "Size of Utf (Kb): %10.3f", (float) count_utf_len / 1024);
dolog();
sprintf (logtext, "Size of VMCode (Kb): %10.3f(%d)", (float) count_vmcode_len / 1024,
count_vmcode_len - 18 * count_all_methods);
dolog();
sprintf (logtext, "Size of ExTable (Kb): %10.3f", (float) count_extable_len / 1024);
dolog();
+ sprintf (logtext, "Number of class loads: %d", count_class_loads);
+ dolog();
+ sprintf (logtext, "Number of class inits: %d", count_class_inits);
+ dolog();
sprintf (logtext, "Number of loaded Methods: %d\n\n", count_all_methods);
dolog();
+
+ sprintf (logtext, "Calls of utf_new: %22d", count_utf_new);
+ dolog();
+ sprintf (logtext, "Calls of utf_new (element found): %6d\n\n", count_utf_new_found);
+ dolog();
}
if (showmethods) class_showmethods (topclass);
if (showconstantpool) class_showconstantpool (topclass);
- if (showunicode) unicode_show ();
+ if (showutf) utf_show ();
#ifdef USE_THREADS
clear_thread_flags(); /* restores standard file descriptor
compiler_close ();
#endif
loader_close ();
- unicode_close ( literalstring_free );
+ tables_close ( literalstring_free );
if (verbose || getcompilingtime || statistics) {
log_text ("CACAO terminated");
{
s4 i,j;
char *cp;
- java_objectheader *exceptionptr;
+ java_objectheader *local_exceptionptr = 0;
void *dummy;
/********** interne (nur fuer main relevante Optionen) **************/
#ifdef OLD_COMPILER
case 's': showstack=true; compileverbose=true; break;
#endif
- case 'u': showunicode=true; break;
+ case 'u': showutf=true; break;
default: print_usage();
exit(10);
}
}
break;
+ case OPT_OLOOP:
+ opt_loops = true;
+ break;
+
default:
print_usage();
exit(10);
suck_init (classpath);
native_setclasspath (classpath);
- unicode_init();
+ tables_init();
heap_init(heapsize, heapstartsize, &dummy);
loader_init();
#ifdef OLD_COMPILER
if (cp[i]=='.') cp[i]='/'; /* auf slashes umbauen */
}
- topclass = loader_load ( unicode_new_char (cp) );
+ topclass = loader_load ( utf_new_char (cp) );
+
+ if (exceptionptr != 0)
+ {
+ printf ("#### Class loader has thrown: ");
+ utf_display (exceptionptr->vftbl->class->name);
+ printf ("\n");
- loader_compute_subclasses();
+ exceptionptr = 0;
+ }
+
+ if (topclass == 0)
+ {
+ printf("#### Could not find top class - exiting\n");
+ exit(1);
+ }
gc_init();
mainmethod = class_findmethod (
topclass,
- unicode_new_char ("main"),
- unicode_new_char ("([Ljava/lang/String;)V")
+ utf_new_char ("main"),
+ utf_new_char ("([Ljava/lang/String;)V")
);
if (!mainmethod) panic ("Can not find method 'void main(String[])'");
if ((mainmethod->flags & ACC_STATIC) != ACC_STATIC) panic ("main is not static!");
a = builtin_anewarray (argc - opt_ind, class_java_lang_String);
for (i=opt_ind; i<argc; i++) {
- a->data[i-opt_ind] = javastring_new (unicode_new_char (argv[i]) );
+ a->data[i-opt_ind] = javastring_new (utf_new_char (argv[i]) );
}
- exceptionptr = asm_calljavamethod (mainmethod, a, NULL,NULL,NULL );
+ local_exceptionptr = asm_calljavamethod (mainmethod, a, NULL,NULL,NULL );
- if (exceptionptr) {
+ if (local_exceptionptr) {
printf ("#### Program has thrown: ");
- unicode_display (exceptionptr->vftbl->class->name);
+ utf_display (local_exceptionptr->vftbl->class->name);
printf ("\n");
}
methodinfo *m;
if (specificsignature)
m = class_findmethod(topclass,
- unicode_new_char(specificmethodname),
- unicode_new_char(specificsignature));
+ utf_new_char(specificmethodname),
+ utf_new_char(specificsignature));
else
m = class_findmethod(topclass,
- unicode_new_char(specificmethodname), NULL);
+ utf_new_char(specificmethodname), NULL);
if (!m) panic ("Specific method not found");
#ifdef OLD_COMPILER
if (newcompiler)