Project 11> Pong-Error :'this' segment must be in the heap range

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Project 11> Pong-Error :'this' segment must be in the heap range

kraftwerk1611
This post was updated on .
Hi,

My code of Project 11 passes all the test except Pong. When testing Pong, what I am seeing is that the program starts but as soon as the ball hits the top of the screen, I see the error at the bottom in VM emulator.

I wonder what is it that I could be doing wrong here.

Thanks.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Project 11> Pong

cadet1620
Administrator
The problem is with the 'this' argument that was passed as argument 0 in the call.

The function is
/** Sets the destination of the ball. */
method void setDestination(int destx, int desty) {
The call code should have pushed the Ball object, then destx, then desty. Look at the arguments the VM Emulator is showing: 4888 looks like a good address for an object and 551, 250 looks like a good screen coordinate.

It looks like your compiler pushed the object address as the last parameter instead of the first.

--Mark
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Project 11> Pong

kraftwerk1611
Thank you,

That indeed was the case. The issue being vm command written in wrong order.



Loading...