[Vm-dev] Problem changing primitiveBitOr or primitiveBitAnd
Mariano Martinez Peck
marianopeck at gmail.com
Thu Oct 7 08:25:08 UTC 2010
On Thu, Oct 7, 2010 at 9:55 AM, Andreas Raab <andreas.raab at gmx.de> wrote:
>
> You *really* need to learn how to use the simulator
Is it working? I've been told it is not working at all and that it should
take me time to fix it.
> (and read the code in the VM).
I am reading the code in the VM as much as possible.
> Asking people here to debug your code is an extremely slow way to do it.
>
> That said, replacing popStack with stackValue is NOT EQUIVALENT. Thus your
> transformation of popStack -> stackValue is entirely incorrect. Where you
> previously had:
>
> 1) popStack
> 2) popStack
> 3) test and...
> 3a) return result
> 3b) unpop 2
>
> with stackValue you need to use
>
> 1) stackValue: 0.
> 2) stackValue: 1.
> 3) test and ...
> 3a) pop 2 and return result
> 3b) =do nothing=
>
> I.e., stackValue does NOT POP but rather indexes into the stack.
>
Ok, I understand that. But before doing that, I just replced
integerArgument := self popPos32BitInteger.
integerReceiver := self popPos32BitInteger.
by
arg := self popStack.
integerArgument := self positive32BitValueOf: arg.
rcvr := self popStack.
integerReceiver := self positive32BitValueOf: rcvr.
So....I JUST copy the code of #popPos32BitInteger and put it there.....I
didn't change anything else, and I have the same problem.
At the end:
primitiveBitOr
| integerReceiver integerArgument arg rcvr |
arg := self popStack.
integerArgument := self positive32BitValueOf: arg.
rcvr := self popStack.
integerReceiver := self positive32BitValueOf: rcvr.
successFlag
ifTrue: [
self push: (self positive32BitIntegerFor:
(integerReceiver bitOr: integerArgument))]
ifFalse: [self unPop: 2]
is has CPU100 and
primitiveBitOr
| integerReceiver integerArgument |
integerArgument := self popPos32BitInteger.
integerReceiver := self popPos32BitInteger.
successFlag
ifTrue: [self push: (self positive32BitIntegerFor:
(integerReceiver bitOr: integerArgument))]
ifFalse: [self unPop: 2]
works perfect.
And I am not using stackValue.
Anyway, thanks for the explanation about both differences.
Cheers
Mariano
>
> Cheers,
> - Andreas
>
>
> On 10/7/2010 12:39 AM, Mariano Martinez Peck wrote:
>
>>
>>
>>
>>
>> Hi, I want to change #primitiveBitOr or #primitiveBitAnd and in both
>> cases, I compile the VM, I run an image, and the image cannot even start
>> and CPU 100% :(
>> I have a loop somewhere.
>>
>> This is the current implementation of #primitiveBitOr for example:
>>
>> primitiveBitOr
>> | integerReceiver integerArgument |
>> integerArgument := self popPos32BitInteger.
>> integerReceiver := self popPos32BitInteger.
>> successFlag
>> ifTrue: [self push: (self positive32BitIntegerFor:
>> (integerReceiver bitOr: integerArgument))]
>> ifFalse: [self unPop: 2]
>>
>>
>> I NEED to have the receiver oop and the argument oop. So, I've change it
>> to:
>>
>> primitiveBitOr
>> | integerReceiver integerArgument arg rcvr |
>> arg := self popStack.
>> integerArgument := self positive32BitValueOf: arg.
>> rcvr := self popStack.
>> integerReceiver := self positive32BitValueOf: rcvr.
>>
>> successFlag
>> ifTrue: [
>> self push: (self positive32BitIntegerFor:
>> (integerReceiver bitOr: integerArgument))]
>> ifFalse: [self unPop: 2]
>>
>>
>> And then to:
>>
>> primitiveBitOr
>> | integerReceiver integerArgument arg rcvr |
>> arg := self stackValue: 0.
>> integerArgument := self positive32BitValueOf: arg.
>> rcvr := self stackValue: 1.
>> integerReceiver := self positive32BitValueOf: rcvr.
>>
>> successFlag
>> ifTrue: [
>> self push: (self positive32BitIntegerFor:
>> (integerReceiver bitOr: integerArgument))]
>> ifFalse: [self unPop: 2]
>>
>> But in both cases, while trying to start an image, I have cpu 100%
>> Of course, the same happens if I do this in #primitiveBitAnd
>>
>> Any ideas what can be happening? because I tried to understand but
>> nothing :(
>>
>> Thanks in advance
>>
>> Mariano
>>
>>
>>
>>
>>
>>
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20101007/916ccf70/attachment.htm
More information about the Vm-dev
mailing list