<div dir="ltr">Good work on making the optimization compatible.<div><br></div><div style>To make this patch independent of the compiler</div><div style>patches, may I suggest that you remove wait_file_reply/1</div><div style>
and rewrite file_request/2 like this:</div><div style><br></div><div style><div>file_request(Io, Request) -></div><div> Ref = erlang:monitor(process, Io),</div><div> Io ! {file_request,self(),Ref,Request},</div><div>
receive</div><div><span class="" style="white-space:pre"> </span>{file_reply,Ref,Reply} -></div><div><span class="" style="white-space:pre"> </span> erlang:demonitor(Ref, [flush]),</div><div><span class="" style="white-space:pre"> </span> Reply;</div>
<div><span class="" style="white-space:pre"> </span>{'DOWN', Ref, _, _, _} -></div><div><span class="" style="white-space:pre"> </span> {error, terminated}</div><div> end.</div><div><br></div></div></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 10, 2013 at 12:29 AM, Anthony Ramine <span dir="ltr"><<a href="mailto:n.oxyde@gmail.com" target="_blank">n.oxyde@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Björn,<br>
<br>
I found a way to make it backwards compatible with the old protocol right now.<br>
<br>
The file module communicates with a file io server with the following protocol for file operations:<br>
<br>
> {file_request,From,ReplyAs,Request}<br>
< {file_reply,ReplyAs,Reply}<br>
<br>
The ReplyAs value is sent by the client side to match against when receiving the reply and is otherwise left untouched and passed as is by the server.<br>
<br>
The amended commit changes the protocol to:<br>
<br>
> {file_request,From,MonitorRef,Request}<br>
< {file_reply,MonitorRef,Reply}<br>
<br>
As the shape of the messages is not changed, backwards compatibility is not a concern.<br>
<br>
Unfortunately, the following patch fails to compile because of a bug in the optimization pass. I've submitted two other patches; the first fixes beam_receive by teaching it how to track a set of registers instead of a single one, making it able to cope with the Core Erlang code generated by the inliner, the second improves sys_core_fold and makes it simplifies what is outputted by said inliner.<br>
<br>
Please refetch.<br>
<br>
Regards,<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Anthony Ramine<br>
<br>
Le 9 avr. 2013 à 12:12, Björn Gustavsson a écrit :<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> The patch looks fine and it would be a good thing to do.<br>
><br>
> Unfortunately, there is the pesky question of backward<br>
> compatibility.<br>
><br>
> Someone can open a file on an R15 system, send the<br>
> file descriptor (=a pid) to an R16B01 system with your<br>
> patch and the R16B01 system will attempt to do file<br>
> operations on the file.<br>
><br>
> The backward compatible way to do this is to first introduce<br>
> a file_io_server module that can handle both the new<br>
> and the old messages. Two releases later the file module<br>
> can be changed to use the new message format.<br>
><br>
> Strictly speaking, two releases forward means R19<br>
> to allow the original R16B release to communicate<br>
> with an R18 release.<br>
><br>
> /Bjorn<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Björn Gustavsson, Erlang/OTP, Ericsson AB
</div>