diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-05-09 01:51:59 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-05-09 01:51:59 +0000 |
commit | c2324ff26ea29f87a5f6eb4f57003ac4820afb14 (patch) | |
tree | d7ea94ce23ff98760b30bdc5876fc8b1e3052ba7 /gcc/java | |
parent | 0baf89fb6cebe9bb6fdb3a188a50bb131c11058d (diff) | |
download | gcc-c2324ff26ea29f87a5f6eb4f57003ac4820afb14.tar.gz |
* expr.c (build_jni_stub): Cache the result of
_Jv_LookupJNIMethod.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33786 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/java/expr.c | 24 |
2 files changed, 25 insertions, 4 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index f4ce31e3b54..0fc8b70c314 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2000-05-08 Tom Tromey <tromey@cygnus.com> + + * expr.c (build_jni_stub): Cache the result of + _Jv_LookupJNIMethod. + 2000-05-05 Alexandre Petit-Bianco <apbianco@cygnus.com> * decl.c (predef_filenames_size): Now 7. diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 7a92a8c66c6..b417bac3d3b 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -1855,6 +1855,7 @@ build_jni_stub (method) 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); @@ -1867,13 +1868,25 @@ build_jni_stub (method) DECL_EXTERNAL (method) = 0; env_var = build_decl (VAR_DECL, get_identifier ("env"), ptr_type_node); + DECL_CONTEXT (env_var) = method; + if (TREE_TYPE (TREE_TYPE (method)) != void_type_node) { res_var = build_decl (VAR_DECL, get_identifier ("res"), TREE_TYPE (TREE_TYPE (method))); + DECL_CONTEXT (res_var) = method; TREE_CHAIN (env_var) = res_var; } + push_obstacks (&permanent_obstack, &permanent_obstack); + 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, 0); + meth_var = pushdecl_top_level (meth_var); + pop_obstacks (); + /* One strange way that the front ends are different is that they store arguments differently. */ if (from_class) @@ -1936,9 +1949,13 @@ build_jni_stub (method) = 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); + jnifunc = build (COND_EXPR, ptr_type_node, + meth_var, meth_var, + build (MODIFY_EXPR, ptr_type_node, + meth_var, + 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. */ @@ -2003,7 +2020,6 @@ build_jni_stub (method) return block; } - /* Expand an operation to extract from or store into a field. IS_STATIC is 1 iff the field is static. IS_PUTTING is 1 for putting into a field; 0 for getting from the field. |