Re: Pinning Objects in Pharo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Pinning Objects in Pharo

Eliot Miranda-2
 
Hi Torsten, Hi Esteban,

> On Aug 28, 2017, at 9:17 AM, Torsten Bergmann <[hidden email]> wrote:
>
> As some of you are aware of Spur added memory pinning and in Pharo 6.1 (#60510) as well as Pharo 7
> we currently have
>
> Object>>pin
> Object>>unpin
> Object>>isPinned
>
> and also Object>>setPinned:.
>
> Object pinning is explained by Eliot here [1].
>
> I would propose two changes (at least for Pharo but ideally also for Squeak):
>
> 1. IMHO #setPinned: should be moved to a private protocol
> 2. Provide a #pinDuring: aBlock method like:
>
>      pinDuring: aBlock
>          [ self pin.
>            aBlock value ] ensure: [ self unpin ]
>
>    so we can ensure that a pinned object is unpinned after an operation.
>
> What do you think?
>
> Also I wonder why FFICallbackTests>>#testCqsortWithByteArray is sending #pin but not
> #unpin afterwards. Maybe that is the reason why there is a flag in this method that it
> is crashing on Windows.

This test is news to me.  Neither the test nor the class is in FFI-Tests at source.squeak.org, which is where the package lives.  Why is it missing?

>
> Bye
> T.
>
> [1] http://lists.squeakfoundation.org/pipermail/squeak-dev/2017-August/195129.html
Reply | Threaded
Open this post in threaded view
|

Re: Pinning Objects in Pharo

Torsten Bergmann
 
Hi Eliot,

this test is part of UnifiedFFI (which is Pharo only so far) - not FFI. This was just
a side note.

I would rather be interested if we would like to have a common #pinDuring:
in Squeak, Pharo, Cuis, ...

Thanks
Torsten


> Gesendet: Montag, 28. August 2017 um 22:08 Uhr
> Von: "Eliot Miranda" <[hidden email]>
> An: "Torsten Bergmann" <[hidden email]>, "Esteban Lorenzano" <[hidden email]>
> Cc: "Pharo Development List" <[hidden email]>, [hidden email]
> Betreff: Re: Pinning Objects in Pharo
>
> Hi Torsten, Hi Esteban,
>
> > On Aug 28, 2017, at 9:17 AM, Torsten Bergmann <[hidden email]> wrote:
> >
> > As some of you are aware of Spur added memory pinning and in Pharo 6.1 (#60510) as well as Pharo 7
> > we currently have
> >
> > Object>>pin
> > Object>>unpin
> > Object>>isPinned
> >
> > and also Object>>setPinned:.
> >
> > Object pinning is explained by Eliot here [1].
> >
> > I would propose two changes (at least for Pharo but ideally also for Squeak):
> >
> > 1. IMHO #setPinned: should be moved to a private protocol
> > 2. Provide a #pinDuring: aBlock method like:
> >
> >      pinDuring: aBlock
> >          [ self pin.
> >            aBlock value ] ensure: [ self unpin ]
> >
> >    so we can ensure that a pinned object is unpinned after an operation.
> >
> > What do you think?
> >
> > Also I wonder why FFICallbackTests>>#testCqsortWithByteArray is sending #pin but not
> > #unpin afterwards. Maybe that is the reason why there is a flag in this method that it
> > is crashing on Windows.
>
> This test is news to me.  Neither the test nor the class is in FFI-Tests at source.squeak.org, which is where the package lives.  Why is it missing?
>
> >
> > Bye
> > T.
> >
> > [1] http://lists.squeakfoundation.org/pipermail/squeak-dev/2017-August/195129.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Pinning Objects in Pharo

EstebanLM
 

> On 29 Aug 2017, at 09:59, Torsten Bergmann <[hidden email]> wrote:
>
> Hi Eliot,
>
> this test is part of UnifiedFFI (which is Pharo only so far) - not FFI. This was just
> a side note.

yes, and it’s purpose is to test callbacks in the UFFI context, not callbacks itself :)

Esteban

>
> I would rather be interested if we would like to have a common #pinDuring:
> in Squeak, Pharo, Cuis, ...
>
> Thanks
> Torsten
>
>
>> Gesendet: Montag, 28. August 2017 um 22:08 Uhr
>> Von: "Eliot Miranda" <[hidden email]>
>> An: "Torsten Bergmann" <[hidden email]>, "Esteban Lorenzano" <[hidden email]>
>> Cc: "Pharo Development List" <[hidden email]>, [hidden email]
>> Betreff: Re: Pinning Objects in Pharo
>>
>> Hi Torsten, Hi Esteban,
>>
>>> On Aug 28, 2017, at 9:17 AM, Torsten Bergmann <[hidden email]> wrote:
>>>
>>> As some of you are aware of Spur added memory pinning and in Pharo 6.1 (#60510) as well as Pharo 7
>>> we currently have
>>>
>>> Object>>pin
>>> Object>>unpin
>>> Object>>isPinned
>>>
>>> and also Object>>setPinned:.
>>>
>>> Object pinning is explained by Eliot here [1].
>>>
>>> I would propose two changes (at least for Pharo but ideally also for Squeak):
>>>
>>> 1. IMHO #setPinned: should be moved to a private protocol
>>> 2. Provide a #pinDuring: aBlock method like:
>>>
>>>     pinDuring: aBlock
>>>         [ self pin.
>>>           aBlock value ] ensure: [ self unpin ]
>>>
>>>   so we can ensure that a pinned object is unpinned after an operation.
>>>
>>> What do you think?
>>>
>>> Also I wonder why FFICallbackTests>>#testCqsortWithByteArray is sending #pin but not
>>> #unpin afterwards. Maybe that is the reason why there is a flag in this method that it
>>> is crashing on Windows.
>>
>> This test is news to me.  Neither the test nor the class is in FFI-Tests at source.squeak.org, which is where the package lives.  Why is it missing?
>>
>>>
>>> Bye
>>> T.
>>>
>>> [1] http://lists.squeakfoundation.org/pipermail/squeak-dev/2017-August/195129.html
>>

Reply | Threaded
Open this post in threaded view
|

Re: Pinning Objects in Pharo

Juan Vuletich-3
In reply to this post by Torsten Bergmann
 
Hi Folks,

On 8/29/2017 4:59 AM, Torsten Bergmann wrote:
>
> Hi Eliot,
>
> this test is part of UnifiedFFI (which is Pharo only so far) - not FFI. This was just
> a side note.
>
> I would rather be interested if we would like to have a common #pinDuring:
> in Squeak, Pharo, Cuis, ...
>

I think it makes a lot of sense.

> Thanks
> Torsten

Thanks,

--
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
@JuanVuletich