mirror of git://gcc.gnu.org/git/gcc.git
re PR libgcj/25187 (dereferencing type-punned pointer warnings while building libgcj)
2006-02-08 Bryce McKinlay <mckinlay@redhat.com> PR libgcj/25187: * gnu/gcj/io/natSimpleSHSStream.cc (gnu::gcj::io::SimpleSHSStream::shsFinal): Remove bogus cast. * interpret.cc (_Jv_InterpMethod::run): Simplify arguments to _Jv_InterpFrame(). * boehm.cc: #undef some autoconf macros before including gc-config.h. (_Jv_MarkObject): Don't mark the class, it is reachable via the vtable. (_Jv_MarkArray): Likewise. * java/lang/ref/natReference.cc (java::lang::ref::Reference::create): Simplify _Jv_GCRegisterDisappearingLink() call. * java/lang/Class.h (getComponentType): Use element_type. (element_type): New field declaration, as a union with "methods". * java/lang/natClassLoader.cc (_Jv_NewArrayClass): Use "element_type". * java/net/natVMNetworkInterfacePosix.cc (java::net::VMNetworkInterface::getInterfaces): Add "int" cast to avoid sign comparison warning. * include/java-interp.h (_Jv_InterpFrame): Take thread as second argument, not parent call frame. * include/x86_64-signal.h (MAKE_THROW_FRAME): Use "gregs" directly, without a cast. (restore_rt): Declare with hidden visibility, not "static". * posix.cc (_Jv_platform_initProperties): Make "tmpdir" a string constant. * jni.cc (_Jv_JNI_DestroyJavaVM): Use a union to avoid strict alias warning From-SVN: r110783
This commit is contained in:
parent
c03a2b6f68
commit
1349c68851
|
@ -1,3 +1,31 @@
|
||||||
|
2006-02-08 Bryce McKinlay <mckinlay@redhat.com>
|
||||||
|
|
||||||
|
PR libgcj/25187:
|
||||||
|
* gnu/gcj/io/natSimpleSHSStream.cc
|
||||||
|
(gnu::gcj::io::SimpleSHSStream::shsFinal): Remove bogus cast.
|
||||||
|
* interpret.cc (_Jv_InterpMethod::run): Simplify arguments to
|
||||||
|
_Jv_InterpFrame().
|
||||||
|
* boehm.cc: #undef some autoconf macros before including gc-config.h.
|
||||||
|
(_Jv_MarkObject): Don't mark the class, it is reachable via the vtable.
|
||||||
|
(_Jv_MarkArray): Likewise.
|
||||||
|
* java/lang/ref/natReference.cc (java::lang::ref::Reference::create):
|
||||||
|
Simplify _Jv_GCRegisterDisappearingLink() call.
|
||||||
|
* java/lang/Class.h (getComponentType): Use element_type.
|
||||||
|
(element_type): New field declaration, as a union with "methods".
|
||||||
|
* java/lang/natClassLoader.cc (_Jv_NewArrayClass): Use "element_type".
|
||||||
|
* java/net/natVMNetworkInterfacePosix.cc
|
||||||
|
(java::net::VMNetworkInterface::getInterfaces): Add "int" cast to
|
||||||
|
avoid sign comparison warning.
|
||||||
|
* include/java-interp.h (_Jv_InterpFrame): Take thread as second
|
||||||
|
argument, not parent call frame.
|
||||||
|
* include/x86_64-signal.h (MAKE_THROW_FRAME): Use "gregs" directly,
|
||||||
|
without a cast.
|
||||||
|
(restore_rt): Declare with hidden visibility, not "static".
|
||||||
|
* posix.cc (_Jv_platform_initProperties): Make "tmpdir" a string
|
||||||
|
constant.
|
||||||
|
* jni.cc (_Jv_JNI_DestroyJavaVM): Use a union to avoid strict alias
|
||||||
|
warning.
|
||||||
|
|
||||||
2006-02-08 Bryce McKinlay <mckinlay@redhat.com>
|
2006-02-08 Bryce McKinlay <mckinlay@redhat.com>
|
||||||
|
|
||||||
PR libgcj/26113:
|
PR libgcj/26113:
|
||||||
|
|
|
@ -26,6 +26,12 @@ details. */
|
||||||
#undef TRUE
|
#undef TRUE
|
||||||
#undef FALSE
|
#undef FALSE
|
||||||
|
|
||||||
|
// We include two autoconf headers. Avoid multiple definition warnings.
|
||||||
|
#undef PACKAGE_NAME
|
||||||
|
#undef PACKAGE_STRING
|
||||||
|
#undef PACKAGE_TARNAME
|
||||||
|
#undef PACKAGE_VERSION
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include <gc_config.h>
|
#include <gc_config.h>
|
||||||
|
@ -93,9 +99,6 @@ _Jv_MarkObj (void *addr, void *msp, void *msl, void *env)
|
||||||
p = (GC_PTR) obj->sync_info;
|
p = (GC_PTR) obj->sync_info;
|
||||||
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, obj);
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, obj);
|
||||||
# endif
|
# endif
|
||||||
// Mark the object's class.
|
|
||||||
p = (GC_PTR) klass;
|
|
||||||
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, obj);
|
|
||||||
|
|
||||||
if (__builtin_expect (klass == &java::lang::Class::class$, false))
|
if (__builtin_expect (klass == &java::lang::Class::class$, false))
|
||||||
{
|
{
|
||||||
|
@ -208,7 +211,6 @@ _Jv_MarkArray (void *addr, void *msp, void *msl, void *env)
|
||||||
// we may need to round up the size.
|
// we may need to round up the size.
|
||||||
if (__builtin_expect (! dt || !(dt -> get_finalizer()), false))
|
if (__builtin_expect (! dt || !(dt -> get_finalizer()), false))
|
||||||
return mark_stack_ptr;
|
return mark_stack_ptr;
|
||||||
jclass klass = dt->clas;
|
|
||||||
GC_PTR p;
|
GC_PTR p;
|
||||||
|
|
||||||
p = (GC_PTR) dt;
|
p = (GC_PTR) dt;
|
||||||
|
@ -219,9 +221,6 @@ _Jv_MarkArray (void *addr, void *msp, void *msl, void *env)
|
||||||
p = (GC_PTR) array->sync_info;
|
p = (GC_PTR) array->sync_info;
|
||||||
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, array);
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, array);
|
||||||
# endif
|
# endif
|
||||||
// Mark the object's class.
|
|
||||||
p = (GC_PTR) klass;
|
|
||||||
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, &(dt -> clas));
|
|
||||||
|
|
||||||
for (int i = 0; i < JvGetArrayLength (array); ++i)
|
for (int i = 0; i < JvGetArrayLength (array); ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,7 @@ gnu::gcj::io::SimpleSHSStream::shsFinal (jbyteArray shs_info)
|
||||||
::shsFinal (info);
|
::shsFinal (info);
|
||||||
|
|
||||||
jbyteArray buffer = JvNewByteArray (SHS_DIGESTSIZE);
|
jbyteArray buffer = JvNewByteArray (SHS_DIGESTSIZE);
|
||||||
memcpy (elements (buffer), (jbyte *)&info->digest, SHS_DIGESTSIZE);
|
memcpy (elements (buffer), &info->digest, SHS_DIGESTSIZE);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ details. */
|
||||||
#include <java/lang/Class.h>
|
#include <java/lang/Class.h>
|
||||||
#include <java/lang/ClassLoader.h>
|
#include <java/lang/ClassLoader.h>
|
||||||
#include <java/lang/reflect/Modifier.h>
|
#include <java/lang/reflect/Modifier.h>
|
||||||
|
#include <java/lang/Thread.h>
|
||||||
|
#include <gnu/gcj/RawData.h>
|
||||||
|
|
||||||
// Define this to get the direct-threaded interpreter. If undefined,
|
// Define this to get the direct-threaded interpreter. If undefined,
|
||||||
// we revert to a basic bytecode interpreter. The former is faster
|
// we revert to a basic bytecode interpreter. The former is faster
|
||||||
|
@ -290,22 +292,22 @@ public:
|
||||||
struct _Jv_InterpFrame
|
struct _Jv_InterpFrame
|
||||||
{
|
{
|
||||||
_Jv_InterpMethod *self;
|
_Jv_InterpMethod *self;
|
||||||
_Jv_InterpFrame **ptr;
|
java::lang::Thread *thread;
|
||||||
_Jv_InterpFrame *next;
|
_Jv_InterpFrame *next;
|
||||||
pc_t pc;
|
pc_t pc;
|
||||||
|
|
||||||
_Jv_InterpFrame (_Jv_InterpMethod *s, _Jv_InterpFrame **n)
|
_Jv_InterpFrame (_Jv_InterpMethod *s, java::lang::Thread *thr)
|
||||||
{
|
{
|
||||||
self = s;
|
self = s;
|
||||||
ptr = n;
|
thread = thr;
|
||||||
next = *n;
|
next = (_Jv_InterpFrame *) thr->interp_frame;
|
||||||
*n = this;
|
thr->interp_frame = (gnu::gcj::RawData *) this;
|
||||||
pc = NULL;
|
pc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
~_Jv_InterpFrame ()
|
~_Jv_InterpFrame ()
|
||||||
{
|
{
|
||||||
*ptr = next;
|
thread->interp_frame = (gnu::gcj::RawData *) next;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,7 @@ do \
|
||||||
instruction: the x86_64 exception handler expects \
|
instruction: the x86_64 exception handler expects \
|
||||||
the PC to point to the instruction after a call. */ \
|
the PC to point to the instruction after a call. */ \
|
||||||
struct ucontext *_uc = (struct ucontext *)_p; \
|
struct ucontext *_uc = (struct ucontext *)_p; \
|
||||||
volatile struct sigcontext *_sc = (struct sigcontext *) &_uc->uc_mcontext; \
|
_uc->uc_mcontext.gregs[REG_RIP] += 2; \
|
||||||
_sc->rip += 2; \
|
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
@ -60,7 +59,8 @@ asm \
|
||||||
|
|
||||||
/* The return code for realtime-signals. */
|
/* The return code for realtime-signals. */
|
||||||
RESTORE (restore_rt, __NR_rt_sigreturn)
|
RESTORE (restore_rt, __NR_rt_sigreturn)
|
||||||
static void restore_rt (void) asm ("__restore_rt");
|
void restore_rt (void) asm ("__restore_rt")
|
||||||
|
__attribute__ ((visibility ("hidden")));
|
||||||
|
|
||||||
#define INIT_SEGV \
|
#define INIT_SEGV \
|
||||||
do \
|
do \
|
||||||
|
|
|
@ -807,8 +807,7 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth)
|
||||||
// destructor so it cleans up automatically when the interpreter
|
// destructor so it cleans up automatically when the interpreter
|
||||||
// returns.
|
// returns.
|
||||||
java::lang::Thread *thread = java::lang::Thread::currentThread();
|
java::lang::Thread *thread = java::lang::Thread::currentThread();
|
||||||
_Jv_InterpFrame frame_desc (meth,
|
_Jv_InterpFrame frame_desc (meth, thread);
|
||||||
(_Jv_InterpFrame **) &thread->interp_frame);
|
|
||||||
|
|
||||||
_Jv_word stack[meth->max_stack];
|
_Jv_word stack[meth->max_stack];
|
||||||
_Jv_word *sp = stack;
|
_Jv_word *sp = stack;
|
||||||
|
|
|
@ -368,7 +368,7 @@ public:
|
||||||
|
|
||||||
inline jclass getComponentType (void)
|
inline jclass getComponentType (void)
|
||||||
{
|
{
|
||||||
return isArray () ? (* (jclass *) &methods) : 0;
|
return isArray () ? element_type : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
jboolean isAssignableFrom (jclass cls);
|
jboolean isAssignableFrom (jclass cls);
|
||||||
|
@ -554,7 +554,11 @@ private:
|
||||||
_Jv_Constants constants;
|
_Jv_Constants constants;
|
||||||
// Methods. If this is an array class, then this field holds a
|
// Methods. If this is an array class, then this field holds a
|
||||||
// pointer to the element type.
|
// pointer to the element type.
|
||||||
|
union
|
||||||
|
{
|
||||||
_Jv_Method *methods;
|
_Jv_Method *methods;
|
||||||
|
jclass element_type;
|
||||||
|
};
|
||||||
// Number of methods. If this class is primitive, this holds the
|
// Number of methods. If this class is primitive, this holds the
|
||||||
// character used to represent this type in a signature.
|
// character used to represent this type in a signature.
|
||||||
jshort method_count;
|
jshort method_count;
|
||||||
|
|
|
@ -458,7 +458,7 @@ _Jv_NewArrayClass (jclass element, java::lang::ClassLoader *loader,
|
||||||
= java::lang::Object::class$.vtable_method_count;
|
= java::lang::Object::class$.vtable_method_count;
|
||||||
|
|
||||||
// Stash the pointer to the element type.
|
// Stash the pointer to the element type.
|
||||||
array_class->methods = (_Jv_Method *) element;
|
array_class->element_type = element;
|
||||||
|
|
||||||
// Register our interfaces.
|
// Register our interfaces.
|
||||||
static jclass interfaces[] =
|
static jclass interfaces[] =
|
||||||
|
|
|
@ -363,8 +363,8 @@ void
|
||||||
// finalizer for ourselves as well.
|
// finalizer for ourselves as well.
|
||||||
_Jv_RegisterFinalizer (this, finalize_reference);
|
_Jv_RegisterFinalizer (this, finalize_reference);
|
||||||
_Jv_RegisterFinalizer (referent, finalize_referred_to_object);
|
_Jv_RegisterFinalizer (referent, finalize_referred_to_object);
|
||||||
jobject *objp = reinterpret_cast<jobject *> (&referent);
|
gnu::gcj::RawData **p = &referent;
|
||||||
_Jv_GCRegisterDisappearingLink (objp);
|
_Jv_GCRegisterDisappearingLink ((jobject *) p);
|
||||||
add_to_hash (this);
|
add_to_hash (this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ java::net::VMNetworkInterface::getInterfaces ()
|
||||||
if (::ioctl (fd, SIOCGIFCONF, &if_data) < 0)
|
if (::ioctl (fd, SIOCGIFCONF, &if_data) < 0)
|
||||||
throw new java::net::SocketException;
|
throw new java::net::SocketException;
|
||||||
}
|
}
|
||||||
while (if_data.ifc_len >= (sizeof (struct ifreq) * num_interfaces));
|
while (if_data.ifc_len >= (int) (sizeof (struct ifreq) * num_interfaces));
|
||||||
|
|
||||||
// Get addresses of all interfaces.
|
// Get addresses of all interfaces.
|
||||||
if_record = if_data.ifc_req;
|
if_record = if_data.ifc_req;
|
||||||
|
|
|
@ -2426,7 +2426,12 @@ _Jv_JNI_DestroyJavaVM (JavaVM *vm)
|
||||||
{
|
{
|
||||||
JvAssert (the_vm && vm == the_vm);
|
JvAssert (the_vm && vm == the_vm);
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
JNIEnv *env;
|
JNIEnv *env;
|
||||||
|
void *env_p;
|
||||||
|
};
|
||||||
|
|
||||||
if (_Jv_ThreadCurrent () != NULL)
|
if (_Jv_ThreadCurrent () != NULL)
|
||||||
{
|
{
|
||||||
jstring main_name;
|
jstring main_name;
|
||||||
|
@ -2440,8 +2445,7 @@ _Jv_JNI_DestroyJavaVM (JavaVM *vm)
|
||||||
return JNI_ERR;
|
return JNI_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
jint r = _Jv_JNI_AttachCurrentThread (vm, main_name,
|
jint r = _Jv_JNI_AttachCurrentThread (vm, main_name, &env_p,
|
||||||
reinterpret_cast<void **> (&env),
|
|
||||||
NULL, false);
|
NULL, false);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -98,7 +98,7 @@ _Jv_platform_initProperties (java::util::Properties* newprops)
|
||||||
SET ("file.separator", "/");
|
SET ("file.separator", "/");
|
||||||
SET ("path.separator", ":");
|
SET ("path.separator", ":");
|
||||||
SET ("line.separator", "\n");
|
SET ("line.separator", "\n");
|
||||||
char *tmpdir = ::getenv("TMPDIR");
|
const char *tmpdir = ::getenv("TMPDIR");
|
||||||
if (! tmpdir)
|
if (! tmpdir)
|
||||||
tmpdir = "/tmp";
|
tmpdir = "/tmp";
|
||||||
SET ("java.io.tmpdir", tmpdir);
|
SET ("java.io.tmpdir", tmpdir);
|
||||||
|
|
Loading…
Reference in New Issue