Modifier.java (ALL_FLAGS): New constant.
* java/lang/reflect/Modifier.java (ALL_FLAGS): New constant. * resolve.cc: Removed constants defined by java.lang.reflect.Modifier. Include <java/lang/reflect/Modifier.h>. (_Jv_ResolvePoolEntry): Use values from Modifier. (_Jv_DetermineVTableIndex): Likewise. (_Jv_PrepareClass): Likewise. (ncode): Likewise. * defineclass.cc (_Jv_ClassReader): Removed constants defined by java.lang.reflect.Modifier. Include <java/lang/reflect/Modifier.h>. (checkExtends): Use values from Modifier. (checkImplements): Likewise. (handleField): Likewise. (handleConstantValueAttribute): Likewise. (handleFieldsEnd): Likewise. (handleMethod ): Likewise. (handleMethodsEnd): Likewise. (handleClassBegin): Likewise. * interpret.cc: Removed constants defined by java.lang.reflect.Modifier. (continue1): Use values from Modifier. * java/lang/natClassLoader.cc: Removed constants defined by java.lang.reflect.Modifier. From-SVN: r29037
This commit is contained in:
parent
c7f9c6f5e3
commit
e409a2c8f4
6 changed files with 122 additions and 105 deletions
|
@ -1,5 +1,30 @@
|
|||
1999-09-01 Tom Tromey <tromey@cygnus.com>
|
||||
|
||||
* java/lang/reflect/Modifier.java (ALL_FLAGS): New constant.
|
||||
* resolve.cc: Removed constants defined by
|
||||
java.lang.reflect.Modifier.
|
||||
Include <java/lang/reflect/Modifier.h>.
|
||||
(_Jv_ResolvePoolEntry): Use values from Modifier.
|
||||
(_Jv_DetermineVTableIndex): Likewise.
|
||||
(_Jv_PrepareClass): Likewise.
|
||||
(ncode): Likewise.
|
||||
* defineclass.cc (_Jv_ClassReader): Removed constants defined by
|
||||
java.lang.reflect.Modifier.
|
||||
Include <java/lang/reflect/Modifier.h>.
|
||||
(checkExtends): Use values from Modifier.
|
||||
(checkImplements): Likewise.
|
||||
(handleField): Likewise.
|
||||
(handleConstantValueAttribute): Likewise.
|
||||
(handleFieldsEnd): Likewise.
|
||||
(handleMethod ): Likewise.
|
||||
(handleMethodsEnd): Likewise.
|
||||
(handleClassBegin): Likewise.
|
||||
* interpret.cc: Removed constants defined by
|
||||
java.lang.reflect.Modifier.
|
||||
(continue1): Use values from Modifier.
|
||||
* java/lang/natClassLoader.cc: Removed constants defined by
|
||||
java.lang.reflect.Modifier.
|
||||
|
||||
* java/lang/natClassLoader.cc (_Jv_NewClass): Use
|
||||
JV_STATE_NOTHING, not `0'.
|
||||
* java/lang/Class.h: Replaced JV_STATE_ defines with enum.
|
||||
|
|
|
@ -36,6 +36,7 @@ details. */
|
|||
#include <java/lang/ClassCircularityError.h>
|
||||
#include <java/lang/ClassNotFoundException.h>
|
||||
#include <java/lang/IncompatibleClassChangeError.h>
|
||||
#include <java/lang/reflect/Modifier.h>
|
||||
|
||||
#define ClassClass _CL_Q34java4lang5Class
|
||||
extern java::lang::Class ClassClass;
|
||||
|
@ -246,20 +247,6 @@ struct _Jv_ClassReader {
|
|||
* could be implemented in prims.cc (_Jv_makeUtf8Const), since it
|
||||
* computes the hash value anyway.
|
||||
*/
|
||||
|
||||
static const int PUBLIC = 0x001;
|
||||
static const int PRIVATE = 0x002;
|
||||
static const int PROTECTED = 0x004;
|
||||
static const int STATIC = 0x008;
|
||||
static const int FINAL = 0x010;
|
||||
static const int SYNCHRONIZED = 0x020;
|
||||
static const int VOLATILE = 0x040;
|
||||
static const int TRANSIENT = 0x080;
|
||||
static const int NATIVE = 0x100;
|
||||
static const int INTERFACE = 0x200;
|
||||
static const int ABSTRACT = 0x400;
|
||||
static const int ALL_FLAGS = 0x7FF;
|
||||
|
||||
};
|
||||
|
||||
/* This is used for the isJavaIdentifierStart & isJavaIdentifierPart
|
||||
|
@ -825,6 +812,8 @@ void
|
|||
_Jv_ClassReader::handleClassBegin
|
||||
(int access_flags, int this_class, int super_class)
|
||||
{
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
unsigned char *pool_tags = (unsigned char*) def->constants.tags;
|
||||
_Jv_word *pool_data = def->constants.data;
|
||||
|
||||
|
@ -870,7 +859,7 @@ _Jv_ClassReader::handleClassBegin
|
|||
if (super_class == 0)
|
||||
{
|
||||
// interfaces have java.lang.Object as super.
|
||||
if (access_flags & INTERFACE)
|
||||
if (access_flags & Modifier::INTERFACE)
|
||||
{
|
||||
def->superclass = (jclass)&ClassObject;
|
||||
}
|
||||
|
@ -919,14 +908,16 @@ _Jv_ClassReader::handleClassBegin
|
|||
void
|
||||
_Jv_ClassReader::checkExtends (jclass sub, jclass super)
|
||||
{
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
// having an interface or a final class as a superclass is no good
|
||||
if ((super->accflags & (INTERFACE | FINAL)) != 0)
|
||||
if ((super->accflags & (Modifier::INTERFACE | Modifier::FINAL)) != 0)
|
||||
{
|
||||
throw_incompatible_class_change_error (sub->getName ());
|
||||
}
|
||||
|
||||
// if the super class is not public, we need to check some more
|
||||
if ((super->accflags & PUBLIC) == 0)
|
||||
if ((super->accflags & Modifier::PUBLIC) == 0)
|
||||
{
|
||||
// With package scope, the classes must have the same
|
||||
// class loader.
|
||||
|
@ -986,15 +977,17 @@ void _Jv_ClassReader::handleInterface (int if_number, int offset)
|
|||
void
|
||||
_Jv_ClassReader::checkImplements (jclass sub, jclass super)
|
||||
{
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
// well, it *must* be an interface
|
||||
if ((super->accflags & INTERFACE) == 0)
|
||||
if ((super->accflags & Modifier::INTERFACE) == 0)
|
||||
{
|
||||
throw_incompatible_class_change_error (sub->getName ());
|
||||
}
|
||||
|
||||
// if it has package scope, it must also be defined by the
|
||||
// same loader.
|
||||
if ((super->accflags & PUBLIC) == 0)
|
||||
if ((super->accflags & Modifier::PUBLIC) == 0)
|
||||
{
|
||||
if ( sub->loader != super->loader
|
||||
|| !_Jv_ClassNameSamePackage (sub->name, super->name))
|
||||
|
@ -1026,6 +1019,8 @@ void _Jv_ClassReader::handleField (int field_no,
|
|||
int name,
|
||||
int desc)
|
||||
{
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
_Jv_word *pool_data = def->constants.data;
|
||||
|
||||
_Jv_Field *field = &def->fields[field_no];
|
||||
|
@ -1041,16 +1036,19 @@ void _Jv_ClassReader::handleField (int field_no,
|
|||
_Jv_VerifyIdentifier (field_name);
|
||||
|
||||
// ignore flags we don't know about.
|
||||
field->flags = flags & ALL_FLAGS;
|
||||
field->flags = flags & Modifier::ALL_FLAGS;
|
||||
|
||||
if (verify)
|
||||
{
|
||||
if (field->flags & (SYNCHRONIZED|NATIVE|INTERFACE|ABSTRACT))
|
||||
if (field->flags & (Modifier::SYNCHRONIZED
|
||||
| Modifier::NATIVE
|
||||
| Modifier::INTERFACE
|
||||
| Modifier::ABSTRACT))
|
||||
throw_class_format_error ("erroneous field access flags");
|
||||
|
||||
if (1 < ( ((field->flags & PUBLIC) ? 1 : 0)
|
||||
+((field->flags & PRIVATE) ? 1 : 0)
|
||||
+((field->flags & PROTECTED) ? 1 : 0)))
|
||||
if (1 < ( ((field->flags & Modifier::PUBLIC) ? 1 : 0)
|
||||
+((field->flags & Modifier::PRIVATE) ? 1 : 0)
|
||||
+((field->flags & Modifier::PROTECTED) ? 1 : 0)))
|
||||
throw_class_format_error ("erroneous field access flags");
|
||||
}
|
||||
|
||||
|
@ -1070,9 +1068,13 @@ void _Jv_ClassReader::handleField (int field_no,
|
|||
void _Jv_ClassReader::handleConstantValueAttribute (int field_index,
|
||||
int value)
|
||||
{
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
_Jv_Field *field = &def->fields[field_index];
|
||||
|
||||
if ((field->flags & (STATIC|FINAL|PRIVATE)) == 0)
|
||||
if ((field->flags & (Modifier::STATIC
|
||||
| Modifier::FINAL
|
||||
| Modifier::PRIVATE)) == 0)
|
||||
{
|
||||
// Ignore, as per vmspec #4.7.2
|
||||
return;
|
||||
|
@ -1095,6 +1097,8 @@ void _Jv_ClassReader::handleConstantValueAttribute (int field_index,
|
|||
|
||||
void _Jv_ClassReader::handleFieldsEnd ()
|
||||
{
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
// We need to reorganize the fields so that the static ones are first,
|
||||
// to conform to GCJ class layout.
|
||||
|
||||
|
@ -1107,11 +1111,11 @@ void _Jv_ClassReader::handleFieldsEnd ()
|
|||
while (low < high)
|
||||
{
|
||||
// go forward on low, while it's a static
|
||||
while (low < high && (fields[low].flags & STATIC) != 0)
|
||||
while (low < high && (fields[low].flags & Modifier::STATIC) != 0)
|
||||
low++;
|
||||
|
||||
// go backwards on high, while it's a non-static
|
||||
while (low < high && (fields[high].flags & STATIC) == 0)
|
||||
while (low < high && (fields[high].flags & Modifier::STATIC) == 0)
|
||||
high--;
|
||||
|
||||
if (low==high)
|
||||
|
@ -1130,7 +1134,7 @@ void _Jv_ClassReader::handleFieldsEnd ()
|
|||
low += 1;
|
||||
}
|
||||
|
||||
if ((fields[low].flags & STATIC) != 0)
|
||||
if ((fields[low].flags & Modifier::STATIC) != 0)
|
||||
low += 1;
|
||||
|
||||
def->static_field_count = low;
|
||||
|
@ -1156,6 +1160,8 @@ void _Jv_ClassReader::handleMethodsBegin (int count)
|
|||
void _Jv_ClassReader::handleMethod
|
||||
(int mth_index, int accflags, int name, int desc)
|
||||
{
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
_Jv_word *pool_data = def->constants.data;
|
||||
_Jv_Method *method = &def->methods[mth_index];
|
||||
|
||||
|
@ -1168,7 +1174,7 @@ void _Jv_ClassReader::handleMethod
|
|||
method->signature = pool_data[desc].utf8;
|
||||
|
||||
// ignore unknown flags
|
||||
method->accflags = accflags & ALL_FLAGS;
|
||||
method->accflags = accflags & Modifier::ALL_FLAGS;
|
||||
|
||||
// intialize...
|
||||
method->ncode = 0;
|
||||
|
@ -1183,12 +1189,14 @@ void _Jv_ClassReader::handleMethod
|
|||
|
||||
_Jv_VerifyMethodSignature (method->signature);
|
||||
|
||||
if (method->accflags & (VOLATILE|TRANSIENT|INTERFACE))
|
||||
if (method->accflags & (Modifier::VOLATILE
|
||||
| Modifier::TRANSIENT
|
||||
| Modifier::INTERFACE))
|
||||
throw_class_format_error ("erroneous method access flags");
|
||||
|
||||
if (1 < ( ((method->accflags & PUBLIC) ? 1 : 0)
|
||||
+((method->accflags & PRIVATE) ? 1 : 0)
|
||||
+((method->accflags & PROTECTED) ? 1 : 0)))
|
||||
if (1 < ( ((method->accflags & Modifier::PUBLIC) ? 1 : 0)
|
||||
+((method->accflags & Modifier::PRIVATE) ? 1 : 0)
|
||||
+((method->accflags & Modifier::PROTECTED) ? 1 : 0)))
|
||||
throw_class_format_error ("erroneous method access flags");
|
||||
}
|
||||
}
|
||||
|
@ -1233,10 +1241,12 @@ void _Jv_ClassReader::handleExceptionTableEntry
|
|||
|
||||
void _Jv_ClassReader::handleMethodsEnd ()
|
||||
{
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
for (int i = 0; i < def->method_count; i++)
|
||||
{
|
||||
_Jv_Method *method = &def->methods[i];
|
||||
if (method->accflags & (NATIVE|ABSTRACT))
|
||||
if (method->accflags & (Modifier::NATIVE | Modifier::ABSTRACT))
|
||||
{
|
||||
if (def->interpreted_methods[i] != 0)
|
||||
throw_class_format_error ("code provided "
|
||||
|
|
|
@ -53,19 +53,6 @@ gnu::gcj::runtime::MethodInvocation::continue1 (gnu::gcj::RawData *,
|
|||
#define ClassError _CL_Q34java4lang5Error
|
||||
extern java::lang::Class ClassError;
|
||||
|
||||
static const int PUBLIC = 0x001;
|
||||
static const int PRIVATE = 0x002;
|
||||
static const int PROTECTED = 0x004;
|
||||
static const int STATIC = 0x008;
|
||||
static const int FINAL = 0x010;
|
||||
static const int SYNCHRONIZED = 0x020;
|
||||
static const int VOLATILE = 0x040;
|
||||
static const int TRANSIENT = 0x080;
|
||||
static const int NATIVE = 0x100;
|
||||
static const int INTERFACE = 0x200;
|
||||
static const int ABSTRACT = 0x400;
|
||||
static const int ALL_FLAGS = 0x7FF;
|
||||
|
||||
static _Jv_Utf8Const *init_name = _Jv_makeUtf8Const ("<init>", 6);
|
||||
|
||||
static void throw_internal_error (char *msg)
|
||||
|
@ -426,6 +413,8 @@ gnu::gcj::runtime::MethodInvocation::continue1 (gnu::gcj::RawData *meth,
|
|||
|
||||
void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
{
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
register _Jv_word *sp = inv->sp;
|
||||
register unsigned char *pc PC_REGISTER_ASM = inv->pc;
|
||||
_Jv_word *locals = inv->local_base ();
|
||||
|
@ -2001,7 +1990,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
|||
_Jv_ResolvePoolEntry (defining_class, fieldref_index);
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
|
||||
if ((field->flags & STATIC) == 0)
|
||||
if ((field->flags & Modifier::STATIC) == 0)
|
||||
throw_incompatible_class_change_error
|
||||
(JvNewStringLatin1 ("field no longer static"));
|
||||
|
||||
|
@ -2048,7 +2037,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
|||
_Jv_ResolvePoolEntry (defining_class, fieldref_index);
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
|
||||
if ((field->flags & STATIC) != 0)
|
||||
if ((field->flags & Modifier::STATIC) != 0)
|
||||
throw_incompatible_class_change_error
|
||||
(JvNewStringLatin1 ("field is static"));
|
||||
|
||||
|
@ -2104,7 +2093,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
|||
jclass type = field->type;
|
||||
|
||||
// ResolvePoolEntry cannot check this
|
||||
if ((field->flags & STATIC) == 0)
|
||||
if ((field->flags & Modifier::STATIC) == 0)
|
||||
throw_incompatible_class_change_error
|
||||
(JvNewStringLatin1 ("field no longer static"));
|
||||
|
||||
|
@ -2153,7 +2142,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
|||
|
||||
jclass type = field->type;
|
||||
|
||||
if ((field->flags & STATIC) != 0)
|
||||
if ((field->flags & Modifier::STATIC) != 0)
|
||||
throw_incompatible_class_change_error
|
||||
(JvNewStringLatin1 ("field is static"));
|
||||
|
||||
|
|
|
@ -205,19 +205,6 @@ java::lang::ClassLoader::findLoadedClass (jstring name)
|
|||
return _Jv_FindClassInCache (_Jv_makeUtf8Const (name), this);
|
||||
}
|
||||
|
||||
static const int PUBLIC = 0x001;
|
||||
static const int PRIVATE = 0x002;
|
||||
static const int PROTECTED = 0x004;
|
||||
static const int STATIC = 0x008;
|
||||
static const int FINAL = 0x010;
|
||||
static const int SYNCHRONIZED = 0x020;
|
||||
static const int VOLATILE = 0x040;
|
||||
static const int TRANSIENT = 0x080;
|
||||
static const int NATIVE = 0x100;
|
||||
static const int INTERFACE = 0x200;
|
||||
static const int ABSTRACT = 0x400;
|
||||
static const int ALL_FLAGS = 0x7FF;
|
||||
|
||||
|
||||
/** This function does class-preparation for compiled classes.
|
||||
NOTE: It contains replicated functionality from
|
||||
|
|
|
@ -35,6 +35,9 @@ public class Modifier
|
|||
public static final int INTERFACE = 0x200;
|
||||
public static final int ABSTRACT = 0x400;
|
||||
|
||||
// This is only used by the C++ code, so it is not public.
|
||||
static final int ALL_FLAGS = 0x7ff;
|
||||
|
||||
public static boolean isAbstract (int mod)
|
||||
{
|
||||
return (mod & ABSTRACT) != 0;
|
||||
|
|
|
@ -27,6 +27,7 @@ details. */
|
|||
#include <java/lang/AbstractMethodError.h>
|
||||
#include <java/lang/ClassNotFoundException.h>
|
||||
#include <java/lang/IncompatibleClassChangeError.h>
|
||||
#include <java/lang/reflect/Modifier.h>
|
||||
|
||||
#ifdef INTERPRETER
|
||||
|
||||
|
@ -54,19 +55,6 @@ _Jv_BuildResolvedMethod (_Jv_Method*,
|
|||
jint);
|
||||
|
||||
|
||||
static const int PUBLIC = 0x001;
|
||||
static const int PRIVATE = 0x002;
|
||||
static const int PROTECTED = 0x004;
|
||||
static const int STATIC = 0x008;
|
||||
static const int FINAL = 0x010;
|
||||
static const int SYNCHRONIZED = 0x020;
|
||||
static const int VOLATILE = 0x040;
|
||||
static const int TRANSIENT = 0x080;
|
||||
static const int NATIVE = 0x100;
|
||||
static const int INTERFACE = 0x200;
|
||||
static const int ABSTRACT = 0x400;
|
||||
static const int ALL_FLAGS = 0x7FF;
|
||||
|
||||
// We need to know the name of a constructor.
|
||||
static _Jv_Utf8Const *init_name = _Jv_makeUtf8Const ("<init>", 6);
|
||||
|
||||
|
@ -78,6 +66,8 @@ static void throw_incompatible_class_change_error (jstring msg)
|
|||
_Jv_word
|
||||
_Jv_ResolvePoolEntry (jclass klass, int index)
|
||||
{
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
_Jv_Constants *pool = &klass->constants;
|
||||
|
||||
if ((pool->tags[index] & JV_CONSTANT_ResolvedFlag) != 0)
|
||||
|
@ -101,7 +91,7 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
|
|||
JvThrow (new java::lang::ClassNotFoundException (str));
|
||||
}
|
||||
|
||||
if ((found->accflags & PUBLIC) == PUBLIC
|
||||
if ((found->accflags & Modifier::PUBLIC) == Modifier::PUBLIC
|
||||
|| (_Jv_ClassNameSamePackage (found->name,
|
||||
klass->name)))
|
||||
{
|
||||
|
@ -171,10 +161,10 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
|
|||
// now, check field access.
|
||||
|
||||
if ( (cls == klass)
|
||||
|| ((field->flags & PUBLIC) != 0)
|
||||
|| (((field->flags & PROTECTED) != 0)
|
||||
|| ((field->flags & Modifier::PUBLIC) != 0)
|
||||
|| (((field->flags & Modifier::PROTECTED) != 0)
|
||||
&& cls->isAssignableFrom (klass))
|
||||
|| (((field->flags & PRIVATE) == 0)
|
||||
|| (((field->flags & Modifier::PRIVATE) == 0)
|
||||
&& _Jv_ClassNameSamePackage (cls->name,
|
||||
klass->name)))
|
||||
{
|
||||
|
@ -255,10 +245,10 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
|
|||
continue;
|
||||
|
||||
if (cls == klass
|
||||
|| ((method->accflags & PUBLIC) != 0)
|
||||
|| (((method->accflags & PROTECTED) != 0)
|
||||
|| ((method->accflags & Modifier::PUBLIC) != 0)
|
||||
|| (((method->accflags & Modifier::PROTECTED) != 0)
|
||||
&& cls->isAssignableFrom (klass))
|
||||
|| (((method->accflags & PRIVATE) == 0)
|
||||
|| (((method->accflags & Modifier::PRIVATE) == 0)
|
||||
&& _Jv_ClassNameSamePackage (cls->name,
|
||||
klass->name)))
|
||||
{
|
||||
|
@ -306,7 +296,7 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
|
|||
pool->data[index].rmethod =
|
||||
_Jv_BuildResolvedMethod(the_method,
|
||||
found_class,
|
||||
((the_method->accflags & STATIC) != 0),
|
||||
(the_method->accflags & Modifier::STATIC) != 0,
|
||||
vtable_index);
|
||||
pool->tags[index] |= JV_CONSTANT_ResolvedFlag;
|
||||
}
|
||||
|
@ -357,6 +347,8 @@ _Jv_DetermineVTableIndex (jclass klass,
|
|||
_Jv_Utf8Const *name,
|
||||
_Jv_Utf8Const *signature)
|
||||
{
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
jclass super_class = klass->getSuperclass ();
|
||||
|
||||
if (super_class != NULL)
|
||||
|
@ -390,8 +382,10 @@ _Jv_DetermineVTableIndex (jclass klass,
|
|||
* 3) it is the method <init>
|
||||
*/
|
||||
|
||||
if ( (meth->accflags & (STATIC|PRIVATE|FINAL)) != 0
|
||||
|| (klass->accflags & FINAL) != 0
|
||||
if ((meth->accflags & (Modifier::STATIC
|
||||
| Modifier::PRIVATE
|
||||
| Modifier::FINAL)) != 0
|
||||
|| (klass->accflags & Modifier::FINAL) != 0
|
||||
|| _Jv_equalUtf8Consts (name, init_name))
|
||||
return -1;
|
||||
|
||||
|
@ -422,7 +416,7 @@ _Jv_DetermineVTableIndex (jclass klass,
|
|||
/* fist some checks for things that surely do not go in the
|
||||
* vtable */
|
||||
|
||||
if ((m->accflags & (STATIC|PRIVATE)) != 0)
|
||||
if ((m->accflags & (Modifier::STATIC | Modifier::PRIVATE)) != 0)
|
||||
continue;
|
||||
if (_Jv_equalUtf8Consts (m->name, init_name))
|
||||
continue;
|
||||
|
@ -439,7 +433,7 @@ _Jv_DetermineVTableIndex (jclass klass,
|
|||
|
||||
/* but if it is final, and not declared in the super class,
|
||||
* then we also skip it */
|
||||
if ((m->accflags & FINAL) != 0)
|
||||
if ((m->accflags & Modifier::FINAL) != 0)
|
||||
continue;
|
||||
|
||||
/* finally, we can assign the index of this method */
|
||||
|
@ -460,6 +454,8 @@ _Jv_abstractMethodError ()
|
|||
void
|
||||
_Jv_PrepareClass(jclass klass)
|
||||
{
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
/*
|
||||
* The job of this function is to: 1) assign storage to fields, and 2)
|
||||
* build the vtable. static fields are assigned real memory, instance
|
||||
|
@ -527,7 +523,7 @@ _Jv_PrepareClass(jclass klass)
|
|||
field->bsize = field_size;
|
||||
#endif
|
||||
|
||||
if (field->flags & STATIC)
|
||||
if (field->flags & Modifier::STATIC)
|
||||
{
|
||||
/* this computes an offset into a region we'll allocate
|
||||
shortly, and then add this offset to the start address */
|
||||
|
@ -558,7 +554,7 @@ _Jv_PrepareClass(jclass klass)
|
|||
{
|
||||
_Jv_Field *field = &clz->fields[i];
|
||||
|
||||
if ((field->flags & STATIC) != 0)
|
||||
if ((field->flags & Modifier::STATIC) != 0)
|
||||
{
|
||||
field->u.addr = static_data + field->u.boffset;
|
||||
|
||||
|
@ -590,7 +586,7 @@ _Jv_PrepareClass(jclass klass)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((clz->methods[i].accflags & NATIVE) != 0)
|
||||
if ((clz->methods[i].accflags & Modifier::NATIVE) != 0)
|
||||
{
|
||||
JvThrow
|
||||
(new java::lang::VirtualMachineError
|
||||
|
@ -600,7 +596,7 @@ _Jv_PrepareClass(jclass klass)
|
|||
}
|
||||
}
|
||||
|
||||
if (clz->accflags & INTERFACE)
|
||||
if (clz->accflags & Modifier::INTERFACE)
|
||||
{
|
||||
clz->state = JV_STATE_PREPARED;
|
||||
clz->notifyAll ();
|
||||
|
@ -627,7 +623,7 @@ _Jv_PrepareClass(jclass klass)
|
|||
{
|
||||
_Jv_Method *this_meth = &clz->methods[i];
|
||||
|
||||
if ((this_meth->accflags & (STATIC|PRIVATE)) != 0
|
||||
if ((this_meth->accflags & (Modifier::STATIC | Modifier::PRIVATE)) != 0
|
||||
|| _Jv_equalUtf8Consts (this_meth->name, init_name))
|
||||
{
|
||||
/* skip this, it doesn't go in the vtable */
|
||||
|
@ -641,17 +637,19 @@ _Jv_PrepareClass(jclass klass)
|
|||
if (orig_meth == 0)
|
||||
{
|
||||
// new methods that are final, also don't go in the vtable
|
||||
if ((this_meth->accflags & FINAL) != 0)
|
||||
if ((this_meth->accflags & Modifier::FINAL) != 0)
|
||||
continue;
|
||||
|
||||
new_method_count += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((orig_meth->accflags & (STATIC|PRIVATE|FINAL)) != 0
|
||||
|| ((orig_meth->accflags & ABSTRACT) == 0
|
||||
&& (this_meth->accflags & ABSTRACT) != 0
|
||||
&& (klass->accflags & ABSTRACT) == 0))
|
||||
if ((orig_meth->accflags & (Modifier::STATIC
|
||||
| Modifier::PRIVATE
|
||||
| Modifier::FINAL)) != 0
|
||||
|| ((orig_meth->accflags & Modifier::ABSTRACT) == 0
|
||||
&& (this_meth->accflags & Modifier::ABSTRACT) != 0
|
||||
&& (klass->accflags & Modifier::ABSTRACT) == 0))
|
||||
{
|
||||
clz->state = JV_STATE_ERROR;
|
||||
clz->notifyAll ();
|
||||
|
@ -715,6 +713,8 @@ _Jv_PrepareClass(jclass klass)
|
|||
void
|
||||
_Jv_InitField (jobject obj, jclass klass, int index)
|
||||
{
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
if (obj != 0 && klass == 0)
|
||||
klass = obj->getClass ();
|
||||
|
||||
|
@ -738,12 +738,12 @@ _Jv_InitField (jobject obj, jclass klass, int index)
|
|||
if (! field->isResolved ())
|
||||
throw_internal_error ("initializing unresolved field");
|
||||
|
||||
if (obj==0 && ((field->flags & STATIC) == 0))
|
||||
if (obj==0 && ((field->flags & Modifier::STATIC) == 0))
|
||||
throw_internal_error ("initializing non-static field with no object");
|
||||
|
||||
void *addr = 0;
|
||||
|
||||
if ((field->flags & STATIC) != 0)
|
||||
if ((field->flags & Modifier::STATIC) != 0)
|
||||
addr = (void*) field->u.addr;
|
||||
else
|
||||
addr = (void*) (((char*)obj) + field->u.boffset);
|
||||
|
@ -1002,12 +1002,15 @@ typedef struct {
|
|||
|
||||
typedef void (*ffi_closure_fun) (ffi_cif*,void*,ffi_raw*,void*);
|
||||
|
||||
void* _Jv_InterpMethod::ncode ()
|
||||
void *
|
||||
_Jv_InterpMethod::ncode ()
|
||||
{
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
if (self->ncode != 0)
|
||||
return self->ncode;
|
||||
|
||||
jboolean staticp = (self->accflags & STATIC) != 0;
|
||||
jboolean staticp = (self->accflags & Modifier::STATIC) != 0;
|
||||
int arg_count = count_arguments (self->signature, staticp);
|
||||
|
||||
ncode_closure *closure =
|
||||
|
@ -1024,7 +1027,7 @@ void* _Jv_InterpMethod::ncode ()
|
|||
|
||||
args_raw_size = ffi_raw_size (&closure->cif);
|
||||
|
||||
if ((self->accflags & SYNCHRONIZED) != 0)
|
||||
if ((self->accflags & Modifier::SYNCHRONIZED) != 0)
|
||||
{
|
||||
if (staticp)
|
||||
fun = (ffi_closure_fun)&_Jv_InterpMethod::run_synch_class;
|
||||
|
@ -1098,4 +1101,4 @@ throw_internal_error (char *msg)
|
|||
}
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* INTERPRETER */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue