[Cuis] Optimizing away unused literals

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

[Cuis] Optimizing away unused literals

keith1y
In using Cuis, I discover that unused literals in a method, otherwise  
known as "poor-mans pragmas" are optimized away in compiledMethod.  
Does anyone know when this happened? (or was I using some other method  
to find them)

Keith

Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] Optimizing away unused literals

Juan Vuletich-4
keith wrote:
> In using Cuis, I discover that unused literals in a method, otherwise
> known as "poor-mans pragmas" are optimized away in compiledMethod.
> Does anyone know when this happened? (or was I using some other method
> to find them)
>
> Keith

Well, the same also happens in Squeak, Pharo and Cuis 1.0
(pre-closures). I'd say it has always been like this. See #flag: . It is
dated 4/28/2000, and serves your purpose.

Cheers,
Juan Vuletich

Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] Optimizing away unused literals

keith1y

On 13 Feb 2010, at 21:11, Juan Vuletich wrote:

> keith wrote:
>> In using Cuis, I discover that unused literals in a method,  
>> otherwise known as "poor-mans pragmas" are optimized away in  
>> compiledMethod. Does anyone know when this happened? (or was I  
>> using some other method to find them)
>>
>> Keith
>
> Well, the same also happens in Squeak, Pharo and Cuis 1.0 (pre-
> closures). I'd say it has always been like this. See #flag: . It is  
> dated 4/28/2000, and serves your purpose.
>
> Cheers,
> Juan Vuletich

It didn't happen in squeak 3.9

Keith


Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] Optimizing away unused literals

keith1y
In reply to this post by Juan Vuletich-4
 In using Cuis, I discover that unused literals in a method, otherwise known as "poor-mans pragmas" are optimized away in compiledMethod. Does anyone know when this happened? (or was I using some other method to find them)

Keith

Well, the same also happens in Squeak, Pharo and Cuis 1.0 (pre-closures). I'd say it has always been like this. See #flag: . It is dated 4/28/2000, and serves your purpose.

Cheers,
Juan Vuletich

So flag: it is!

In the process of making things more modular, with less dependencies I am removing the manual registration of selectors in #presumedSentMessages using the following conventions. #methodsToKeep and:

self flag: #presumeSentSelector.

cheers

Keith





Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] Optimizing away unused literals

Juan Vuletich-4
In reply to this post by keith1y
keith wrote:

>
> On 13 Feb 2010, at 21:11, Juan Vuletich wrote:
>
>> keith wrote:
>>> In using Cuis, I discover that unused literals in a method,
>>> otherwise known as "poor-mans pragmas" are optimized away in
>>> compiledMethod. Does anyone know when this happened? (or was I using
>>> some other method to find them)
>>>
>>> Keith
>>
>> Well, the same also happens in Squeak, Pharo and Cuis 1.0
>> (pre-closures). I'd say it has always been like this. See #flag: . It
>> is dated 4/28/2000, and serves your purpose.
>>
>> Cheers,
>> Juan Vuletich
>
> It didn't happen in squeak 3.9
>
> Keith
>
Yes it did. Just tried in Squeak3.9-final-7067.

Cheers,
Juan Vuletich

Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] Optimizing away unused literals

Juan Vuletich-4
In reply to this post by keith1y
keith wrote:

>>>  In using Cuis, I discover that unused literals in a method,
>>> otherwise known as "poor-mans pragmas" are optimized away in
>>> compiledMethod. Does anyone know when this happened? (or was I using
>>> some other method to find them)
>>>
>>> Keith
>>
>> Well, the same also happens in Squeak, Pharo and Cuis 1.0
>> (pre-closures). I'd say it has always been like this. See #flag: . It
>> is dated 4/28/2000, and serves your purpose.
>>
>> Cheers,
>> Juan Vuletich
>
> So flag: it is!
>
> In the process of making things more modular, with less dependencies I
> am removing the manual registration of selectors in
> #presumedSentMessages using the following conventions. #methodsToKeep and:
>
> self flag: #presumeSentSelector.
>
> cheers
>
> Keith

Good idea!

Cheers,
Juan Vuletich

Reply | Threaded
Open this post in threaded view
|

[Cuis] Bug in StandardFileStream upTo:

keith1y
Juan,

I just found a bug in StandardFileStream upTo:  that seems to be recent.

Keith



Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] Optimizing away unused literals

keith1y
In reply to this post by Juan Vuletich-4

On 13 Feb 2010, at 22:04, Juan Vuletich wrote:

keith wrote:

On 13 Feb 2010, at 21:11, Juan Vuletich wrote:

keith wrote:
In using Cuis, I discover that unused literals in a method, otherwise known as "poor-mans pragmas" are optimized away in compiledMethod. Does anyone know when this happened? (or was I using some other method to find them)

Keith

Well, the same also happens in Squeak, Pharo and Cuis 1.0 (pre-closures). I'd say it has always been like this. See #flag: . It is dated 4/28/2000, and serves your purpose.

Cheers,
Juan Vuletich

It didn't happen in squeak 3.9

Keith

Yes it did. Just tried in Squeak3.9-final-7067.

That is puzzling, I used to search on unused literals as markers for tests.

Keith


Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] Bug in StandardFileStream upTo:

Juan Vuletich-4
In reply to this post by keith1y
keith wrote:
> Juan,
>
> I just found a bug in StandardFileStream upTo:  that seems to be recent.
>
> Keith
>
Could you post a script that shows the incorrect behavior? I test would
be even better.

Cheers,
Juan Vuletich

Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] Bug in StandardFileStream upTo:

keith1y

On 13 Feb 2010, at 23:13, Juan Vuletich wrote:

> keith wrote:
>> Juan,
>>
>> I just found a bug in StandardFileStream upTo:  that seems to be  
>> recent.
>>
>> Keith
>>
> Could you post a script that shows the incorrect behavior? I test  
> would be even better.
>
> Cheers,
> Juan Vuletich

Ok, it was not as obvious as I thought. peek messes things up.

(FileStream newFileNamed: 'test') nextPutAll: 'hello*world'; close.
(FileStream concreteStream readOnlyFileNamed: 'test')  position: 0;  
peek; upTo: $*.

peek appears to set readLimit, and then the following part of upTo: is  
invoked.

        collection ifNotNil: [
                (position < readLimit and: [
                        (count := collection indexOf: delim startingAt: position + 1) <=  
readLimit and: [
                                count > 0 ] ]) ifTrue: [
                                        ^collection copyFrom: position + 1 to: (position := position +  
count) ] ].

this gets it wrong, I think it should be something like,  to:  
(position := position + count -1) - 1

Keith




Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] Bug in StandardFileStream upTo:

Levente Uzonyi-2
On Sat, 13 Feb 2010, keith wrote:

>
> On 13 Feb 2010, at 23:13, Juan Vuletich wrote:
>
>> keith wrote:
>>> Juan,
>>>
>>> I just found a bug in StandardFileStream upTo:  that seems to be recent.
>>>
>>> Keith
>>>
>> Could you post a script that shows the incorrect behavior? I test would be
>> even better.
>>
>> Cheers,
>> Juan Vuletich
>
> Ok, it was not as obvious as I thought. peek messes things up.
>
> (FileStream newFileNamed: 'test') nextPutAll: 'hello*world'; close.
> (FileStream concreteStream readOnlyFileNamed: 'test')  position: 0; peek;
> upTo: $*.
>
> peek appears to set readLimit, and then the following part of upTo: is
> invoked.
>
> collection ifNotNil: [
> (position < readLimit and: [
> (count := collection indexOf: delim startingAt:
> position + 1) <= readLimit and: [
> count > 0 ] ]) ifTrue: [
> ^collection copyFrom: position + 1
> to: (position := position + count) ] ].
>
> this gets it wrong, I think it should be something like,  to: (position :=
> position + count -1) - 1

Seems like Cuis has an older version of the filestream buffering. This bug
was fixed later in the Trunk, here's the current version:

  collection ifNotNil: [
  (position < readLimit and: [
  (pos := collection indexOf: delim startingAt: position + 1) <= readLimit and: [
  pos > 0 ] ]) ifTrue: [
  ^collection copyFrom: position + 1 to: (position := pos) - 1 ] ].


Levente

>
> Keith
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] Bug in StandardFileStream upTo:

Juan Vuletich-4
In reply to this post by keith1y
keith wrote:

>
> On 13 Feb 2010, at 23:13, Juan Vuletich wrote:
>
>> keith wrote:
>>> Juan,
>>>
>>> I just found a bug in StandardFileStream upTo:  that seems to be
>>> recent.
>>>
>>> Keith
>>>
>> Could you post a script that shows the incorrect behavior? I test
>> would be even better.
>>
>> Cheers,
>> Juan Vuletich
>
> Ok, it was not as obvious as I thought. peek messes things up.
>
> (FileStream newFileNamed: 'test') nextPutAll: 'hello*world'; close.
> (FileStream concreteStream readOnlyFileNamed: 'test')  position: 0;
> peek; upTo: $*.
>
> peek appears to set readLimit, and then the following part of upTo: is
> invoked.
>
>     collection ifNotNil: [
>         (position < readLimit and: [
>             (count := collection indexOf: delim startingAt: position +
> 1) <= readLimit and: [
>                 count > 0 ] ]) ifTrue: [
>                     ^collection copyFrom: position + 1 to: (position
> := position + count) ] ].
>
> this gets it wrong, I think it should be something like,  to:
> (position := position + count -1) - 1
>
> Keith

Oh! Thanks for the report! I'll update the FileStream code to latest in
trunk ASAP.

Cheers,
Juan Vuletich

Reply | Threaded
Open this post in threaded view
|

Re: [Cuis] Bug in StandardFileStream upTo:

Juan Vuletich-4
In reply to this post by Levente Uzonyi-2
Levente Uzonyi wrote:

> On Sat, 13 Feb 2010, keith wrote:
>
>>
>> On 13 Feb 2010, at 23:13, Juan Vuletich wrote:
>>
>>> keith wrote:
>>>> Juan,
>>>>
>>>> I just found a bug in StandardFileStream upTo:  that seems to be
>>>> recent.
>>>>
>>>> Keith
>>>>
>>> Could you post a script that shows the incorrect behavior? I test
>>> would be even better.
>>>
>>> Cheers,
>>> Juan Vuletich
>>
>> Ok, it was not as obvious as I thought. peek messes things up.
>>
>> (FileStream newFileNamed: 'test') nextPutAll: 'hello*world'; close.
>> (FileStream concreteStream readOnlyFileNamed: 'test')  position: 0;
>> peek; upTo: $*.
>>
>> peek appears to set readLimit, and then the following part of upTo:
>> is invoked.
>>
>>     collection ifNotNil: [
>>         (position < readLimit and: [
>>             (count := collection indexOf: delim startingAt: position
>> + 1) <= readLimit and: [
>>                 count > 0 ] ]) ifTrue: [
>>                     ^collection copyFrom: position + 1 to: (position
>> := position + count) ] ].
>>
>> this gets it wrong, I think it should be something like,  to:
>> (position := position + count -1) - 1
>
> Seems like Cuis has an older version of the filestream buffering. This
> bug was fixed later in the Trunk, here's the current version:
>
>     collection ifNotNil: [
>         (position < readLimit and: [
>             (pos := collection indexOf: delim startingAt: position +
> 1) <= readLimit and: [
>                 pos > 0 ] ]) ifTrue: [
>                     ^collection copyFrom: position + 1 to: (position
> := pos) - 1 ] ].
>
>
> Levente
Thanks Levente. Comparing with trunk, I found this, and a few other
methods that I need to load in Cuis. Will have this ready soon.

Cheers,
Juan Vuletich