langhooks-def.h (LANG_HOOKS_DECL_OK_FOR_SIBCALL): New.

2003-05-21  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-05-21  Andrew Haley  <aph@redhat.com>

	* lang.c (LANG_HOOKS_DECL_OK_FOR_SIBCALL): New.
	(java_decl_ok_for_sibcall): New.

From-SVN: r67713
This commit is contained in:
Andrew Haley 2003-06-10 16:43:39 +00:00 committed by Andrew Haley
parent e7e09ad8f2
commit e076f71a38
7 changed files with 53 additions and 5 deletions

View File

@ -1,3 +1,13 @@
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,

View File

@ -2508,10 +2508,11 @@ expand_call (exp, target, ignore)
|| 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)

View File

@ -1,3 +1,8 @@
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.

View File

@ -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"

View File

@ -64,6 +64,7 @@ extern bool lhd_can_use_bit_fields_p PARAMS ((void));
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));
@ -224,6 +225,7 @@ int lhd_tree_dump_type_quals PARAMS ((tree));
#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, \
@ -234,7 +236,8 @@ int lhd_tree_dump_type_quals PARAMS ((tree));
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. */

View File

@ -469,6 +469,16 @@ lhd_tree_size (c)
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

View File

@ -180,6 +180,9 @@ struct lang_hooks_for_decls
/* 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. */