[Vm-dev] bug when instantiating ExternalData (to return void* from FFI)
eliot.miranda at gmail.com
Tue Aug 22 20:21:40 UTC 2017
On Tue, Aug 22, 2017 at 3:47 AM, Esteban Lorenzano <estebanlm at gmail.com>
> Hi Eliot, list
> I found a bug :)
> With latest VM (32 bits, using PharoVM flavour), I crash the VM when
> executing this:
> LGitError giterr_last.
> LGitError class>>giterr_last
> ^ self call: #(void *giterr_last()) options: #( )
> this is a very basic FFI call, and should answer an ExternalData instance
> (pointing to NULL, in this case).
> Digging into it, I found at a point (when instantiating the pointer) it
> answers nil instead an instantiated ExternalData, and this is because in
> otherwise clause is:
> otherwise: "non-indexable"
> [self cppIf: (PharoVM or: [true]) "Leave the old
> code but ignore it completely unless someone complains."
> ["some Squeak images include funky
> fixed subclasses of abstract variable
> superclasses. e.g.
> DirectoryEntry as a subclass of ArrayedCollection.
> Allow fixed classes to be
> instantiated here iff nElements = 0."
> (nElements ~= 0 or: [instSpec >
> self lastPointerFormat]) ifTrue:
> numSlots := self
> fixedFieldsOfClassFormat: classFormat.
> fillValue := nilObj]].
> So it will always answer nil/NULL.
> Now, I don’t know why it was commented out, but since there it says
> "Leave the old code but ignore it completely unless someone complains.”, I
> complain :D
> Thing is… if I restore old code it works fine.
> Question is: should we restore that code? or this shows a deeper problem?
We can replace it with the ifFalse: branch. I will do so. I made this
change because Nicolai Hess wrote to the Pharo mailing list
I knew that Squeak relied on the behavior but not Pharo. So
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev