[ENH][VM] Allow the allocation of objects without initialization.
John M McIntosh
johnmci at mac.com
Wed Jul 9 07:32:47 UTC 2003
Rearranged ObjectMemory>>instantiateClass:indexableSize: and
ObjectMemory>>instantiateSmallClass:sizeInBytes: to enable you to
specify fill or nofill
IE added
ObjectMemory>>instantiateClassNoFill:indexableSize:
Now it seems this has been done in the past, and this work is a bit
nasty dangerous because
leaving a pointer object around with un-initialized bits and then
invoking the GC logic will trash things.
So those that have done this in the past, should look and comment, in
case I missed something.
There are some questions, for example calling
Interpreter>>primitiveClipboardText
First we ask the OS support routines the size of the clipboard, then we
allocate the space, then
get the data. But what if the OS support routine does a callback and
causes a GC? Well in this case
our data is of Class String, so no issue, however if we are told there
are 100 bytes, but only get 90,
then 10 are junk, versus hex 00. {MMMM on second thought I think this
raises an issue because we are assuming
the object won't move during the call to the primitive to get the
clipboard data, so I think there is no exposure}
However paranoid thinking is required.
To consider are
primitiveNewMethod which allocates a pointer object, changed but I
think we are safe.
createActualMessageTo I did not change because of GC issues.
all others allocate data based objects, (please check) so exposure is
low.
I've not changed any of the plugins, one thing at a time, after
comments perhaps, perhaps never
But perhaps the largeinteger plugin should be looked at
--
========================================================================
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
========================================================================
===
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AllocateNoFill-JMM.1.cs.gz
Type: application/x-gzip
Size: 4704 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030709/45da3d38/AllocateNoFill-JMM.1.cs.bin
More information about the Squeak-dev
mailing list
|