I HAVE DONE IT PEOPLE

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

I HAVE DONE IT PEOPLE

pawdwanlearner
Finally the VM Translator is complete and fully functional. Passing all tests. Now I can move on to chapter 9. This project by far has been the hardest and i have heard that the compiler is no picnic either, but I am going for it. Thanks Cadet, and everyone else in the forum I never would have made it without your help. I am sure i will have more questions later. Hope your game. Whoo Hoo SO STOKED !!!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: I HAVE DONE IT PEOPLE

cadet1620
Administrator
Congratulations on a job well done!

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

Re: I HAVE DONE IT PEOPLE

pawdwanlearner
One thing is left i may have to rewrite some of my implementations for the tanslator. I translated the os to run the square game on the cpu emulator and it came back with program too large. looks like square game with os translates to a file that is 617kb long. Any tips on how to squeeze it down.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: I HAVE DONE IT PEOPLE

cadet1620
Administrator
This is the main thread about optimizing VM translation.
  Generated code size
A few posts into that thread is a table of VM instruction counts in the OS. That table and the length of code your translator generates will show you what instructions you need to optimize first.

If your translator is typical, call is the top offender; its implementation is huge and there are lots of them. Return is also huge, but there are not many instances of it. Return is, however, really easy to optimize.

All return instructions translate into exactly the same ASM code. The first time you write that code, give it a label like ($$RETURN), and all the remaining return commands translate into 2 instructions:
  @$$RETURN
  0;JMP


This post shows how you can make an assembly language subroutine to handle the compare instructions.
  Translating eq to asm
This technique reduces the compare commands from a dozen or so instructions to four instructions.

You can use a similar technique to make an ASM subroutine to handle call instructions.
Use two of the temp registers (R13-15) and D register to pass the target function's address and number of parameters and return IP. This will reduce each call command to 12 instructions.


This is more work because it involves making your VM translator two-pass, but really cuts down on ASM size.
  Call tree analysis  (in "Generated code size" thread.)

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

Re: I HAVE DONE IT PEOPLE

pawdwanlearner
ok looks like i have more work to do. My hat goes off to the pioneers who made software back in the day. Theses are things we really dont have to worry too much bout these days much respect from this one.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: I HAVE DONE IT PEOPLE

cadet1620
Administrator
pawdwanlearner wrote
ok looks like i have more work to do.
I would recommend that you move on to chapter 9 and come back after chapter 12 to work on optimizing your VM translator.

Things that you learn in those chapters may give you more insights into optimization.

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

Re: I HAVE DONE IT PEOPLE

pawdwanlearner
Thanks mark i have already moved on. I have determined that i need to beef up my skills in object oriented programming to more fully understand classes and objects and all that stuff. When i was in school back man almost 13 years agoI learned c++ up to arrays and didn't go beyond that. I learned a lot writing the assembler and the translator, but i feel my lack of knowledge in these other areas is holding me back a little so. Im off to take  a coursera course in object oriented programming with python. Hopefully i haven't forgotten everything about hack when i return. Till then ill see you later.  
Loading...