Changes: Christian Thalinger
- $Id: native.c 2186 2005-04-02 00:43:25Z edwin $
+ $Id: native.c 2190 2005-04-02 10:07:44Z edwin $
*/
u2 excount;
u2 i;
java_objectarray *result;
+ classinfo *cls;
excount = m->thrownexceptionscount;
result = builtin_anewarray(excount, class_java_lang_Class);
for (i = 0; i < excount; i++) {
- java_objectheader *o = (java_objectheader *) (m->thrownexceptions[i]);
- use_class_as_object((classinfo *) o);
- result->data[i] = o;
+ if (!resolve_classref_or_classinfo(NULL,m->thrownexceptions[i],resolveEager,false,&cls))
+ return NULL; /* exception */
+ use_class_as_object(cls);
+ result->data[i] = (java_objectheader *)cls;
}
return result;
Changes: Joseph Wenninger
Christian Thalinger
- $Id: VMClass.c 2186 2005-04-02 00:43:25Z edwin $
+ $Id: VMClass.c 2190 2005-04-02 10:07:44Z edwin $
*/
if (!Java_java_lang_VMClass_isPrimitive(env, clazz, (java_lang_Class *) c) && (c->name->text[0] != '[')) {
/* determine number of declared classes */
for (i = 0; i < c->innerclasscount; i++) {
- if ( (c->innerclass[i].outer_class == c) && (notPublicOnly || (c->innerclass[i].flags & ACC_PUBLIC)))
+ if ( (c->innerclass[i].outer_class.cls == c) && (notPublicOnly || (c->innerclass[i].flags & ACC_PUBLIC)))
/* outer class is this class */
declaredclasscount++;
}
result = builtin_anewarray(declaredclasscount, class_java_lang_Class);
for (i = 0; i < c->innerclasscount; i++) {
- classinfo *inner = c->innerclass[i].inner_class;
- classinfo *outer = c->innerclass[i].outer_class;
+ classinfo *inner = c->innerclass[i].inner_class.cls;
+ classinfo *outer = c->innerclass[i].outer_class.cls;
if ((outer == c) && (notPublicOnly || (inner->flags & ACC_PUBLIC))) {
/* outer class is this class, store innerclass in array */
return NULL;
for (i = 0; i < c->innerclasscount; i++) {
- classinfo *inner = c->innerclass[i].inner_class;
- classinfo *outer = c->innerclass[i].outer_class;
+ classinfo *inner = c->innerclass[i].inner_class.cls;
+ classinfo *outer = c->innerclass[i].outer_class.cls;
if (inner == c) {
/* innerclass is this class */
Changes:
- $Id: class.h 2186 2005-04-02 00:43:25Z edwin $
+ $Id: class.h 2190 2005-04-02 10:07:44Z edwin $
*/
/* innerclassinfo *************************************************************/
struct innerclassinfo {
- classinfo *inner_class; /* inner class pointer */
- classinfo *outer_class; /* outer class pointer */
- utf *name; /* innerclass name */
- s4 flags; /* ACC flags */
+ classref_or_classinfo inner_class; /* inner class pointer */
+ classref_or_classinfo outer_class; /* outer class pointer */
+ utf *name; /* innerclass name */
+ s4 flags; /* ACC flags */
};
Changes:
- $Id: classcache.c 2186 2005-04-02 00:43:25Z edwin $
+ $Id: classcache.c 2190 2005-04-02 10:07:44Z edwin $
*/
CLASSCACHE_ASSERT(cls);
+#ifdef CLASSCACHE_VERBOSE
+ fprintf(stderr,"classcache_store(%p,",initloader);
+ utf_fprint_classname(stderr,cls->name);
+ fprintf(stderr,")\n");
+#endif
+
CLASSCACHE_LOCK();
en = classcache_new_name(cls->name);
Changes: Joseph Wenninger
Christian Thalinger
- $Id: codegen.c 2184 2005-04-01 21:19:05Z edwin $
+ $Id: codegen.c 2190 2005-04-02 10:07:44Z edwin $
*/
dseg_addtarget(cd, ex->start);
dseg_addtarget(cd, ex->end);
dseg_addtarget(cd, ex->handler);
- (void) dseg_addaddress(cd, ex->catchtype);
+ (void) dseg_addaddress(cd, ex->catchtype.cls);
}
/* initialize mcode variables */
Changes: Joseph Wenninger
- $Id: codegen.c 2184 2005-04-01 21:19:05Z edwin $
+ $Id: codegen.c 2190 2005-04-02 10:07:44Z edwin $
*/
dseg_addtarget(cd, ex->start);
dseg_addtarget(cd, ex->end);
dseg_addtarget(cd, ex->handler);
- (void) dseg_addaddress(cd, ex->catchtype);
+ (void) dseg_addaddress(cd, ex->catchtype.cls);
}
This module generates MIPS machine code for a sequence of
intermediate code commands (ICMDs).
- $Id: codegen.c 2184 2005-04-01 21:19:05Z edwin $
+ $Id: codegen.c 2190 2005-04-02 10:07:44Z edwin $
*/
dseg_addtarget(cd, ex->start);
dseg_addtarget(cd, ex->end);
dseg_addtarget(cd, ex->handler);
- (void) dseg_addaddress(cd, ex->catchtype);
+ (void) dseg_addaddress(cd, ex->catchtype.cls);
}
/* initialize mcode variables */
Changes: Christian Thalinger
- $Id: codegen.c 2184 2005-04-01 21:19:05Z edwin $
+ $Id: codegen.c 2190 2005-04-02 10:07:44Z edwin $
*/
dseg_addtarget(cd, ex->start);
dseg_addtarget(cd, ex->end);
dseg_addtarget(cd, ex->handler);
- (void) dseg_addaddress(cd, ex->catchtype);
+ (void) dseg_addaddress(cd, ex->catchtype.cls);
}
/* initialize mcode variables */
Authors: Edwin Steiner
- $Id: typecheck.c 2186 2005-04-02 00:43:25Z edwin $
+ $Id: typecheck.c 2190 2005-04-02 10:07:44Z edwin $
*/
i = 0;
while (handlers[i]) {
TYPECHECK_COUNT(stat_handlers_reached);
- cls = handlers[i]->catchtype; /* XXX change to classref */
- excstack.typeinfo.typeclass.cls = (cls) ? cls
- : class_java_lang_Throwable;
+ if (handlers[i]->catchtype.any)
+ excstack.typeinfo.typeclass = handlers[i]->catchtype;
+ else
+ excstack.typeinfo.typeclass.cls = class_java_lang_Throwable;
repeat |= typestate_reach(cd,rd, localbuf,bptr,
handlers[i]->handler,
&excstack,localset,
Authors: Andreas Krall
Christian Thalinger
- $Id: codegen.c 2184 2005-04-01 21:19:05Z edwin $
+ $Id: codegen.c 2190 2005-04-02 10:07:44Z edwin $
*/
dseg_addtarget(cd, ex->start);
dseg_addtarget(cd, ex->end);
dseg_addtarget(cd, ex->handler);
- (void) dseg_addaddress(cd, ex->catchtype);
+ (void) dseg_addaddress(cd, ex->catchtype.cls);
}
/* initialize mcode variables */
Edwin Steiner
Christian Thalinger
- $Id: linker.c 2186 2005-04-02 00:43:25Z edwin $
+ $Id: linker.c 2190 2005-04-02 10:07:44Z edwin $
*/
if (c->linked)
return c;
+ if (linkverbose)
+ log_message_class("Linking class: ", c);
+
/* the class must be loaded */
if (!c->loaded)
throw_cacao_exception_exit(string_java_lang_InternalError,
"Trying to link unloaded class");
- if (linkverbose)
- log_message_class("Linking class: ", c);
-
/* ok, this class is somewhat linked */
c->linked = true;
Edwin Steiner
Christian Thalinger
- $Id: loader.c 2189 2005-04-02 02:05:59Z edwin $
+ $Id: loader.c 2190 2005-04-02 10:07:44Z edwin $
*/
#include "vm/statistics.h"
#include "vm/stringlocal.h"
#include "vm/tables.h"
+#include "vm/classcache.h"
#if defined(USE_ZLIB)
# include "vm/unzip.h"
idx = suck_u2(cb);
if (!idx) {
- m->exceptiontable[j].catchtype = NULL;
+ m->exceptiontable[j].catchtype.any = NULL;
} else {
- if (!(m->exceptiontable[j].catchtype =
+ if (!(m->exceptiontable[j].catchtype.cls =
class_getconstant(c, idx, CONSTANT_Class)))
return false;
}
if (!check_classbuffer_size(cb, 2 * m->thrownexceptionscount))
return false;
- m->thrownexceptions = MNEW(classinfo*, m->thrownexceptionscount);
+ m->thrownexceptions = MNEW(classref_or_classinfo, m->thrownexceptionscount);
for (j = 0; j < m->thrownexceptionscount; j++) {
- if (!((m->thrownexceptions)[j] =
+ if (!((m->thrownexceptions)[j].cls =
class_getconstant(c, suck_u2(cb), CONSTANT_Class)))
return false;
}
innerclassinfo *info = c->innerclass + j;
- info->inner_class =
+ info->inner_class.cls =
innerclass_getconstant(c, suck_u2(cb), CONSTANT_Class);
- info->outer_class =
+ info->outer_class.cls =
innerclass_getconstant(c, suck_u2(cb), CONSTANT_Class);
info->name =
innerclass_getconstant(c, suck_u2(cb), CONSTANT_Utf8);
{
classinfo *r;
+ /* lookup if this class has already been loaded */
+ r = classcache_lookup(cl,c->name);
+ if (r)
+ return r;
+
/* if other class loader than bootstrap, call it */
if (cl) {
javastring_new(c->name),
NULL, NULL);
+ /* store this class in the loaded class cache */
+ if (r && !classcache_store(cl,r)) {
+ log_message_class("Could not cache:",c);
+ r->loaded = false;
+ class_remove(r);
+ r = NULL; /* exception */
+ }
+
return r;
} else {
classbuffer *cb;
classinfo *r;
+ /* lookup if this class has already been loaded */
+ r = classcache_lookup(NULL,c->name);
+ if (r)
+ return r;
+
#if defined(USE_THREADS)
/* enter a monitor on the class */
compilingtime_start();
#endif
+ /* store this class in the loaded class cache */
+ if (r && !classcache_store(NULL,c)) {
+ log_message_class("Could not cache:",c);
+ c->loaded = false;
+ class_remove(c);
+ r = NULL; /* exception */
+ }
+
#if defined(USE_THREADS)
/* leave the monitor */
Changes: Christian Thalinger
- $Id: method.h 2184 2005-04-01 21:19:05Z edwin $
+ $Id: method.h 2190 2005-04-02 10:07:44Z edwin $
*/
exceptiontable *exceptiontable; /* the exceptiontable */
u2 thrownexceptionscount;/* number of exceptions attribute */
- classinfo **thrownexceptions; /* checked exceptions a method may throw */
+ classref_or_classinfo *thrownexceptions; /* except. a method may throw */
u2 linenumbercount; /* number of linenumber attributes */
lineinfo *linenumbers; /* array of lineinfo items */
s4 handlerpc; /* pc of exception handler */
basicblock *handler;
- classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
+ classref_or_classinfo catchtype; /* catchtype of exc. (NULL == catchall) */
exceptiontable *next; /* used to build a list of exception when */
/* loops are copied */
exceptiontable *down; /* instead of the old array, a list is used */