Author Topic: Khavi: Java on the Prizm  (Read 64454 times)

0 Members and 1 Guest are viewing this topic.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Java on the Prizm
« Reply #45 on: May 08, 2011, 08:59:40 am »
I've decided that a slight change of name is in order. The project is now officially the Khavi Virtual Machine Framework.

This name change is prompted by the fact that I have now added support for the instruction set of the Lua virtual machine. This will be included in the default release and will allow the framework to emulate both stack based and register based virtual machines.

So is Khavi a random name you invented?

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: Java on the Prizm
« Reply #46 on: May 08, 2011, 09:11:23 am »
I've decided that a slight change of name is in order. The project is now officially the Khavi Virtual Machine Framework.

This name change is prompted by the fact that I have now added support for the instruction set of the Lua virtual machine. This will be included in the default release and will allow the framework to emulate both stack based and register based virtual machines.

So is Khavi a random name you invented?
Khavi means coffee in some language (I don't know which one), and coffee = java

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Java on the Prizm
« Reply #47 on: May 09, 2011, 08:43:25 am »
Nice work here! The fact that it's going to support LUA is pretty sweet too! =)

Offline ZippyDee

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +83/-8
  • Why not zoidberg?
    • View Profile
Re: Java on the Prizm
« Reply #48 on: May 09, 2011, 08:48:49 am »
Khavi means coffee in some language (I don't know which one), and coffee = java
Finnish, I believe.
There's something about Tuesday...


Pushpins 'n' stuff...


Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Khavi: Java on the Prizm
« Reply #49 on: May 12, 2011, 04:17:06 pm »
Here's a quick description of how Khavi works, for anyone who'se interested:

When a program is opened from the shell, the shell recognizes the extension and passes it on to Khavi, along with some other information such as a pointer to the program. If Khavi hasn't been opened in a thread before, then it overwrites the Interrupt table to set up its thread manager, starts it, and passes control to what will become the primary thread. Back in the thread, Khavi looks up the proper parsing algorithm in a table and jumps to that algorithm. Each algorithm goes through the file header and extracts all of the useful information from it. Once that's completed, Khavi selects the proper interpreter to parse the bytecode with.

The interpreter for each type of bytecode is mostly custom and implements a complete instruction set for the virtual machine as well as the interpreter itself. The Khavi framework itself imposes no restrictions on each interpreter and they can do as they like. This allows each interpreter to be as powerful as the designer wants them to be. However, it also means a lot of redundant code with multiple languages written in. Therefore, Khavi also offers a small library of "threadcalls" to do common things like add float point numbers, write strings to the screen. It also provides programs with ways of doing things that would be extremely difficult to do within the confines of the instruction set itself, such as passing arguments to other threads.

Behind all of this lies the Thread manager (or context switcher, if you prefer). This component transparently handles the threading so that no individual thread is aware of the fact that it isn't always operating. Its other important task is to handle interactions between threads as well as manage their interaction with the rest of the system, both of which are done through the "threadcalls."

There's actually a lot more small stuff going on with cache management and the heap, but that's the simple explanation  :)
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Khavi: Java on the Prizm
« Reply #50 on: May 12, 2011, 04:28:11 pm »
So basically this allows multiple languages to use this? I am a bit confused because I though all this was was a java interpreter/virtual machine. ???

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Khavi: Java on the Prizm
« Reply #51 on: May 12, 2011, 04:31:55 pm »
It's a virtual machine for any instruction set that has been written for it. That's currently Java and Lua.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Khavi: Java on the Prizm
« Reply #52 on: May 12, 2011, 05:04:08 pm »
Ah ok I see now. I wonder how many languages it will support in the future...

Ashbad

  • Guest
Re: Khavi: Java on the Prizm
« Reply #53 on: May 12, 2011, 05:22:50 pm »
it could quite possibly support emerald, though most likely not as optimized because most instructions in the Emerald Opcode Language are controlled primarily by the VM (there's only even 1 math command that tells the VM to evaluate the expression and perform all lower-level math specified) -- most of the opcodes are even undo-able without support for Emerald Ideals.  Maybe we can collaborate for an emerald extension later on, but for now I don't think it would fare very well ;)

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Khavi: Java on the Prizm
« Reply #54 on: May 12, 2011, 05:31:21 pm »
Ashbad, it's precisely as optimized as you write the code to be ;)

Getting the instruction and looking up the address of that instruction handler takes less than 10 cycles. The inefficiencies in your C compiler outweigh that.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Ashbad

  • Guest
Re: Khavi: Java on the Prizm
« Reply #55 on: May 12, 2011, 05:37:31 pm »
GCC-based code can be pretty darn close to assembly code ;) if it weren't GCC or LLVM, I would be concerned -- but GCC is close enough, ~10 more cycles doesn't hurt anything ;)

Also, qwerty, I think your VM is a bit different than mine -- yours is more low-level in the sense it does the bare bones interpretation, whereas mine basically wraps the program around like a snake 5 coils around and acts as a whole surrogate OS in a sense.  Emerald is meant to be ran on a more suitable environment meant for emerald-only programming (of course any language that can compile to Emerald Bytecode is welcome, though) because the VM and the program react almost as two living creatures, as it implements my "Living VM" theory.

Offline z80man

  • Casio Traitor
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 977
  • Rating: +85/-3
    • View Profile
Re: Khavi: Java on the Prizm
« Reply #56 on: May 13, 2011, 02:26:49 am »
And I'd like to implement my 84+ emulator on Khavi too as that is technically a bytecode VM as well. I do have a question though. Is Khavi a standalone program or is it more like a framework to be used to make VM's? Sort of like libraries that you attach to a program except this library controls the program flow.

List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Khavi: Java on the Prizm
« Reply #57 on: May 13, 2011, 02:34:40 am »
It's kind of both, except I haven't added support for external libraries (not that it would be terribly difficult). Khavi is a standalone program except in that it needs certain arguments to be passed to it when it's booted. After that, it will be able to run independently of other programs. I will be releasing an official version supporting multiple languages to reduce the number of add-ins necessary. However, anyone who wants to will be able to use the Kavi framework with minor changes to the actual interpreter and only have to write the instruction set, so it's a framework in that sense.

BASIC, though, presents some special challenges to bytecode interpretation, since it's not pure bytecode. You'll need to tokenize the arguments and the expressions, which is where you're going to lose a lot of speed.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline z80man

  • Casio Traitor
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 977
  • Rating: +85/-3
    • View Profile
Re: Khavi: Java on the Prizm
« Reply #58 on: May 13, 2011, 02:39:51 am »
Would Khavi have a break button by any chance. That could be useful to break from buggy programs using the ON button.

List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Khavi: Java on the Prizm
« Reply #59 on: May 13, 2011, 02:40:54 am »
I could write it in, since the ON button normally isn't used anyway.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