OSDN Git Service

* class.c (add_method_1): Set both DECL_EXTERNAL and METHOD_NATIVE
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 May 2000 20:32:31 +0000 (20:32 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 May 2000 20:32:31 +0000 (20:32 +0000)
on native function.
* jcf-parse.c (parse_class_file): Call build_jni_stub for native
JNI methods.
* expr.c (build_jni_stub): New function.
* lang-specs.h: -fjni and -femit-class-file are incompatible.
* parse.c: Rebuilt.
* parse.y (java_complete_expand_methods): Expand a native method
and call build_jni_stub if -fjni given.
* lang-options.h: Document -fjni.
* lang.c (flag_jni): New global.
(lang_f_options): Added `jni' entry.
* java-tree.h (soft_lookupjnimethod_node,
soft_getjnienvnewframe_node, soft_jnipopsystemframe_node):
Declare.
(flag_jni): Declare.
(build_jni_stub): Declare.
(struct lang_decl): Added `native' flag.
(METHOD_NATIVE): Redefined to use `native' field of lang specific
structure.
* decl.c (soft_lookupjnimethod_node, soft_getjnienvnewframe_node,
soft_jnipopsystemframe_node): New globals.
(init_decl_processing): Set them.  _Jv_InitClass only takes one
argument.

* java-tree.def: Put into `C' mode.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33615 138bc75d-0d04-0410-961f-82ee72b054a4

12 files changed:
gcc/java/ChangeLog
gcc/java/class.c
gcc/java/decl.c
gcc/java/expr.c
gcc/java/java-tree.def
gcc/java/java-tree.h
gcc/java/jcf-parse.c
gcc/java/lang-options.h
gcc/java/lang-specs.h
gcc/java/lang.c
gcc/java/parse.c
gcc/java/parse.y

index 29ac87f..e3e3a63 100644 (file)
@@ -1,3 +1,32 @@
+2000-04-19  Tom Tromey  &lt;tromey@cygnus.com&gt;
+
+       * class.c (add_method_1): Set both DECL_EXTERNAL and METHOD_NATIVE
+       on native function.
+       * jcf-parse.c (parse_class_file): Call build_jni_stub for native
+       JNI methods.
+       * expr.c (build_jni_stub): New function.
+       * lang-specs.h: -fjni and -femit-class-file are incompatible.
+       * parse.c: Rebuilt.
+       * parse.y (java_complete_expand_methods): Expand a native method
+       and call build_jni_stub if -fjni given.
+       * lang-options.h: Document -fjni.
+       * lang.c (flag_jni): New global.
+       (lang_f_options): Added `jni' entry.
+       * java-tree.h (soft_lookupjnimethod_node,
+       soft_getjnienvnewframe_node, soft_jnipopsystemframe_node):
+       Declare.
+       (flag_jni): Declare.
+       (build_jni_stub): Declare.
+       (struct lang_decl): Added `native' flag.
+       (METHOD_NATIVE): Redefined to use `native' field of lang specific
+       structure.
+       * decl.c (soft_lookupjnimethod_node, soft_getjnienvnewframe_node,
+       soft_jnipopsystemframe_node): New globals.
+       (init_decl_processing): Set them.  _Jv_InitClass only takes one
+       argument.
+
+       * java-tree.def: Put into `C' mode.
+
 2000-04-27  Tom Tromey  <tromey@cygnus.com>
 
        Fix for PR gcj/2:
 2000-04-27  Tom Tromey  <tromey@cygnus.com>
 
        Fix for PR gcj/2:
index 031d4b7..ca29eb9 100644 (file)
@@ -644,7 +644,11 @@ add_method_1 (handle_class, access_flags, name, function_type)
   if (access_flags & ACC_PROTECTED) METHOD_PROTECTED (fndecl) = 1;
   if (access_flags & ACC_PRIVATE)
     METHOD_PRIVATE (fndecl) = DECL_INLINE (fndecl) = 1;
   if (access_flags & ACC_PROTECTED) METHOD_PROTECTED (fndecl) = 1;
   if (access_flags & ACC_PRIVATE)
     METHOD_PRIVATE (fndecl) = DECL_INLINE (fndecl) = 1;
-  if (access_flags & ACC_NATIVE) METHOD_NATIVE (fndecl) = 1;
+  if (access_flags & ACC_NATIVE)
+    {
+      METHOD_NATIVE (fndecl) = 1;
+      DECL_EXTERNAL (fndecl) = 1;
+    }
   if (access_flags & ACC_STATIC) 
     METHOD_STATIC (fndecl) = DECL_INLINE (fndecl) = 1;
   if (access_flags & ACC_FINAL) 
   if (access_flags & ACC_STATIC) 
     METHOD_STATIC (fndecl) = DECL_INLINE (fndecl) = 1;
   if (access_flags & ACC_FINAL) 
index 385a8aa..a5eb527 100644 (file)
@@ -381,6 +381,9 @@ tree soft_checkarraystore_node;
 tree soft_monitorenter_node;
 tree soft_monitorexit_node;
 tree soft_lookupinterfacemethod_node;
 tree soft_monitorenter_node;
 tree soft_monitorexit_node;
 tree soft_lookupinterfacemethod_node;
+tree soft_lookupjnimethod_node;
+tree soft_getjnienvnewframe_node;
+tree soft_jnipopsystemframe_node;
 tree soft_fmod_node;
 tree soft_exceptioninfo_call_node;
 tree soft_idiv_node;
 tree soft_fmod_node;
 tree soft_exceptioninfo_call_node;
 tree soft_idiv_node;
@@ -753,12 +756,13 @@ init_decl_processing ()
                                        build_function_type (ptr_type_node, t),
                                        0, NOT_BUILT_IN, NULL_PTR);
   DECL_IS_MALLOC (alloc_object_node) = 1;
                                        build_function_type (ptr_type_node, t),
                                        0, NOT_BUILT_IN, NULL_PTR);
   DECL_IS_MALLOC (alloc_object_node) = 1;
+
+  t = tree_cons (NULL_TREE, ptr_type_node, endlink);
   soft_initclass_node = builtin_function ("_Jv_InitClass",
                                          build_function_type (void_type_node,
                                                               t),
                                          0, NOT_BUILT_IN,
                                          NULL_PTR);
   soft_initclass_node = builtin_function ("_Jv_InitClass",
                                          build_function_type (void_type_node,
                                                               t),
                                          0, NOT_BUILT_IN,
                                          NULL_PTR);
