You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Xiao-Feng Li <xi...@gmail.com> on 2007/06/01 08:14:03 UTC
[drlvm][thread] question on hythread_suspend_enable and tmn_suspend_enable
Hi, folks, I am having some difficulty in understanding the usage
difference between hythread_xxx() procedures and tmn_xxx() series for
thread suspension control.
1). Looks like they are used interchangeably (?) .
For example,
In file vm/vmcore/src/init/vm_init.cpp,
576: hythread_suspend_enable();
577: exn_print_stack_trace(stderr, exn_get());
578: hythread_suspend_disable();
In file vm/vmcore/src/exception/exceptions.cpp,
619: tmn_suspend_disable();
620:
621: ManagedObject *exn = exc->object;
622: exn_native_print_stack_trace(f, exn);
623:
624: tmn_suspend_enable();
2). A code snippet I can't understand:
In file vm/vmcore/src/exception/exceptions.cpp,
549: inline void exn_native_print_stack_trace(FILE * f, ManagedObject * exn)
550: {
551:
552: assert(hythread_is_suspend_enabled());
If we see the line 552 here and line 619 above (both in
exceptions.cpp), we may find they are contraditory (?) . The flow
disables suspension and calls into a function which requires
suspension enabled. Why is that?
Can DRLVM thread guy please give some explantions on the two questions?
Thanks,
xiaofeng
--
http://xiao-feng.blogspot.com
Re: [drlvm][thread] question on hythread_suspend_enable and tmn_suspend_enable
Posted by Weldon Washburn <we...@gmail.com>.
Xiao Feng,
The short answer is that yes, this is broken code. Feel free to open a JIRA
if its causing problems. If its not causing problems, perhaps we can leave
it to be cleaned up later.
The long answer is that we need to develop an enable/disable model. Then go
through all the XXX_enable/XXX_disable code to bring it into conformance
with this model.
Weldon
On 6/1/07, Xiao-Feng Li <xi...@gmail.com> wrote:
>
> On 6/1/07, Pavel Afremov <pa...@gmail.com> wrote:
> > Line "assert(hythread_is_suspend_enabled());" is wrong and should be
> > replaced by "assert(!hythread_is_suspend_enabled());"
>
> Thanks, Pavel.
>
> Let's ask threading guy to fix it.
>
> Thanks,
> xiaofeng
>
> > Thanks.
> > Pavel Afremov.
> >
> > On 6/1/07, Xiao-Feng Li <xi...@gmail.com> wrote:
> > >
> > > On 6/1/07, Pavel Pervov <pm...@gmail.com> wrote:
> > > > hythread_suspend_disalbe is allowed to be called recursively.
> > > > tmn_suspend_disable is not. That is the difference.
> > > >
> > > > WBR,
> > > > Pavel.
> > >
> > > Thanks, Pavel. It helps, but I still don't understand if the question
> > > 2) is indeed a problem, i.e., the code calls tmn_suspend_disable()
> > > first, then calls assert(hythread_is_suspend_enabled()). Does that
> > > mean tmn_suspend_disable() actually doesn't really disable the
> > > suspension? Thanks for further explanations.
> > >
> > >
> > > -xiaofeng
> > >
> > > >
> > > > On 6/1/07, Xiao-Feng Li <xi...@gmail.com> wrote:
> > > > >
> > > > > Hi, folks, I am having some difficulty in understanding the usage
> > > > > difference between hythread_xxx() procedures and tmn_xxx() series
> for
> > > > > thread suspension control.
> > > > >
> > > > > 1). Looks like they are used interchangeably (?) .
> > > > >
> > > > > For example,
> > > > >
> > > > > In file vm/vmcore/src/init/vm_init.cpp,
> > > > >
> > > > > 576: hythread_suspend_enable();
> > > > > 577: exn_print_stack_trace(stderr, exn_get());
> > > > > 578: hythread_suspend_disable();
> > > > >
> > > > >
> > > > > In file vm/vmcore/src/exception/exceptions.cpp,
> > > > >
> > > > > 619: tmn_suspend_disable();
> > > > > 620:
> > > > > 621: ManagedObject *exn = exc->object;
> > > > > 622: exn_native_print_stack_trace(f, exn);
> > > > > 623:
> > > > > 624: tmn_suspend_enable();
> > > > >
> > > > > 2). A code snippet I can't understand:
> > > > >
> > > > > In file vm/vmcore/src/exception/exceptions.cpp,
> > > > >
> > > > > 549: inline void exn_native_print_stack_trace(FILE * f,
> ManagedObject
> > > *
> > > > > exn)
> > > > > 550: {
> > > > > 551:
> > > > > 552: assert(hythread_is_suspend_enabled());
> > > > >
> > > > > If we see the line 552 here and line 619 above (both in
> > > > > exceptions.cpp), we may find they are contraditory (?) . The flow
> > > > > disables suspension and calls into a function which requires
> > > > > suspension enabled. Why is that?
> > > > >
> > > > > Can DRLVM thread guy please give some explantions on the two
> > > questions?
> > > > >
> > > > > Thanks,
> > > > > xiaofeng
> > > > > --
> > > > > http://xiao-feng.blogspot.com
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Pavel Pervov,
> > > > Intel Enterprise Solutions Software Division
> > > >
> > >
> > >
> > > --
> > > http://xiao-feng.blogspot.com
> > >
> >
>
>
> --
> http://xiao-feng.blogspot.com
>
--
Weldon Washburn
Re: [drlvm][thread] question on hythread_suspend_enable and tmn_suspend_enable
Posted by Xiao-Feng Li <xi...@gmail.com>.
On 6/1/07, Pavel Afremov <pa...@gmail.com> wrote:
> Line "assert(hythread_is_suspend_enabled());" is wrong and should be
> replaced by "assert(!hythread_is_suspend_enabled());"
Thanks, Pavel.
Let's ask threading guy to fix it.
Thanks,
xiaofeng
> Thanks.
> Pavel Afremov.
>
> On 6/1/07, Xiao-Feng Li <xi...@gmail.com> wrote:
> >
> > On 6/1/07, Pavel Pervov <pm...@gmail.com> wrote:
> > > hythread_suspend_disalbe is allowed to be called recursively.
> > > tmn_suspend_disable is not. That is the difference.
> > >
> > > WBR,
> > > Pavel.
> >
> > Thanks, Pavel. It helps, but I still don't understand if the question
> > 2) is indeed a problem, i.e., the code calls tmn_suspend_disable()
> > first, then calls assert(hythread_is_suspend_enabled()). Does that
> > mean tmn_suspend_disable() actually doesn't really disable the
> > suspension? Thanks for further explanations.
> >
> >
> > -xiaofeng
> >
> > >
> > > On 6/1/07, Xiao-Feng Li <xi...@gmail.com> wrote:
> > > >
> > > > Hi, folks, I am having some difficulty in understanding the usage
> > > > difference between hythread_xxx() procedures and tmn_xxx() series for
> > > > thread suspension control.
> > > >
> > > > 1). Looks like they are used interchangeably (?) .
> > > >
> > > > For example,
> > > >
> > > > In file vm/vmcore/src/init/vm_init.cpp,
> > > >
> > > > 576: hythread_suspend_enable();
> > > > 577: exn_print_stack_trace(stderr, exn_get());
> > > > 578: hythread_suspend_disable();
> > > >
> > > >
> > > > In file vm/vmcore/src/exception/exceptions.cpp,
> > > >
> > > > 619: tmn_suspend_disable();
> > > > 620:
> > > > 621: ManagedObject *exn = exc->object;
> > > > 622: exn_native_print_stack_trace(f, exn);
> > > > 623:
> > > > 624: tmn_suspend_enable();
> > > >
> > > > 2). A code snippet I can't understand:
> > > >
> > > > In file vm/vmcore/src/exception/exceptions.cpp,
> > > >
> > > > 549: inline void exn_native_print_stack_trace(FILE * f, ManagedObject
> > *
> > > > exn)
> > > > 550: {
> > > > 551:
> > > > 552: assert(hythread_is_suspend_enabled());
> > > >
> > > > If we see the line 552 here and line 619 above (both in
> > > > exceptions.cpp), we may find they are contraditory (?) . The flow
> > > > disables suspension and calls into a function which requires
> > > > suspension enabled. Why is that?
> > > >
> > > > Can DRLVM thread guy please give some explantions on the two
> > questions?
> > > >
> > > > Thanks,
> > > > xiaofeng
> > > > --
> > > > http://xiao-feng.blogspot.com
> > > >
> > >
> > >
> > >
> > > --
> > > Pavel Pervov,
> > > Intel Enterprise Solutions Software Division
> > >
> >
> >
> > --
> > http://xiao-feng.blogspot.com
> >
>
--
http://xiao-feng.blogspot.com
Re: [drlvm][thread] question on hythread_suspend_enable and tmn_suspend_enable
Posted by Pavel Afremov <pa...@gmail.com>.
Line "assert(hythread_is_suspend_enabled());" is wrong and should be
replaced by "assert(!hythread_is_suspend_enabled());"
Thanks.
Pavel Afremov.
On 6/1/07, Xiao-Feng Li <xi...@gmail.com> wrote:
>
> On 6/1/07, Pavel Pervov <pm...@gmail.com> wrote:
> > hythread_suspend_disalbe is allowed to be called recursively.
> > tmn_suspend_disable is not. That is the difference.
> >
> > WBR,
> > Pavel.
>
> Thanks, Pavel. It helps, but I still don't understand if the question
> 2) is indeed a problem, i.e., the code calls tmn_suspend_disable()
> first, then calls assert(hythread_is_suspend_enabled()). Does that
> mean tmn_suspend_disable() actually doesn't really disable the
> suspension? Thanks for further explanations.
>
>
> -xiaofeng
>
> >
> > On 6/1/07, Xiao-Feng Li <xi...@gmail.com> wrote:
> > >
> > > Hi, folks, I am having some difficulty in understanding the usage
> > > difference between hythread_xxx() procedures and tmn_xxx() series for
> > > thread suspension control.
> > >
> > > 1). Looks like they are used interchangeably (?) .
> > >
> > > For example,
> > >
> > > In file vm/vmcore/src/init/vm_init.cpp,
> > >
> > > 576: hythread_suspend_enable();
> > > 577: exn_print_stack_trace(stderr, exn_get());
> > > 578: hythread_suspend_disable();
> > >
> > >
> > > In file vm/vmcore/src/exception/exceptions.cpp,
> > >
> > > 619: tmn_suspend_disable();
> > > 620:
> > > 621: ManagedObject *exn = exc->object;
> > > 622: exn_native_print_stack_trace(f, exn);
> > > 623:
> > > 624: tmn_suspend_enable();
> > >
> > > 2). A code snippet I can't understand:
> > >
> > > In file vm/vmcore/src/exception/exceptions.cpp,
> > >
> > > 549: inline void exn_native_print_stack_trace(FILE * f, ManagedObject
> *
> > > exn)
> > > 550: {
> > > 551:
> > > 552: assert(hythread_is_suspend_enabled());
> > >
> > > If we see the line 552 here and line 619 above (both in
> > > exceptions.cpp), we may find they are contraditory (?) . The flow
> > > disables suspension and calls into a function which requires
> > > suspension enabled. Why is that?
> > >
> > > Can DRLVM thread guy please give some explantions on the two
> questions?
> > >
> > > Thanks,
> > > xiaofeng
> > > --
> > > http://xiao-feng.blogspot.com
> > >
> >
> >
> >
> > --
> > Pavel Pervov,
> > Intel Enterprise Solutions Software Division
> >
>
>
> --
> http://xiao-feng.blogspot.com
>
Re: [drlvm][thread] question on hythread_suspend_enable and tmn_suspend_enable
Posted by Xiao-Feng Li <xi...@gmail.com>.
On 6/1/07, Pavel Pervov <pm...@gmail.com> wrote:
> hythread_suspend_disalbe is allowed to be called recursively.
> tmn_suspend_disable is not. That is the difference.
>
> WBR,
> Pavel.
Thanks, Pavel. It helps, but I still don't understand if the question
2) is indeed a problem, i.e., the code calls tmn_suspend_disable()
first, then calls assert(hythread_is_suspend_enabled()). Does that
mean tmn_suspend_disable() actually doesn't really disable the
suspension? Thanks for further explanations.
-xiaofeng
>
> On 6/1/07, Xiao-Feng Li <xi...@gmail.com> wrote:
> >
> > Hi, folks, I am having some difficulty in understanding the usage
> > difference between hythread_xxx() procedures and tmn_xxx() series for
> > thread suspension control.
> >
> > 1). Looks like they are used interchangeably (?) .
> >
> > For example,
> >
> > In file vm/vmcore/src/init/vm_init.cpp,
> >
> > 576: hythread_suspend_enable();
> > 577: exn_print_stack_trace(stderr, exn_get());
> > 578: hythread_suspend_disable();
> >
> >
> > In file vm/vmcore/src/exception/exceptions.cpp,
> >
> > 619: tmn_suspend_disable();
> > 620:
> > 621: ManagedObject *exn = exc->object;
> > 622: exn_native_print_stack_trace(f, exn);
> > 623:
> > 624: tmn_suspend_enable();
> >
> > 2). A code snippet I can't understand:
> >
> > In file vm/vmcore/src/exception/exceptions.cpp,
> >
> > 549: inline void exn_native_print_stack_trace(FILE * f, ManagedObject *
> > exn)
> > 550: {
> > 551:
> > 552: assert(hythread_is_suspend_enabled());
> >
> > If we see the line 552 here and line 619 above (both in
> > exceptions.cpp), we may find they are contraditory (?) . The flow
> > disables suspension and calls into a function which requires
> > suspension enabled. Why is that?
> >
> > Can DRLVM thread guy please give some explantions on the two questions?
> >
> > Thanks,
> > xiaofeng
> > --
> > http://xiao-feng.blogspot.com
> >
>
>
>
> --
> Pavel Pervov,
> Intel Enterprise Solutions Software Division
>
--
http://xiao-feng.blogspot.com
Re: [drlvm][thread] question on hythread_suspend_enable and tmn_suspend_enable
Posted by Pavel Pervov <pm...@gmail.com>.
hythread_suspend_enable and tmn_suspend_enable are just reversive operations
for those two. Yes, they are identical.
On 6/1/07, Pavel Pervov <pm...@gmail.com> wrote:
>
> hythread_suspend_disalbe is allowed to be called recursively.
> tmn_suspend_disable is not. That is the difference.
>
> WBR,
> Pavel.
>
>
> On 6/1/07, Xiao-Feng Li <xi...@gmail.com> wrote:
> >
> > Hi, folks, I am having some difficulty in understanding the usage
> > difference between hythread_xxx() procedures and tmn_xxx() series for
> > thread suspension control.
> >
> > 1). Looks like they are used interchangeably (?) .
> >
> > For example,
> >
> > In file vm/vmcore/src/init/vm_init.cpp,
> >
> > 576: hythread_suspend_enable();
> > 577: exn_print_stack_trace(stderr, exn_get());
> > 578: hythread_suspend_disable();
> >
> >
> > In file vm/vmcore/src/exception/exceptions.cpp,
> >
> > 619: tmn_suspend_disable();
> > 620:
> > 621: ManagedObject *exn = exc->object;
> > 622: exn_native_print_stack_trace(f, exn);
> > 623:
> > 624: tmn_suspend_enable();
> >
> > 2). A code snippet I can't understand:
> >
> > In file vm/vmcore/src/exception/exceptions.cpp,
> >
> > 549: inline void exn_native_print_stack_trace(FILE * f, ManagedObject *
> > exn)
> > 550: {
> > 551:
> > 552: assert(hythread_is_suspend_enabled());
> >
> > If we see the line 552 here and line 619 above (both in
> > exceptions.cpp), we may find they are contraditory (?) . The flow
> > disables suspension and calls into a function which requires
> > suspension enabled. Why is that?
> >
> > Can DRLVM thread guy please give some explantions on the two questions?
> >
> > Thanks,
> > xiaofeng
> > --
> > http://xiao-feng.blogspot.com
> >
>
>
>
> --
> Pavel Pervov,
> Intel Enterprise Solutions Software Division
--
Pavel Pervov,
Intel Enterprise Solutions Software Division
Re: [drlvm][thread] question on hythread_suspend_enable and tmn_suspend_enable
Posted by Pavel Pervov <pm...@gmail.com>.
hythread_suspend_disalbe is allowed to be called recursively.
tmn_suspend_disable is not. That is the difference.
WBR,
Pavel.
On 6/1/07, Xiao-Feng Li <xi...@gmail.com> wrote:
>
> Hi, folks, I am having some difficulty in understanding the usage
> difference between hythread_xxx() procedures and tmn_xxx() series for
> thread suspension control.
>
> 1). Looks like they are used interchangeably (?) .
>
> For example,
>
> In file vm/vmcore/src/init/vm_init.cpp,
>
> 576: hythread_suspend_enable();
> 577: exn_print_stack_trace(stderr, exn_get());
> 578: hythread_suspend_disable();
>
>
> In file vm/vmcore/src/exception/exceptions.cpp,
>
> 619: tmn_suspend_disable();
> 620:
> 621: ManagedObject *exn = exc->object;
> 622: exn_native_print_stack_trace(f, exn);
> 623:
> 624: tmn_suspend_enable();
>
> 2). A code snippet I can't understand:
>
> In file vm/vmcore/src/exception/exceptions.cpp,
>
> 549: inline void exn_native_print_stack_trace(FILE * f, ManagedObject *
> exn)
> 550: {
> 551:
> 552: assert(hythread_is_suspend_enabled());
>
> If we see the line 552 here and line 619 above (both in
> exceptions.cpp), we may find they are contraditory (?) . The flow
> disables suspension and calls into a function which requires
> suspension enabled. Why is that?
>
> Can DRLVM thread guy please give some explantions on the two questions?
>
> Thanks,
> xiaofeng
> --
> http://xiao-feng.blogspot.com
>
--
Pavel Pervov,
Intel Enterprise Solutions Software Division