Project 8 Sys.vm code

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Project 8 Sys.vm code

stansbuj
Sys.vm pushes 6 and 8 onto the stack, and then calls Class1.set to push those two onto static[0] and static[1]. Sys.vm then pushes 23 and 15 onto the stack and then calls Class2.set to push those two onto static[0] and static[1]. But doesn't that override what Class1.set pushed into those two static locations?

Jack
Reply | Threaded
Open this post in threaded view
|

Re: Project 8 Sys.vm code

ybakos
Yep, it does.
Reply | Threaded
Open this post in threaded view
|

Re: Project 8 Sys.vm code

stansbuj
Is that the intended behavior?

Jack
Reply | Threaded
Open this post in threaded view
|

Re: Project 8 Sys.vm code

cadet1620
Administrator
In reply to this post by stansbuj
stansbuj wrote
Sys.vm pushes 6 and 8 onto the stack, and then calls Class1.set to push those two onto static[0] and static[1]. Sys.vm then pushes 23 and 15 onto the stack and then calls Class2.set to push those two onto static[0] and static[1]. But doesn't that override what Class1.set pushed into those two static locations?

Jack
The point of this test is that static n in Class1 must use a different symbol name than static n in Class2 so that they don't get overwritten.

See figure 8.6, 3rd entry: "Xxx.j".

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: Project 8 Sys.vm code

TheKraken
So I've got four different symbols @Class1.0, @Class1.1, @Class2.0, and @Class2.1. However, when I call Class2.set 2, it replaces @Class1.1 with @Class2.0's value. This is very strange, and I can't figure out what is going on.

I think this is related: When the VM assigns memory locations, instead of [16],[17],[18],[19] like I would expect. It's assigning [16],[18],[18],[20]. with 0's in the [17] and [19] spots.
Reply | Threaded
Open this post in threaded view
|

Re: Project 8 Sys.vm code

ybakos
What does Class2.set do? (specifically)

Did you verify that you are indeed generating unique symbols for the static variables at the ASM level?
Reply | Threaded
Open this post in threaded view
|

Re: Project 8 Sys.vm code

TheKraken
Yea, I definitely did.

Class1.set pastebin
Class2.set pastebin

Pushing two new constants and then calling Class1.set than Class1.get again after call to Class2.set and get will set the correct register for @Class1.0 [16]=6, but then it sets @Class1.1 [18]=8 which overwrites @Class2.0.

I can't for the life of me figure out why they are overlapping or why they're using only even static registers.
Reply | Threaded
Open this post in threaded view
|

Re: Project 8 Sys.vm code

cadet1620
Administrator
The individual set functions look sane. Email me your StaticsTest.asm file and I'll take a look at it.

--Mark
 
Reply | Threaded
Open this post in threaded view
|

Re: Project 8 Sys.vm code

cadet1620
Administrator
This post was updated on .
[Deleted by author -- no longer apropos]
Reply | Threaded
Open this post in threaded view
|

Re: Project 8 Sys.vm code

TheKraken
Thanks, I'm extremely puzzled by this.

I sent it.