segmentation fault in SableVM...

"Sébastien Adam" <[email protected]> Thu, 30 Mar 2006 09:18:16 -0500
Newsgroups gmane.comp.java.vm.sablevm.devel
Message-ID <[email protected]>
--===============0481737893==
Content-Type: multipart/alternative; 
	boundary="----=_Part_4430_10060292.1143728296724"

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

Hi,

I am working on a new gc in SableVM. When I ran a program with my new gc, I
got the following segmentation fault:

_#0  0xb7f25a6d in _svmf_interpreter (_env=3D0x804dcf0) at
instructions_switch.c:8778
/home/sadam/svm-gc/src/libsablevm/instructions_switch.c:8778:169341:beg:0xb=
7f25a6d

This segmentation fault happens in the following code:

...
#ifdef _SABLEVM_SIGNALS_FOR_EXCEPTIONS

#ifndef NDEBUG

      if (instance =3D=3D NULL)
        {
          env->sigsegv_expected =3D JNI_TRUE;
        }

#endif /* NOT NDEBUG */

      /* save pc in case exception is raised */
      env->stack.current_frame->pc =3D pc;

#else

      if (instance =3D=3D NULL)
        {
          env->stack.current_frame->pc =3D pc;
          _svmm_goto_label (nullpointerexception_handler);
        }

#endif /* _SABLEVM_SIGNALS_FOR_EXCEPTIONS */


      /* the following can cause a segfault */
      method =3D
        *((_svmt_method_info **) (void *)
          (((char *) instance->vtable) + method_offset));

In this file, the comment specify that a segfault can happen.

Can somebody help me to find where I must search for the problem?

Here is the program I used to test my gc. If I remove the print statements,
I get the segfault.  Otherwise, everything works perfectly. Why???? I have
no answer for now...

public class C1 {
    public static void main(String[] args) {

    final int LG =3D 10000;
    final int DEL =3D 75000;

        String s;

        System.out.println("111111111");

        String ss[] =3D new String[LG];

        for (int i =3D 0; i < DEL; i++)
        {
        s =3D new String(i + " ");
        }

         System.out.println("2222222222");

        for (int i =3D 0; i < LG; i++)
        {
        ss[i] =3D new String(i + " ");
        }

            System.out.println("333333333");

        for (int i =3D 0; i < LG; i+=3D2)
        {
        ss[i] =3D new String(i + " ");
        }


            System.out.println("444444444");

        for (int i =3D 0; i < DEL; i++)
        {
        s =3D new String(i + " ");
        }

            System.out.println("5555555555");

        for (int i =3D 0; i < LG; i+=3D3)
        {
        ss[i] =3D new String(i + " ");
        }

        System.out.println("--------end--------");
    }
}

Thanks,
S=E9bastien

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

Hi,<br>
<br>
I am working on a new gc in SableVM. When I ran a program with my new gc, I=
 got the following segmentation fault:<br>
<br>
_#0&nbsp; 0xb7f25a6d in _svmf_interpreter (_env=3D0x804dcf0) at instruction=
s_switch.c:8778<br>
/home/sadam/svm-gc/src/libsablevm/instructions_switch.c:8778:169341:beg:0xb=
7f25a6d<br>
<br>
This segmentation fault happens in the following code:<br>
<font size=3D"1"><br>
...<br>
#ifdef _SABLEVM_SIGNALS_FOR_EXCEPTIONS<br>
<br>
#ifndef NDEBUG<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; if (instance =3D=3D NULL)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; env-&gt;sigsegv_expected =
=3D JNI_TRUE;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
<br>
#endif /* NOT NDEBUG */<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; /* save pc in case exception is raised */<br>
&nbsp;&nbsp;&nbsp; &nbsp; env-&gt;stack.current_frame-&gt;pc =3D pc;<br>
<br>
#else<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; if (instance =3D=3D NULL)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; env-&gt;stack.current_fra=
me-&gt;pc =3D pc;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _svmm_goto_label (nullpoi=
nterexception_handler);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
<br>
#endif /* _SABLEVM_SIGNALS_FOR_EXCEPTIONS */<br>
<br>
&nbsp;&nbsp;&nbsp; <span style=3D"font-weight: bold;">&nbsp; </span><br sty=
le=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp; &nbsp; /* the followi=
ng can cause a segfault */</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp; &nbsp; method =3D</sp=
an><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; *(=
(_svmt_method_info **) (void *)</span><br style=3D"font-weight: bold;">
<span style=3D"font-weight: bold;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp; (((char *) instance-&gt;vtable) + method_offset));<br>
</span><br>
<font size=3D"2">In this file, the comment specify that a segfault can happ=
en.<br>
<br>
Can somebody help me to find where I must search for the problem?<br>
<br>
Here is the program I used to test my gc. If I remove the print
statements, I get the segfault.&nbsp; Otherwise, everything works
perfectly. Why???? I have no answer for now...</font></font><font size=3D"2=
"><br>
<br>
</font><font size=3D"1">public class C1 {<br>
&nbsp;&nbsp;&nbsp; public static void main(String[] args) {<br>
<br>
&nbsp;&nbsp;&nbsp; final int LG =3D 10000;<br>
&nbsp;&nbsp;&nbsp; final int DEL =3D 75000;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String s;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;1111111=
11&quot;);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String ss[] =3D new String[LG];<=
br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i =3D 0; i &lt; DEL; i+=
+)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s =3D new String(i + &quot; &quot;);<=
br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;2=
222222222&quot;);<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i =3D 0; i &lt; LG; i++=
)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ss[i] =3D new String(i + &quot; &quot=
;);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.o=
ut.println(&quot;333333333&quot;);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i =3D 0; i &lt; LG; i+=
=3D2)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ss[i] =3D new String(i + &quot; &quot=
;);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.o=
ut.println(&quot;444444444&quot;);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i =3D 0; i &lt; DEL; i+=
+)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s =3D new String(i + &quot; &quot;);<=
br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.o=
ut.println(&quot;5555555555&quot;);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i =3D 0; i &lt; LG; i+=
=3D3)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ss[i] =3D new String(i + &quot; &quot=
;);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(&quot;-------=
-end--------&quot;);<br>
&nbsp;&nbsp;&nbsp; }<br>
}<br>
<font size=3D"2"><br>
Thanks,<br>
S=E9bastien</font><br>
<span style=3D"font-weight: bold;"></span></font>

------=_Part_4430_10060292.1143728296724--


--===============0481737893==
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

--===============0481737893==--