Re: [rvm-research] Insert call to a new entrypoint not working

"David P Grove" <[email protected]> Thu, 20 Sep 2018 10:51:09 -0400
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <OF2D519BD7.AB197850-ON8525830E.005132E6-8525830E.00519698@notes.na.collabserv.com>
--===============5908778708334089817==
Content-type: multipart/alternative; 	boundary="0__=0ABB099DDFC2B4768f9e8a93df938690918c0ABB099DDFC2B476"
Content-Disposition: inline


--0__=0ABB099DDFC2B4768f9e8a93df938690918c0ABB099DDFC2B476
Content-Transfer-Encoding: quoted-printable
Content-type: text/plain; charset=ISO-8859-1




Khaled Z Mahmoud <[email protected]> wrote on 09/19/2018 03:26:32 AM:
>
> Hi,
>
> I inserted an entry point to EntryPoints.java as below
>
> =A0public static final NormalMethod custom=5FyieldMethod =3D
> =A0=A0=A0=A0=A0 getMethod(org.jikesrvm.scheduler.RVMThread.class,
> "custom=5Fyield", "()V");
>
> Then, I inserted a call to this method from the BaselineCompiler compiler
>
> Offset yieldOffset;
> ForwardReference fr11 =3D asm.forwardJcc(EQ);
> Offset yieldOffset1 =3D Entrypoints.custom=5FyieldMethod.getOffset();
> asm.generateJTOCcall(yieldOffset1);
> fr11.resolve(asm);
>
> The above code was inserted at the beginning of the genThreadSwitchTest
> However, whenever I run Jikes,=A0 get an ugly run-time error as below:
>

This is a pretty delicate point to be calling out to a method.  The calling
conventions are optimized to assume that yieldpoints are infrequently
taken, so work gets pushed off to the callee method (in your case
custom=5Fyield).

It is essential that your new method have all the same annotations as
RVMThread.yieldpointFromPrologue and obey the same restrictions (for
example being Unpreemptible).

I'd probably debug by making very small changes from a working system and
testing each tiny step.  When things go wrong at this level of Jikes RVM
you almost always end up with a corrupted machine state and nasty low-level
dumps.

--dave

--0__=0ABB099DDFC2B4768f9e8a93df938690918c0ABB099DDFC2B476
Content-Transfer-Encoding: quoted-printable
Content-type: text/html; charset=ISO-8859-1
Content-Disposition: inline

<html><body><p><tt><font size=3D"2">Khaled Z Mahmoud &lt;kmahmou1@binghamto=
n.edu&gt; wrote on 09/19/2018 03:26:32 AM:</font></tt><br><tt><font size=3D=
"2">&gt; <br>&gt; Hi,</font></tt><br><tt><font size=3D"2">&gt; <br>&gt; I i=
nserted an entry point to EntryPoints.java as below</font></tt><br><tt><fon=
t size=3D"2">&gt; <br>&gt; =A0public static final NormalMethod custom=5Fyie=
ldMethod =3D<br>&gt; =A0=A0=A0=A0=A0 getMethod(org.jikesrvm.scheduler.RVMTh=
read.class, <br>&gt; &quot;custom=5Fyield&quot;, &quot;()V&quot;);</font></=
tt><br><tt><font size=3D"2">&gt; <br>&gt; Then, I inserted a call to this m=
ethod from the BaselineCompiler compiler</font></tt><br><tt><font size=3D"2=
">&gt; =A0 </font></tt><br><tt><font size=3D"2">&gt; Offset yieldOffset;<br=
>&gt; ForwardReference fr11 =3D asm.forwardJcc(EQ);<br>&gt; Offset yieldOff=
set1 =3D Entrypoints.custom=5FyieldMethod.getOffset();<br>&gt; asm.generate=
JTOCcall(yieldOffset1);<br>&gt; fr11.resolve(asm);</font></tt><br><tt><font=
 size=3D"2">&gt; <br>&gt; The above code was inserted at the beginning of t=
he genThreadSwitchTest</font></tt><br><tt><font size=3D"2">&gt; However, wh=
enever I run Jikes,=A0 get an ugly run-time error as below:</font></tt><br>=
<tt><font size=3D"2">&gt; <br></font></tt><br><tt><font size=3D"2">This is =
a pretty delicate point to be calling out to a method. &nbsp;The calling co=
nventions are optimized to assume that yieldpoints are infrequently taken, =
so work gets pushed off to the callee method (in your case custom=5Fyield).=
</font></tt><br><br><tt><font size=3D"2">It is essential that your new meth=
od have all the same annotations as RVMThread.yieldpointFromPrologue and ob=
ey the same restrictions (for example being Unpreemptible).</font></tt><br>=
<br><tt><font size=3D"2">I'd probably debug by making very small changes fr=
om a working system and testing each tiny step. &nbsp;When things go wrong =
at this level of Jikes RVM you almost always end up with a corrupted machin=
e state and nasty low-level dumps.</font></tt><br><br><tt><font size=3D"2">=
--dave</font></tt><br><BR>
</body></html>

--0__=0ABB099DDFC2B4768f9e8a93df938690918c0ABB099DDFC2B476--



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


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

_______________________________________________
Jikesrvm-researchers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers

--===============5908778708334089817==--