* [Qemu-devel] [PATCH 03/18] TCG: remove broken stack allocation for call arguments
@ 2011-05-28 10:06 Blue Swirl
0 siblings, 0 replies; 2+ messages in thread
From: Blue Swirl @ 2011-05-28 10:06 UTC (permalink / raw)
To: qemu-devel, Richard Henderson, Aurelien Jarno
The code for stack allocation for call arguments is way too simplistic
to actually work on targets with non-trivial stack allocation policies,
e.g. ppc64. We've also already allocated TCG_STATIC_CALL_ARGS_SIZE worth
of stack for calls which should be well more than any helper needs.
Remove broken dynamic stack allocation code and replace it with an assert.
Should dynamic stack allocation ever be needed again, target specific
functions should be added.
Thanks to Richard Henderson for the analysis.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
tcg/tcg.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/tcg/tcg.c b/tcg/tcg.c
index b31d80d..226f1a1 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1846,13 +1846,14 @@ static int tcg_reg_alloc_call(TCGContext *s,
const TCGOpDef *def,
nb_regs = nb_params;
/* assign stack slots first */
- /* XXX: preallocate call stack */
call_stack_size = (nb_params - nb_regs) * sizeof(tcg_target_long);
call_stack_size = (call_stack_size + TCG_TARGET_STACK_ALIGN - 1) &
~(TCG_TARGET_STACK_ALIGN - 1);
allocate_args = (call_stack_size > TCG_STATIC_CALL_ARGS_SIZE);
if (allocate_args) {
- tcg_out_addi(s, TCG_REG_CALL_STACK, -STACK_DIR(call_stack_size));
+ /* XXX: if more than TCG_STATIC_CALL_ARGS_SIZE is needed,
+ preallocate call stack */
+ tcg_abort();
}
stack_offset = TCG_TARGET_CALL_STACK_OFFSET;
@@ -1971,10 +1972,6 @@ static int tcg_reg_alloc_call(TCGContext *s,
const TCGOpDef *def,
}
tcg_out_op(s, opc, &func_arg, &const_func_arg);
-
- if (allocate_args) {
- tcg_out_addi(s, TCG_REG_CALL_STACK, STACK_DIR(call_stack_size));
- }
/* assign output registers and emit moves if needed */
for(i = 0; i < nb_oargs; i++) {
--
1.6.2.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Qemu-devel] [PATCH 03/18] TCG: remove broken stack allocation for call arguments
@ 2011-06-19 21:04 Blue Swirl
0 siblings, 0 replies; 2+ messages in thread
From: Blue Swirl @ 2011-06-19 21:04 UTC (permalink / raw)
To: qemu-devel
The code for stack allocation for call arguments is way too simplistic
to actually work on targets with non-trivial stack allocation policies,
e.g. ppc64. We've also already allocated TCG_STATIC_CALL_ARGS_SIZE worth
of stack for calls which should be well more than any helper needs.
Remove broken dynamic stack allocation code and replace it with an assert.
Should dynamic stack allocation ever be needed again, target specific
functions should be added.
Thanks to Richard Henderson for the analysis.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
tcg/tcg.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/tcg/tcg.c b/tcg/tcg.c
index d8bf721..29cd7a2 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1845,13 +1845,14 @@ static int tcg_reg_alloc_call(TCGContext *s,
const TCGOpDef *def,
nb_regs = nb_params;
/* assign stack slots first */
- /* XXX: preallocate call stack */
call_stack_size = (nb_params - nb_regs) * sizeof(tcg_target_long);
call_stack_size = (call_stack_size + TCG_TARGET_STACK_ALIGN - 1) &
~(TCG_TARGET_STACK_ALIGN - 1);
allocate_args = (call_stack_size > TCG_STATIC_CALL_ARGS_SIZE);
if (allocate_args) {
- tcg_out_addi(s, TCG_REG_CALL_STACK, -STACK_DIR(call_stack_size));
+ /* XXX: if more than TCG_STATIC_CALL_ARGS_SIZE is needed,
+ preallocate call stack */
+ tcg_abort();
}
stack_offset = TCG_TARGET_CALL_STACK_OFFSET;
@@ -1970,10 +1971,6 @@ static int tcg_reg_alloc_call(TCGContext *s,
const TCGOpDef *def,
}
tcg_out_op(s, opc, &func_arg, &const_func_arg);
-
- if (allocate_args) {
- tcg_out_addi(s, TCG_REG_CALL_STACK, STACK_DIR(call_stack_size));
- }
/* assign output registers and emit moves if needed */
for(i = 0; i < nb_oargs; i++) {
--
1.6.2.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-06-19 21:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-19 21:04 [Qemu-devel] [PATCH 03/18] TCG: remove broken stack allocation for call arguments Blue Swirl
-- strict thread matches above, loose matches on Subject: below --
2011-05-28 10:06 Blue Swirl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).