[Vm-dev] Proxies and primitives

Mariano Martinez Peck marianopeck at gmail.com
Tue Jan 17 10:52:40 UTC 2012


Hi guys. I am experimenting with something that creates proxies
automatically and become existing objects to those proxies. The objects I
become with proxies are selected kind of automatically and they can be
instances of any class. I have a list of classes that I don't become their
instances since it seems I can easily crash the VM (such as SmallIntegers,
Characters, Symbols, etc).  Now...with mi proxy implementation I can
intercept almost all messages, so I don't have a problem with that. What I
am thinking now is the problem of proxies that are passed as arguments to
primitives. My question is if there can be primitives that assumes the type
of the argument and do something directly. So if I send a proxy that
doesn't respect the expected shape...it can answer something wrong or even
crash. Another possibility is that the primitive fails normally
(primitiveFailure) but then that there is no smalltalk code after the
primitive invocation (I guess not all methods that use a primitive has the
correct smalltalk code after).
So.... Is this possible?  do you have an example?

Now the second question is which are mostly the types of arguments? as much
as I could see they are most of the times SmallInteger, Characters,
Symbols, etc., which I do not become anyway. Do you have a list of more
types that could bother me? for example what about Points, Bitmaps, Color,
Process, etc.?

I was thinking also that if I can tag proxies (say I can mark a bit in the
object header) then I could modify the place of the VM that dispatch
primitives and check that all arguments are proxies and otherwise do a
primitive failure... but again, I am not sure all smalltalk code after
primitives is correct..

Thanks in advance,

-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20120117/82f97cbd/attachment.htm


More information about the Vm-dev mailing list