Commit 7941ceab by Anthony Green

[multiple changes]

Mon Aug  9 18:33:38 1999  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

        * Makefile: Rebuilt.
	* Makefile.am (toolexeclibdir): Add $(MULTISUBDIR) even for native
	builds.

	* java/net/natPlainSocketImpl.cc: Include <sys/select.h> only if
	present.

	* configure: Rebuilt.
	* configure.in: Properly align --help output, fix capitalization
	and punctuation.
	* acinclude.m4: Likewise.

1999-08-09  Kresten Krab Thorup  <krab@gnu.org>

	* include/javaprims.h (_Jv_word, _Jv_word2): New types.

	* include/java-interp.h (_Jv_InterpMethodInvocation): Use _Jv_word.
	(_Jv_callInterpretedMethod): Unused. Remove.
	(_Jv_InterpMethod::run,run_normal,run_synch_object,run_synch_class):
	Use ffi_raw.
	* include/java-cpool.h (_Jv_get, _Jv_put): Remove.
	(_Jv_{store,load}{Indexes,Int,Float,Long,Double}): Use _Jv_word.
	* boehm.cc (_Jv_MarkObj): Use _Jv_word.
	* interpret.cc: use _Jv_word.
	* defineclass.cc: use_Jv_word.
	* resolve.cc: Use _Jv_word.
	(_Jv_ResolvePoolEntry): Return _Jv_word.
	* java/lang/Class.h (_Jv_Constants): Use _Jv_word for cpool.
	* java/lang/natClassLoader.cc (_Jv_InternClassStrings): Use _Jv_word.

	* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
	Change comment.

