This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Ping: C-family stack check for threads


Richard Henderson wrote:
 On 07/03/2011 08:06 AM, Thomas Klein wrote:
 >  +/*
 >  + * Write prolouge part of stack check into asm file.
 >  + * For Thumb this may look like this:
 >  + *   push {rsym,ramn}
 >  + *   ldr rsym, .LSPCHK0
 >  + *   ldr rsym, [rsym]
 >  + *   ldr ramn, .LSPCHK0 + 4
 >  + *   add rsym, rsym, ramn
 >  + *   cmp sp, rsym
 >  + *   bhs .LSPCHK1
 >  + *   push {lr}
 >  + *   bl __thumb_stack_failure
 >  + * .align 2
 >  + * .LSPCHK0:
 >  + *   .word symbol_addr_of(stack_limit_rtx)
 >  + *   .word lenght_of(amount)
 >   + * .LSPCHK1:
 >  + *   pop {rsym,ramn}
 >  + */
 >  +void
 >  +stack_check_output_function (FILE *f, int reg0, int reg1, unsigned amount,
 >  +                             unsigned numregs)
 >  +{

 Is there an exceedingly good reason you're emitting this much code
 as text, rather than as rtl?

To me, the stack check is one coherent operation. This is placed after an initial push, which can't be eliminated, but before a major stack adjustment.

I have, had some problems with rtl at prologue stage.
Is there a way to encapsulate a rtl sequence within prologue.
There is a emit_multi_reg_push but is there something like emit_multi_reg_pop, too.
Are the other operations (compare, branche, ..) still allowed?

 In particular, you adjust the stack but not the unwind info.  So
 if one puts a breakpoint at your __thumb_stack_failure function,
 the unwind information will be incorrect.

Yes, if the failure function is taken the info will be wrong. If this is a major problem do I have to add this info after any push and pop operation? Will the rtl push/pop do this already for me?

Regards
 Thomas Klein



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]