mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-19 03:53:58 +08:00
[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
This commit is contained in:
parent
3ef1cea850
commit
7941ceabf0
@ -1,5 +1,41 @@
|
||||
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);
|
||||
}
|
||||
|
||||
|
414
libjava/configure
vendored
414
libjava/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||
|
@ -47,7 +47,7 @@ details. */
|
||||
|
||||
#include <gnu/gcj/runtime/MethodInvocation.h>
|
||||
|
||||
/* this is the exception handler hack, for the interpreter */
|
||||
/* This should never happen. */
|
||||
void
|
||||
gnu::gcj::runtime::MethodInvocation::continue1 (gnu::gcj::RawData *,
|
||||
gnu::gcj::RawData *)
|
||||
@ -89,7 +89,7 @@ static void throw_arithmetic_exception ()
|
||||
#endif
|
||||
|
||||
|
||||
static inline void dupx (void **&sp, int n, int x)
|
||||
static inline void dupx (_Jv_word *&sp, int n, int x)
|
||||
{
|
||||
// first "slide" n+x elements n to the right
|
||||
int top = n-1;
|
||||
@ -110,36 +110,43 @@ static inline void dupx (void **&sp, int n, int x)
|
||||
|
||||
|
||||
#define PUSHA(V) \
|
||||
({ jobject __v=(V); *(jobject*)sp++ = __v; })
|
||||
({ jobject __v=(V); (sp++)->o = __v; })
|
||||
#define PUSHI(V) \
|
||||
({ jint __v=(V); *(jint*)sp++ = __v; })
|
||||
({ jint __v=(V); (sp++)->i = __v; })
|
||||
#define PUSHF(V) \
|
||||
({ jfloat __v=(V); *(jfloat*)sp++ = __v; })
|
||||
({ jfloat __v=(V); (sp++)->f = __v; })
|
||||
#define PUSHL(V) \
|
||||
({ jlong __v=(V); memcpy ((void*)sp, (void*)&__v, 8); sp+=2; })
|
||||
({ jlong __v=(V); _Jv_storeLong(sp,__v); sp+=2; })
|
||||
#define PUSHD(V) \
|
||||
({ jdouble __v=(V); memcpy ((void*)sp, (void*)&__v, 8); sp+=2; })
|
||||
({ jdouble __v=(V); _Jv_storeDouble(sp,__v); sp+=2; })
|
||||
|
||||
#define POPA() (*(jobject*)--sp)
|
||||
#define POPI() (*(jint*)--sp)
|
||||
#define POPF() (*(jfloat*)--sp)
|
||||
#define POPL() ({ jlong __r; sp-=2; memcpy ((void*)&__r, sp, 8); __r; })
|
||||
#define POPD() ({ jdouble __r; sp-=2; memcpy ((void*)&__r, sp, 8); __r; })
|
||||
#define POPA() ((--sp)->o)
|
||||
#define POPI() ((jint) (--sp)->i) // cast since it may be promoted
|
||||
#define POPF() ((jfloat) (--sp)->f)
|
||||
#define POPL() ({ sp-=2; _Jv_loadLong (sp); })
|
||||
#define POPD() ({ sp-=2; _Jv_loadDouble (sp); })
|
||||
|
||||
#define LOADA(I) *sp++ = locals[I]
|
||||
#define LOADI(I) *sp++ = locals[I]
|
||||
#define LOADF(I) *sp++ = locals[I]
|
||||
#define LOADL(I) ({ memcpy (sp, locals+(I), 8); sp+=2; })
|
||||
#define LOADD(I) ({ memcpy (sp, locals+(I), 8); sp+=2; })
|
||||
#define LOADA(I) (sp++)->o = locals[I].o
|
||||
#define LOADI(I) (sp++)->i = locals[I].i
|
||||
#define LOADF(I) (sp++)->f = locals[I].f
|
||||
#define LOADL(I) ({ jint __idx = (I); \
|
||||
(sp++)->ia[0] = locals[__idx].ia[0]; \
|
||||
(sp++)->ia[0] = locals[__idx+1].ia[0]; \
|
||||
})
|
||||
#define LOADD(I) LOADL(I)
|
||||
|
||||
#define STOREA(I) locals[I] = *--sp
|
||||
#define STOREI(I) locals[I] = *--sp
|
||||
#define STOREF(I) locals[I] = *--sp
|
||||
#define STOREL(I) ({ sp-=2; memcpy (locals+(I), sp, 8); })
|
||||
#define STORED(I) ({ sp-=2; memcpy (locals+(I), sp, 8); })
|
||||
|
||||
#define PEEKI(I) (*(jint*) (locals+(I)))
|
||||
#define PEEKA(I) (*(jobject*) (locals+(I)))
|
||||
#define STOREA(I) locals[I].o = (--sp)->o
|
||||
#define STOREI(I) locals[I].i = (--sp)->i
|
||||
#define STOREF(I) locals[I].f = (--sp)->f
|
||||
#define STOREL(I) ({ jint __idx = (I); \
|
||||
locals[__idx+1].ia[0] = (--sp)->ia[0]; \
|
||||
locals[__idx].ia[0] = (--sp)->ia[0]; \
|
||||
})
|
||||
#define STORED(I) STOREL(I)
|
||||
|
||||
#define PEEKI(I) (locals+(I))->i
|
||||
#define PEEKA(I) (locals+(I))->o
|
||||
|
||||
#define POKEI(I,V) (*(jint*) (locals+(I)) = (V))
|
||||
|
||||
@ -215,16 +222,16 @@ static jint get4(unsigned char* loc) {
|
||||
inline jobject
|
||||
_Jv_InterpMethod::run (ffi_cif* cif,
|
||||
void *retp,
|
||||
void**args,
|
||||
ffi_raw *args,
|
||||
_Jv_InterpMethodInvocation *inv)
|
||||
{
|
||||
inv->running = this;
|
||||
inv->pc = bytecode ();
|
||||
inv->sp = inv->stack_base ();
|
||||
void **locals = inv->local_base ();
|
||||
_Jv_word *locals = inv->local_base ();
|
||||
|
||||
/* Go straight at it! the ffi raw format matches the internal
|
||||
stack representation exactly!
|
||||
stack representation exactly. At leat, that's the idea.
|
||||
*/
|
||||
memcpy ((void*) locals, (void*) args, args_raw_size);
|
||||
|
||||
@ -237,7 +244,7 @@ _Jv_InterpMethod::run (ffi_cif* cif,
|
||||
if (ex == 0) // no exception...
|
||||
{
|
||||
/* define sp locally, so the POP? macros will pick it up */
|
||||
void **sp = (void**)inv->sp;
|
||||
_Jv_word *sp = inv->sp;
|
||||
int rtype = cif->rtype->type;
|
||||
|
||||
if (rtype == FFI_TYPE_POINTER)
|
||||
@ -320,9 +327,8 @@ bool _Jv_InterpMethod::find_exception (jobject ex,
|
||||
jclass handler;
|
||||
|
||||
if (exc[i].handler_type != 0)
|
||||
handler = (jclass)
|
||||
_Jv_ResolvePoolEntry (defining_class,
|
||||
exc[i].handler_type);
|
||||
handler = (_Jv_ResolvePoolEntry (defining_class,
|
||||
exc[i].handler_type)).clazz;
|
||||
else
|
||||
handler = NULL;
|
||||
|
||||
@ -330,7 +336,7 @@ bool _Jv_InterpMethod::find_exception (jobject ex,
|
||||
{
|
||||
inv->pc = bytecode () + exc[i].handler_pc;
|
||||
inv->sp = inv->stack_base (); // reset stack
|
||||
*(jobject*) (inv->sp ++) = ex;
|
||||
(inv->sp++)->o = ex; // push exception
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -340,7 +346,7 @@ bool _Jv_InterpMethod::find_exception (jobject ex,
|
||||
|
||||
void _Jv_InterpMethod::run_normal (ffi_cif* cif,
|
||||
void* ret,
|
||||
void** args,
|
||||
ffi_raw * args,
|
||||
void* __this)
|
||||
{
|
||||
_Jv_InterpMethod* _this = (_Jv_InterpMethod*)__this;
|
||||
@ -350,7 +356,7 @@ void _Jv_InterpMethod::run_normal (ffi_cif* cif,
|
||||
int storage_size = _this->max_stack+_this->max_locals;
|
||||
_Jv_InterpMethodInvocation* inv = (_Jv_InterpMethodInvocation*)
|
||||
alloca (sizeof (_Jv_InterpMethodInvocation)
|
||||
+ storage_size * sizeof (void*));
|
||||
+ storage_size * sizeof (_Jv_word));
|
||||
|
||||
jobject ex = _this->run (cif, ret, args, inv);
|
||||
if (ex != 0) _Jv_Throw (ex);
|
||||
@ -358,16 +364,16 @@ void _Jv_InterpMethod::run_normal (ffi_cif* cif,
|
||||
|
||||
void _Jv_InterpMethod::run_synch_object (ffi_cif* cif,
|
||||
void* ret,
|
||||
void** args,
|
||||
ffi_raw * args,
|
||||
void* __this)
|
||||
{
|
||||
_Jv_InterpMethod* _this = (_Jv_InterpMethod*)__this;
|
||||
jobject rcv = (jobject)args[0];
|
||||
jobject rcv = (jobject)args[0].ptr;
|
||||
|
||||
int storage_size = _this->max_stack+_this->max_locals;
|
||||
_Jv_InterpMethodInvocation* inv = (_Jv_InterpMethodInvocation*)
|
||||
alloca (sizeof (_Jv_InterpMethodInvocation)
|
||||
+ storage_size * sizeof (void*));
|
||||
+ storage_size * sizeof (_Jv_word));
|
||||
|
||||
_Jv_MonitorEnter (rcv);
|
||||
jobject ex = _this->run (cif, ret, args, inv);
|
||||
@ -378,7 +384,7 @@ void _Jv_InterpMethod::run_synch_object (ffi_cif* cif,
|
||||
|
||||
void _Jv_InterpMethod::run_synch_class (ffi_cif* cif,
|
||||
void* ret,
|
||||
void** args,
|
||||
ffi_raw * args,
|
||||
void* __this)
|
||||
{
|
||||
_Jv_InterpMethod* _this = (_Jv_InterpMethod*)__this;
|
||||
@ -387,7 +393,7 @@ void _Jv_InterpMethod::run_synch_class (ffi_cif* cif,
|
||||
int storage_size = _this->max_stack+_this->max_locals;
|
||||
_Jv_InterpMethodInvocation* inv = (_Jv_InterpMethodInvocation*)
|
||||
alloca (sizeof (_Jv_InterpMethodInvocation)
|
||||
+ storage_size * sizeof (void*));
|
||||
+ storage_size * sizeof (_Jv_word));
|
||||
|
||||
_Jv_MonitorEnter (sync);
|
||||
jobject ex = _this->run (cif, ret, args, inv);
|
||||
@ -461,13 +467,13 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
* gcc, why isn't there a -fpack-stack, allowing reuse of stack
|
||||
* locations? */
|
||||
|
||||
void** sp = inv->sp;
|
||||
_Jv_word *sp = inv->sp;
|
||||
unsigned char *pc = inv->pc;
|
||||
void** locals = inv->local_base ();
|
||||
_Jv_word *locals = inv->local_base ();
|
||||
int opcode;
|
||||
|
||||
jclass defining_class = this->defining_class;
|
||||
void **pool_data = defining_class->constants.data;
|
||||
_Jv_word *pool_data = defining_class->constants.data;
|
||||
|
||||
/* these two are used in the invokeXXX instructions */
|
||||
void (*fun)(...);
|
||||
@ -581,8 +587,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
* JV_CONSTANT_ResolvedFlag in the tag directly. For now, I
|
||||
* don't think it is worth it. */
|
||||
|
||||
rmeth = (_Jv_ResolvedMethod*)
|
||||
_Jv_ResolvePoolEntry (defining_class, index);
|
||||
rmeth = (_Jv_ResolvePoolEntry (defining_class, index)).rmethod;
|
||||
|
||||
sp -= rmeth->stack_item_count;
|
||||
NULLCHECK(sp[0]);
|
||||
@ -595,7 +600,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
}
|
||||
else
|
||||
{
|
||||
jobject rcv = (jobject)sp[0];
|
||||
jobject rcv = sp[0].o;
|
||||
_Jv_VTable *table = *(_Jv_VTable**)rcv;
|
||||
fun = (void (*) (...))table->method[rmeth->vtable_index];
|
||||
}
|
||||
@ -606,12 +611,12 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
{
|
||||
/* here goes the magic again... */
|
||||
ffi_cif *cif = &rmeth->cif;
|
||||
void **raw = sp;
|
||||
ffi_raw *raw = (ffi_raw*) sp;
|
||||
|
||||
jdouble rvalue;
|
||||
|
||||
TIME_SUSPEND;
|
||||
ffi_raw_call (cif, fun, (void*)&rvalue, (ffi_raw*) raw);
|
||||
ffi_raw_call (cif, fun, (void*)&rvalue, raw);
|
||||
TIME_RESUME;
|
||||
|
||||
int rtype = cif->rtype->type;
|
||||
@ -717,21 +722,21 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
case op_ldc:
|
||||
{
|
||||
int index = get1u (pc++);
|
||||
PUSHA((jobject) pool_data[index]);
|
||||
PUSHA(pool_data[index].o);
|
||||
}
|
||||
goto next_insn;
|
||||
|
||||
case op_ldc_w:
|
||||
{
|
||||
int index = get2u (pc); pc += 2;
|
||||
PUSHA((jobject) pool_data[index]);
|
||||
PUSHA(pool_data[index].o);
|
||||
}
|
||||
goto next_insn;
|
||||
|
||||
case op_ldc2_w:
|
||||
{
|
||||
int index = get2u (pc); pc += 2;
|
||||
memcpy (sp, &pool_data[index], 8);
|
||||
memcpy (sp, &pool_data[index], 2*sizeof (_Jv_word));
|
||||
sp += 2;
|
||||
}
|
||||
goto next_insn;
|
||||
@ -1715,7 +1720,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
unsigned char *base_pc = pc-1;
|
||||
jint fieldref_index = get2u (pc); pc += 2;
|
||||
_Jv_ResolvePoolEntry (defining_class, fieldref_index);
|
||||
_Jv_Field *field = (_Jv_Field*) pool_data[fieldref_index];
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
|
||||
if ((field->flags & STATIC) == 0)
|
||||
throw_incompatible_class_change_error
|
||||
@ -1761,7 +1766,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
unsigned char *base_pc = pc-1;
|
||||
jint fieldref_index = get2u (pc); pc += 2;
|
||||
_Jv_ResolvePoolEntry (defining_class, fieldref_index);
|
||||
_Jv_Field *field = (_Jv_Field*) pool_data[fieldref_index];
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
|
||||
if ((field->flags & STATIC) != 0)
|
||||
throw_incompatible_class_change_error
|
||||
@ -1813,7 +1818,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
unsigned char* base_pc = pc-1;
|
||||
jint fieldref_index = get2u (pc); pc += 2;
|
||||
_Jv_ResolvePoolEntry (defining_class, fieldref_index);
|
||||
_Jv_Field *field = (_Jv_Field*) pool_data[fieldref_index];
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
|
||||
jclass type = field->type;
|
||||
|
||||
@ -1862,7 +1867,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
unsigned char* base_pc = pc-1;
|
||||
jint fieldref_index = get2u (pc); pc += 2;
|
||||
_Jv_ResolvePoolEntry (defining_class, fieldref_index);
|
||||
_Jv_Field *field = (_Jv_Field*) pool_data[fieldref_index];
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
|
||||
jclass type = field->type;
|
||||
|
||||
@ -1947,7 +1952,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
case op_getstatic_1:
|
||||
{
|
||||
jint fieldref_index = get2u (pc); pc += 2;
|
||||
_Jv_Field *field = (_Jv_Field*) pool_data[fieldref_index];
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
PUSHI (*(jbyte*) (field->u.addr));
|
||||
}
|
||||
goto next_insn;
|
||||
@ -1955,7 +1960,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
case op_getstatic_2s:
|
||||
{
|
||||
jint fieldref_index = get2u (pc); pc += 2;
|
||||
_Jv_Field *field = (_Jv_Field*) pool_data[fieldref_index];
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
PUSHI(*(jshort*) (field->u.addr));
|
||||
}
|
||||
goto next_insn;
|
||||
@ -1963,7 +1968,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
case op_getstatic_2u:
|
||||
{
|
||||
jint fieldref_index = get2u (pc); pc += 2;
|
||||
_Jv_Field *field = (_Jv_Field*) pool_data[fieldref_index];
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
PUSHI(*(jchar*) (field->u.addr));
|
||||
}
|
||||
goto next_insn;
|
||||
@ -1971,7 +1976,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
case op_getstatic_4:
|
||||
{
|
||||
jint fieldref_index = get2u (pc); pc += 2;
|
||||
_Jv_Field *field = (_Jv_Field*) pool_data[fieldref_index];
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
PUSHI(*(jint*) (field->u.addr));
|
||||
}
|
||||
goto next_insn;
|
||||
@ -1979,7 +1984,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
case op_getstatic_8:
|
||||
{
|
||||
jint fieldref_index = get2u (pc); pc += 2;
|
||||
_Jv_Field *field = (_Jv_Field*) pool_data[fieldref_index];
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
PUSHL(*(jlong*) (field->u.addr));
|
||||
}
|
||||
goto next_insn;
|
||||
@ -1987,7 +1992,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
case op_getstatic_a:
|
||||
{
|
||||
jint fieldref_index = get2u (pc); pc += 2;
|
||||
_Jv_Field *field = (_Jv_Field*) pool_data[fieldref_index];
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
PUSHA(*(jobject*) (field->u.addr));
|
||||
}
|
||||
goto next_insn;
|
||||
@ -2046,7 +2051,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
{
|
||||
jint value = POPI();
|
||||
jint fieldref_index = get2u (pc); pc += 2;
|
||||
_Jv_Field *field = (_Jv_Field*) pool_data[fieldref_index];
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
*(jbyte*) (field->u.addr) = value;
|
||||
}
|
||||
goto next_insn;
|
||||
@ -2055,7 +2060,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
{
|
||||
jint value = POPI();
|
||||
jint fieldref_index = get2u (pc); pc += 2;
|
||||
_Jv_Field *field = (_Jv_Field*) pool_data[fieldref_index];
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
*(jchar*) (field->u.addr) = value;
|
||||
}
|
||||
goto next_insn;
|
||||
@ -2064,7 +2069,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
{
|
||||
jint value = POPI();
|
||||
jint fieldref_index = get2u (pc); pc += 2;
|
||||
_Jv_Field *field = (_Jv_Field*) pool_data[fieldref_index];
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
*(jint*) (field->u.addr) = value;
|
||||
}
|
||||
goto next_insn;
|
||||
@ -2073,7 +2078,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
{
|
||||
jlong value = POPL();
|
||||
jint fieldref_index = get2u (pc); pc += 2;
|
||||
_Jv_Field *field = (_Jv_Field*) pool_data[fieldref_index];
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
*(jlong*) (field->u.addr) = value;
|
||||
}
|
||||
goto next_insn;
|
||||
@ -2082,7 +2087,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
{
|
||||
jobject value = POPA();
|
||||
jint fieldref_index = get2u (pc); pc += 2;
|
||||
_Jv_Field *field = (_Jv_Field*) pool_data[fieldref_index];
|
||||
_Jv_Field *field = pool_data[fieldref_index].field;
|
||||
*(jobject*) (field->u.addr) = value;
|
||||
}
|
||||
goto next_insn;
|
||||
@ -2091,8 +2096,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
{
|
||||
int index = get2u (pc); pc += 2;
|
||||
|
||||
rmeth = (_Jv_ResolvedMethod*)
|
||||
_Jv_ResolvePoolEntry (defining_class, index);
|
||||
rmeth = (_Jv_ResolvePoolEntry (defining_class, index)).rmethod;
|
||||
|
||||
sp -= rmeth->stack_item_count;
|
||||
|
||||
@ -2106,8 +2110,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
{
|
||||
int index = get2u (pc); pc += 2;
|
||||
|
||||
rmeth = (_Jv_ResolvedMethod*)
|
||||
_Jv_ResolvePoolEntry (defining_class, index);
|
||||
rmeth = (_Jv_ResolvePoolEntry (defining_class, index)).rmethod;
|
||||
|
||||
sp -= rmeth->stack_item_count;
|
||||
|
||||
@ -2123,13 +2126,12 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
// invokeinterface has two unused bytes...
|
||||
pc += 2;
|
||||
|
||||
rmeth = (_Jv_ResolvedMethod*)
|
||||
_Jv_ResolvePoolEntry (defining_class, index);
|
||||
rmeth = (_Jv_ResolvePoolEntry (defining_class, index)).rmethod;
|
||||
|
||||
sp -= rmeth->stack_item_count;
|
||||
NULLCHECK(sp[0]);
|
||||
|
||||
jobject rcv = (jobject)sp[0];
|
||||
jobject rcv = sp[0].o;
|
||||
|
||||
fun = (void (*) (...))
|
||||
_Jv_LookupInterfaceMethod (rcv->getClass (),
|
||||
@ -2142,8 +2144,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
case op_new:
|
||||
{
|
||||
int index = get2u (pc); pc += 2;
|
||||
jclass klass = (jclass) _Jv_ResolvePoolEntry (defining_class,
|
||||
index);
|
||||
jclass klass = (_Jv_ResolvePoolEntry (defining_class, index)).clazz;
|
||||
_Jv_InitClass (klass);
|
||||
jobject res = _Jv_AllocObject (klass, klass->size_in_bytes);
|
||||
PUSHA (res);
|
||||
@ -2162,7 +2163,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
case op_anewarray:
|
||||
{
|
||||
int index = get2u (pc); pc += 2;
|
||||
jclass klass = (jclass) _Jv_ResolvePoolEntry (defining_class, index);
|
||||
jclass klass = (_Jv_ResolvePoolEntry (defining_class, index)).clazz;
|
||||
int size = POPI();
|
||||
_Jv_InitClass (klass);
|
||||
jobject result = _Jv_NewObjectArray (size, klass, 0);
|
||||
@ -2189,8 +2190,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
{
|
||||
jobject value = POPA();
|
||||
jint index = get2u (pc); pc += 2;
|
||||
jclass to = (jclass)_Jv_ResolvePoolEntry (defining_class,
|
||||
index);
|
||||
jclass to = (_Jv_ResolvePoolEntry (defining_class, index)).clazz;
|
||||
|
||||
if (value != NULL && ! to->isInstance (value))
|
||||
{
|
||||
@ -2207,8 +2207,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
{
|
||||
jobject value = POPA();
|
||||
jint index = get2u (pc); pc += 2;
|
||||
jclass to = (jclass)_Jv_ResolvePoolEntry (defining_class,
|
||||
index);
|
||||
jclass to = (_Jv_ResolvePoolEntry (defining_class, index)).clazz;
|
||||
PUSHI (to->isInstance (value));
|
||||
}
|
||||
goto next_insn;
|
||||
@ -2315,8 +2314,8 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||
int kind_index = get2u (pc); pc += 2;
|
||||
int dim = get1u (pc); pc += 1;
|
||||
|
||||
jclass type = (jclass) _Jv_ResolvePoolEntry (defining_class,
|
||||
kind_index);
|
||||
jclass type
|
||||
= (_Jv_ResolvePoolEntry (defining_class, kind_index)).clazz;
|
||||
_Jv_InitClass (type);
|
||||
jint *sizes = (jint*) alloca (sizeof (jint)*dim);
|
||||
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user