Patchwork Two patches for gcj on ARM backported to gcc 4.6 branch

login
register
mail settings
Submitter Andrew Haley
Date Oct. 4, 2011, 4:59 p.m.
Message ID <4E8B3B62.2030305@redhat.com>
Download mbox | patch
Permalink /patch/117665/
State New
Headers show

Comments

Andrew Haley - Oct. 4, 2011, 4:59 p.m.
Two patches, both in trunk for some time, which fix crashes on ARM.

Andrew.


2011-10-04  Andrew Haley  <aph@redhat.com>

        * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Clear icache.

Patch

Index: libffi/src/arm/ffi.c
===================================================================
--- libffi/src/arm/ffi.c	(revision 179511)
+++ libffi/src/arm/ffi.c	(working copy)
@@ -341,12 +341,16 @@ 
 ({ unsigned char *__tramp = (unsigned char*)(TRAMP);			\
    unsigned int  __fun = (unsigned int)(FUN);				\
    unsigned int  __ctx = (unsigned int)(CTX);				\
+   unsigned char *insns = (unsigned char *)(CTX);                       \
    *(unsigned int*) &__tramp[0] = 0xe92d000f; /* stmfd sp!, {r0-r3} */	\
    *(unsigned int*) &__tramp[4] = 0xe59f0000; /* ldr r0, [pc] */	\
    *(unsigned int*) &__tramp[8] = 0xe59ff000; /* ldr pc, [pc] */	\
    *(unsigned int*) &__tramp[12] = __ctx;				\
    *(unsigned int*) &__tramp[16] = __fun;				\
-   __clear_cache((&__tramp[0]), (&__tramp[19]));			\
+   __clear_cache((&__tramp[0]), (&__tramp[19])); /* Clear data mapping.  */ \
+   __clear_cache(insns, insns + 3 * sizeof (unsigned int));             \
+                                                 /* Clear instruction   \
+                                                    mapping.  */        \
  })


2011-07-12  Andrew Haley  <aph@redhat.com>

        * java/lang/natClass.cc (finalize): Make sure that the class
        really has an engine.

Index: libjava/java/lang/natClass.cc
===================================================================
--- libjava/java/lang/natClass.cc	(revision 179511)
+++ libjava/java/lang/natClass.cc	(working copy)
@@ -668,7 +668,9 @@ 
 void
 java::lang::Class::finalize (void)
 {
-  engine->unregister(this);
+  // Array classes don't have an engine, and don't need to be finalized.
+  if (engine)
+    engine->unregister(this);
 }

 #ifdef INTERPRETER