* langhooks-def.h (LANG_HOOKS_DECL_OK_FOR_SIBCALL): New.
(LANG_HOOKS_DECLS): Add LANG_HOOKS_DECL_OK_FOR_SIBCALL.
(lhd_decl_ok_for_sibcall): New.
* langhooks.c (lhd_decl_ok_for_sibcall): New.
* langhooks.h (lang_hooks_for_decls.ok_for_sibcall): New field.
* calls.c (expand_call): Check lang_hook before generating a
sibcall.
2003-05-21 Andrew Haley <aph@redhat.com>
* lang.c (LANG_HOOKS_DECL_OK_FOR_SIBCALL): New.
(java_decl_ok_for_sibcall): New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67713
138bc75d-0d04-0410-961f-
82ee72b054a4
+2003-06-10 Andrew Haley <aph@redhat.com>
+
+ * langhooks-def.h (LANG_HOOKS_DECL_OK_FOR_SIBCALL): New.
+ (LANG_HOOKS_DECLS): Add LANG_HOOKS_DECL_OK_FOR_SIBCALL.
+ (lhd_decl_ok_for_sibcall): New.
+ * langhooks.c (lhd_decl_ok_for_sibcall): New.
+ * langhooks.h (lang_hooks_for_decls.ok_for_sibcall): New field.
+ * calls.c (expand_call): Check lang_hook before generating a
+ sibcall.
+
2003-06-10 DJ Delorie <dj@redhat.com>
* config/stormy16/stormy16.c (xstormy16_extra_constraint_p): Add Z,
|| args_size.constant > current_function_args_size
/* If the callee pops its own arguments, then it must pop exactly
the same number of arguments as the current function. */
- || RETURN_POPS_ARGS (fndecl, funtype, args_size.constant)
- != RETURN_POPS_ARGS (current_function_decl,
- TREE_TYPE (current_function_decl),
- current_function_args_size))
+ || (RETURN_POPS_ARGS (fndecl, funtype, args_size.constant)
+ != RETURN_POPS_ARGS (current_function_decl,
+ TREE_TYPE (current_function_decl),
+ current_function_args_size))
+ || !(*lang_hooks.decls.ok_for_sibcall) (fndecl))
try_tail_call = 0;
if (try_tail_call || try_tail_recursion)
+2003-06-10 Andrew Haley <aph@redhat.com>
+
+ * lang.c (LANG_HOOKS_DECL_OK_FOR_SIBCALL): New.
+ (java_decl_ok_for_sibcall): New.
+
2003-06-09 Neil Booth <neil@daikokuya.co.uk>
* Make-lang.in (JAVA_OBJS, java/lang.o): Update.
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"
#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;
}
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"
extern bool lhd_warn_unused_global_decl PARAMS ((tree));
extern void lhd_incomplete_type_error PARAMS ((tree, tree));
extern tree lhd_type_promotes_to PARAMS ((tree));
+extern bool lhd_decl_ok_for_sibcall PARAMS ((tree));
extern tree lhd_expr_size PARAMS ((tree));
extern size_t lhd_tree_size PARAMS ((enum tree_code));
#define LANG_HOOKS_GETDECLS getdecls
#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL lhd_warn_unused_global_decl
#define LANG_HOOKS_WRITE_GLOBALS write_global_declarations
+#define LANG_HOOKS_DECL_OK_FOR_SIBCALL lhd_decl_ok_for_sibcall
#define LANG_HOOKS_DECLS { \
LANG_HOOKS_PUSHLEVEL, \
LANG_HOOKS_PUSHDECL, \
LANG_HOOKS_GETDECLS, \
LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, \
- LANG_HOOKS_WRITE_GLOBALS \
+ LANG_HOOKS_WRITE_GLOBALS, \
+ LANG_HOOKS_DECL_OK_FOR_SIBCALL, \
}
/* The whole thing. The structure is defined in langhooks.h. */
return 0;
}
+/* Return true if decl, which is a function decl, may be called by a
+ sibcall. */
+
+bool
+lhd_decl_ok_for_sibcall (decl)
+ tree decl ATTRIBUTE_UNUSED;
+{
+ return true;
+}
+
/* lang_hooks.decls.final_write_globals: perform final processing on
global variables. */
void
/* Obtain a list of globals and do final output on them at end
of compilation */
void (*final_write_globals) PARAMS ((void));
+
+ /* True if this decl may be called via a sibcall. */
+ bool (*ok_for_sibcall) PARAMS ((tree));
};
/* Language-specific hooks. See langhooks-def.h for defaults. */