-  t = tree_cons (NULL_TREE, ptr_type_node, endlink);
   throw_node[0] = builtin_function ("_Jv_Throw",
                                    build_function_type (ptr_type_node, t),
                                    0, NOT_BUILT_IN, NULL_PTR);
   throw_node[0] = builtin_function ("_Jv_Throw",
                                    build_function_type (ptr_type_node, t),
                                    0, NOT_BUILT_IN, NULL_PTR);
@@ -848,6 +852,24 @@ init_decl_processing ()
     = builtin_function ("_Jv_LookupInterfaceMethodIdx",
                        build_function_type (ptr_type_node, t),
                        0, NOT_BUILT_IN, NULL_PTR);
     = builtin_function ("_Jv_LookupInterfaceMethodIdx",
                        build_function_type (ptr_type_node, t),
                        0, NOT_BUILT_IN, NULL_PTR);
+
+  t = tree_cons (NULL_TREE, object_ptr_type_node,
+                tree_cons (NULL_TREE, ptr_type_node,
+                           tree_cons (NULL_TREE, ptr_type_node, endlink)));
+  soft_lookupjnimethod_node
+    = builtin_function ("_Jv_LookupJNIMethod",
+                       build_function_type (ptr_type_node, t),
+                       0, NOT_BUILT_IN, NULL_PTR);
+  t = tree_cons (NULL_TREE, ptr_type_node, endlink);
+  soft_getjnienvnewframe_node
+    = builtin_function ("_Jv_GetJNIEnvNewFrame",
+                       build_function_type (ptr_type_node, t),
+                       0, NOT_BUILT_IN, NULL_PTR);
+  soft_jnipopsystemframe_node
+    = builtin_function ("_Jv_JNI_PopSystemFrame",
+                       build_function_type (ptr_type_node, t),
+                       0, NOT_BUILT_IN, NULL_PTR);
+
   t = tree_cons (NULL_TREE, double_type_node,
                 tree_cons (NULL_TREE, double_type_node, endlink));
   soft_fmod_node
   t = tree_cons (NULL_TREE, double_type_node,
                 tree_cons (NULL_TREE, double_type_node, endlink));
   soft_fmod_node
@@ -1726,7 +1748,7 @@ complete_start_java_method (fndecl)
 
   if (METHOD_SYNCHRONIZED (fndecl) && ! flag_emit_class_files)
     {
 
   if (METHOD_SYNCHRONIZED (fndecl) && ! flag_emit_class_files)
     {
-      /* Warp function body with a monitorenter plus monitorexit cleanup. */
+      /* Wrap function body with a monitorenter plus monitorexit cleanup. */
       tree enter, exit, lock;
       if (METHOD_STATIC (fndecl))
        lock = build_class_ref (DECL_CONTEXT (fndecl));
       tree enter, exit, lock;
       if (METHOD_STATIC (fndecl))
        lock = build_class_ref (DECL_CONTEXT (fndecl));
index 5666502..37358e5 100644 (file)
@@ -1844,6 +1844,165 @@ expand_invoke (opcode, method_ref_index, nargs)
     }
 }
 
     }
 }
 
