RFR(S): 8017313: PPC64 (part 6): cppInterpreter: stack handling improvements

Coleen Phillimore coleen.phillimore at oracle.com
Tue Jun 25 06:34:12 PDT 2013


Yes, I think this would be useful for the other platforms to simplify 
the stack overflow limit checking in the interpreter assembly code.

       100    // Initialize the memory stack limit.

       101    address mem_stk_limit = thread->stack_base() - thread->stack_size() +

       102      ((StackShadowPages + StackYellowPages + StackRedPages) * os::vm_page_size());

       103  

       104    thread->set_memory_stack_limit(mem_stk_limit);


My other comment was to move 101-102 into the function 
set_stack_overflow_limit() since nothing on those lines depends on the 
platform and the values used to compute this are owned by class Thread 
anyway.

thanks,
Coleen

On 06/25/2013 09:27 AM, Lindenmaier, Goetz wrote:
> Hi Colleen, David,
>
> I'll rename the methods to stack_overflow_limit and update the webrev,
> I like that name better too.
>
> We set it in os::initialize_thread():
> http://hg.openjdk.java.net/ppc-aix-port/jdk8/hotspot/file/2a6fd169b0b7/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp
> and we use it here (line427):
> http://hg.openjdk.java.net/ppc-aix-port/jdk8/hotspot/file/2a6fd169b0b7/src/cpu/ppc/vm/cppInterpreter_ppc.cpp
> In that files the method is called [set_]memory_stack_limit().
>
> Actually, it's got nothing to do with the cppInterpreter.  I first thought so,
> because we only used it with the cppInterpreter when I moved this from
> our VM to the port (a while ago now).  But look at the code in
> void InterpreterGenerator::generate_stack_overflow_check(void) on x86 that
> computes the stack bound in rax ... that's not really simple, and requires
> two loads (stack_base, stack_size).
>
> The difference between cppInterpreter and template interpreter is that
> we always check against the stack_limit in the cppInterpreter, but the
> templateInterpreter first checks whether the stack is < 1 page, thus
> experiencing less overhead from the lengthy coding.
>
> Best regards,
>    Goetz
>
>
> -----Original Message-----
> From: hotspot-dev-bounces at openjdk.java.net [mailto:hotspot-dev-bounces at openjdk.java.net] On Behalf Of Coleen Phillimore
> Sent: Dienstag, 25. Juni 2013 14:49
> To: hotspot-dev at openjdk.java.net
> Subject: Re: RFR(S): 8017313: PPC64 (part 6): cppInterpreter: stack handling improvements
>
>
> Which stack limit is this?   Does it subtract off the red and yellow
> zones?   Where do you set it?  Yes, it would simplify the assembler code
> in the interpreter entries to use this.
>
> It might be better to rename it though if it's the usable stack
> (subtracting red and yellow zones) and maybe compute the value inside of
> Thread class (so you see it always subtracting the red and yellow
> zones).   It's sort of ambiguous that this is happening. How about
> stack_overflow_limit()?
>
> Thanks,
> Coleen
>
> On 06/25/2013 08:44 AM, Lindenmaier, Goetz wrote:
>> Hi,
>>
>> We precompute the stack limit for overflow checks and save this
>> limit in the thread.  This simplifies the assembler coding checking
>> the stack overflow. This change contains the necessary shared
>> functionality. It can easily be ported to other platforms, too.
>> http://cr.openjdk.java.net/~goetz/webrevs/8017313-stack/
>>
>> Please review this change.
>>
>> Best regards,
>>     Goetz.
>>
>> PS: I removed some parts of patch 0006 because I found a better
>> platform-only solution.



More information about the hotspot-dev mailing list