aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/lang.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/java/lang.c')
-rw-r--r--gcc/java/lang.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index f870a57..64283d4 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -65,6 +65,7 @@ static int inline_init_test_initialization (void * *, void *);
static bool java_can_use_bit_fields_p (void);
static bool java_dump_tree (void *, tree);
static void dump_compound_expr (dump_info_p, tree);
+static bool java_decl_ok_for_sibcall (tree);
#ifndef TARGET_OBJECT_SUFFIX
# define TARGET_OBJECT_SUFFIX ".o"
@@ -251,6 +252,9 @@ struct language_function GTY(())
#undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN java_dump_tree
+#undef LANG_HOOKS_DECL_OK_FOR_SIBCALL
+#define LANG_HOOKS_DECL_OK_FOR_SIBCALL java_decl_ok_for_sibcall
+
/* Each front end provides its own. */
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
@@ -1077,4 +1081,16 @@ java_dump_tree (void *dump_info, tree t)
}
return false;
}
+
+/* Java calls can't, in general, be sibcalls because we need an
+ accurate stack trace in order to guarantee correct operation of
+ methods such as Class.forName(String) and
+ SecurityManager.getClassContext(). */
+
+static bool
+java_decl_ok_for_sibcall (tree decl)
+{
+ return decl != NULL && DECL_CONTEXT (decl) == current_class;
+}
+
#include "gt-java-lang.h"