Pharocore 1.1: Array DNU createMethod: header

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

Pharocore 1.1: Array DNU createMethod: header

Alain Plantec-4
in

CompiledMethod>>
newBytes: numberOfBytes trailerBytes: trailer nArgs: nArgs nTemps:
nTemps nStack: stackSize nLits: nLits primitive: primitiveIndex
    "Answer an instance of me. The header is specified by the message
    arguments. The remaining parts are not as yet determined."
    | largeBit primBits |
    nTemps > 63 ifTrue:
        [^ self error: 'Cannot compile -- too many temporary
variables'].  
    nLits > 255 ifTrue:
        [^ self error: 'Cannot compile -- too many literals variables'].  
    largeBit := (nTemps + stackSize) > SmallFrame ifTrue: [1] ifFalse: [0].
    primBits := primitiveIndex <= 16r1FF
        ifTrue: [primitiveIndex]
        ifFalse: ["For now the high bit of primitive no. is in the 29th
bit of header"
                primitiveIndex > 16r3FF ifTrue: [self error: 'prim num
too large'].
                (primitiveIndex bitAnd: 16r1FF) + ((primitiveIndex
bitAnd: 16r200) bitShift: 19)].

    ^ trailer createMethod: numberOfBytes
         header: (nArgs bitShift: 24) +
                (nTemps bitShift: 18) +
                (largeBit bitShift: 17) +
                (nLits bitShift: 9) +
                primBits.

Alain


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharocore 1.1: Array DNU createMethod: header

Stéphane Ducasse
alain

this is strange.
normally the trailer should not be an array.
how do you get this error.

is here the method igor introduced for his transformation and remove at the end.


ArrayedCollection>>createMethod: numberOfBytesForAllButTrailer header: headerWord
        | meth |
        meth := CompiledMethod newMethod: numberOfBytesForAllButTrailer + self size header: headerWord.
        "copy the encoded trailer data"
        1 to: self size do:
                [:i | meth at: meth size - self size + i put: (self at: i)].

        ^ meth! !





On Jan 11, 2010, at 5:53 PM, Alain Plantec wrote:

> in
>
> CompiledMethod>>
> newBytes: numberOfBytes trailerBytes: trailer nArgs: nArgs nTemps:
> nTemps nStack: stackSize nLits: nLits primitive: primitiveIndex
>    "Answer an instance of me. The header is specified by the message
>    arguments. The remaining parts are not as yet determined."
>    | largeBit primBits |
>    nTemps > 63 ifTrue:
>        [^ self error: 'Cannot compile -- too many temporary
> variables'].  
>    nLits > 255 ifTrue:
>        [^ self error: 'Cannot compile -- too many literals variables'].  
>    largeBit := (nTemps + stackSize) > SmallFrame ifTrue: [1] ifFalse: [0].
>    primBits := primitiveIndex <= 16r1FF
>        ifTrue: [primitiveIndex]
>        ifFalse: ["For now the high bit of primitive no. is in the 29th
> bit of header"
>                primitiveIndex > 16r3FF ifTrue: [self error: 'prim num
> too large'].
>                (primitiveIndex bitAnd: 16r1FF) + ((primitiveIndex
> bitAnd: 16r200) bitShift: 19)].
>
>    ^ trailer createMethod: numberOfBytes
>         header: (nArgs bitShift: 24) +
>                (nTemps bitShift: 18) +
>                (largeBit bitShift: 17) +
>                (nLits bitShift: 9) +
>                primBits.
>
> Alain
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharocore 1.1: Array DNU createMethod: header

Alain Plantec-4
ok, I've checked again, it comes from an old
package of mine that I'm trying to resurrect :)
sorry.
Alain


Stéphane Ducasse a écrit :

> alain
>
> this is strange.
> normally the trailer should not be an array.
> how do you get this error.
>
> is here the method igor introduced for his transformation and remove at the end.
>
>
> ArrayedCollection>>createMethod: numberOfBytesForAllButTrailer header: headerWord
> | meth |
> meth := CompiledMethod newMethod: numberOfBytesForAllButTrailer + self size header: headerWord.
> "copy the encoded trailer data"
> 1 to: self size do:
> [:i | meth at: meth size - self size + i put: (self at: i)].
>
> ^ meth! !
>
>
>
>
>
> On Jan 11, 2010, at 5:53 PM, Alain Plantec wrote:
>
>  
>> in
>>
>> CompiledMethod>>
>> newBytes: numberOfBytes trailerBytes: trailer nArgs: nArgs nTemps:
>> nTemps nStack: stackSize nLits: nLits primitive: primitiveIndex
>>    "Answer an instance of me. The header is specified by the message
>>    arguments. The remaining parts are not as yet determined."
>>    | largeBit primBits |
>>    nTemps > 63 ifTrue:
>>        [^ self error: 'Cannot compile -- too many temporary
>> variables'].  
>>    nLits > 255 ifTrue:
>>        [^ self error: 'Cannot compile -- too many literals variables'].  
>>    largeBit := (nTemps + stackSize) > SmallFrame ifTrue: [1] ifFalse: [0].
>>    primBits := primitiveIndex <= 16r1FF
>>        ifTrue: [primitiveIndex]
>>        ifFalse: ["For now the high bit of primitive no. is in the 29th
>> bit of header"
>>                primitiveIndex > 16r3FF ifTrue: [self error: 'prim num
>> too large'].
>>                (primitiveIndex bitAnd: 16r1FF) + ((primitiveIndex
>> bitAnd: 16r200) bitShift: 19)].
>>
>>    ^ trailer createMethod: numberOfBytes
>>         header: (nArgs bitShift: 24) +
>>                (nTemps bitShift: 18) +
>>                (largeBit bitShift: 17) +
>>                (nLits bitShift: 9) +
>>                primBits.
>>
>> Alain
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>    
>
>
>  


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharocore 1.1: Array DNU createMethod: header

Stéphane Ducasse
ok

On Jan 11, 2010, at 7:39 PM, Alain Plantec wrote:

> ok, I've checked again, it comes from an old
> package of mine that I'm trying to resurrect :)
> sorry.
> Alain
>
>
> Stéphane Ducasse a écrit :
>> alain
>>
>> this is strange.
>> normally the trailer should not be an array.
>> how do you get this error.
>>
>> is here the method igor introduced for his transformation and remove at the end.
>>
>>
>> ArrayedCollection>>createMethod: numberOfBytesForAllButTrailer header: headerWord
>> | meth |
>> meth := CompiledMethod newMethod: numberOfBytesForAllButTrailer + self size header: headerWord.
>> "copy the encoded trailer data"
>> 1 to: self size do:
>> [:i | meth at: meth size - self size + i put: (self at: i)].
>>
>> ^ meth! !
>>
>>
>>
>>
>>
>> On Jan 11, 2010, at 5:53 PM, Alain Plantec wrote:
>>
>>
>>> in
>>>
>>> CompiledMethod>>
>>> newBytes: numberOfBytes trailerBytes: trailer nArgs: nArgs nTemps:
>>> nTemps nStack: stackSize nLits: nLits primitive: primitiveIndex
>>>   "Answer an instance of me. The header is specified by the message
>>>   arguments. The remaining parts are not as yet determined."
>>>   | largeBit primBits |
>>>   nTemps > 63 ifTrue:
>>>       [^ self error: 'Cannot compile -- too many temporary
>>> variables'].  
>>>   nLits > 255 ifTrue:
>>>       [^ self error: 'Cannot compile -- too many literals variables'].  
>>>   largeBit := (nTemps + stackSize) > SmallFrame ifTrue: [1] ifFalse: [0].
>>>   primBits := primitiveIndex <= 16r1FF
>>>       ifTrue: [primitiveIndex]
>>>       ifFalse: ["For now the high bit of primitive no. is in the 29th
>>> bit of header"
>>>               primitiveIndex > 16r3FF ifTrue: [self error: 'prim num
>>> too large'].
>>>               (primitiveIndex bitAnd: 16r1FF) + ((primitiveIndex
>>> bitAnd: 16r200) bitShift: 19)].
>>>
>>>   ^ trailer createMethod: numberOfBytes
>>>        header: (nArgs bitShift: 24) +
>>>               (nTemps bitShift: 18) +
>>>               (largeBit bitShift: 17) +
>>>               (nLits bitShift: 9) +
>>>               primBits.
>>>
>>> Alain
>>>
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>
>>
>>
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project