This is the mail archive of the java-discuss@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Does -fjni work with recent builds?



Barnet Wagman writes:

> As far as I know, the 'static native' declaration is legitimate.  It
> works with a various jvms.

I don't think this is the problem. I can reduce the test case to:

public class j {

    public native void jni_test();
    public native void jniSetup();
}

Tom, since `meth' (held by `meth_var') in build_jni_stub is a global
symbol, shouldn't it be created only once?

./A

2001-01-19  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* expr.c (build_jni_stub): Local `meth_var' turned static. Symbol
	`meth' created and registered only one.

Index: expr.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/expr.c,v
retrieving revision 1.96
diff -u -p -r1.96 expr.c
--- expr.c      2001/01/17 00:39:09     1.96
+++ expr.c      2001/01/19 22:38:59
@@ -1993,11 +1993,11 @@ tree
 build_jni_stub (method)
      tree method;
 {
+  static tree meth_var = NULL_TREE;
   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 meth_var;
 
   tree klass = DECL_CONTEXT (method);
   int from_class = ! CLASS_FROM_SOURCE_P (klass);
@@ -2020,12 +2020,15 @@ build_jni_stub (method)
       TREE_CHAIN (env_var) = res_var;
     }
 
-  meth_var = build_decl (VAR_DECL, get_identifier ("meth"), ptr_type_node);
-  TREE_STATIC (meth_var) = 1;
-  TREE_PUBLIC (meth_var) = 0;
-  DECL_EXTERNAL (meth_var) = 0;
-  make_decl_rtl (meth_var, NULL);
-  meth_var = pushdecl_top_level (meth_var);
+  if (!meth_var)
+    {
+      meth_var = build_decl (VAR_DECL, get_identifier ("meth"), ptr_type_node);
+      TREE_STATIC (meth_var) = 1;
+      TREE_PUBLIC (meth_var) = 0;
+      DECL_EXTERNAL (meth_var) = 0;
+      make_decl_rtl (meth_var, NULL);
+      meth_var = pushdecl_top_level (meth_var);
+    }
 
   /* One strange way that the front ends are different is that they
      store arguments differently.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]