<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<font face="Georgia">or just implement SmallInteger
class>>new:, etc, to signal an error without bothering the
primitive at all. <br>
<br>
</font>
<div class="moz-cite-prefix">On 12/16/13 8:59 PM, Eliot Miranda
wrote:<br>
</div>
<blockquote
cite="mid:CAC20JE1rQncGUKup2aMgMSX=aP=hSVyLVMN3w0z=7ZTso0W79Q@mail.gmail.com"
type="cite">
<pre wrap=""> </pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<div dir="ltr">Hi Nicolas,
<div><br>
</div>
<div> good catch. thanks.<br>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Mon, Dec 16, 2013 at 2:36 PM,
Nicolas Cellier <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:nicolas.cellier.aka.nice@gmail.com"
target="_blank">nicolas.cellier.aka.nice@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"> <br>
<div dir="ltr">
<div>(SmallInteger new: 0) can quickly lead to a VM
crash.<br>
</div>
<div>This should better be intercepted as a primitive
failure.<br>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>greed. But there are two obvious ways to go about
this (at least in Spur). One is to explicitly test for
the immediate classes in the new and new: primitives.
This is poor as it introduces additional tests on a
critical path. The other way is to give SmallInteger
and Character special formats and then the primitives
would fail without additional tests. The question is
what format to use. In Spur the formats are</div>
<div><br>
</div>
<div>
<div><span class="Apple-tab-span"
style="white-space:pre"> </span> 0 = 0 sized
objects (UndefinedObject True False et al)</div>
<div><span class="Apple-tab-span"
style="white-space:pre"> </span> 1 = non-indexable
objects with inst vars (Point et al)</div>
<div><span class="Apple-tab-span"
style="white-space:pre"> </span> 2 = indexable
objects with no inst vars (Array et al)</div>
<div><span class="Apple-tab-span"
style="white-space:pre"> </span> 3 = indexable
objects with inst vars (MethodContext
AdditionalMethodState et al)</div>
<div><span class="Apple-tab-span"
style="white-space:pre"> </span> 4 = weak indexable
objects with inst vars (WeakArray et al)</div>
<div><span class="Apple-tab-span"
style="white-space:pre"> </span> 5 = weak
non-indexable objects with inst vars (ephemerons)
(Ephemeron)</div>
<div><span class="Apple-tab-span"
style="white-space:pre"> </span> 6 unused, reserved
for exotic pointer objects?</div>
<div><span class="Apple-tab-span"
style="white-space:pre"> </span> 7 Forwarded
Object, 1st field is pointer, rest of fields are
ignored</div>
<div><span class="Apple-tab-span"
style="white-space:pre"> </span> 8 unused, reserved
for exotic non-pointer objects?</div>
<div><span class="Apple-tab-span"
style="white-space:pre"> </span> 9 (?) 64-bit
indexable</div>
<div>
<span class="Apple-tab-span" style="white-space:pre">
</span> 10 - 11 32-bit indexable<span
class="Apple-tab-span" style="white-space:pre"> </span>(11
unused in 32 bits)</div>
<div><span class="Apple-tab-span"
style="white-space:pre"> </span> 12 - 15 16-bit
indexable<span class="Apple-tab-span"
style="white-space:pre"> </span>(14 & 15 unused
in 32-bits)</div>
<div><span class="Apple-tab-span"
style="white-space:pre"> </span> 16 - 23 byte
indexable<span class="Apple-tab-span"
style="white-space:pre"> </span>(20-23 unused in
32-bits)</div>
<div><span class="Apple-tab-span"
style="white-space:pre"> </span> 24 - 31 compiled
method<span class="Apple-tab-span"
style="white-space:pre"> </span>(28-21 unused in
32-bits)</div>
</div>
<div><br>
</div>
<div>Format 7 should never be valid for an instance as it
is reserved by the VM for forwarders. So how about
making 7 the format for immediate classes? Ten it will
be easy to arrange that both new and new: will fail
naturally for this format.</div>
<div><br>
</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">I know that we cannot protect against all
and every mistake, but this one should be easy.<br>
<div>
<div><br>
See <a moz-do-not-send="true"
href="http://stackoverflow.com/questions/20621119/how-to-print-an-integer-to-transcript"
target="_blank">http://stackoverflow.com/questions/20621119/how-to-print-an-integer-to-transcript</a><br>
<br>
</div>
<div>I'm thinking of Spur where Character are
immediate and where archeo-code could lead to same
kind of crash.</div>
</div>
</div>
</blockquote>
</div>
<div><br>
</div>
-- <br>
best,
<div>Eliot</div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>