* Merged gcj-abi-2-dev-branch to trunk.
(Actual changes too large to list in the commit message; see ChangeLog.) From-SVN: r91270
This commit is contained in:
parent
ec0641f612
commit
367390404d
70 changed files with 11301 additions and 3355 deletions
|
@ -145,6 +145,7 @@ LIBGCJTESTSPEC = @LIBGCJTESTSPEC@
|
|||
LIBGCJ_CFLAGS = @LIBGCJ_CFLAGS@
|
||||
LIBGCJ_CXXFLAGS = @LIBGCJ_CXXFLAGS@
|
||||
LIBGCJ_JAVAFLAGS = @LIBGCJ_JAVAFLAGS@
|
||||
LIBGCJ_LD_SYMBOLIC = @LIBGCJ_LD_SYMBOLIC@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBLTDL = @LIBLTDL@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
|
|
146
libjava/include/execution.h
Normal file
146
libjava/include/execution.h
Normal file
|
@ -0,0 +1,146 @@
|
|||
// execution.h - Execution engines. -*- c++ -*-
|
||||
|
||||
/* Copyright (C) 2004 Free Software Foundation
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef __JAVA_EXECUTION_H__
|
||||
#define __JAVA_EXECUTION_H__
|
||||
|
||||
// This represents one execution engine. Note that we use function
|
||||
// pointers and not virtual methods to avoid calls to
|
||||
// __cxa_call_unexpected and the like.
|
||||
struct _Jv_ExecutionEngine
|
||||
{
|
||||
public:
|
||||
|
||||
void (*unregister) (jclass);
|
||||
// FIXME: probably should handle this elsewhere, see how
|
||||
// interpreter does it.
|
||||
bool (*need_resolve_string_fields) ();
|
||||
void (*verify) (jclass);
|
||||
void (*allocate_static_fields) (jclass, int);
|
||||
void (*create_ncode) (jclass);
|
||||
_Jv_ResolvedMethod *(*resolve_method) (_Jv_Method *, jclass,
|
||||
jboolean, jint);
|
||||
void (*post_miranda_hook) (jclass);
|
||||
};
|
||||
|
||||
// This handles all gcj-compiled code, including BC ABI.
|
||||
struct _Jv_CompiledEngine : public _Jv_ExecutionEngine
|
||||
{
|
||||
public:
|
||||
|
||||
static void do_unregister (jclass)
|
||||
{
|
||||
}
|
||||
|
||||
static bool do_need_resolve_string_fields ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static void do_verify (jclass klass)
|
||||
{
|
||||
_Jv_Linker::verify_type_assertions (klass);
|
||||
}
|
||||
|
||||
static _Jv_ResolvedMethod *do_resolve_method (_Jv_Method *, jclass,
|
||||
jboolean, jint)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void do_allocate_static_fields (jclass, int)
|
||||
{
|
||||
// Compiled classes don't need this.
|
||||
}
|
||||
|
||||
static void do_create_ncode (jclass)
|
||||
{
|
||||
// Not needed.
|
||||
}
|
||||
|
||||
static void do_post_miranda_hook (jclass)
|
||||
{
|
||||
// Not needed.
|
||||
}
|
||||
|
||||
_Jv_CompiledEngine ()
|
||||
{
|
||||
unregister = do_unregister;
|
||||
need_resolve_string_fields = do_need_resolve_string_fields;
|
||||
verify = do_verify;
|
||||
allocate_static_fields = do_allocate_static_fields;
|
||||
create_ncode = do_create_ncode;
|
||||
resolve_method = do_resolve_method;
|
||||
post_miranda_hook = do_post_miranda_hook;
|
||||
}
|
||||
|
||||
// These operators make it so we don't have to link in libstdc++.
|
||||
void *operator new (size_t bytes)
|
||||
{
|
||||
return _Jv_Malloc(bytes);
|
||||
}
|
||||
|
||||
void operator delete (void *mem)
|
||||
{
|
||||
_Jv_Free(mem);
|
||||
}
|
||||
};
|
||||
|
||||
// This handles interpreted code.
|
||||
class _Jv_InterpreterEngine : public _Jv_ExecutionEngine
|
||||
{
|
||||
public:
|
||||
|
||||
static void do_verify (jclass);
|
||||
static void do_allocate_static_fields (jclass, int);
|
||||
static void do_create_ncode (jclass);
|
||||
static _Jv_ResolvedMethod *do_resolve_method (_Jv_Method *, jclass,
|
||||
jboolean, jint);
|
||||
|
||||
static bool do_need_resolve_string_fields ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static void do_unregister(jclass klass)
|
||||
{
|
||||
_Jv_UnregisterClass(klass);
|
||||
}
|
||||
|
||||
static void do_post_miranda_hook (jclass);
|
||||
|
||||
_Jv_InterpreterEngine ()
|
||||
{
|
||||
unregister = do_unregister;
|
||||
need_resolve_string_fields = do_need_resolve_string_fields;
|
||||
verify = do_verify;
|
||||
allocate_static_fields = do_allocate_static_fields;
|
||||
create_ncode = do_create_ncode;
|
||||
resolve_method = do_resolve_method;
|
||||
post_miranda_hook = do_post_miranda_hook;
|
||||
}
|
||||
|
||||
// These operators make it so we don't have to link in libstdc++.
|
||||
void *operator new (size_t bytes)
|
||||
{
|
||||
return _Jv_Malloc(bytes);
|
||||
}
|
||||
|
||||
void operator delete (void *mem)
|
||||
{
|
||||
_Jv_Free(mem);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
extern _Jv_InterpreterEngine _Jv_soleInterpreterEngine;
|
||||
extern _Jv_CompiledEngine _Jv_soleCompiledEngine;
|
||||
|
||||
#endif // __JAVA_EXECUTION_H__
|
|
@ -1,6 +1,6 @@
|
|||
// java-interp.h - Header file for the bytecode interpreter. -*- c++ -*-
|
||||
|
||||
/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation
|
||||
/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
|
@ -36,7 +36,8 @@ _Jv_IsInterpretedClass (jclass c)
|
|||
struct _Jv_ResolvedMethod;
|
||||
|
||||
void _Jv_InitInterpreter ();
|
||||
void _Jv_DefineClass (jclass, jbyteArray, jint, jint);
|
||||
void _Jv_DefineClass (jclass, jbyteArray, jint, jint,
|
||||
java::security::ProtectionDomain *);
|
||||
|
||||
void _Jv_InitField (jobject, jclass, int);
|
||||
void * _Jv_AllocMethodInvocation (jsize size);
|
||||
|
@ -88,11 +89,7 @@ protected:
|
|||
// Size of raw arguments.
|
||||
_Jv_ushort args_raw_size;
|
||||
|
||||
// Chain of addresses to fill in. See _Jv_Defer_Resolution.
|
||||
void *deferred;
|
||||
|
||||
friend void _Jv_Defer_Resolution (void *cl, _Jv_Method *meth, void **);
|
||||
friend void _Jv_PrepareClass(jclass);
|
||||
friend class _Jv_InterpreterEngine;
|
||||
|
||||
public:
|
||||
_Jv_Method *get_method ()
|
||||
|
@ -150,10 +147,9 @@ class _Jv_InterpMethod : public _Jv_MethodBase
|
|||
friend class _Jv_BytecodeVerifier;
|
||||
friend class gnu::gcj::runtime::NameFinder;
|
||||
friend class gnu::gcj::runtime::StackTrace;
|
||||
friend class _Jv_InterpreterEngine;
|
||||
|
||||
|
||||
friend void _Jv_PrepareClass(jclass);
|
||||
|
||||
#ifdef JV_MARKOBJ_DECL
|
||||
friend JV_MARKOBJ_DECL;
|
||||
#endif
|
||||
|
@ -166,43 +162,15 @@ class _Jv_InterpClass
|
|||
|
||||
friend class _Jv_ClassReader;
|
||||
friend class _Jv_InterpMethod;
|
||||
friend void _Jv_PrepareClass(jclass);
|
||||
friend void _Jv_PrepareMissingMethods (jclass base2, jclass iface_class);
|
||||
friend class _Jv_InterpreterEngine;
|
||||
friend void _Jv_InitField (jobject, jclass, int);
|
||||
#ifdef JV_MARKOBJ_DECL
|
||||
friend JV_MARKOBJ_DECL;
|
||||
#endif
|
||||
|
||||
friend _Jv_MethodBase ** _Jv_GetFirstMethod (_Jv_InterpClass *klass);
|
||||
friend void _Jv_Defer_Resolution (void *cl, _Jv_Method *meth, void **);
|
||||
};
|
||||
|
||||
// We have an interpreted class CL and we're trying to find the
|
||||
// address of the ncode of a method METH. That interpreted class
|
||||
// hasn't yet been prepared, so we defer fixups until they are ready.
|
||||
// To do this, we create a chain of fixups that will be resolved by
|
||||
// _Jv_PrepareClass.
|
||||
extern inline void
|
||||
_Jv_Defer_Resolution (void *cl, _Jv_Method *meth, void **address)
|
||||
{
|
||||
int i;
|
||||
jclass self = (jclass) cl;
|
||||
_Jv_InterpClass *interp_cl = (_Jv_InterpClass*) self->aux_info;
|
||||
|
||||
for (i = 0; i < self->method_count; i++)
|
||||
{
|
||||
_Jv_Method *m = &self->methods[i];
|
||||
if (m == meth)
|
||||
{
|
||||
_Jv_MethodBase *imeth = interp_cl->interpreted_methods[i];
|
||||
*address = imeth->deferred;
|
||||
imeth->deferred = address;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
extern inline _Jv_MethodBase **
|
||||
_Jv_GetFirstMethod (_Jv_InterpClass *klass)
|
||||
{
|
||||
|
@ -240,7 +208,11 @@ class _Jv_JNIMethod : public _Jv_MethodBase
|
|||
void *ncode ();
|
||||
|
||||
friend class _Jv_ClassReader;
|
||||
friend void _Jv_PrepareClass(jclass);
|
||||
friend class _Jv_InterpreterEngine;
|
||||
|
||||
#ifdef JV_MARKOBJ_DECL
|
||||
friend JV_MARKOBJ_DECL;
|
||||
#endif
|
||||
|
||||
public:
|
||||
// FIXME: this is ugly.
|
||||
|
|
84
libjava/include/java-stack.h
Normal file
84
libjava/include/java-stack.h
Normal file
|
@ -0,0 +1,84 @@
|
|||
// java-stack.h - Definitions for unwinding & inspecting the call stack.
|
||||
|
||||
/* Copyright (C) 2003 Free Software Foundation
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef __JV_STACKTRACE_H__
|
||||
#define __JV_STACKTRACE_H__
|
||||
|
||||
#include <unwind.h>
|
||||
|
||||
#include <gcj/cni.h>
|
||||
#include <gcj/javaprims.h>
|
||||
|
||||
#include <java-interp.h>
|
||||
|
||||
#include <java/lang/Class.h>
|
||||
#include <java/lang/StackTraceElement.h>
|
||||
#include <java/lang/Throwable.h>
|
||||
|
||||
#include <gnu/gcj/runtime/NameFinder.h>
|
||||
|
||||
using namespace gnu::gcj::runtime;
|
||||
|
||||
enum _Jv_FrameType
|
||||
{
|
||||
frame_native,
|
||||
frame_interpreter
|
||||
};
|
||||
|
||||
#ifdef INTERPRETER
|
||||
struct _Jv_InterpFrameInfo
|
||||
{
|
||||
_Jv_InterpMethod *meth;
|
||||
pc_t pc;
|
||||
};
|
||||
#endif
|
||||
|
||||
union _Jv_FrameInfo
|
||||
{
|
||||
};
|
||||
|
||||
struct _Jv_StackFrame
|
||||
{
|
||||
_Jv_FrameType type; /* Native or interpreted. */
|
||||
union {
|
||||
#ifdef INTERPRETER
|
||||
_Jv_InterpFrameInfo interp;
|
||||
#endif
|
||||
void *ip;
|
||||
};
|
||||
// _Jv_FrameInfo info; /* Frame-type specific data. */
|
||||
jclass klass;
|
||||
_Jv_Method *meth;
|
||||
};
|
||||
|
||||
class _Jv_StackTrace
|
||||
{
|
||||
private:
|
||||
int length;
|
||||
_Jv_StackFrame frames[];
|
||||
|
||||
static void UpdateNCodeMap ();
|
||||
static jclass ClassForIP (void *ip, void **ncode);
|
||||
static void FillInFrameInfo (_Jv_StackFrame *frame);
|
||||
static void getLineNumberForFrame(_Jv_StackFrame *frame, NameFinder *finder,
|
||||
jstring *sourceFileName, jint *lineNum);
|
||||
|
||||
static _Unwind_Reason_Code UnwindTraceFn (struct _Unwind_Context *context,
|
||||
void *state_ptr);
|
||||
|
||||
public:
|
||||
static _Jv_StackTrace *GetStackTrace (void);
|
||||
static JArray< ::java::lang::StackTraceElement *>*
|
||||
GetStackTraceElements (_Jv_StackTrace *trace,
|
||||
java::lang::Throwable *throwable);
|
||||
static jclass GetCallingClass (void);
|
||||
};
|
||||
|
||||
#endif /* __JV_STACKTRACE_H__ */
|
|
@ -1,6 +1,6 @@
|
|||
// jvm.h - Header file for private implementation information. -*- c++ -*-
|
||||
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
|
||||
/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
|
@ -231,9 +231,6 @@ inline _Jv_TempUTFString::~_Jv_TempUTFString ()
|
|||
char utfstr##_buf[utfstr##_len <= 256 ? utfstr##_len : 0]; \
|
||||
_Jv_TempUTFString utfstr(utfstr##thejstr, sizeof(utfstr##_buf)==0 ? 0 : utfstr##_buf)
|
||||
|
||||
// FIXME: remove this define.
|
||||
#define StringClass java::lang::String::class$
|
||||
|
||||
namespace gcj
|
||||
{
|
||||
/* Some constants used during lookup of special class methods. */
|
||||
|
@ -249,6 +246,43 @@ namespace gcj
|
|||
extern bool verbose_class_flag;
|
||||
}
|
||||
|
||||
// This class handles all aspects of class preparation and linking.
|
||||
class _Jv_Linker
|
||||
{
|
||||
private:
|
||||
static void prepare_constant_time_tables(jclass);
|
||||
static jshort get_interfaces(jclass, _Jv_ifaces *);
|
||||
static void link_symbol_table(jclass);
|
||||
static void link_exception_table(jclass);
|
||||
static void layout_interface_methods(jclass);
|
||||
static void layout_vtable_methods(jclass);
|
||||
static void set_vtable_entries(jclass, _Jv_VTable *);
|
||||
static void make_vtable(jclass);
|
||||
static void ensure_fields_laid_out(jclass);
|
||||
static void ensure_class_linked(jclass);
|
||||
static void ensure_supers_installed(jclass);
|
||||
static void add_miranda_methods(jclass, jclass);
|
||||
static void ensure_method_table_complete(jclass);
|
||||
static void verify_class(jclass);
|
||||
static jshort find_iindex(jclass *, jshort *, jshort);
|
||||
static jshort indexof(void *, void **, jshort);
|
||||
static int get_alignment_from_class(jclass);
|
||||
static void generate_itable(jclass, _Jv_ifaces *, jshort *);
|
||||
static jshort append_partial_itable(jclass, jclass, void **, jshort);
|
||||
static _Jv_Method *search_method_in_class (jclass, jclass,
|
||||
_Jv_Utf8Const *,
|
||||
_Jv_Utf8Const *);
|
||||
|
||||
public:
|
||||
|
||||
static void print_class_loaded (jclass);
|
||||
static void resolve_class_ref (jclass, jclass *);
|
||||
static void wait_for_state(jclass, int);
|
||||
static _Jv_word resolve_pool_entry (jclass, int);
|
||||
static void resolve_field (_Jv_Field *, java::lang::ClassLoader *);
|
||||
static void verify_type_assertions (jclass);
|
||||
};
|
||||
|
||||
/* Type of pointer used as finalizer. */
|
||||
typedef void _Jv_FinalizerFunc (jobject);
|
||||
|
||||
|
@ -416,7 +450,6 @@ extern "C" void _Jv_RegisterClasses_Counted (const jclass *classes,
|
|||
size_t count);
|
||||
extern "C" void _Jv_RegisterResource (void *vptr);
|
||||
extern void _Jv_UnregisterClass (_Jv_Utf8Const*, java::lang::ClassLoader*);
|
||||
extern void _Jv_ResolveField (_Jv_Field *, java::lang::ClassLoader*);
|
||||
|
||||
extern jclass _Jv_FindClass (_Jv_Utf8Const *name,
|
||||
java::lang::ClassLoader *loader);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue