remove alloca from natMethod.cc

Andreas Tobler toa@pop.agri.ch
Mon Jan 7 11:47:00 GMT 2002


Hi,

while digging with darwin and libgcj I struggle over a undefined
_alloca. A hint from Jeff S. showed me AG's patch for defineclass.cc
from last february.

I have now for natMethod.cc something similar.

Is this ok or completley wrong?

Thanks for feedback.

Built on darwin5.2.

Andreas

P.S. with the ar switches qc discussed parallel on java@gcc.gnu.org

2002-01-07  Andreas Tobler <a.tobler@schweiz.ch>

        * java/lang/reflect/natMethod.cc: Don't include alloca.h.
        (_Jv_CallAnyMethodA): Convert alloca to __builtin_alloca.

--- java/lang/reflect/natMethod.cc.orig Mon Jan  7 20:18:52 2002
+++ java/lang/reflect/natMethod.cc      Mon Jan  7 20:20:41 2002
@@ -10,9 +10,6 @@

 #include <config.h>

-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#endif

 #include <gcj/cni.h>
 #include <jvm.h>
@@ -348,7 +345,7 @@
     rtype = &ffi_type_void;
   else
     rtype = get_ffi_type (return_type);
-  ffi_type **argtypes = (ffi_type **) alloca (param_count
+  ffi_type **argtypes = (ffi_type **) __builtin_alloca (param_count
                                              * sizeof (ffi_type *));

   jclass *paramelts = elements (parameter_types);
@@ -392,8 +389,8 @@
       // FIXME: throw some kind of VirtualMachineError here.
     }

-  char *p = (char *) alloca (size);
-  void **values = (void **) alloca (param_count * sizeof (void *));
+  char *p = (char *) __builtin_alloca (size);
+  void **values = (void **) __builtin_alloca (param_count * sizeof
(void *));

   i = 0;
   if (needs_this)



More information about the Java-patches mailing list