+/* Create a stub which will be put into the vtable but which will call
+   a JNI function.  */
+
+tree
+build_jni_stub (method)
+     tree method;
+{
+  tree jnifunc, call, args, body, lookup_arg, method_sig, arg_types;
+  tree jni_func_type, tem;
+  tree env_var, res_var = NULL_TREE, block;
+  tree method_args, res_type;
+
+  tree klass = DECL_CONTEXT (method);
+  int from_class = ! CLASS_FROM_SOURCE_P (klass);
+  klass = build_class_ref (klass);
+
+  if (! METHOD_NATIVE (method) || ! flag_jni)
+    abort ();
+
+  DECL_ARTIFICIAL (method) = 1;
+  DECL_EXTERNAL (method) = 0;
+
+  env_var = build_decl (VAR_DECL, get_identifier ("env"), ptr_type_node);
+  if (TREE_TYPE (TREE_TYPE (method)) != void_type_node)
+    {
+      res_var = build_decl (VAR_DECL, get_identifier ("res"),
+                           TREE_TYPE (TREE_TYPE (method)));
+      TREE_CHAIN (env_var) = res_var;
+    }
+
+  /* One strange way that the front ends are different is that they
+     store arguments differently.  */
+  if (from_class)
+    method_args = DECL_ARGUMENTS (method);
+  else
+    method_args = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (method));
+  block = build_block (env_var, NULL_TREE, NULL_TREE,
+                      method_args, NULL_TREE);
+  TREE_SIDE_EFFECTS (block) = 1;
+  /* When compiling from source we don't set the type of the block,
+     because that will prevent patch_return from ever being run.  */
+  if (from_class)
+    TREE_TYPE (block) = TREE_TYPE (TREE_TYPE (method));
+
+  /* Compute the local `env' by calling _Jv_GetJNIEnvNewFrame.  */
+  body = build (MODIFY_EXPR, ptr_type_node, env_var,
+               build (CALL_EXPR, ptr_type_node,
+                      build_address_of (soft_getjnienvnewframe_node),
+                      build_tree_list (NULL_TREE, klass),
+                      NULL_TREE));
+  CAN_COMPLETE_NORMALLY (body) = 1;
+
+  /* All the arguments to this method become arguments to the
+     underlying JNI function.  If we had to wrap object arguments in a
+     special way, we would do that here.  */
+  args = NULL_TREE;
+  for (tem = method_args; tem != NULL_TREE; tem = TREE_CHAIN (tem))
+    args = tree_cons (NULL_TREE, tem, args);
+  args = nreverse (args);
+  arg_types = TYPE_ARG_TYPES (TREE_TYPE (method));
+
+  /* For a static method the second argument is the class.  For a
+     non-static method the second argument is `this'; that is already
+     available in the argument list.  */
+  if (METHOD_STATIC (method))
+    {
+      args = tree_cons (NULL_TREE, klass, args);
+      arg_types = tree_cons (NULL_TREE, object_ptr_type_node, arg_types);
+    }
+
+  /* The JNIEnv structure is the first argument to the JNI function.  */
+  args = tree_cons (NULL_TREE, env_var, args);
+  arg_types = tree_cons (NULL_TREE, ptr_type_node, arg_types);
+
+  /* We call _Jv_LookupJNIMethod to find the actual underlying
+     function pointer.  _Jv_LookupJNIMethod will throw the appropriate
+     exception if this function is not found at runtime.  */
+  method_sig = build_java_signature (TREE_TYPE (method));
+  lookup_arg =
+    build_tree_list (NULL_TREE,
+                    build_utf8_ref (unmangle_classname
+                                    (IDENTIFIER_POINTER (method_sig),
+                                     IDENTIFIER_LENGTH (method_sig))));
+  tem = DECL_NAME (method);
+  lookup_arg
+    = tree_cons (NULL_TREE, klass,
+                tree_cons (NULL_TREE, build_utf8_ref (tem), lookup_arg));
+
+  jni_func_type
+    = build_pointer_type (build_function_type (TREE_TYPE (TREE_TYPE (method)),
+                                              arg_types));
+
+  jnifunc = build (CALL_EXPR, ptr_type_node,
+                  build_address_of (soft_lookupjnimethod_node),
+                  lookup_arg, NULL_TREE);
+
+  /* Now we make the actual JNI call via the resulting function
+     pointer.    */
+  call = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (method)),
+               build1 (NOP_EXPR, jni_func_type, jnifunc),
+               args, NULL_TREE);
+
+  /* If the JNI call returned a result, capture it here.  If we had to
+     unwrap JNI object results, we would do that here.  */
+  if (res_var != NULL_TREE)
+    call = build (MODIFY_EXPR, TREE_TYPE (TREE_TYPE (method)),
+                 res_var, call);
+
+  TREE_SIDE_EFFECTS (call) = 1;
+  CAN_COMPLETE_NORMALLY (call) = 1;
+
+  body = build (COMPOUND_EXPR, void_type_node, body, call);
+  TREE_SIDE_EFFECTS (body) = 1;
+
+  /* Now free the environment we allocated.  */
+  call = build (CALL_EXPR, ptr_type_node,
+               build_address_of (soft_jnipopsystemframe_node),
+               build_tree_list (NULL_TREE, env_var),
+               NULL_TREE);
+  TREE_SIDE_EFFECTS (call) = 1;
+  CAN_COMPLETE_NORMALLY (call) = 1;
+  body = build (COMPOUND_EXPR, void_type_node, body, call);
+  TREE_SIDE_EFFECTS (body) = 1;
+
+  /* Finally, do the return.  When compiling from source we rely on
+     patch_return to patch the return value -- because DECL_RESULT is
+     not set at the time this function is called.  */
+  if (from_class)
+    {
+      res_type = void_type_node;
+      if (res_var != NULL_TREE)
+       {
+         tree drt;
+         if (! DECL_RESULT (method))
+           abort ();
+         /* Make sure we copy the result variable to the actual
+            result.  We use the type of the DECL_RESULT because it
+            might be different from the return type of the function:
+            it might be promoted.  */
+         drt = TREE_TYPE (DECL_RESULT (method));
+         if (drt != TREE_TYPE (res_var))
+           res_var = build1 (CONVERT_EXPR, drt, res_var);
+         res_var = build (MODIFY_EXPR, drt, DECL_RESULT (method), res_var);
+         TREE_SIDE_EFFECTS (res_var) = 1;
+       }
+    }
+  else
+    {
+      /* This is necessary to get patch_return to run.  */
+      res_type = NULL_TREE;
+    }
+  body = build (COMPOUND_EXPR, void_type_node, body,
+               build1 (RETURN_EXPR, res_type, res_var));
+  TREE_SIDE_EFFECTS (body) = 1;
+
+  BLOCK_EXPR_BODY (block) = body;
+  return block;
+}
+
 
 /* Expand an operation to extract from or store into a field.
    IS_STATIC is 1 iff the field is static.
 
 /* Expand an operation to extract from or store into a field.
    IS_STATIC is 1 iff the field is static.
index aad5524..1b00769 100644 (file)
@@ -63,7 +63,7 @@ DEFTREECODE (CATCH_EXPR, "catch", '1', 1)
 DEFTREECODE (SYNCHRONIZED_EXPR, "synchronized", 'e', 2)
 
 /* Throw statement.
 DEFTREECODE (SYNCHRONIZED_EXPR, "synchronized", 'e', 2)
 
 /* Throw statement.
-   Operand 0 is the throw expresion.  */
+   Operand 0 is the throw expression.  */
 DEFTREECODE (THROW_EXPR, "throw", '1', 1)
 
 /* Conditional operator.
 DEFTREECODE (THROW_EXPR, "throw", '1', 1)
 
 /* Conditional operator.
@@ -93,3 +93,8 @@ DEFTREECODE (CLASS_LITERAL, "class_literal", '1', 1)
    is used for context detection, so that special rules can be
    enforced. */
 DEFTREECODE (INSTANCE_INITIALIZERS_EXPR, "instance_initializers_expr", '1', 1)
    is used for context detection, so that special rules can be
    enforced. */
 DEFTREECODE (INSTANCE_INITIALIZERS_EXPR, "instance_initializers_expr", '1', 1)
+/*
+Local variables:
+mode:c
+End:
+*/
index 5e56a17..1bf166a 100644 (file)
@@ -135,6 +135,11 @@ extern int flag_assume_compiled;
 
 extern int flag_emit_class_files;
 
 
 extern int flag_emit_class_files;
 
+/* When non zero, assume all native functions are implemented with
+   JNI, not CNI.  */
+
+extern int flag_jni;
+
 /* When non zero, we emit xref strings. Values of the flag for xref
    backends are defined in xref.h.  */
 
 /* When non zero, we emit xref strings. Values of the flag for xref
    backends are defined in xref.h.  */
 
@@ -296,6 +301,9 @@ extern tree soft_checkarraystore_node;
 extern tree soft_monitorenter_node;
 extern tree soft_monitorexit_node;
 extern tree soft_lookupinterfacemethod_node;
 extern tree soft_monitorenter_node;
 extern tree soft_monitorexit_node;
 extern tree soft_lookupinterfacemethod_node;
+extern tree soft_lookupjnimethod_node;
+extern tree soft_getjnienvnewframe_node;
+extern tree soft_jnipopsystemframe_node;
 extern tree soft_fmod_node;
 extern tree soft_exceptioninfo_call_node;
 extern tree soft_idiv_node;
 extern tree soft_fmod_node;
 extern tree soft_exceptioninfo_call_node;
 extern tree soft_idiv_node;
