You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Gregory Shimansky <gs...@gmail.com> on 2006/10/25 15:23:22 UTC

Re: svn commit: r467552 - in /incubator/harmony/enhanced/drlvm/trunk/vm: tests/smoke/StackTest.java vmcore/src/util/ia32/base/compile_IA32.cpp vmcore/src/util/linux/signals_ia32.cpp vmcore/src/util/win/ia32/nt_exception_filter.cpp

Hello Weldon

I've noticed that along with changes from Rana's patch from HARMONY-1786
you've committed some changes compile_IA32.cpp. They don't seem to be
related to the patch, but rather a part of MMTK integration. Could it be
that you had some modifications to compile_IA32.cpp and accidently committed
them along with Rana's patch? Is it code safe to be committed in drlvm right
now?

2006/10/25, wjwashburn@apache.org <wj...@apache.org>:
>
> Author: wjwashburn
> Date: Tue Oct 24 20:55:30 2006
> New Revision: 467552
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=467552
> Log:
> HARMONY-1786, a patch to fix Stack Overflow Error detection on Linux
> smoke tests pass on both Linux and WindowsXP
>
>
> Modified:
>     incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/StackTest.java
>
>     incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
>
>     incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
>
>     incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
>
> Modified:
> incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/StackTest.java
> URL:
> http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/StackTest.java?view=diff&rev=467552&r1=467551&r2=467552
>
> ==============================================================================
> --- incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/StackTest.java
> (original)
> +++ incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/StackTest.java
> Tue Oct 24 20:55:30 2006
> @@ -15,10 +15,6 @@
>   *  limitations under the License.
>   */
>
> -/*
> - *  $$$ GMJ
> - *  @keyword XXX_StackOverflowBroken
> - */
> public class StackTest {
>
>      static int depth = 0;
>
> Modified:
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
> URL:
> http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp?view=diff&rev=467552&r1=467551&r2=467552
>
> ==============================================================================
> ---
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
> (original)
> +++
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
> Tue Oct 24 20:55:30 2006
> @@ -1,4 +1,4 @@
> -/*
> +/*
>   *  Licensed to the Apache Software Foundation (ASF) under one or more
>   *  contributor license agreements.  See the NOTICE file distributed with
>   *  this work for additional information regarding copyright ownership.
> @@ -88,6 +88,9 @@
>      unsigned cur_word = 0;
>      for(unsigned i=0; i<num_args; i++) {
>          Type_Info_Handle tih = method_args_get_type_info(msh, i);
> +        bool is_magic = false;  //wjw, MMTk support
> +        const String *str = tih->get_type_name();
> +
>          switch (type_info_get_type(tih)) {
>          case VM_DATA_TYPE_INT64:
>          case VM_DATA_TYPE_UINT64:
> @@ -110,6 +113,19 @@
>              break;
>          case VM_DATA_TYPE_CLASS:
>          case VM_DATA_TYPE_ARRAY:
> +            if (str) {   //wjw MMTk support
> +                if (strncmp(str->bytes, "org/vmmagic/unboxed/Address",
> str->len) == 0 )
> +                     is_magic = true;
> +                if (strncmp(str->bytes,
> "org/vmmagic/unboxed/Extent",  str->len) == 0 )
> +                     is_magic = true;
> +                if (strncmp(str->bytes,
> "org/vmmagic/unboxed/Offset",  str->len) == 0 )
> +                     is_magic = true;
> +                if (strncmp(str->bytes,
> "org/vmmagic/unboxed/Word",    str->len) == 0 )
> +                     is_magic = true;
> +                if (strncmp(str->bytes,
> "org/vmmagic/unboxed/ObjectReference",    str->len) == 0 )
> +                     is_magic = true;
> +            }
> +            if (is_magic == false)
>              gc->add_object((ManagedObject**)get_arg_word(num_arg_words,
> cur_word));
>              cur_word++;
>              break;
>
> Modified:
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
> URL:
> http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp?view=diff&rev=467552&r1=467551&r2=467552
>
> ==============================================================================
> ---
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
> (original)
> +++
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
> Tue Oct 24 20:55:30 2006
> @@ -78,6 +78,8 @@
> static int sc_nest = -1;
> static uint32 exam_point;
>
> +
> +
> void linux_ucontext_to_regs(Registers* regs, ucontext_t *uc)
> {
>      regs->eax = uc->uc_mcontext.gregs[REG_EAX];
> @@ -150,16 +152,13 @@
>
>      uint32 exception_esp = regs.esp;
>      DebugUtilsTI* ti = VM_Global_State::loader_env->TI;
> -
>      exn_athrow_regs(&regs, exc_clss);
> -
>      assert(exception_esp <= regs.esp);
>      if
> (ti->get_global_capability(DebugUtilsTI::TI_GC_ENABLE_EXCEPTION_EVENT)) {
>          regs.esp = regs.esp - 4;
>          *((uint32*) regs.esp) = regs.eip;
>          regs.eip = ((uint32)asm_jvmti_exception_catch_callback);
>      }
> -
>      linux_regs_to_ucontext(uc, &regs);
> }
>
> @@ -272,6 +271,7 @@
>
> inline size_t find_guard_stack_size() {
>      return 64*1024;
> +
> }
>
> inline size_t find_guard_page_size() {
> @@ -318,34 +318,39 @@
> void set_guard_stack() {
>      int err;
>
> -    /*
> -     * have the stack parameters been initialized?
> -     *
> -     * TODO - fix this - this probably should be elsewhere
> -     */
> -
> -    if(!p_TLS_vmthread->stack_addr) {
> -        init_stack_info();
> -    }
> -
>      char* stack_addr = (char*) get_stack_addr();
>      size_t stack_size = get_stack_size();
>      size_t guard_stack_size = get_guard_stack_size();
>      size_t guard_page_size = get_guard_page_size();
>
> -    err = mprotect(stack_addr - stack_size + guard_page_size +
> guard_stack_size,
> -        guard_page_size, PROT_NONE);
> +    // map the guard page and protect it
> +    void UNUSED *res = mmap(stack_addr - stack_size + guard_page_size +
> +    guard_stack_size, guard_page_size,  PROT_READ | PROT_WRITE,
> +    MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> +
> +    assert(res!=MAP_FAILED);
> +
> +    err = mprotect(stack_addr - stack_size  + guard_page_size +
> +    guard_stack_size, guard_page_size, PROT_NONE );
> +
> +    assert(!err);
> +
> +    //map the alternate stack on which we want to handle the signal
> +    void UNUSED *res2 = mmap(stack_addr - stack_size + guard_page_size,
> +    guard_stack_size,  PROT_READ | PROT_WRITE,
> +    MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> +
> +    assert(res2!=MAP_FAILED);
> +
>
> -/* $$$ GMJ    assert(!err);  */
> -
>      stack_t sigalt;
>      sigalt.ss_sp = stack_addr - stack_size + guard_page_size;
>      sigalt.ss_flags = SS_ONSTACK;
>      sigalt.ss_size = guard_stack_size;
>
>      err = sigaltstack (&sigalt, NULL);
> -
>      assert(!err);
> +
> }
>
> size_t get_available_stack_size() {
> @@ -376,8 +381,10 @@
>      size_t guard_stack_size = get_guard_stack_size();
>      size_t guard_page_size = get_guard_page_size();
>
> -    err = mprotect(stack_addr - stack_size + guard_page_size +
> guard_stack_size,
> -        guard_page_size, PROT_READ | PROT_WRITE);
> +
> +    err = mprotect(stack_addr - stack_size + guard_page_size +
> +    guard_stack_size, guard_page_size, PROT_READ | PROT_WRITE);
> +
>
>      stack_t sigalt;
>      sigalt.ss_sp = stack_addr - stack_size + guard_page_size;
> @@ -385,6 +392,7 @@
>      sigalt.ss_size = guard_stack_size;
>
>      err = sigaltstack (&sigalt, NULL);
> +
> }
>
> bool check_stack_overflow(siginfo_t *info, ucontext_t *uc) {
> @@ -395,6 +403,7 @@
>
>      char* guard_page_begin = stack_addr - stack_size + guard_page_size +
> guard_stack_size;
>      char* guard_page_end = guard_page_begin + guard_page_size;
> +
>      char* fault_addr = (char*)(info->si_addr);
>      //char* esp_value = (char*)(uc->uc_mcontext.gregs[REG_ESP]);
>
> @@ -432,7 +441,7 @@
> }
>
> void null_java_reference_handler(int signum, siginfo_t* UNREF info, void*
> context)
> -{
> +{
>      ucontext_t *uc = (ucontext_t *)context;
>      Global_Env *env = VM_Global_State::loader_env;
>
> @@ -443,7 +452,7 @@
>          stack_overflow_handler(signum, info, context);
>          return;
>      }
> -
> +
>      if (env->shutting_down != 0) {
>          fprintf(stderr, "null_java_reference_handler(): called in
> shutdown stage\n");
>      } else if (!interpreter_enabled()) {
> @@ -452,7 +461,6 @@
>              return;
>          }
>      }
> -
>      fprintf(stderr, "SIGSEGV in VM code.\n");
>      Registers regs;
>      linux_ucontext_to_regs(&regs, uc);
>
> Modified:
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
> URL:
> http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp?view=diff&rev=467552&r1=467551&r2=467552
>
> ==============================================================================
> ---
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
> (original)
> +++
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
> Tue Oct 24 20:55:30 2006
> @@ -176,17 +176,6 @@
> }
>
> void set_guard_stack() {
> -
> -    /*
> -     * have the stack parameters been initialized?
> -     *
> -     * TODO - fix this - this probably should be elsewhere
> -     */
> -
> -    if(!p_TLS_vmthread->stack_addr) {
> -        init_stack_info();
> -    }
> -
>      void* stack_addr = get_stack_addr();
>      size_t stack_size = get_stack_size();
>      size_t page_size = get_guard_page_size();
>
>
>


-- 
Gregory Shimansky, Intel Middleware Products Division

Re: svn commit: r467552 - in /incubator/harmony/enhanced/drlvm/trunk/vm: tests/smoke/StackTest.java vmcore/src/util/ia32/base/compile_IA32.cpp vmcore/src/util/linux/signals_ia32.cpp vmcore/src/util/win/ia32/nt_exception_filter.cpp

Posted by Weldon Washburn <we...@gmail.com>.
oops.  Gregory is right.  It is MMTk support.  Its been running on my local
machine for several months without problem.  It needed to be committed
anyway.  There is a JIRA on it.  At this point, if it is not causing any
problems my inclination is to simply close the JIRA that's already
outstanding.

Also, I had network failure last night and could not commit.  And I am on
the airplane today.  But the very next thing I do will be 1786, 1900 and
1898 commits.


On 10/25/06, Rana Dasgupta <rd...@gmail.com> wrote:
>
> Hi Weldon,
>   It is quite likely that Gregory is right about the open file.
> compile_IA32.cpp is not changed by 1786 :-) Could you also please close
> the
> JIRA on 1786, 1900, 1898 when you have reviewed and applied the patches?
> They still show open.
>
> Thanks for your help,
> Rana
>
>
>
> > On 10/25/06, Gregory Shimansky <gs...@gmail.com> wrote:
> > >
> > > Hello Weldon
> > >
> > > I've noticed that along with changes from Rana's patch from
> HARMONY-1786
> > > you've committed some changes compile_IA32.cpp. They don't seem to be
> > > related to the patch, but rather a part of MMTK integration. Could it
> be
> > > that you had some modifications to compile_IA32.cpp and accidently
> > > committed
> > > them along with Rana's patch? Is it code safe to be committed in drlvm
> > > right
> > > now?
> > >
> > > 2006/10/25, wjwashburn@apache.org <wj...@apache.org>:
> > > >
> > > > Author: wjwashburn
> > > > Date: Tue Oct 24 20:55:30 2006
> > > > New Revision: 467552
> > > >
> > > > URL: http://svn.apache.org/viewvc?view=rev&rev=467552
> > > > Log:
> > > > HARMONY-1786, a patch to fix Stack Overflow Error detection on Linux
> > > > smoke tests pass on both Linux and WindowsXP
> > > >
> > > >
> > > > Modified:
> > > >
> > > incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/StackTest.java
> > > >
> > > >
> > >
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
> > > >
> > > >
> > >
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
> > > >
> > > >
> > >
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
> > > >
> > > > Modified:
> > > > incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/StackTest.java
> > > > URL:
> > > >
> > >
> http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/StackTest.java?view=diff&rev=467552&r1=467551&r2=467552
> > > >
> > > >
> > >
> ==============================================================================
> > > > ---
> > > incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/StackTest.java
> > > > (original)
> > > > +++
> > > incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/StackTest.java
> > > > Tue Oct 24 20:55:30 2006
> > > > @@ -15,10 +15,6 @@
> > > >   *  limitations under the License.
> > > >   */
> > > >
> > > > -/*
> > > > - *  $$$ GMJ
> > > > - *  @keyword XXX_StackOverflowBroken
> > > > - */
> > > > public class StackTest {
> > > >
> > > >      static int depth = 0;
> > > >
> > > > Modified:
> > > >
> > >
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
> > > > URL:
> > > >
> > >
> http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp?view=diff&rev=467552&r1=467551&r2=467552
> > > >
> > > >
> > >
> ==============================================================================
> > > > ---
> > > >
> > >
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
> > > > (original)
> > > > +++
> > > >
> > >
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
> > > > Tue Oct 24 20:55:30 2006
> > > > @@ -1,4 +1,4 @@
> > > > -/*
> > > > +/*
> > > >   *  Licensed to the Apache Software Foundation (ASF) under one or
> > > more
> > > >   *  contributor license agreements.  See the NOTICE file
> distributed
> > > with
> > > >   *  this work for additional information regarding copyright
> > > ownership.
> > > > @@ -88,6 +88,9 @@
> > > >      unsigned cur_word = 0;
> > > >      for(unsigned i=0; i<num_args; i++) {
> > > >          Type_Info_Handle tih = method_args_get_type_info(msh, i);
> > > > +        bool is_magic = false;  //wjw, MMTk support
> > > > +        const String *str = tih->get_type_name();
> > > > +
> > > >          switch (type_info_get_type(tih)) {
> > > >          case VM_DATA_TYPE_INT64:
> > > >          case VM_DATA_TYPE_UINT64:
> > > > @@ -110,6 +113,19 @@
> > > >              break;
> > > >          case VM_DATA_TYPE_CLASS:
> > > >          case VM_DATA_TYPE_ARRAY:
> > > > +            if (str) {   //wjw MMTk support
> > > > +                if (strncmp(str->bytes,
> > > "org/vmmagic/unboxed/Address",
> > > > str->len) == 0 )
> > > > +                     is_magic = true;
> > > > +                if (strncmp(str->bytes,
> > > > "org/vmmagic/unboxed/Extent",  str->len) == 0 )
> > > > +                     is_magic = true;
> > > > +                if (strncmp(str->bytes,
> > > > "org/vmmagic/unboxed/Offset",  str->len) == 0 )
> > > > +                     is_magic = true;
> > > > +                if (strncmp(str->bytes,
> > > > "org/vmmagic/unboxed/Word",    str->len) == 0 )
> > > > +                     is_magic = true;
> > > > +                if (strncmp(str->bytes,
> > > > "org/vmmagic/unboxed/ObjectReference",    str->len) == 0 )
> > > > +                     is_magic = true;
> > > > +            }
> > > > +            if (is_magic == false)
> > >
> > >
> >              gc->add_object((ManagedObject**)get_arg_word(num_arg_words,
> > > > cur_word));
> > > >              cur_word++;
> > > >              break;
> > > >
> > > > Modified:
> > > >
> > >
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
> > > > URL:
> > > >
> > >
> http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp?view=diff&rev=467552&r1=467551&r2=467552
> > > >
> > > >
> > >
> ==============================================================================
> > > > ---
> > > >
> > >
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
> > > > (original)
> > > > +++
> > > >
> > >
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
> > > > Tue Oct 24 20:55:30 2006
> > > > @@ -78,6 +78,8 @@
> > > > static int sc_nest = -1;
> > > > static uint32 exam_point;
> > > >
> > > > +
> > > > +
> > > > void linux_ucontext_to_regs(Registers* regs, ucontext_t *uc)
> > > > {
> > > >      regs->eax = uc->uc_mcontext.gregs[REG_EAX];
> > > > @@ -150,16 +152,13 @@
> > > >
> > > >      uint32 exception_esp = regs.esp;
> > > >      DebugUtilsTI* ti = VM_Global_State::loader_env->TI;
> > > > -
> > > >      exn_athrow_regs(&regs, exc_clss);
> > > > -
> > > >      assert(exception_esp <= regs.esp);
> > > >      if
> > > >
> > >
> (ti->get_global_capability(DebugUtilsTI::TI_GC_ENABLE_EXCEPTION_EVENT)) {
> > > >          regs.esp = regs.esp - 4;
> > > >          *((uint32*) regs.esp) = regs.eip;
> > > >          regs.eip = ((uint32)asm_jvmti_exception_catch_callback);
> > > >      }
> > > > -
> > > >      linux_regs_to_ucontext(uc, &regs);
> > > > }
> > > >
> > > > @@ -272,6 +271,7 @@
> > > >
> > > > inline size_t find_guard_stack_size() {
> > > >      return 64*1024;
> > > > +
> > > > }
> > > >
> > > > inline size_t find_guard_page_size() {
> > > > @@ -318,34 +318,39 @@
> > > > void set_guard_stack() {
> > > >      int err;
> > > >
> > > > -    /*
> > > > -     * have the stack parameters been initialized?
> > > > -     *
> > > > -     * TODO - fix this - this probably should be elsewhere
> > > > -     */
> > > > -
> > > > -    if(!p_TLS_vmthread->stack_addr) {
> > > > -        init_stack_info();
> > > > -    }
> > > > -
> > > >      char* stack_addr = (char*) get_stack_addr();
> > > >      size_t stack_size = get_stack_size();
> > > >      size_t guard_stack_size = get_guard_stack_size();
> > > >      size_t guard_page_size = get_guard_page_size();
> > > >
> > > > -    err = mprotect(stack_addr - stack_size + guard_page_size +
> > > > guard_stack_size,
> > > > -        guard_page_size, PROT_NONE);
> > > > +    // map the guard page and protect it
> > > > +    void UNUSED *res = mmap(stack_addr - stack_size +
> guard_page_size
> > > +
> > > > +    guard_stack_size, guard_page_size,  PROT_READ | PROT_WRITE,
> > > > +    MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> > > > +
> > > > +    assert(res!=MAP_FAILED);
> > > > +
> > > > +    err = mprotect(stack_addr - stack_size  + guard_page_size +
> > > > +    guard_stack_size, guard_page_size, PROT_NONE );
> > > > +
> > > > +    assert(!err);
> > > > +
> > > > +    //map the alternate stack on which we want to handle the signal
> > > > +    void UNUSED *res2 = mmap(stack_addr - stack_size +
> > > guard_page_size,
> > > > +    guard_stack_size,  PROT_READ | PROT_WRITE,
> > > > +    MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> > > > +
> > > > +    assert(res2!=MAP_FAILED);
> > > > +
> > > >
> > > > -/* $$$ GMJ    assert(!err);  */
> > > > -
> > > >      stack_t sigalt;
> > > >      sigalt.ss_sp = stack_addr - stack_size + guard_page_size;
> > > >      sigalt.ss_flags = SS_ONSTACK;
> > > >      sigalt.ss_size = guard_stack_size;
> > > >
> > > >      err = sigaltstack (&sigalt, NULL);
> > > > -
> > > >      assert(!err);
> > > > +
> > > > }
> > > >
> > > > size_t get_available_stack_size() {
> > > > @@ -376,8 +381,10 @@
> > > >      size_t guard_stack_size = get_guard_stack_size();
> > > >      size_t guard_page_size = get_guard_page_size();
> > > >
> > > > -    err = mprotect(stack_addr - stack_size + guard_page_size +
> > > > guard_stack_size,
> > > > -        guard_page_size, PROT_READ | PROT_WRITE);
> > > > +
> > > > +    err = mprotect(stack_addr - stack_size + guard_page_size +
> > > > +    guard_stack_size, guard_page_size, PROT_READ | PROT_WRITE);
> > > > +
> > > >
> > > >      stack_t sigalt;
> > > >      sigalt.ss_sp = stack_addr - stack_size + guard_page_size;
> > > > @@ -385,6 +392,7 @@
> > > >      sigalt.ss_size = guard_stack_size;
> > > >
> > > >      err = sigaltstack (&sigalt, NULL);
> > > > +
> > > > }
> > > >
> > > > bool check_stack_overflow(siginfo_t *info, ucontext_t *uc) {
> > > > @@ -395,6 +403,7 @@
> > > >
> > > >      char* guard_page_begin = stack_addr - stack_size +
> > > guard_page_size +
> > > > guard_stack_size;
> > > >      char* guard_page_end = guard_page_begin + guard_page_size;
> > > > +
> > > >      char* fault_addr = (char*)(info->si_addr);
> > > >      //char* esp_value = (char*)(uc->uc_mcontext.gregs[REG_ESP]);
> > > >
> > > > @@ -432,7 +441,7 @@
> > > > }
> > > >
> > > > void null_java_reference_handler(int signum, siginfo_t* UNREF info,
> > > void*
> > > > context)
> > > > -{
> > > > +{
> > > >      ucontext_t *uc = (ucontext_t *)context;
> > > >      Global_Env *env = VM_Global_State::loader_env;
> > > >
> > > > @@ -443,7 +452,7 @@
> > > >          stack_overflow_handler(signum, info, context);
> > > >          return;
> > > >      }
> > > > -
> > > > +
> > > >      if (env->shutting_down != 0) {
> > > >          fprintf(stderr, "null_java_reference_handler(): called in
> > > > shutdown stage\n");
> > > >      } else if (!interpreter_enabled()) {
> > > > @@ -452,7 +461,6 @@
> > > >              return;
> > > >          }
> > > >      }
> > > > -
> > > >      fprintf(stderr, "SIGSEGV in VM code.\n");
> > > >      Registers regs;
> > > >      linux_ucontext_to_regs(&regs, uc);
> > > >
> > > > Modified:
> > > >
> > >
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
> > > > URL:
> > > >
> > >
> http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp?view=diff&rev=467552&r1=467551&r2=467552
> > > >
> > > >
> > >
> ==============================================================================
> > > > ---
> > > >
> > >
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
> > > > (original)
> > > > +++
> > > >
> > >
> incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
> > > > Tue Oct 24 20:55:30 2006
> > > > @@ -176,17 +176,6 @@
> > > > }
> > > >
> > > > void set_guard_stack() {
> > > > -
> > > > -    /*
> > > > -     * have the stack parameters been initialized?
> > > > -     *
> > > > -     * TODO - fix this - this probably should be elsewhere
> > > > -     */
> > > > -
> > > > -    if(!p_TLS_vmthread->stack_addr) {
> > > > -        init_stack_info();
> > > > -    }
> > > > -
> > > >      void* stack_addr = get_stack_addr();
> > > >      size_t stack_size = get_stack_size();
> > > >      size_t page_size = get_guard_page_size();
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Gregory Shimansky, Intel Middleware Products Division
> > >
> > >
> >
>
>


-- 
Weldon Washburn
Intel Enterprise Solutions Software Division

Re: svn commit: r467552 - in /incubator/harmony/enhanced/drlvm/trunk/vm: tests/smoke/StackTest.java vmcore/src/util/ia32/base/compile_IA32.cpp vmcore/src/util/linux/signals_ia32.cpp vmcore/src/util/win/ia32/nt_exception_filter.cpp

Posted by Rana Dasgupta <rd...@gmail.com>.
Hi Weldon,
   It is quite likely that Gregory is right about the open file.
compile_IA32.cpp is not changed by 1786 :-) Could you also please close the
JIRA on 1786, 1900, 1898 when you have reviewed and applied the patches?
They still show open.

Thanks for your help,
Rana



> On 10/25/06, Gregory Shimansky <gs...@gmail.com> wrote:
> >
> > Hello Weldon
> >
> > I've noticed that along with changes from Rana's patch from HARMONY-1786
> > you've committed some changes compile_IA32.cpp. They don't seem to be
> > related to the patch, but rather a part of MMTK integration. Could it be
> > that you had some modifications to compile_IA32.cpp and accidently
> > committed
> > them along with Rana's patch? Is it code safe to be committed in drlvm
> > right
> > now?
> >
> > 2006/10/25, wjwashburn@apache.org <wj...@apache.org>:
> > >
> > > Author: wjwashburn
> > > Date: Tue Oct 24 20:55:30 2006
> > > New Revision: 467552
> > >
> > > URL: http://svn.apache.org/viewvc?view=rev&rev=467552
> > > Log:
> > > HARMONY-1786, a patch to fix Stack Overflow Error detection on Linux
> > > smoke tests pass on both Linux and WindowsXP
> > >
> > >
> > > Modified:
> > >
> > incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/StackTest.java
> > >
> > >
> > incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
> > >
> > >
> > incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
> > >
> > >
> > incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
> > >
> > > Modified:
> > > incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/StackTest.java
> > > URL:
> > >
> > http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/StackTest.java?view=diff&rev=467552&r1=467551&r2=467552
> > >
> > >
> > ==============================================================================
> > > ---
> > incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/StackTest.java
> > > (original)
> > > +++
> > incubator/harmony/enhanced/drlvm/trunk/vm/tests/smoke/StackTest.java
> > > Tue Oct 24 20:55:30 2006
> > > @@ -15,10 +15,6 @@
> > >   *  limitations under the License.
> > >   */
> > >
> > > -/*
> > > - *  $$$ GMJ
> > > - *  @keyword XXX_StackOverflowBroken
> > > - */
> > > public class StackTest {
> > >
> > >      static int depth = 0;
> > >
> > > Modified:
> > >
> > incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
> > > URL:
> > >
> > http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp?view=diff&rev=467552&r1=467551&r2=467552
> > >
> > >
> > ==============================================================================
> > > ---
> > >
> > incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
> > > (original)
> > > +++
> > >
> > incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
> > > Tue Oct 24 20:55:30 2006
> > > @@ -1,4 +1,4 @@
> > > -/*
> > > +/*
> > >   *  Licensed to the Apache Software Foundation (ASF) under one or
> > more
> > >   *  contributor license agreements.  See the NOTICE file distributed
> > with
> > >   *  this work for additional information regarding copyright
> > ownership.
> > > @@ -88,6 +88,9 @@
> > >      unsigned cur_word = 0;
> > >      for(unsigned i=0; i<num_args; i++) {
> > >          Type_Info_Handle tih = method_args_get_type_info(msh, i);
> > > +        bool is_magic = false;  //wjw, MMTk support
> > > +        const String *str = tih->get_type_name();
> > > +
> > >          switch (type_info_get_type(tih)) {
> > >          case VM_DATA_TYPE_INT64:
> > >          case VM_DATA_TYPE_UINT64:
> > > @@ -110,6 +113,19 @@
> > >              break;
> > >          case VM_DATA_TYPE_CLASS:
> > >          case VM_DATA_TYPE_ARRAY:
> > > +            if (str) {   //wjw MMTk support
> > > +                if (strncmp(str->bytes,
> > "org/vmmagic/unboxed/Address",
> > > str->len) == 0 )
> > > +                     is_magic = true;
> > > +                if (strncmp(str->bytes,
> > > "org/vmmagic/unboxed/Extent",  str->len) == 0 )
> > > +                     is_magic = true;
> > > +                if (strncmp(str->bytes,
> > > "org/vmmagic/unboxed/Offset",  str->len) == 0 )
> > > +                     is_magic = true;
> > > +                if (strncmp(str->bytes,
> > > "org/vmmagic/unboxed/Word",    str->len) == 0 )
> > > +                     is_magic = true;
> > > +                if (strncmp(str->bytes,
> > > "org/vmmagic/unboxed/ObjectReference",    str->len) == 0 )
> > > +                     is_magic = true;
> > > +            }
> > > +            if (is_magic == false)
> >
> > >              gc->add_object((ManagedObject**)get_arg_word(num_arg_words,
> > > cur_word));
> > >              cur_word++;
> > >              break;
> > >
> > > Modified:
> > >
> > incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
> > > URL:
> > >
> > http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp?view=diff&rev=467552&r1=467551&r2=467552
> > >
> > >
> > ==============================================================================
> > > ---
> > >
> > incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
> > > (original)
> > > +++
> > >
> > incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
> > > Tue Oct 24 20:55:30 2006
> > > @@ -78,6 +78,8 @@
> > > static int sc_nest = -1;
> > > static uint32 exam_point;
> > >
> > > +
> > > +
> > > void linux_ucontext_to_regs(Registers* regs, ucontext_t *uc)
> > > {
> > >      regs->eax = uc->uc_mcontext.gregs[REG_EAX];
> > > @@ -150,16 +152,13 @@
> > >
> > >      uint32 exception_esp = regs.esp;
> > >      DebugUtilsTI* ti = VM_Global_State::loader_env->TI;
> > > -
> > >      exn_athrow_regs(&regs, exc_clss);
> > > -
> > >      assert(exception_esp <= regs.esp);
> > >      if
> > >
> > (ti->get_global_capability(DebugUtilsTI::TI_GC_ENABLE_EXCEPTION_EVENT)) {
> > >          regs.esp = regs.esp - 4;
> > >          *((uint32*) regs.esp) = regs.eip;
> > >          regs.eip = ((uint32)asm_jvmti_exception_catch_callback);
> > >      }
> > > -
> > >      linux_regs_to_ucontext(uc, &regs);
> > > }
> > >
> > > @@ -272,6 +271,7 @@
> > >
> > > inline size_t find_guard_stack_size() {
> > >      return 64*1024;
> > > +
> > > }
> > >
> > > inline size_t find_guard_page_size() {
> > > @@ -318,34 +318,39 @@
> > > void set_guard_stack() {
> > >      int err;
> > >
> > > -    /*
> > > -     * have the stack parameters been initialized?
> > > -     *
> > > -     * TODO - fix this - this probably should be elsewhere
> > > -     */
> > > -
> > > -    if(!p_TLS_vmthread->stack_addr) {
> > > -        init_stack_info();
> > > -    }
> > > -
> > >      char* stack_addr = (char*) get_stack_addr();
> > >      size_t stack_size = get_stack_size();
> > >      size_t guard_stack_size = get_guard_stack_size();
> > >      size_t guard_page_size = get_guard_page_size();
> > >
> > > -    err = mprotect(stack_addr - stack_size + guard_page_size +
> > > guard_stack_size,
> > > -        guard_page_size, PROT_NONE);
> > > +    // map the guard page and protect it
> > > +    void UNUSED *res = mmap(stack_addr - stack_size + guard_page_size
> > +
> > > +    guard_stack_size, guard_page_size,  PROT_READ | PROT_WRITE,
> > > +    MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> > > +
> > > +    assert(res!=MAP_FAILED);
> > > +
> > > +    err = mprotect(stack_addr - stack_size  + guard_page_size +
> > > +    guard_stack_size, guard_page_size, PROT_NONE );
> > > +
> > > +    assert(!err);
> > > +
> > > +    //map the alternate stack on which we want to handle the signal
> > > +    void UNUSED *res2 = mmap(stack_addr - stack_size +
> > guard_page_size,
> > > +    guard_stack_size,  PROT_READ | PROT_WRITE,
> > > +    MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> > > +
> > > +    assert(res2!=MAP_FAILED);
> > > +
> > >
> > > -/* $$$ GMJ    assert(!err);  */
> > > -
> > >      stack_t sigalt;
> > >      sigalt.ss_sp = stack_addr - stack_size + guard_page_size;
> > >      sigalt.ss_flags = SS_ONSTACK;
> > >      sigalt.ss_size = guard_stack_size;
> > >
> > >      err = sigaltstack (&sigalt, NULL);
> > > -
> > >      assert(!err);
> > > +
> > > }
> > >
> > > size_t get_available_stack_size() {
> > > @@ -376,8 +381,10 @@
> > >      size_t guard_stack_size = get_guard_stack_size();
> > >      size_t guard_page_size = get_guard_page_size();
> > >
> > > -    err = mprotect(stack_addr - stack_size + guard_page_size +
> > > guard_stack_size,
> > > -        guard_page_size, PROT_READ | PROT_WRITE);
> > > +
> > > +    err = mprotect(stack_addr - stack_size + guard_page_size +
> > > +    guard_stack_size, guard_page_size, PROT_READ | PROT_WRITE);
> > > +
> > >
> > >      stack_t sigalt;
> > >      sigalt.ss_sp = stack_addr - stack_size + guard_page_size;
> > > @@ -385,6 +392,7 @@
> > >      sigalt.ss_size = guard_stack_size;
> > >
> > >      err = sigaltstack (&sigalt, NULL);
> > > +
> > > }
> > >
> > > bool check_stack_overflow(siginfo_t *info, ucontext_t *uc) {
> > > @@ -395,6 +403,7 @@
> > >
> > >      char* guard_page_begin = stack_addr - stack_size +
> > guard_page_size +
> > > guard_stack_size;
> > >      char* guard_page_end = guard_page_begin + guard_page_size;
> > > +
> > >      char* fault_addr = (char*)(info->si_addr);
> > >      //char* esp_value = (char*)(uc->uc_mcontext.gregs[REG_ESP]);
> > >
> > > @@ -432,7 +441,7 @@
> > > }
> > >
> > > void null_java_reference_handler(int signum, siginfo_t* UNREF info,
> > void*
> > > context)
> > > -{
> > > +{
> > >      ucontext_t *uc = (ucontext_t *)context;
> > >      Global_Env *env = VM_Global_State::loader_env;
> > >
> > > @@ -443,7 +452,7 @@
> > >          stack_overflow_handler(signum, info, context);
> > >          return;
> > >      }
> > > -
> > > +
> > >      if (env->shutting_down != 0) {
> > >          fprintf(stderr, "null_java_reference_handler(): called in
> > > shutdown stage\n");
> > >      } else if (!interpreter_enabled()) {
> > > @@ -452,7 +461,6 @@
> > >              return;
> > >          }
> > >      }
> > > -
> > >      fprintf(stderr, "SIGSEGV in VM code.\n");
> > >      Registers regs;
> > >      linux_ucontext_to_regs(&regs, uc);
> > >
> > > Modified:
> > >
> > incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
> > > URL:
> > >
> > http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp?view=diff&rev=467552&r1=467551&r2=467552
> > >
> > >
> > ==============================================================================
> > > ---
> > >
> > incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
> > > (original)
> > > +++
> > >
> > incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32/nt_exception_filter.cpp
> > > Tue Oct 24 20:55:30 2006
> > > @@ -176,17 +176,6 @@
> > > }
> > >
> > > void set_guard_stack() {
> > > -
> > > -    /*
> > > -     * have the stack parameters been initialized?
> > > -     *
> > > -     * TODO - fix this - this probably should be elsewhere
> > > -     */
> > > -
> > > -    if(!p_TLS_vmthread->stack_addr) {
> > > -        init_stack_info();
> > > -    }
> > > -
> > >      void* stack_addr = get_stack_addr();
> > >      size_t stack_size = get_stack_size();
> > >      size_t page_size = get_guard_page_size();
> > >
> > >
> > >
> >
> >
> > --
> > Gregory Shimansky, Intel Middleware Products Division
> >
> >
>