From-SVN: r28641
parent 3ef1cea8
Mon Aug 9 18:33:38 1999 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* Makefile: Rebuilt.
* Makefile.am (toolexeclibdir): Add $(MULTISUBDIR) even for native
builds.
* java/net/natPlainSocketImpl.cc: Include <sys/select.h> only if
present.
* configure: Rebuilt.
* configure.in: Properly align --help output, fix capitalization
and punctuation.
* acinclude.m4: Likewise.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* include/javaprims.h (_Jv_word, _Jv_word2): New types.
* include/java-interp.h (_Jv_InterpMethodInvocation): Use _Jv_word.
(_Jv_callInterpretedMethod): Unused. Remove.
(_Jv_InterpMethod::run,run_normal,run_synch_object,run_synch_class):
Use ffi_raw.
* include/java-cpool.h (_Jv_get, _Jv_put): Remove.
(_Jv_{store,load}{Indexes,Int,Float,Long,Double}): Use _Jv_word.
* boehm.cc (_Jv_MarkObj): Use _Jv_word.
* interpret.cc: use _Jv_word.
* defineclass.cc: use_Jv_word.
* resolve.cc: Use _Jv_word.
(_Jv_ResolvePoolEntry): Return _Jv_word.
* java/lang/Class.h (_Jv_Constants): Use _Jv_word for cpool.
* java/lang/natClassLoader.cc (_Jv_InternClassStrings): Use _Jv_word.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Change comment.
Mon Aug 9 18:33:38 1999 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* configure: Rebuilt.
* configure.in (sched_yield): Try librt first, then libposix4.
Add -lrt, -lposix4 to THREADSPEC.
......
......@@ -15,7 +15,7 @@ endif
## Install a library built with a cross compiler in tooldir, not
## libdir.
if USE_LIBDIR
toolexeclibdir = $(libdir)
toolexeclibdir = $(libdir)$(MULTISUBDIR)
else
toolexecdir = $(exec_prefix)/$(target_alias)
toolexeclibdir = $(toolexecdir)/lib$(MULTISUBDIR)
......
......@@ -110,7 +110,7 @@ AUTOMAKE_OPTIONS = foreign no-installinfo
@TESTSUBDIR_TRUE@SUBDIRS = \
@TESTSUBDIR_TRUE@testsuite
@USE_LIBDIR_TRUE@toolexeclibdir = \
@USE_LIBDIR_TRUE@$(libdir)
@USE_LIBDIR_TRUE@$(libdir)$(MULTISUBDIR)
@USE_LIBDIR_FALSE@toolexeclibdir = \
@USE_LIBDIR_FALSE@$(toolexecdir)/lib$(MULTISUBDIR)
@USE_LIBDIR_FALSE@toolexecdir = \
......
......@@ -13,7 +13,7 @@ Gilles Zunino Gilles.Zunino@hei.fr
Kresten Krab Thorup krab@gnu.org
Per Bothner per@bothner.com
Rainer Orth ro@TechFak.Uni-Bielefeld.DE
Stu Grossman grossman@juniper.com
Stu Grossman grossman@juniper.net
Tom Tromey tromey@cygnus.com
Urban Widmark urban@svenskatest.se
Warren Levy warrenl@cygnus.com
......@@ -8,7 +8,7 @@ AC_DEFUN(LIBGCJ_CONFIGURE,
[
dnl Default to --enable-multilib
AC_ARG_ENABLE(multilib,
[ --enable-multilib build many library versions (default)],
[ --enable-multilib build many library versions (default)],
[case "${enableval}" in
yes) multilib=yes ;;
no) multilib=no ;;
......
......@@ -112,7 +112,8 @@ _Jv_MarkObj (void *addr, void *msp, void *msl, void * /*env*/)
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, c, c4label);
for (int i = 0; i < c->constants.size; ++i)
{
w = (word) c->constants.data[i];
/* FIXME: We could make this more precise by using the tags -KKT */
w = (word) c->constants.data[i].p;
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, c, c5label);
}
......
......@@ -8,9 +8,10 @@ AC_CANONICAL_SYSTEM
dnl We use these options to decide which functions to include.
AC_ARG_WITH(target-subdir,
[ --with-target-subdir=SUBDIR Configuring in a subdirectory])
[ --with-target-subdir=SUBDIR
configuring in a subdirectory])
AC_ARG_WITH(cross-host,
[ --with-cross-host=HOST Configuring with a cross compiler])
[ --with-cross-host=HOST configuring with a cross compiler])
LIBGCJ_CONFIGURE(.)
......@@ -31,20 +32,20 @@ AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
dnl See whether the user prefers size or speed for Character.
dnl The default is size.
AC_ARG_ENABLE(fast-character,
[ --enable-fast-character Prefer speed over size for Character],
[ --enable-fast-character prefer speed over size for Character],
# Nothing
, AC_DEFINE(COMPACT_CHARACTER))
dnl See if the user has requested runtime debugging.
AC_ARG_ENABLE(libgcj-debug,
[ --enable-libgcj-debug Enable runtime debugging code],
[ --enable-libgcj-debug enable runtime debugging code],
if test "$enable_libgcj_debug" = yes; then
AC_DEFINE(DEBUG)
fi)
dnl See if the user has the enterpreter included.
AC_ARG_ENABLE(interpreter,
[ --enable-interpreter Enable interpreter],
[ --enable-interpreter enable interpreter],
if test "$enable_interpreter" = yes; then
AC_DEFINE(INTERPRETER)
fi)
......@@ -59,7 +60,7 @@ dnl FIXME: this should not be a local option but a global target
dnl system; at present there is no eCos target.
TARGET_ECOS="no"
AC_ARG_WITH(ecos,
[ --with-ecos Enable runtime eCos target support.],
[ --with-ecos enable runtime eCos target support],
TARGET_ECOS="$with_ecos"
)
......@@ -101,7 +102,7 @@ SYSTEMSPEC=
AC_SUBST(SYSTEMSPEC)
AC_ARG_WITH(system-zlib,
[ --with-system-zlib Use installed libz])
[ --with-system-zlib use installed libz])
ZLIBSPEC=
AC_SUBST(ZLIBSPEC)
......@@ -112,7 +113,7 @@ dnl Allow the GC to be disabled. Can be useful when debugging.
AC_MSG_CHECKING([for garbage collector to use])
AC_ARG_ENABLE(java-gc,
changequote(<<,>>)dnl
<< --enable-java-gc=TYPE choose garbage collector [boehm]>>,
<< --enable-java-gc=TYPE choose garbage collector [boehm]>>,
changequote([,])
GC=$enableval,
GC=boehm)
......@@ -159,7 +160,7 @@ dnl Note that this code is kept in sync with similar code in gcc/configure.in.
dnl In particular both packages must make the same decision about which
dnl thread package to use.
AC_MSG_CHECKING([for threads package to use])
AC_ARG_ENABLE(threads, [ --enable-threads=TYPE choose threading package],
AC_ARG_ENABLE(threads, [ --enable-threads=TYPE choose threading package],
THREADS=$enableval,
dnl FIXME: figure out native threads to use here.
THREADS=no)
......
......@@ -614,7 +614,8 @@ void _Jv_ClassReader::handleConstantPool ()
// the pool is scanned explicitly by the collector
jbyte *pool_tags = (jbyte*) _Jv_AllocBytesChecked (pool_count);
void **pool_data = (void**) _Jv_AllocBytesChecked (pool_count * sizeof (void*));
_Jv_word *pool_data
= (_Jv_word*) _Jv_AllocBytesChecked (pool_count * sizeof (_Jv_word));
def->constants.tags = pool_tags;
def->constants.data = pool_data;
......@@ -634,7 +635,7 @@ void _Jv_ClassReader::handleConstantPool ()
check_tag (utf_index, JV_CONSTANT_Utf8);
unsigned char *utf_data = bytes + offsets[utf_index];
int len = get2u (utf_data);
pool_data[i] = (void*)_Jv_makeUtf8Const ((char*)(utf_data+2), len);
pool_data[i].utf8 = _Jv_makeUtf8Const ((char*)(utf_data+2), len);
pool_tags[i] = JV_CONSTANT_String;
}
else
......@@ -671,7 +672,7 @@ _Jv_ClassReader::prepare_pool_entry (int index, unsigned char this_tag)
structure we are currently defining */
unsigned char *pool_tags = (unsigned char*) def->constants.tags;
void **pool_data = (void**) def->constants.data;
_Jv_word *pool_data = def->constants.data;
/* this entry was already prepared */
if (pool_tags[index] == this_tag)
......@@ -703,7 +704,7 @@ _Jv_ClassReader::prepare_pool_entry (int index, unsigned char this_tag)
buffer[i] = (char) s[i];
}
pool_data[index] = (void*)_Jv_makeUtf8Const (buffer, len);
pool_data[index].utf8 = _Jv_makeUtf8Const (buffer, len);
pool_tags[index] = JV_CONSTANT_Utf8;
}
break;
......@@ -715,9 +716,9 @@ _Jv_ClassReader::prepare_pool_entry (int index, unsigned char this_tag)
prepare_pool_entry (utf_index, JV_CONSTANT_Utf8);
if (verify)
_Jv_VerifyClassName ((_Jv_Utf8Const*)pool_data[utf_index]);
_Jv_VerifyClassName (pool_data[utf_index].utf8);
pool_data[index] = pool_data[utf_index];
pool_data[index].utf8 = pool_data[utf_index].utf8;
pool_tags[index] = JV_CONSTANT_Class;
}
break;
......@@ -743,24 +744,22 @@ _Jv_ClassReader::prepare_pool_entry (int index, unsigned char this_tag)
if (verify)
{
_Jv_ushort name_index, type_index;
_Jv_loadIndexes ((const void**)&pool_data[nat_index],
_Jv_loadIndexes (&pool_data[nat_index],
name_index, type_index);
if (this_tag == JV_CONSTANT_Fieldref)
_Jv_VerifyFieldSignature
((_Jv_Utf8Const*)pool_data[type_index]);
_Jv_VerifyFieldSignature (pool_data[type_index].utf8);
else
_Jv_VerifyMethodSignature
((_Jv_Utf8Const*)pool_data[type_index]);
_Jv_VerifyMethodSignature (pool_data[type_index].utf8);
_Jv_Utf8Const* name = (_Jv_Utf8Const*)pool_data[name_index];
_Jv_Utf8Const* name = pool_data[name_index].utf8;
if (this_tag != JV_CONSTANT_Fieldref
&& ( _Jv_equalUtf8Consts (name, clinit_name)
|| _Jv_equalUtf8Consts (name, init_name)))
/* ignore */;
else
_Jv_VerifyIdentifier ((_Jv_Utf8Const*)pool_data[name_index]);
_Jv_VerifyIdentifier (pool_data[name_index].utf8);
}
_Jv_storeIndexes (&pool_data[index], class_index, nat_index);
......@@ -827,10 +826,10 @@ _Jv_ClassReader::handleClassBegin
(int access_flags, int this_class, int super_class)
{
unsigned char *pool_tags = (unsigned char*) def->constants.tags;
void **pool_data = (void**) def->constants.data;
_Jv_word *pool_data = def->constants.data;
check_tag (this_class, JV_CONSTANT_Class);
_Jv_Utf8Const *loadedName = (_Jv_Utf8Const*)pool_data[this_class];
_Jv_Utf8Const *loadedName = pool_data[this_class].utf8;
// was ClassLoader.defineClass called with an expected class name?
if (def->name == 0)
......@@ -865,7 +864,7 @@ _Jv_ClassReader::handleClassBegin
}
def->accflags = access_flags;
pool_data[this_class] = (void*)def;
pool_data[this_class].clazz = def;
pool_tags[this_class] = JV_CONSTANT_ResolvedClass;
if (super_class == 0)
......@@ -894,8 +893,7 @@ _Jv_ClassReader::handleClassBegin
{
// load the super class
check_tag (super_class, JV_CONSTANT_Class);
_Jv_Utf8Const* super_name =
(_Jv_Utf8Const*)pool_data[super_class];
_Jv_Utf8Const* super_name = pool_data[super_class].utf8;
// load the super class using our defining loader
jclass the_super = _Jv_FindClass (super_name,
......@@ -906,7 +904,7 @@ _Jv_ClassReader::handleClassBegin
checkExtends (def, the_super);
def->superclass = the_super;
pool_data[super_class] = (void*) the_super;
pool_data[super_class].clazz = the_super;
pool_tags[super_class] = JV_CONSTANT_ResolvedClass;
}
......@@ -956,19 +954,19 @@ void _Jv_ClassReader::handleInterfacesBegin (int count)
void _Jv_ClassReader::handleInterface (int if_number, int offset)
{
void ** pool_data = def->constants.data;
_Jv_word * pool_data = def->constants.data;
unsigned char * pool_tags = (unsigned char*) def->constants.tags;
jclass the_interface;
if (pool_tags[offset] == JV_CONSTANT_Class)
{
_Jv_Utf8Const* name = (_Jv_Utf8Const*) pool_data[offset];
_Jv_Utf8Const* name = pool_data[offset].utf8;
the_interface = _Jv_FindClass (name, def->loader);
}
else if (pool_tags[offset] == JV_CONSTANT_ResolvedClass)
{
the_interface = (jclass)pool_data[offset];
the_interface = pool_data[offset].clazz;
}
else
{
......@@ -979,7 +977,7 @@ void _Jv_ClassReader::handleInterface (int if_number, int offset)
// allowed to implement that interface.
checkImplements (def, the_interface);
pool_data[offset] = (void*)the_interface;
pool_data[offset].clazz = the_interface;
pool_tags[offset] = JV_CONSTANT_ResolvedClass;
def->interfaces[if_number] = the_interface;
......@@ -1028,10 +1026,10 @@ void _Jv_ClassReader::handleField (int field_no,
int name,
int desc)
{
void **const pool_data = def->constants.data;
_Jv_word *pool_data = def->constants.data;
_Jv_Field *field = &def->fields[field_no];
_Jv_Utf8Const *field_name = (_Jv_Utf8Const*) pool_data[name];
_Jv_Utf8Const *field_name = pool_data[name].utf8;
#ifndef COMPACT_FIELDS
field->name = field_name;
......@@ -1056,7 +1054,7 @@ void _Jv_ClassReader::handleField (int field_no,
throw_class_format_error ("erroneous field access flags");
}
_Jv_Utf8Const* sig = (_Jv_Utf8Const*) pool_data[desc];
_Jv_Utf8Const* sig = pool_data[desc].utf8;
if (verify)
_Jv_VerifyFieldSignature (sig);
......@@ -1158,16 +1156,16 @@ void _Jv_ClassReader::handleMethodsBegin (int count)
void _Jv_ClassReader::handleMethod
(int mth_index, int accflags, int name, int desc)
{
void **const pool_data = def->constants.data;
_Jv_word *pool_data = def->constants.data;
_Jv_Method *method = &def->methods[mth_index];
check_tag (name, JV_CONSTANT_Utf8);
prepare_pool_entry (name, JV_CONSTANT_Utf8);
method->name = (_Jv_Utf8Const*)pool_data[name];
method->name = pool_data[name].utf8;
check_tag (desc, JV_CONSTANT_Utf8);
prepare_pool_entry (desc, JV_CONSTANT_Utf8);
method->signature = (_Jv_Utf8Const*)pool_data[desc];
method->signature = pool_data[desc].utf8;
// ignore unknown flags
method->accflags = accflags & ALL_FLAGS;
......
......@@ -31,142 +31,86 @@ details. */
#define JV_CONSTANT_ResolvedString (16L | 8L)
#define JV_CONSTANT_ResolvedClass (16L | 7L)
/* We use the following two operations uniformly for all put/get operations
* in the runtime system (constant pool & stack), to assure that we keep
* everything in the same format. The idea is, that these should be inlined
* away, into just a simple store (for small data types, and a pair of stores
* if double or long has alignment greater than void *. On an 64-bit
* architecture, all operations should be simple stores; on a 32-bit
* architecture it depends on the alignment requirement for the specific
* type. */
template <class T>
static inline void _Jv_put (void *dst, T value)
{
#if 0
if (sizeof (T) == 8 && __alignof__ (T) > __alignof__ (void*))
{
jint *v_dst = (jint*)(dst);
jint *v_src = (jint*)&value;
v_dst[0] = v_src[0];
v_dst[1] = v_src[1];
}
else
#endif
{
*((T*) (dst)) = value;
}
}
template <class T>
static inline T _Jv_get (void *src)
{
#if 0
if (sizeof (T) == 8 && __alignof__ (T) > __alignof__ (void*))
{
T value;
jint *v_dst = (jint*)&value;
jint *v_src = (jint*)src;
v_dst[0] = v_src[0];
v_dst[1] = v_src[1];
return value;
}
else
#endif
{
return *((T*) (src));
}
}
/** needed to keep the CONSTANT_XXXRef & CONSTANT_NameAndType entries */
extern inline void
_Jv_storeIndexes (void **data,
_Jv_storeIndexes (_Jv_word *data,
_Jv_ushort index0,
_Jv_ushort index1)
{
// accomodate 64bit machines...
if (sizeof (void*) == (2 * sizeof (jint)))
{
((jint*)data)[0] = index0;
((jint*)data)[1] = index0;
}
else
{
_Jv_put<jint>(data, ((jint)index0 << 16) | (jint)index1);
}
data->i = (((jint)index0) << 16) | (jint) index1;
}
extern inline void
_Jv_loadIndexes (const void **data,
_Jv_loadIndexes (const _Jv_word *data,
_Jv_ushort& index0,
_Jv_ushort& index1)
{
if (sizeof (void*) == (2*sizeof (jint)))
{
index0 = ((jint*)data)[0];
index0 = ((jint*)data)[1];
}
else
{
jint udata = _Jv_get<jint>(data);
jint udata = data->i;
_Jv_uint uindex0 = ((udata >> 16) & 0xffff);
_Jv_uint uindex1 = udata & 0xffff;
_Jv_uint uindex0 = ((udata >> 16) & 0xffff);
_Jv_uint uindex1 = udata & 0xffff;
index0 = uindex0;
index1 = uindex1;
}
index0 = uindex0;
index1 = uindex1;
}
extern inline void
_Jv_storeFloat (void **data, jfloat f)
_Jv_storeFloat (_Jv_word *data, jfloat f)
{
_Jv_put<jfloat>(data, f);
data->f = f;
}
extern inline jfloat
_Jv_loadFloat (void **data)
_Jv_loadFloat (_Jv_word *data)
{
return _Jv_get<jfloat>(data);
return data->f;
}
extern inline void
_Jv_storeInt (void **data, jint i)
_Jv_storeInt (_Jv_word *data, jint i)
{
_Jv_put<jint>(data, i);
data->i = i;
}
extern inline jint
_Jv_loadInt (void **data)
_Jv_loadInt (_Jv_word *data)
{
return _Jv_get<jint>(data);
return data->i;
}
extern inline void
_Jv_storeLong (void **data, jlong l)
_Jv_storeLong (_Jv_word *data, jlong l)
{
return _Jv_put<jlong>(data, l);
_Jv_word2 tmp;
tmp.l = l;
data[0].ia[0] = tmp.ia[0];
data[1].ia[0] = tmp.ia[1];
}
extern inline jlong
_Jv_loadLong (void **data)
_Jv_loadLong (_Jv_word *data)
{
return _Jv_get<jlong>(data);
_Jv_word2 tmp;
tmp.ia[0] = data[0].ia[0];
tmp.ia[1] = data[1].ia[0];
return tmp.l;
}
extern inline void
_Jv_storeDouble (void **data, jdouble d)
_Jv_storeDouble (_Jv_word *data, jdouble d)
{
_Jv_put<jdouble>(data, d);
_Jv_word2 tmp;
tmp.d = d;
data[0].ia[0] = tmp.ia[0];
data[1].ia[0] = tmp.ia[1];
}
extern inline jdouble
_Jv_loadDouble (void **data)
_Jv_loadDouble (_Jv_word *data)
{
return _Jv_get<jdouble> (data);
_Jv_word2 tmp;
tmp.ia[0] = data[0].ia[0];
tmp.ia[1] = data[1].ia[0];
return tmp.d;
}
......
......@@ -105,11 +105,11 @@ class _Jv_InterpMethod {
void *ncode ();
void continue1 (_Jv_InterpMethodInvocation *inv);
static void run_normal (ffi_cif*, void*, void**, void*);
static void run_synch_object (ffi_cif*, void*, void**, void*);
static void run_synch_class (ffi_cif*, void*, void**, void*);
static void run_normal (ffi_cif*, void*, ffi_raw*, void*);
static void run_synch_object (ffi_cif*, void*, ffi_raw*, void*);
static void run_synch_class (ffi_cif*, void*, ffi_raw*, void*);
inline jobject run (ffi_cif*, void*, void**,
inline jobject run (ffi_cif*, void*, ffi_raw*,
_Jv_InterpMethodInvocation*);
bool find_exception (jobject ex,
......@@ -123,21 +123,16 @@ class _Jv_InterpMethod {
friend class gnu::gcj::runtime::MethodInvocation;
friend void _Jv_PrepareClass(jclass);
friend void _Jv_callInterpretedMethod (ffi_cif*,
void*,
void **,
void*);
};
class _Jv_InterpMethodInvocation {
_Jv_InterpMethod *running;
void **sp;
_Jv_word *sp;
unsigned char *pc;
void* state[0];
_Jv_word state[0];
void** stack_base () { return &state[0]; }
void** local_base () { return &state[running->max_stack]; }
_Jv_word* stack_base () { return &state[0]; }
_Jv_word* local_base () { return &state[running->max_stack]; }
friend class _Jv_InterpMethod;
};
......
......@@ -261,6 +261,27 @@ extern "C" void _Jv_Free (void*);
typedef unsigned short _Jv_ushort __attribute__((__mode__(__HI__)));
typedef unsigned int _Jv_uint __attribute__((__mode__(__SI__)));
typedef union {
jobject o;
jint i; // Also stores smaller integral types.
jfloat f;
jint ia[1]; // Half of _Jv_word2.
void* p;
// these are things we will store in the constant
jclass clazz;
jstring string;
struct _Jv_Field *field;
struct _Jv_Utf8Const *utf8;
struct _Jv_ResolvedMethod *rmethod;
} _Jv_word;
typedef union {
jint ia[2];
jlong l;
jdouble d;
} _Jv_word2;
struct _Jv_Utf8Const
{
_Jv_ushort hash;
......
......@@ -49,7 +49,7 @@ struct _Jv_Constants
{
jint size;
jbyte *tags;
void **data;
_Jv_word *data;
};
struct _Jv_Method
......@@ -192,7 +192,7 @@ private:
friend int _Jv_DetermineVTableIndex (jclass, _Jv_Utf8Const *,
_Jv_Utf8Const*);
friend void _Jv_InitField (jobject, jclass, int);
friend void* _Jv_ResolvePoolEntry (jclass, int);
friend _Jv_word _Jv_ResolvePoolEntry (jclass, int);
friend void _Jv_PrepareClass (jclass);
friend class _Jv_ClassReader;
......
......@@ -233,8 +233,8 @@ _Jv_InternClassStrings(jclass klass)
if (pool->tags[i] == JV_CONSTANT_String)
{
jstring str;
str = _Jv_NewStringUtf8Const ((_Jv_Utf8Const *) pool->data[i]);
pool->data[i] = (void *) str;
str = _Jv_NewStringUtf8Const (pool->data[i].utf8);
pool->data[i].string = str;
pool->tags[i] |= JV_CONSTANT_ResolvedFlag;
}
}
......
......@@ -11,7 +11,9 @@ details. */
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <errno.h>
......
......@@ -75,7 +75,7 @@ static void throw_incompatible_class_change_error (jstring msg)
JvThrow (new java::lang::IncompatibleClassChangeError (msg));
}
void*
_Jv_word
_Jv_ResolvePoolEntry (jclass klass, int index)
{
_Jv_Constants *pool = &klass->constants;
......@@ -86,7 +86,7 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
switch (pool->tags[index]) {
case JV_CONSTANT_Class:
{
_Jv_Utf8Const *name = (_Jv_Utf8Const *) pool->data[index];
_Jv_Utf8Const *name = pool->data[index].utf8;
jclass found;
if (name->data[0] == '[')
......@@ -105,7 +105,7 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
|| (_Jv_ClassNameSamePackage (found->name,
klass->name)))
{
pool->data[index] = (void *) found;
pool->data[index].clazz = found;
pool->tags[index] |= JV_CONSTANT_ResolvedFlag;
}
else
......@@ -118,8 +118,8 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
case JV_CONSTANT_String:
{
jstring str;
str = _Jv_NewStringUtf8Const ((_Jv_Utf8Const *) pool->data[index]);
pool->data[index] = (void *) str;
str = _Jv_NewStringUtf8Const (pool->data[index].utf8);
pool->data[index].o = str;
pool->tags[index] |= JV_CONSTANT_ResolvedFlag;
}
break;
......@@ -127,22 +127,21 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
case JV_CONSTANT_Fieldref:
{
_Jv_ushort class_index, name_and_type_index;
_Jv_loadIndexes ((const void**) &pool->data[index],
_Jv_loadIndexes (&pool->data[index],
class_index,
name_and_type_index);
jclass owner = (jclass) _Jv_ResolvePoolEntry (klass, class_index);
jclass owner = (_Jv_ResolvePoolEntry (klass, class_index)).clazz;
if (owner != klass)
_Jv_InitClass (owner);
_Jv_ushort name_index, type_index;
_Jv_loadIndexes ((const void**) &pool->data[name_and_type_index],
_Jv_loadIndexes (&pool->data[name_and_type_index],
name_index,
type_index);
_Jv_Utf8Const *field_name = (_Jv_Utf8Const*) pool->data[name_index];
_Jv_Utf8Const *field_type_name =
(_Jv_Utf8Const*) pool->data[type_index];
_Jv_Utf8Const *field_name = pool->data[name_index].utf8;
_Jv_Utf8Const *field_type_name = pool->data[type_index].utf8;
// FIXME: The implementation of this function
// (_Jv_FindClassFromSignature) will generate an instance of
......@@ -211,7 +210,7 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
throw_incompatible_class_change_error (msg);
}
pool->data[index] = (void*)the_field;
pool->data[index].field = the_field;
pool->tags[index] |= JV_CONSTANT_ResolvedFlag;
}
break;
......@@ -220,22 +219,21 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
case JV_CONSTANT_InterfaceMethodref:
{
_Jv_ushort class_index, name_and_type_index;
_Jv_loadIndexes ((const void**) &pool->data[index],
_Jv_loadIndexes (&pool->data[index],
class_index,
name_and_type_index);
jclass owner = (jclass) _Jv_ResolvePoolEntry (klass, class_index);
jclass owner = (_Jv_ResolvePoolEntry (klass, class_index)).clazz;
if (owner != klass)
_Jv_InitClass (owner);
_Jv_ushort name_index, type_index;
_Jv_loadIndexes ((const void**) &pool->data[name_and_type_index],
_Jv_loadIndexes (&pool->data[name_and_type_index],
name_index,
type_index);
_Jv_Utf8Const *method_name = (_Jv_Utf8Const*) pool->data[name_index];
_Jv_Utf8Const *method_signature =
(_Jv_Utf8Const*) pool->data[type_index];
_Jv_Utf8Const *method_name = pool->data[name_index].utf8;
_Jv_Utf8Const *method_signature = pool->data[type_index].utf8;
int vtable_index = -1;
_Jv_Method *the_method = 0;
......@@ -304,7 +302,7 @@ _Jv_ResolvePoolEntry (jclass klass, int index)
JvThrow(new java::lang::NoSuchFieldError (msg));
}
pool->data[index] = (void*)
pool->data[index].rmethod =
_Jv_BuildResolvedMethod(the_method,
found_class,
((the_method->accflags & STATIC) != 0),
......@@ -754,8 +752,8 @@ _Jv_InitField (jobject obj, jclass klass, int index)
{
_Jv_MonitorEnter (clz);
jstring str;
str = _Jv_NewStringUtf8Const ((_Jv_Utf8Const *) pool->data[init]);
pool->data[init] = (void *) str;
str = _Jv_NewStringUtf8Const (pool->data[init].utf8);
pool->data[init].string = str;
pool->tags[init] = JV_CONSTANT_ResolvedString;
_Jv_MonitorExit (clz);
}
......@@ -765,12 +763,12 @@ _Jv_InitField (jobject obj, jclass klass, int index)
if (! (field->type == &StringClass || field->type == &ObjectClass))
throw_class_format_error ("string initialiser to non-string field");
*(jstring*)addr = *(jstring*) (pool->data + init);
*(jstring*)addr = pool->data[init].string;
break;
case JV_CONSTANT_Integer:
{
int value = *(jint*)(pool->data + init);
int value = pool->data[init].i;
if (field->type == JvPrimClass (boolean))
*(jboolean*)addr = (jboolean)value;
......@@ -796,21 +794,21 @@ _Jv_InitField (jobject obj, jclass klass, int index)
if (field->type != JvPrimClass (long))
throw_class_format_error ("erroneous field initializer");
memcpy (addr, pool->data+init, 8);
*(jlong*)addr = _Jv_loadLong (&pool->data[init]);
break;
case JV_CONSTANT_Float:
if (field->type != JvPrimClass (float))
throw_class_format_error ("erroneous field initializer");
memcpy (addr, pool->data+init, 4);
*(jfloat*)addr = pool->data[init].f;
break;
case JV_CONSTANT_Double:
if (field->type != JvPrimClass (double))
throw_class_format_error ("erroneous field initializer");
memcpy (addr, pool->data+init, 8);
*(jdouble*)addr = _Jv_loadDouble (&pool->data[init]);
break;
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment