- Calling the class loader
- Running the main method
- $Id: main.c 748 2003-12-13 22:13:59Z twisti $
+ $Id: main.c 862 2004-01-06 23:42:01Z stefan $
*/
bool verbose = false;
bool compileall = false;
-bool runverbose = false;
+bool runverbose = false; /* trace all method invocation */
bool collectverbose = false;
bool loadverbose = false;
bool linkverbose = false;
bool initverbose = false;
-bool opt_rt = false; /* true if RTA parse should be used RT-CO */
-bool opt_xta = false; /* true if XTA parse should be used XTA-CO */
-bool opt_vta = false; /* true if VTA parse should be used VTA-CO */
+bool opt_rt = false; /* true if RTA parse should be used RT-CO */
+bool opt_xta = false; /* true if XTA parse should be used XTA-CO */
+bool opt_vta = false; /* true if VTA parse should be used VTA-CO */
bool showmethods = false;
bool showconstantpool = false;
bool showutf = false;
-bool compileverbose = false;
+bool compileverbose = false; /* trace compiler actions */
bool showstack = false;
-bool showdisassemble = false;
-bool showddatasegment = false;
-bool showintermediate = false;
-
-bool useinlining = false;
-bool inlinevirtuals = false;
-bool inlineexceptions = false;
-bool inlineparamopt = false;
-bool inlineoutsiders = false;
-
-bool checkbounds = true;
-bool checknull = true;
-bool opt_noieee = false;
-bool checksync = true;
-bool opt_loops = false;
+bool showdisassemble = false; /* generate disassembler listing */
+bool showddatasegment = false; /* generate data segment listing */
+bool showintermediate = false; /* generate intermediate code listing */
+
+bool useinlining = false; /* use method inlining */
+bool inlinevirtuals = false; /* inline unique virtual methods */
+bool inlineexceptions = false; /* inline methods, that contain excptions */
+bool inlineparamopt = false; /* optimize parameter passing to inlined methods */
+bool inlineoutsiders = false; /* inline methods, that are not member of the invoker's class */
+
+bool checkbounds = true; /* check array bounds */
+bool checknull = true; /* check null pointers */
+bool opt_noieee = false; /* don't implement ieee compliant floats */
+bool checksync = true; /* do synchronization */
+bool opt_loops = false; /* optimize array accesses in loops */
bool makeinitializations = true;
bool getloadingtime = false; /* to measure the runtime */
s8 loadingtime = 0;
+bool getcompilingtime = false; /* compute compile time */
+s8 compilingtime = 0; /* accumulated compile time */
+
+int has_ext_instr_set = 0; /* has instruction set extensions */
+
+bool statistics = false;
+
+bool opt_verify = true; /* true if classfiles should be verified */
+
static classinfo *topclass;
#define OPT_XTA 27
#define OPT_VTA 28
#define OPT_VERBOSETC 29
+#define OPT_NOVERIFY 30
struct {char *name; bool arg; int value;} opts[] = {
{"ms", true, OPT_MS},
{"mx", true, OPT_MX},
{"noasyncgc", false, OPT_IGNORE},
- {"noverify", false, OPT_IGNORE},
+ {"noverify", false, OPT_NOVERIFY},
{"oss", true, OPT_IGNORE},
{"ss", true, OPT_IGNORE},
{"v", false, OPT_VERBOSE1},
#if defined(__ALPHA__)
printf(" -noieee .............. don't use ieee compliant arithmetic\n");
#endif
+ printf(" -noverify ............ don't verify classfiles\n");
printf(" -softnull ............ use software nullpointer check\n");
printf(" -time ................ measure the runtime\n");
printf(" -stat ................ detailed compiler statistics\n");
s8 runtime = totaltime - loadingtime - compilingtime;
char logtext[MAXLOGTEXT];
+#if defined(__I386__)
sprintf(logtext, "Time for loading classes: %lld secs, %lld millis",
+#else
+ sprintf(logtext, "Time for loading classes: %ld secs, %ld millis",
+#endif
loadingtime / 1000000, (loadingtime % 1000000) / 1000);
log_text(logtext);
+
+#if defined(__I386__)
sprintf(logtext, "Time for compiling code: %lld secs, %lld millis",
+#else
+ sprintf(logtext, "Time for compiling code: %ld secs, %ld millis",
+#endif
compilingtime / 1000000, (compilingtime % 1000000) / 1000);
log_text(logtext);
+
+#if defined(__I386__)
sprintf(logtext, "Time for running program: %lld secs, %lld millis",
+#else
+ sprintf(logtext, "Time for running program: %ld secs, %ld millis",
+#endif
runtime / 1000000, (runtime % 1000000) / 1000);
log_text(logtext);
+
+#if defined(__I386__)
sprintf(logtext, "Total time: %lld secs, %lld millis",
+#else
+ sprintf(logtext, "Total time: %ld secs, %ld millis",
+#endif
totaltime / 1000000, (totaltime % 1000000) / 1000);
log_text(logtext);
}
}
-
/********** Function: class_compile_methods (debugging only) ********/
-void class_compile_methods ()
+void class_compile_methods()
{
int i;
classinfo *c;
methodinfo *m;
- c = list_first (&linkedclasses);
+ c = list_first(&linkedclasses);
while (c) {
for (i = 0; i < c -> methodscount; i++) {
m = &(c->methods[i]);
}
-
/*
* void exit_handler(void)
* -----------------------
char logfilename[200] = "";
u4 heapsize = 64000000;
u4 heapstartsize = 200000;
- char classpath[500] = ".:/usr/local/lib/java/classes";
+ char classpath[500] = ".";
bool startit = true;
char *specificmethodname = NULL;
char *specificsignature = NULL;
opt_noieee = true;
break;
+ case OPT_NOVERIFY:
+ opt_verify = false;
+ break;
+
case OPT_SOFTNULL:
checknull = true;
break;
log_text("CACAO started -------------------------------------------------------");
}
- suck_init(classpath);
native_setclasspath(classpath);
tables_init();
+ suck_init(classpath);
+
heap_init(heapsize, heapstartsize, &dummy);
- log_text("calling jit_init");
jit_init();
- log_text("calling loader_init");
loader_init((u1 *) &dummy);
- log_text("calling native_loadclasses");
native_loadclasses();
if (cp[i] == '.') cp[i] = '/'; /* in the class name */
}
+ /*printf("-------------------->%s\n",cp);*/
topclass = loader_load(utf_new_char(cp));
+ /*class_showmethods(topclass); */
- if (exceptionptr != 0) {
+ if (*exceptionptr != 0) {
printf("Exception in thread \"main\" ");
- utf_display(exceptionptr->vftbl->class->name);
+ utf_display((*exceptionptr)->vftbl->class->name);
printf(": ");
- utf_display(javastring_toutf(((java_lang_Throwable *) exceptionptr)->detailMessage, false));
+ utf_display(javastring_toutf(((java_lang_Throwable *) *exceptionptr)->detailMessage, false));
printf("\n");
- exceptionptr = 0;
+ *exceptionptr = 0;
}
if (topclass == 0) {
if (startit) {
methodinfo *mainmethod;
java_objectarray *a;
- java_objectheader *local_exceptionptr = 0;
/* heap_addreference((void**) &a); */
a = builtin_anewarray(argc - opt_ind, class_java_lang_String);
for (i = opt_ind; i < argc; i++) {
- a->data[i - opt_ind] = javastring_new(utf_new_char(argv[i]));
+ a->data[i - opt_ind] =
+ (java_objectheader *) javastring_new(utf_new_char(argv[i]));
}
#ifdef TYPEINFO_DEBUG_TEST
/*class_showmethods(currentThread->group->header.vftbl->class); */
/* here we go... */
- local_exceptionptr = asm_calljavamethod(mainmethod, a, NULL, NULL, NULL);
+ asm_calljavafunction(mainmethod, a, NULL, NULL, NULL);
- if (local_exceptionptr) {
+ if (*exceptionptr) {
printf("Exception in thread \"main\" ");
- utf_display(local_exceptionptr->vftbl->class->name);
+ utf_display((*exceptionptr)->vftbl->class->name);
/* do we have a detail message? */
- if (((java_lang_Throwable *) exceptionptr)->detailMessage) {
+ if (((java_lang_Throwable *) *exceptionptr)->detailMessage) {
printf(": ");
- utf_display(javastring_toutf(((java_lang_Throwable *) exceptionptr)->detailMessage, false));
+ utf_display(javastring_toutf(((java_lang_Throwable *) *exceptionptr)->detailMessage, false));
}
printf("\n");
}