<div dir="ltr">Relatedly, does this crash?<div><br></div><div><div>(parameterize ([current-input-port (open-input-string "#\\c")]) (read-eval-print-loop))</div></div><div><br></div><div style>Robby</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Sat, May 11, 2013 at 12:28 PM, Robby Findler <span dir="ltr"><<a href="mailto:robby@eecs.northwestern.edu" target="_blank">robby@eecs.northwestern.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Did you try to pull out and simplify read-eval-print-loop until you can get a stand-alone program that crashes? (The impl is in racket/private/misc.rkt.)<span class="HOEnZb"><font color="#888888"><div><br>Robby</div>
</font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra">
<br><br><div class="gmail_quote">On Sat, May 11, 2013 at 12:19 PM, Jon Zeppieri <span dir="ltr"><<a href="mailto:zeppieri@gmail.com" target="_blank">zeppieri@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I did:<br>
<br>
@@ -1555,9 +1570,9 @@ typedef void (*Scheme_Invoke_Proc)(Scheme_Env<br>
*env, intptr_t phase_shift,<br>
<br>
/* Exploit the fact that these should never be dereferenced: */<br>
#ifndef FIRST_TWO_BYTES_ARE_LEGAL_ADDRESSES<br>
-# define MZ_EVAL_WAITING_CONSTANT ((Scheme_Object *)0x2)<br>
-# define MZ_APPLY_WAITING_CONSTANT ((Scheme_Object *)0x4)<br>
-# define MZ_MULTIPLE_VALUES_CONSTANT ((Scheme_Object *)0x6)<br>
+# define MZ_EVAL_WAITING_CONSTANT ((Scheme_Object *)0x4)<br>
+# define MZ_APPLY_WAITING_CONSTANT ((Scheme_Object *)0x8)<br>
+# define MZ_MULTIPLE_VALUES_CONSTANT ((Scheme_Object *)0xc)<br>
#endif<br>
<div><div><br>
<br>
<br>
On Sat, May 11, 2013 at 1:16 PM, Matthew Flatt <<a href="mailto:mflatt@cs.utah.edu" target="_blank">mflatt@cs.utah.edu</a>> wrote:<br>
> Wild guess: Did you change the pseudo-values MZ_EVAL_WAITING_CONSTANT<br>
> and MZ_MULTIPLE_VALUES_CONSTANT to make sure they're not mistreated as<br>
> immediates --- or that a character is not mistreated as a pseduo-value?<br>
><br>
> At Sat, 11 May 2013 13:12:54 -0400, Jon Zeppieri wrote:<br>
>> These all work:<br>
>><br>
>> -> (write #\c)<br>
>> #\c<br>
>> -> (print #\c)<br>
>> #\c<br>
>> -> (display #\c)<br>
>> c<br>
>><br>
>> It really seems to be the case that only functions that return<br>
>> characters have problems, and then, only those that return to the repo<br>
>> loop. For instance:<br>
>><br>
>> -> (write (values #\c))<br>
>> #\c<br>
>> -> (values #\c)<br>
>> Segmentation fault: 11<br>
>><br>
>><br>
>> On Sat, May 11, 2013 at 11:29 AM, Matthew Flatt <<a href="mailto:mflatt@cs.utah.edu" target="_blank">mflatt@cs.utah.edu</a>> wrote:<br>
>> > The last example seems to be the only one that uses `write', while the<br>
>> > others implicitly use `print'.<br>
>> ><br>
>> > Does<br>
>> ><br>
>> > (write #\c)<br>
>> ><br>
>> > crash? How about<br>
>> ><br>
>> > (print #\c)<br>
>> ><br>
>> > ?<br>
>> ><br>
>> > At Fri, 10 May 2013 21:19:25 -0400, Jon Zeppieri wrote:<br>
>> >> My experiment with immediately represented characters has gotten to a<br>
>> >> state where a non-JIT build passes all tests, but a JIT build fails<br>
>> >> (as in, segfaults) on the following program:<br>
>> >><br>
>> >> #\c<br>
>> >><br>
>> >> It also fails on:<br>
>> >><br>
>> >> (integer->char 99)<br>
>> >><br>
>> >> and:<br>
>> >><br>
>> >> (define (foo x) (integer->char x))<br>
>> >> (foo 99)<br>
>> >><br>
>> >> but not on:<br>
>> >><br>
>> >> (define (foo x) (write (integer->char x)))<br>
>> >> (foo 99)<br>
>> >><br>
>> >> So there seems to be a problem returning a character from a jitted<br>
>> >> function back to the repl. I haven't been able to figure out where<br>
>> >> this occurs, though. gdb's stack traces don't seem very useful for<br>
>> >> jitted code, and I can't use Sam's disassembler, because the process<br>
>> >> dies.<br>
>> >><br>
>> >> Any idea where to look or what debugging tools might be useful?<br>
>> >><br>
>> >> -Jon<br>
>> >> _________________________<br>
>> >> Racket Developers list:<br>
>> >> <a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
_________________________<br>
Racket Developers list:<br>
<a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>