-
Notifications
You must be signed in to change notification settings - Fork 9
Home
Welcome to the Tagha Virtual Machine wiki! the Wiki is always being updated to account for iterative changes.
The purpose for Tagha's existence is to utilize C as an embeddable scripting language or, for better words, Tagha is an embeddable runtime environment meant to execute C code that's compiled to Tagha bytecode. Tagha was designed to be used as a viable alternative to a C plugin architecture via dynamically loaded dll's, especially with the advantage of being able to run C code without having to recompile the dll's for different operating systems and ABIs at the cost of native machine code performance.
You might be thinking, why not just pick a scripting language? You're correct. Any developer could simply choose a scripting language. If one wants a scripting language, one is free to embed it but not all developers want to use a scripting language and they could have various reasons like performance, syntax, maybe the runtime is too bloated. Secondly, not all developers might know the language or are comfortable with it.
The Rationale for Tagha is...
-
- give C (and by extension C++) binary portability.
-
- be fast.
-
- be open-source.
-
- have a runtime environment without having dependencies (beyond libc of course)
-
- be portable and embeddable for any program and platform.
-
- be small and minimal.
- C99 compliant C compiler.
- register-based virtual machine with 3 different addressing modes to tackle any kind of operation.
- 22 general purpose registers + 3 reserved-use (stack pointers and instruction pointer) registers.12
- self-contained.
- has its own implementation of libc specially for TaghaVM.
- floats and doubles are supported on the same floating point opcodes through addressing modes.
- uses computed goto dispatches (the ones that use a void*) which is 20%-25% faster than a switch {citation}.
- Tagha is "64-bit" as the registers and memory addresses are 64-bit. (may run slower on 32-bit systems/OSes)
- Embeddable into host applications.
- scripts can call host-defined functions (Native Interface).
- host can give arguments and call script functions and retrieve return values, thus you can set up function event handling to scripts.
- host can bind its own global variables to script-side global variables by name (the script-side global variable must be a pointer).
- integer and float arithmetic, (un)conditional jumps, comparison operations, and stack and memory manipulations.
- function call and return opcodes automatically execute function prologues and epilogues.
- VM is little-endian format architecture.
- very small. The tagha runtime environment static library is typically under 50kb in size.
- Tagha is not natively threaded, this is by design, this is so any developer can thread Tagha in anyway you wish whether by having a single VM instance run multiple scripts in a multi-threaded, managed way OR have an array of Tagha VM instances each running their own scripts in a threaded manner.
- Speed, tagha is very fast for a virtual machine that does not use a JIT.
- General rundown how a script gets made and then executed.
