[Vm-dev] Alien initialization
Eliot Miranda
eliot.miranda at gmail.com
Fri Feb 23 22:36:54 UTC 2018
Hi Tobias,
done. I've made it match Alien class>>ensureInSpecialObjectsArray and
so it only looks in VMObjectIndices. But this should be OK right?
On Fri, Feb 23, 2018 at 11:45 AM, Tobias Pape <Das.Linux at gmx.de> wrote:
>
> Hi,
>
> can someone with commit rights on Alien please change the following method?
>
>
> UnsafeAlien class>>ensureInSpecialObjectsArray
> "UnsafeAlien must be in the specialObjectsArray to enable the
> Newsqueak FFI.
> Because of the bootstrap the specialObjectsArray may already have
> been
> partially initialized with the callback selector and to be large
> enough (as part of
> loading immutability), but it will be missing UnsafeAlien until
> UnsafeAlien is loaded.
> So check if the specialObjectsArray is of the expected size
> before recreating
> and slam UnsafeAlien in if the specialObjectsArray is already
> large enough."
>
> | index |
> self ~~ UnsafeAlien ifTrue: [^self].
>
> index := 55.
> (((Smalltalk includesKey: #VMObjectIndices)
> and: [((Smalltalk at: #VMObjectIndices) classPool at:
> #ClassUnsafeAlien ifAbsent: []) == (index - 1)])
> or: [
> ((Smalltalk includesKey: #ObjectMemory)
> and: [((Smalltalk at: #ObjectMemory) classPool at:
> #ClassUnsafeAlien ifAbsent: []) == (index - 1)])])
> ifFalse:
> [self error: 'index probably wrong'].
>
> Smalltalk specialObjectsArray size < index ifTrue:
> [Smalltalk recreateSpecialObjectsArray].
>
> (Smalltalk specialObjectsArray size < index
> or: [(Smalltalk specialObjectsArray at: index) ~~ nil
> and: [(Smalltalk specialObjectsArray at: index) ~~ self]])
> ifTrue:
> [self error: 'SystemDictionary>>recreateSpecialObjectsArray
> appears incompatible'].
>
> (Smalltalk specialObjectsArray at: index) == nil ifTrue:
> [Smalltalk specialObjectsArray at: index put: self]
>
>
> This is necessary as in the current spur architecture the #Class.... class
> variables are no longer in ObjectMemory but in a Shared Pool.
>
> Hence, it breaks on loading.
>
>
> Best regards
> -Tobias
--
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180223/4a91cfca/attachment.html>
More information about the Vm-dev
mailing list