@@ -514,6 +522,9 @@ struct lang_decl
   tree inner_access;           /* The identifier of the access method
                                   used for invocation from inner classes */
   int nap;                     /* Number of artificial parameters */
   tree inner_access;           /* The identifier of the access method
                                   used for invocation from inner classes */
   int nap;                     /* Number of artificial parameters */
+
+  int native : 1;              /* Nonzero if this is a native
+                                  method.  */
 };
 
 /* init_test_table hash table entry structure.  */
 };
 
 /* init_test_table hash table entry structure.  */
@@ -649,6 +660,7 @@ extern tree build_known_method_ref PARAMS ((tree, tree, tree, tree, tree));
 extern tree build_class_init PARAMS ((tree, tree));
 extern tree build_invokevirtual PARAMS ((tree, tree));
 extern tree build_invokeinterface PARAMS ((tree, tree));
 extern tree build_class_init PARAMS ((tree, tree));
 extern tree build_invokevirtual PARAMS ((tree, tree));
 extern tree build_invokeinterface PARAMS ((tree, tree));
+extern tree build_jni_stub PARAMS ((tree));
 extern tree invoke_build_dtable PARAMS ((int, tree));
 extern tree build_field_ref PARAMS ((tree, tree, tree));
 extern void pushdecl_force_head PARAMS ((tree));
 extern tree invoke_build_dtable PARAMS ((int, tree));
 extern tree build_field_ref PARAMS ((tree, tree, tree));
 extern void pushdecl_force_head PARAMS ((tree));
@@ -773,7 +785,7 @@ struct rtx_def * java_lang_expand_expr PARAMS ((tree, rtx, enum machine_mode,
 #define METHOD_STATIC(DECL) DECL_LANG_FLAG_2 (DECL)
 #define METHOD_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)
 #define METHOD_SYNCHRONIZED(DECL) DECL_LANG_FLAG_4 (DECL)
 #define METHOD_STATIC(DECL) DECL_LANG_FLAG_2 (DECL)
 #define METHOD_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)
 #define METHOD_SYNCHRONIZED(DECL) DECL_LANG_FLAG_4 (DECL)
-#define METHOD_NATIVE(DECL) DECL_EXTERNAL(DECL)
+#define METHOD_NATIVE(DECL) (DECL_LANG_SPECIFIC(DECL)->native)
 #define METHOD_ABSTRACT(DECL) DECL_LANG_FLAG_5 (DECL)
 #define METHOD_TRANSIENT(DECL) DECL_LANG_FLAG_6 (DECL)
 
 #define METHOD_ABSTRACT(DECL) DECL_LANG_FLAG_5 (DECL)
 #define METHOD_TRANSIENT(DECL) DECL_LANG_FLAG_6 (DECL)
 
index 4c3dff7..6d4f246 100644 (file)
@@ -684,9 +684,22 @@ parse_class_file ()
     {
       JCF *jcf = current_jcf;
 
     {
       JCF *jcf = current_jcf;
 
-      if (METHOD_NATIVE (method) || METHOD_ABSTRACT (method))
+      if (METHOD_ABSTRACT (method))
        continue;
 
        continue;
 
+      if (METHOD_NATIVE (method))
+       {
+         if (! flag_jni)
+           continue;
+         DECL_MAX_LOCALS (method)
+           = list_length (TYPE_ARG_TYPES (TREE_TYPE (method)));
+         start_java_method (method);
+         give_name_to_locals (jcf);
+         expand_expr_stmt (build_jni_stub (method));
+         end_java_method ();
+         continue;
+       }
+
       if (DECL_CODE_OFFSET (method) == 0)
        {
          error ("missing Code attribute");
       if (DECL_CODE_OFFSET (method) == 0)
        {
          error ("missing Code attribute");
index 44f9ea4..b6951c6 100644 (file)
@@ -35,6 +35,7 @@ DEFINE_LANG_NAME ("Java")
   { "-femit-class-files", "Dump class files to <name>.class" },
   { "-fuse-boehm-gc", "Generate code for Boehm GC" },
   { "-fhash-synchronization", "Don't put synchronization structure in each object" },
   { "-femit-class-files", "Dump class files to <name>.class" },
   { "-fuse-boehm-gc", "Generate code for Boehm GC" },
   { "-fhash-synchronization", "Don't put synchronization structure in each object" },
+  { "-fjni", "Assume native functions are implemented using JNI" },
 #if ! USE_CPPLIB
   { "-MD", "Print dependencies to FILE.d" },
   { "-MMD", "Print dependencies to FILE.d" },
 #if ! USE_CPPLIB
   { "-MD", "Print dependencies to FILE.d" },
   { "-MMD", "Print dependencies to FILE.d" },
index 574a98e..019fca6 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions for specs for the GNU compiler for the Java(TM) language.
 /* Definitions for specs for the GNU compiler for the Java(TM) language.
-   Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
 
 This file is part of GNU CC.
 
@@ -36,6 +36,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
                    %{f*} %{+e*} %{aux-info*} %{Qn:-fno-ident}\
                     %{I*}\
                    %{MD} %{MMD} %{M} %{MM}\
                    %{f*} %{+e*} %{aux-info*} %{Qn:-fno-ident}\
                     %{I*}\
                    %{MD} %{MMD} %{M} %{MM}\
+                    %{fjni:%{femit-class-file:%e-fjni and -femit-class-file are incompatible}}\
                    %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
                    %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
             %{!S:as %a %Y\
                    %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
                    %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
             %{!S:as %a %Y\
index ad1b826..f8c37f2 100644 (file)
@@ -117,6 +117,10 @@ int flag_use_boehm_gc = 0;
    object to its synchronization structure.  */
 int flag_hash_synchronization;
 
    object to its synchronization structure.  */
 int flag_hash_synchronization;
 
+/* When non zero, assume all native functions are implemented with
+   JNI, not CNI.  */
+int flag_jni = 0;
+
 /* From gcc/flags.h, and indicates if exceptions are turned on or not.  */
 
 extern int flag_new_exceptions;
 /* From gcc/flags.h, and indicates if exceptions are turned on or not.  */
 
 extern int flag_new_exceptions;
@@ -135,7 +139,8 @@ lang_f_options[] =
   {"emit-class-files", &flag_emit_class_files, 1},
   {"use-divide-subroutine", &flag_use_divide_subroutine, 1},
   {"use-boehm-gc", &flag_use_boehm_gc, 1},
   {"emit-class-files", &flag_emit_class_files, 1},
   {"use-divide-subroutine", &flag_use_divide_subroutine, 1},
   {"use-boehm-gc", &flag_use_boehm_gc, 1},
-  {"hash-synchronization", &flag_hash_synchronization, 1}
+  {"hash-synchronization", &flag_hash_synchronization, 1},
+  {"jni", &flag_jni, 1}
 };
 
 JCF *current_jcf;
 };
 
 JCF *current_jcf;
index 42d4699..a362a5d 100644 (file)
@@ -1,6 +1,7 @@
 
 /*  A Bison parser, made from ./parse.y
 
 /*  A Bison parser, made from ./parse.y
-    by GNU Bison version 1.28  */
+ by  GNU Bison version 1.25
+  */
 
 #define YYBISON 1  /* Identify Bison output.  */
 
 
 #define YYBISON 1  /* Identify Bison output.  */
 
 #define yychar java_char
 #define yydebug java_debug
 #define yynerrs java_nerrs
 #define yychar java_char
 #define yydebug java_debug
 #define yynerrs java_nerrs
-#define        PLUS_TK 257
-#define        MINUS_TK        258
-#define        MULT_TK 259
-#define        DIV_TK  260
-#define        REM_TK  261
-#define        LS_TK   262
-#define        SRS_TK  263
-#define        ZRS_TK  264
-#define        AND_TK  265
-#define        XOR_TK  266
-#define        OR_TK   267
-#define        BOOL_AND_TK     268
-#define        BOOL_OR_TK      269
-#define        EQ_TK   270
-#define        NEQ_TK  271
-#define        GT_TK   272
-#define        GTE_TK  273
-#define        LT_TK   274
-#define        LTE_TK  275
-#define        PLUS_ASSIGN_TK  276
-#define        MINUS_ASSIGN_TK 277
-#define        MULT_ASSIGN_TK  278
-#define        DIV_ASSIGN_TK   279
-#define        REM_ASSIGN_TK   280
-#define        LS_ASSIGN_TK    281
-#define        SRS_ASSIGN_TK   282
-#define        ZRS_ASSIGN_TK   283
-#define        AND_ASSIGN_TK   284
-#define        XOR_ASSIGN_TK   285
-#define        OR_ASSIGN_TK    286
-#define        PUBLIC_TK       287
-#define        PRIVATE_TK      288
-#define        PROTECTED_TK    289
-#define        STATIC_TK       290
-#define        FINAL_TK        291
-#define        SYNCHRONIZED_TK 292
-#define        VOLATILE_TK     293
-#define        TRANSIENT_TK    294
-#define        NATIVE_TK       295
-#define        PAD_TK  296
-#define        ABSTRACT_TK     297
-#define        MODIFIER_TK     298
-#define        DECR_TK 299
-#define        INCR_TK 300
-#define        DEFAULT_TK      301
-#define        IF_TK   302
-#define        THROW_TK        303
-#define        BOOLEAN_TK      304
-#define        DO_TK   305
-#define        IMPLEMENTS_TK   306
-#define        THROWS_TK       307
-#define        BREAK_TK        308
-#define        IMPORT_TK       309
-#define        ELSE_TK 310
-#define        INSTANCEOF_TK   311
-#define        RETURN_TK       312
-#define        VOID_TK 313
-#define        CATCH_TK        314
-#define        INTERFACE_TK    315
-#define        CASE_TK 316
-#define        EXTENDS_TK      317
-#define        FINALLY_TK      318
-#define        SUPER_TK        319
-#define        WHILE_TK        320
-#define        CLASS_TK        321
-#define        SWITCH_TK       322
-#define        CONST_TK        323
-#define        TRY_TK  324
-#define        FOR_TK  325
-#define        NEW_TK  326
-#define        CONTINUE_TK     327
-#define        GOTO_TK 328
-#define        PACKAGE_TK      329
-#define        THIS_TK 330
-#define        BYTE_TK 331
-#define        SHORT_TK        332
-#define        INT_TK  333
-#define        LONG_TK 334
-#define        CHAR_TK 335
-#define        INTEGRAL_TK     336
-#define        FLOAT_TK        337
-#define        DOUBLE_TK       338
-#define        FP_TK   339
-#define        ID_TK   340
-#define        REL_QM_TK       341
-#define        REL_CL_TK       342
-#define        NOT_TK  343
-#define        NEG_TK  344
-#define        ASSIGN_ANY_TK   345
-#define        ASSIGN_TK       346
-#define        OP_TK   347
-#define        CP_TK   348
-#define        OCB_TK  349
-#define        CCB_TK  350
-#define        OSB_TK  351
-#define        CSB_TK  352
-#define        SC_TK   353
-#define        C_TK    354
-#define        DOT_TK  355
-#define        STRING_LIT_TK   356
-#define        CHAR_LIT_TK     357
-#define        INT_LIT_TK      358
-#define        FP_LIT_TK       359
-#define        TRUE_TK 360
-#define        FALSE_TK        361
-#define        BOOL_LIT_TK     362
-#define        NULL_TK 363
+#define        PLUS_TK 258
+#define        MINUS_TK        259
+#define        MULT_TK 260
+#define        DIV_TK  261
+#define        REM_TK  262
+#define        LS_TK   263
+#define        SRS_TK  264
+#define        ZRS_TK  265
+#define        AND_TK  266
+#define        XOR_TK  267
+#define        OR_TK   268
+#define        BOOL_AND_TK     269
+#define        BOOL_OR_TK      270
+#define        EQ_TK   271
+#define        NEQ_TK  272
+#define        GT_TK   273
+#define        GTE_TK  274
+#define        LT_TK   275
+#define        LTE_TK  276
+#define        PLUS_ASSIGN_TK  277
+#define        MINUS_ASSIGN_TK 278
+#define        MULT_ASSIGN_TK  279
+#define        DIV_ASSIGN_TK   280
+#define        REM_ASSIGN_TK   281
+#define        LS_ASSIGN_TK    282
+#define        SRS_ASSIGN_TK   283
+#define        ZRS_ASSIGN_TK   284
+#define        AND_ASSIGN_TK   285
+#define        XOR_ASSIGN_TK   286
+#define        OR_ASSIGN_TK    287
+#define        PUBLIC_TK       288
+#define        PRIVATE_TK      289
+#define        PROTECTED_TK    290
+#define        STATIC_TK       291
+#define        FINAL_TK        292
+#define        SYNCHRONIZED_TK 293
+#define        VOLATILE_TK     294
+#define        TRANSIENT_TK    295
+#define        NATIVE_TK       296
+#define        PAD_TK  297
+#define        ABSTRACT_TK     298
+#define        MODIFIER_TK     299
+#define        DECR_TK 300
+#define        INCR_TK 301
+#define        DEFAULT_TK      302
+#define        IF_TK   303
+#define        THROW_TK        304
+#define        BOOLEAN_TK      305
+#define        DO_TK   306
+#define        IMPLEMENTS_TK   307
+#define        THROWS_TK       308
+#define        BREAK_TK        309
+#define        IMPORT_TK       310
+#define        ELSE_TK 311
+#define        INSTANCEOF_TK   312
+#define        RETURN_TK       313
+#define        VOID_TK 314
+#define        CATCH_TK        315
+#define        INTERFACE_TK    316
+#define        CASE_TK 317
+#define        EXTENDS_TK      318
+#define        FINALLY_TK      319
+#define        SUPER_TK        320
+#define        WHILE_TK        321
+#define        CLASS_TK        322
+#define        SWITCH_TK       323
+#define        CONST_TK        324
+#define        TRY_TK  325
+#define        FOR_TK  326
+#define        NEW_TK  327
+#define        CONTINUE_TK     328
+#define        GOTO_TK 329
+#define        PACKAGE_TK      330
+#define        THIS_TK 331
+#define        BYTE_TK 332
+#define        SHORT_TK        333
+#define        INT_TK  334
+#define        LONG_TK 335
+#define        CHAR_TK 336
+#define        INTEGRAL_TK     337
+#define        FLOAT_TK        338
+#define        DOUBLE_TK       339
+#define        FP_TK   340
+#define        ID_TK   341
+#define        REL_QM_TK       342
+#define        REL_CL_TK       343
+#define        NOT_TK  344
+#define        NEG_TK  345
+#define        ASSIGN_ANY_TK   346
+#define        ASSIGN_TK       347
+#define        OP_TK   348
+#define        CP_TK   349
+#define        OCB_TK  350
+#define        CCB_TK  351
+#define        OSB_TK  352
+#define        CSB_TK  353
+#define        SC_TK   354
+#define        C_TK    355
+#define        DOT_TK  356
+#define        STRING_LIT_TK   357
+#define        CHAR_LIT_TK     358
+#define        INT_LIT_TK      359
+#define        FP_LIT_TK       360
+#define        TRUE_TK 361
+#define        FALSE_TK        362
+#define        BOOL_LIT_TK     363
+#define        NULL_TK 364
 
 #line 48 "./parse.y"
 
 
 #line 48 "./parse.y"
 
@@ -516,7 +517,7 @@ typedef union {
 #define        YYFLAG          -32768
 #define        YYNTBASE        110
 
 #define        YYFLAG          -32768
 #define        YYNTBASE        110
 
-#define YYTRANSLATE(x) ((unsigned)(x) <= 363 ? yytranslate[x] : 272)
+#define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 272)
 
 static const char yytranslate[] = {     0,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
 
 static const char yytranslate[] = {     0,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -544,18 +545,18 @@ static const char yytranslate[] = {     0,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
-     7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
-    17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
-    27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
-    37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
-    47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
-    57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
-    67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
-    77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
-    87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
-    97,    98,    99,   100,   101,   102,   103,   104,   105,   106,
-   107,   108,   109
+     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
+     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
+    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+    26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
+    36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
+    46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
+    56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
+    66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
+    76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
+    86,    87,    88,    89,    90,    91,    92,    93,    94,    95,
+    96,    97,    98,    99,   100,   101,   102,   103,   104,   105,
+   106,   107,   108,   109
 };
 
 #if YYDEBUG != 0
 };
 
 #if YYDEBUG != 0
@@ -2386,8 +2387,7 @@ static const short yycheck[] = {     3,
 #define YYPURE 1
 
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
 #define YYPURE 1
 
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
-#line 3 "/usr/lib/bison.simple"
-/* This file comes from bison-1.28.  */
+#line 3 "/usr/share/misc/bison.simple"
 
 /* Skeleton output parser for bison,
    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
 
 /* Skeleton output parser for bison,
    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@@ -2404,66 +2404,46 @@ static const short yycheck[] = {     3,
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* As a special exception, when this file is copied by Bison into a
    Bison output file, you may use that output file without restriction.
    This special exception was added by the Free Software Foundation
    in version 1.24 of Bison.  */
 
 
 /* As a special exception, when this file is copied by Bison into a
    Bison output file, you may use that output file without restriction.
    This special exception was added by the Free Software Foundation
    in version 1.24 of Bison.  */
 
-/* This is the parser code that is written into each bison parser
-  when the %semantic_parser declaration is not specified in the grammar.
-  It was written by Richard Stallman by simplifying the hairy parser
-  used when %semantic_parser is specified.  */
-
-#ifndef YYSTACK_USE_ALLOCA
-#ifdef alloca
-#define YYSTACK_USE_ALLOCA
-#else /* alloca not defined */
+#ifndef alloca
 #ifdef __GNUC__
 #ifdef __GNUC__
-#define YYSTACK_USE_ALLOCA
 #define alloca __builtin_alloca
 #else /* not GNU C.  */
 #define alloca __builtin_alloca
 #else /* not GNU C.  */
-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
-#define YYSTACK_USE_ALLOCA
+#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
 #include <alloca.h>
 #else /* not sparc */
 #include <alloca.h>
 #else /* not sparc */
-/* We think this test detects Watcom and Microsoft C.  */
-/* This used to test MSDOS, but that is a bad idea
-   since that symbol is in the user namespace.  */
-#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
-#if 0 /* No need for malloc.h, which pollutes the namespace;
-        instead, just don't use alloca.  */
+#if defined (MSDOS) && !defined (__TURBOC__)
 #include <malloc.h>
 #include <malloc.h>
-#endif
 #else /* not MSDOS, or __TURBOC__ */
 #if defined(_AIX)
 #else /* not MSDOS, or __TURBOC__ */
 #if defined(_AIX)
-/* I don't know what this was needed for, but it pollutes the namespace.
-   So I turned it off.   rms, 2 May 1997.  */
-/* #include <malloc.h>  */
+#include <malloc.h>
  #pragma alloca
  #pragma alloca
-#define YYSTACK_USE_ALLOCA
-#else /* not MSDOS, or __TURBOC__, or _AIX */
-#if 0
-#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
-                and on HPUX 10.  Eventually we can turn this on.  */
-#define YYSTACK_USE_ALLOCA
-#define alloca __builtin_alloca
+#else /* not MSDOS, __TURBOC__, or _AIX */
+#ifdef __hpux
+#ifdef __cplusplus
+extern "C" {
+void *alloca (unsigned int);
+};
+#else /* not __cplusplus */
+void *alloca ();
+#endif /* not __cplusplus */
 #endif /* __hpux */
 #endif /* __hpux */
-#endif
 #endif /* not _AIX */
 #endif /* not MSDOS, or __TURBOC__ */
 #endif /* not _AIX */
 #endif /* not MSDOS, or __TURBOC__ */
-#endif /* not sparc */
-#endif /* not GNU C */
-#endif /* alloca not defined */
-#endif /* YYSTACK_USE_ALLOCA not defined */
+#endif /* not sparc.  */
+#endif /* not GNU C.  */
+#endif /* alloca not defined.  */
 
 
-#ifdef YYSTACK_USE_ALLOCA
-#define YYSTACK_ALLOC alloca
-#else
-#define YYSTACK_ALLOC malloc
-#endif
+/* This is the parser code that is written into each bison parser
+  when the %semantic_parser declaration is not specified in the grammar.
+  It was written by Richard Stallman by simplifying the hairy parser
+  used when %semantic_parser is specified.  */
 
 /* Note: there must be only one dollar sign in this file.
    It is replaced by the list of actions, each action
 
 /* Note: there must be only one dollar sign in this file.
    It is replaced by the list of actions, each action
@@ -2473,8 +2453,8 @@ static const short yycheck[] = {     3,
 #define yyclearin      (yychar = YYEMPTY)
 #define YYEMPTY                -2
 #define YYEOF          0
 #define yyclearin      (yychar = YYEMPTY)
 #define YYEMPTY                -2
 #define YYEOF          0
-#define YYACCEPT       goto yyacceptlab
-#define YYABORT        goto yyabortlab
+#define YYACCEPT       return(0)
+#define YYABORT        return(1)
 #define YYERROR                goto yyerrlab1
 /* Like YYERROR except do call yyerror.
    This remains here temporarily to ease the
 #define YYERROR                goto yyerrlab1
 /* Like YYERROR except do call yyerror.
    This remains here temporarily to ease the
@@ -2555,12 +2535,14 @@ int yydebug;                    /*  nonzero means print parse trace     */
 #ifndef YYMAXDEPTH
 #define YYMAXDEPTH 10000
 #endif
 #ifndef YYMAXDEPTH
 #define YYMAXDEPTH 10000
 #endif
-\f
-/* Define __yy_memcpy.  Note that the size argument
-   should be passed with type unsigned int, because that is what the non-GCC
-   definitions require.  With GCC, __builtin_memcpy takes an arg
-   of type size_t, but it can handle unsigned int.  */
 
 
+/* Prevent warning if -Wstrict-prototypes.  */
+#ifdef __GNUC__
+#ifndef YYPARSE_PARAM
+int yyparse (void);
+#endif
+#endif
+\f
 #if __GNUC__ > 1               /* GNU C and GNU C++ define this.  */
 #define __yy_memcpy(TO,FROM,COUNT)     __builtin_memcpy(TO,FROM,COUNT)
 #else                          /* not GNU C or C++ */
 #if __GNUC__ > 1               /* GNU C and GNU C++ define this.  */
 #define __yy_memcpy(TO,FROM,COUNT)     __builtin_memcpy(TO,FROM,COUNT)
 #else                          /* not GNU C or C++ */
@@ -2572,7 +2554,7 @@ static void
 __yy_memcpy (to, from, count)
      char *to;
      char *from;
 __yy_memcpy (to, from, count)
      char *to;
      char *from;
-     unsigned int count;
+     int count;
 {
   register char *f = from;
   register char *t = to;
 {
   register char *f = from;
   register char *t = to;
@@ -2587,10 +2569,10 @@ __yy_memcpy (to, from, count)
 /* This is the most reliable way to avoid incompatibilities
    in available built-in functions on various systems.  */
 static void
 /* This is the most reliable way to avoid incompatibilities
    in available built-in functions on various systems.  */
 static void
-__yy_memcpy (char *to, char *from, unsigned int count)
+__yy_memcpy (char *to, char *from, int count)
 {
 {
-  register char *t = to;
   register char *f = from;
   register char *f = from;
+  register char *t = to;
   register int i = count;
 
   while (i-- > 0)
   register int i = count;
 
   while (i-- > 0)
@@ -2600,7 +2582,7 @@ __yy_memcpy (char *to, char *from, unsigned int count)
 #endif
 #endif
 \f
 #endif
 #endif
 \f
-#line 217 "/usr/lib/bison.simple"
+#line 196 "/usr/share/misc/bison.simple"
 
 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
    into yyparse.  The argument should have type void *.
 
 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
    into yyparse.  The argument should have type void *.
@@ -2621,15 +2603,6 @@ __yy_memcpy (char *to, char *from, unsigned int count)
 #define YYPARSE_PARAM_DECL
 #endif /* not YYPARSE_PARAM */
 
 #define YYPARSE_PARAM_DECL
 #endif /* not YYPARSE_PARAM */
 
-/* Prevent warning if -Wstrict-prototypes.  */
-#ifdef __GNUC__
-#ifdef YYPARSE_PARAM
-int yyparse (void *);
-#else
-int yyparse (void);
-#endif
-#endif
-
 int
 yyparse(YYPARSE_PARAM_ARG)
      YYPARSE_PARAM_DECL
 int
 yyparse(YYPARSE_PARAM_ARG)
      YYPARSE_PARAM_DECL
@@ -2658,7 +2631,6 @@ yyparse(YYPARSE_PARAM_ARG)
 #endif
 
   int yystacksize = YYINITDEPTH;
 #endif
 
   int yystacksize = YYINITDEPTH;
-  int yyfree_stacks = 0;
 
 #ifdef YYPURE
   int yychar;
 
 #ifdef YYPURE
   int yychar;
@@ -2743,32 +2715,18 @@ yynewstate:
       if (yystacksize >= YYMAXDEPTH)
        {
          yyerror("parser stack overflow");
       if (yystacksize >= YYMAXDEPTH)
        {
          yyerror("parser stack overflow");
-         if (yyfree_stacks)
-           {
-             free (yyss);
-             free (yyvs);
-#ifdef YYLSP_NEEDED
-             free (yyls);
-#endif
-           }
          return 2;
        }
       yystacksize *= 2;
       if (yystacksize > YYMAXDEPTH)
        yystacksize = YYMAXDEPTH;
          return 2;
        }
       yystacksize *= 2;
       if (yystacksize > YYMAXDEPTH)
        yystacksize = YYMAXDEPTH;
-#ifndef YYSTACK_USE_ALLOCA
-      yyfree_stacks = 1;
-#endif
-      yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
-      __yy_memcpy ((char *)yyss, (char *)yyss1,
-                  size * (unsigned int) sizeof (*yyssp));
-      yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
-      __yy_memcpy ((char *)yyvs, (char *)yyvs1,
-                  size * (unsigned int) sizeof (*yyvsp));
+      yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
+      __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
+      yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
+      __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
 #ifdef YYLSP_NEEDED
 #ifdef YYLSP_NEEDED
-      yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
-      __yy_memcpy ((char *)yyls, (char *)yyls1,
-                  size * (unsigned int) sizeof (*yylsp));
+      yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
+      __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
 #endif
 #endif /* no yyoverflow */
 
 #endif
 #endif /* no yyoverflow */
 
@@ -5020,7 +4978,7 @@ case 503:
     break;}
 }
    /* the action file gets copied in in place of this dollarsign */
     break;}
 }
    /* the action file gets copied in in place of this dollarsign */
-#line 543 "/usr/lib/bison.simple"
+#line 498 "/usr/share/misc/bison.simple"
 \f
   yyvsp -= yylen;
   yyssp -= yylen;
 \f
   yyvsp -= yylen;
   yyssp -= yylen;
@@ -5215,30 +5173,6 @@ yyerrhandle:
 
   yystate = yyn;
   goto yynewstate;
 
   yystate = yyn;
   goto yynewstate;
-
- yyacceptlab:
-  /* YYACCEPT comes here.  */
-  if (yyfree_stacks)
-    {
-      free (yyss);
-      free (yyvs);
-#ifdef YYLSP_NEEDED
-      free (yyls);
-#endif
-    }
-  return 0;
-
- yyabortlab:
-  /* YYABORT comes here.  */
-  if (yyfree_stacks)
-    {
-      free (yyss);
-      free (yyvs);
-#ifdef YYLSP_NEEDED
-      free (yyls);
-#endif
-    }
-  return 1;
 }
 #line 2546 "./parse.y"
 
 }
 #line 2546 "./parse.y"
 
@@ -9995,10 +9929,19 @@ java_complete_expand_methods (class_decl)
   /* First, do the ordinary methods. */
   for (decl = first_decl; decl; decl = TREE_CHAIN (decl))
     {
   /* First, do the ordinary methods. */
   for (decl = first_decl; decl; decl = TREE_CHAIN (decl))
     {
-      /* Skip abstract or native methods */
-      if (METHOD_ABSTRACT (decl) || METHOD_NATIVE (decl)
+      /* Skip abstract or native methods -- but do handle native
+        methods when generating JNI stubs.  */
+      if (METHOD_ABSTRACT (decl)
+         || (! flag_jni && METHOD_NATIVE (decl))
          || DECL_CONSTRUCTOR_P (decl) || DECL_CLINIT_P (decl))
        continue;
          || DECL_CONSTRUCTOR_P (decl) || DECL_CLINIT_P (decl))
        continue;
+
+      if (METHOD_NATIVE (decl))
+       {
+         tree body = build_jni_stub (decl);
+         BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (decl)) = body;
+       }
+
       java_complete_expand_method (decl);
     }
 
       java_complete_expand_method (decl);
     }
 
@@ -10128,7 +10071,7 @@ java_complete_expand_method (mdecl)
        {
          block_body = java_complete_tree (block_body);
 
        {
          block_body = java_complete_tree (block_body);
 
-         if (!flag_emit_xref)
+         if (! flag_emit_xref && ! METHOD_NATIVE (mdecl))
            check_for_initialization (block_body);
          ctxp->explicit_constructor_p = 0;
        }
            check_for_initialization (block_body);
          ctxp->explicit_constructor_p = 0;
        }
index 427ba75..3f5d7ce 100644 (file)
@@ -7297,10 +7297,19 @@ java_complete_expand_methods (class_decl)
   /* First, do the ordinary methods. */
   for (decl = first_decl; decl; decl = TREE_CHAIN (decl))
     {
   /* First, do the ordinary methods. */
   for (decl = first_decl; decl; decl = TREE_CHAIN (decl))
     {
-      /* Skip abstract or native methods */
-      if (METHOD_ABSTRACT (decl) || METHOD_NATIVE (decl)
+      /* Skip abstract or native methods -- but do handle native
+        methods when generating JNI stubs.  */
+      if (METHOD_ABSTRACT (decl)
+         || (! flag_jni && METHOD_NATIVE (decl))
          || DECL_CONSTRUCTOR_P (decl) || DECL_CLINIT_P (decl))
        continue;
          || DECL_CONSTRUCTOR_P (decl) || DECL_CLINIT_P (decl))
        continue;
+
+      if (METHOD_NATIVE (decl))
+       {
+         tree body = build_jni_stub (decl);
+         BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (decl)) = body;
+       }
+
       java_complete_expand_method (decl);
     }
 
       java_complete_expand_method (decl);
     }
 
@@ -7430,7 +7439,7 @@ java_complete_expand_method (mdecl)
        {
          block_body = java_complete_tree (block_body);
 
        {
          block_body = java_complete_tree (block_body);
 
-         if (!flag_emit_xref)
+         if (! flag_emit_xref && ! METHOD_NATIVE (mdecl))
            check_for_initialization (block_body);
          ctxp->explicit_constructor_p = 0;
        }
            check_for_initialization (block_body);
          ctxp->explicit_constructor_p = 0;
        }