Re: Problem in Thread.c

"Sébastien Adam" <[email protected]> Sun, 16 Apr 2006 22:24:34 +0000
Newsgroups gmane.comp.java.vm.sablevm.devel
Message-ID <[email protected]>
--===============0803409260==
Content-Type: multipart/alternative; 
	boundary="----=_Part_7002_22069587.1145226274139"

------=_Part_7002_22069587.1145226274139
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

When I collect the garbage I pass through the stack of each thread to get
the roots.  In addition, I scavenge the heap. Each root is then updated...
Maybe should I pass through some other roots...

inline svm_static void
_svmf_trace_native_references (_svmt_JNIEnv *env)
{
  _svmt_JavaVM *vm =3D env->vm;
  _svmt_JNIEnv *thread;

  /* Trace native global references. */
  _svmf_trace_native_ref_list (env, vm->native_globals.list);

  /* Trace stack and native local references. */
  for (thread =3D vm->threads.user; thread !=3D NULL; thread =3D thread->ne=
xt)
    {
      _svmf_trace_native_ref_list (env, thread->native_locals.list);

      _svmf_trace_stack (env, thread);
    }

  for (thread =3D vm->threads.system; thread !=3D NULL; thread =3D thread->=
next)
    {
      _svmf_trace_native_ref_list (env, thread->native_locals.list);

      _svmf_trace_stack (env, thread);
    }
}

On 4/16/06, Chris Pickett <[email protected]> wrote:
>
> Hi Seb,
>
> This is just a guess, but maybe it is because the object instance for an
> INVOKESTATIC is not on the heap but in class loader memory.
>
> Chris
>
> On Sun, April 16, 2006 10:41 am, S=E9bastien Adam wrote:
> > ... maybe should I add that enter_object_monitor is called in the
> > instruction SVM_INSTRUCTION_INVOKESTATIC in instructions_switch.c...
> >
> > /* preserve references on the stack across GC */
> > frame->stack_size =3D stack_size + args_count;
> >
> > if (_svmf_enter_object_monitor (env, instance) !=3D JNI_OK) {
> > goto exception_handler; }
> >
> >
> > ...
> > _______________________________________________
> > SableVM-devel mailing list
> > [email protected]
> > http://sablevm.org/lists/control/listinfo/sablevm-devel
> >
> >
>
>
>
> _______________________________________________
> SableVM-devel mailing list
> [email protected]
> http://sablevm.org/lists/control/listinfo/sablevm-devel
>

------=_Part_7002_22069587.1145226274139
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

When I collect the garbage I pass through the stack of each thread to
get the roots.&nbsp; In addition, I scavenge the heap. Each root is
then updated... Maybe should I pass through some other roots... <br>
<br>
inline svm_static void <br>
_svmf_trace_native_references (_svmt_JNIEnv *env)<br>
{<br>
&nbsp; _svmt_JavaVM *vm =3D env-&gt;vm;<br>
&nbsp; _svmt_JNIEnv *thread;<br>
<br>
&nbsp; /* Trace native global references. */<br>
&nbsp; _svmf_trace_native_ref_list (env, vm-&gt;native_globals.list);<br>
&nbsp; <br>
&nbsp; /* Trace stack and native local references. */<br>
&nbsp; for (thread =3D vm-&gt;threads.user; thread !=3D NULL; thread =3D th=
read-&gt;next)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _svmf_trace_native_ref_list (env, thread-&gt=
;native_locals.list);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _svmf_trace_stack (env, thread);<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp; for (thread =3D vm-&gt;threads.system; thread !=3D NULL; thread =3D =
thread-&gt;next)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _svmf_trace_native_ref_list (env, thread-&gt=
;native_locals.list);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _svmf_trace_stack (env, thread);<br>
&nbsp;&nbsp;&nbsp; }<br>
}<br><br><div><span class=3D"gmail_quote">On 4/16/06, <b class=3D"gmail_sen=
dername">Chris Pickett</b> &lt;<a href=3D"mailto:[email protected].=
ca">[email protected]</a>&gt; wrote:</span><blockquote class=3D"=
gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0p=
t 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Seb,<br><br>This is just a guess, but maybe it is because the object ins=
tance for an<br>INVOKESTATIC is not on the heap but in class loader memory.=
<br><br>Chris<br><br>On Sun, April 16, 2006 10:41 am, S=E9bastien Adam wrot=
e:
<br>&gt; ... maybe should I add that enter_object_monitor is called in the<=
br>&gt; instruction SVM_INSTRUCTION_INVOKESTATIC in instructions_switch.c..=
.<br>&gt;<br>&gt; /* preserve references on the stack across GC */<br>&gt; =
frame-&gt;stack_size =3D stack_size + args_count;
<br>&gt;<br>&gt; if (_svmf_enter_object_monitor (env, instance) !=3D JNI_OK=
) {<br>&gt; goto exception_handler; }<br>&gt;<br>&gt;<br>&gt; ...<br>&gt; _=
______________________________________________<br>&gt; SableVM-devel mailin=
g list
<br>&gt; <a href=3D"mailto:[email protected]">SableVM-devel@sablevm=
.org</a><br>&gt; <a href=3D"http://sablevm.org/lists/control/listinfo/sable=
vm-devel">http://sablevm.org/lists/control/listinfo/sablevm-devel</a><br>&g=
t;
<br>&gt;<br><br><br><br>_______________________________________________<br>=
SableVM-devel mailing list<br><a href=3D"mailto:[email protected]">=
[email protected]</a><br><a href=3D"http://sablevm.org/lists/contro=
l/listinfo/sablevm-devel">
http://sablevm.org/lists/control/listinfo/sablevm-devel</a><br></blockquote=
></div><br>

------=_Part_7002_22069587.1145226274139--


--===============0803409260==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
SableVM-devel mailing list
[email protected]
http://sablevm.org/lists/control/listinfo/sablevm-devel

--===============0803409260==--