Changes: Mark Probst
Philipp Tomsich
- $Id: headers.c 734 2003-12-13 12:39:47Z stefan $
+ $Id: headers.c 895 2004-01-19 13:53:43Z edwin $
*/
#include "global.h"
#include "tables.h"
#include "loader.h"
+#include "builtin.h"
+#include "mm/boehm.h"
#include "toolbox/chain.h"
#include "toolbox/memory.h"
#include "toolbox/loging.h"
+/* replace command line options */
+
+bool verbose = false;
+bool compileall = false;
+bool runverbose = false;
+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_verify = true; /* true if classfiles should be verified */
+bool opt_liberalutf = false; /* Don't check overlong UTF-8 sequences */
+
+bool showmethods = false;
+bool showconstantpool = false;
+bool showutf = false;
+
+bool makeinitializations = true;
+
+bool getloadingtime = false;
+s8 loadingtime = 0;
+
+
/******* replace some external functions *********/
-functionptr native_findfunction (utf *cname, utf *mname, utf *desc, bool isstatic)
+functionptr native_findfunction(utf *cname, utf *mname, utf *desc, bool isstatic)
{ return NULL; }
-java_objectheader *javastring_new (utf *text) /* schani */
+java_objectheader *javastring_new(utf *text)
{ return NULL; }
-void throw_classnotfoundexception()
-{
- panic("class not found----------");
-}
-/* */
-void throw_classnotfoundexception2(utf* classname)
+void throw_noclassdeffounderror_message(utf* classname)
{
- /* [stefan] code was useless
- sprintf (logtext, "Loading class: ");
- utf_sprint (logtext+strlen(logtext), classname);
- */
- panic("******class not found");
+ printf("Class not found: ");
+ utf_display(classname);
+ printf("\n");
+ exit(1);
}
-/* this is here to avoid link errors. We are not interested in linkagerrors in cacaoh right now*/
-void throw_linkageerror2(utf* classname)
+
+/* this is here to avoid link errors.
+ We are not interested in linkagerrors in cacaoh right now
+*/
+void throw_linkageerror_message(utf* classname)
{
}
-java_objectheader *literalstring_new (utf *u)
-{ return NULL; }
+
+java_objectheader *literalstring_new(utf *u) { return NULL; }
+
void literalstring_free(java_objectheader *o) { }
void stringtable_update() { }
void synchronize_caches() { }
void asm_call_jit_compiler() { }
-void asm_calljavamethod() { }
+void asm_calljavafunction() { }
void asm_dumpregistersandcall() { }
s4 asm_builtin_checkcast(java_objectheader *obj, classinfo *class) { return 0; }
void asm_builtin_monitorenter(java_objectheader *o) {}
void asm_builtin_monitorexit(java_objectheader *o) {}
-s4 asm_builtin_checkarraycast(java_objectheader *o,arraydescriptor *d) {return 0;}
+s4 asm_builtin_checkarraycast(java_objectheader *obj, vftbl *target) {return 0;}
+
#if defined(__I386__)
s4 asm_builtin_arrayinstanceof(java_objectheader *obj, classinfo *class) { return 0; }
/************************ global variables **********************/
-java_objectheader *exceptionptr;
-
-bool verbose = false;
-bool runverbose = false;
-bool collectverbose = false;
+THREADSPECIFIC java_objectheader *_exceptionptr;
static chain *nativemethod_chain; /* chain with native methods */
static chain *nativeclass_chain; /* chain with processed classes */
}
-/******* determine the number of entries of a utf string in the ident chain *****/
+/***** determine the number of entries of a utf string in the ident chain *****/
static int searchidentchain_utf(utf *ident)
{
}
-/**************** print structure for direct access to objects ******************/
+/************** print structure for direct access to objects ******************/
static void printfields(classinfo *c)
{
}
-/****************** remove package-name in fully-qualified classname *********************/
+/******* remove package-name in fully-qualified classname *********************/
static void gen_header_filename(char *buffer, utf *u)
{
}
-/*********** create headerfile for classes and store native methods in chain ************/
+/* create headerfile for classes and store native methods in chain ************/
static void headerfile_generate(classinfo *c)
{
fclose(file);
}
+
/******** print classname, '$' used to seperate inner-class name ***********/
-void print_classname (classinfo *clazz)
+void print_classname(classinfo *clazz)
{
utf *u = clazz->name;
char *endpos = u->text + u->blength;
char *utf_ptr = u->text;
u2 c;
- while (utf_ptr<endpos) {
- if ((c=utf_nextu2(&utf_ptr)) == '_')
- putc ('$',file);
- else
- putc (c,file);
+ while (utf_ptr < endpos) {
+ if ((c = utf_nextu2(&utf_ptr)) == '_') {
+ putc('$', file);
+
+ } else {
+ putc(c, file);
+ }
}
}
char *cp;
classinfo *topclass;
void *dummy;
- int firstarg;
- int noheaders = 0;
/********** internal (only used by main) *****************************/
log_init(NULL);
log_text("Java - header-generator started");
- sprintf(offsets_filename, "jit/%s/offsets.h", ARCH_DIR); /* phil */
+ sprintf(offsets_filename, "jit/%s/offsets.h", ARCH_DIR);
file = fopen(offsets_filename, "w");
if (file == NULL) {
fprintf(stderr, "Can not open file '%s' for write", offsets_filename);
fprintf(file, "#define offbaseval %3d\n", (int) OFFSET(vftbl, baseval));
fprintf(file, "#define offdiffval %3d\n\n", (int) OFFSET(vftbl, diffval));
- fprintf(file, "#define offclassvftbl %3d\n", (int) OFFSET(classinfo, vftbl));
+ fprintf(file, "#define offclassvftbl %3d\n", (int) OFFSET(classinfo, vftbl));
+ fprintf(file, "#define offclassinit %3d\n\n", (int) OFFSET(classinfo, initialized));
fprintf(file, "#define offjniitemtype %3d\n", (int) OFFSET(jni_callblock, itemtype));
fprintf(file, "#define offjniitem %3d\n", (int) OFFSET(jni_callblock, item));
nativemethod_chain = chain_new();
nativeclass_chain = chain_new();
-
- firstarg = 1;
- if (!strcmp(argv[1], "-noheaders")) {
- noheaders = 1;
- firstarg++;
- }
- for (a = firstarg; a < argc; a++) {
+ for (a = 1; a < argc; a++) {
cp = argv[a];
/* convert classname */
topclass = loader_load(utf_new_char(cp));
- if (!noheaders)
- headerfile_generate(topclass);
+ headerfile_generate(topclass);
}
headers_finish();