6 ms·
Viua VM: parallel, register-based, bytecode virtual machine
- Vosporos 9y agoWho want to write the new Erlang on that VM? :-D
- maelkum 9y agoViua VM's developer here. That's sort of the point of the VM. Maybe not to become the new Erlang, but to become the new BEAM.
- chrisaycock 9y agoThe documentation describes a Viua program as a set of communicating processes. However, instead of using channels like in Go, the messages are sent directly to another process. I was hoping the "parallel" in the name would mean vector operations were builtin. I see instructions to create a vector, but I don't see anything to actually add or multiply vectors together, for example.
- maelkum 9y agoHi, Viua VM's developer here. Yeah, the naming of "vector" is unfortunate, I'll give you that. In Viua, a vector is simply a data structure with push, pop, insert, etc. operations - a collection of values. If I ever include vector instructions of the sort you expected then I'll base the design on what RISC-V did.
- kodablah 9y agoCan I get some background on who is behind this project and if there is an initial target/goal that led to its creation? Found a bit of detail at [0], now just curious its background and maybe even why the choice of licensing. 0 - https://github.com/marekjm/viuavm https://github.com/marekjm/viuavm
- maelkum 9y agoHi, Viua VM's developer here - I am behind this project. The initial target/goal for me was to create a programming language, but I found it hard to dig into GCC (didn't know about LLVM then), so I decided to create my own runtime VM. Thus, the VM was born. Why I chose GNU GPL v3? Simply because I am a strong proponent of Free Software (you may have also found that Viua has a page on GNU Savannah). A piece of trivia: why name it "Viua"? "Viua" is pronounced a bit like "wiła" in Polish. Wiła is a female daemon in Slavic mythology https://en.wikipedia.org/wiki/Supernatural_beings_in_Slavic_religion#Vila https://en.wikipedia.org/wiki/Supernatural_beings_in_Slavic_... If you have any other questions, just ask!
- chubot 9y agoDoes building a VM without a language make sense? I don't know of any successful instances of this approach. There are lot of hairy corner cases in languages, and VMs reflect that. If you build the VM first, those design decisions may not be obvious, or might come to light a lot later. I tried compiling Python code to the Lua VM and found that it is extremely coupled to Lua's semantics. That's even more the case with Python's VM. (for example scope rules, module systems, etc.) I mean, I think you can target one language to the VM for sure. If you manage to fit two languages, then you're essentially writing the same language in two different syntaxes.
- DonaldFisk 9y agoI've developed a few VMs and each was always tied to a specific language or one of its close relatives. The advantages of having a VM is that it's a lot easier to compile to than native code, you can run it on any hardware for which an interpreter has been written, and its object code is a lot smaller. The disadvantage is that the compiled code runs slower. The exception is when someone wants their language to run on an existing VM, e.g. for Java or to run in a web browser, so they compile it to the VM's instruction set. Various languages are compiled onto the JVM, and the same WebAssembly code has to run on any hardware onto which the containing web page has been downloaded, and will run faster than the equivalent JavaScript.
- earenndil 9y ago> If you manage to fit two languages, then you're essentially writing the same language in two different syntaxes. Counterexample: the JVM, which runs quite a few languages, including some that were created without any consideration thereof (python, ruby, lisp, perl).
- maelkum 9y agoHello everyone, the Viua VM's developer here! If you have any questions, just ask, I will try to answer them. Mind you, I am not the one who posted the VM here. I was specifically trying to maintain a low profile (and giving only a few presentations about it) until I polished the VM to some acceptable state. But here we are, so just ask me anything ;-)
- exebook 9y agoHi, very interesting stuff! I am trying to choose a new backend, for the programming language I create, currently I use C, so my interest is rather practical here. Where Viua stands in terms of performance for both generated code speed and compilation speed? What kind of optimisations it does or will do? What library you use for register allocation? Is JIT in plans? What are the long term plans/goals?
- maelkum 9y ago> Where Viua stands in terms of performance for both generated code speed and compilation speed? The performance is, frankly, abysmal. At this time you shouldn't use Viua if what you need is execution speed, as I haven't spent much time optimising the VM. Compilation speed is a different matter. I only provide an assembler so the "compilation" process is simple and straightforward, and shouldn't take long. Separate compilation is available, although a bit awkward, which should help. The assembler supplied with Viua does not perform any optimisations on source code. I don't use any library for register allocation. The bytecode is not compiled to native code so I can just supply whatever number of register a function needs. I haven't planned building a JIT compiler for the code, but I thought about it. Don't expect it any time soon as I don't have the chops to do it right ;-) The long term plans and goals... Ah, these deserve a separate post. The shortest possible summary: I do not plan to take the part in speed arms race; what I want for the VM is to provide best-in-class correctness and reliability. That wasn't always the case (and it shows if you know where to look), but now every feature and change is evaluated in the light of "How can X help with writing correct programs?". The same for VM's source code. I compiles warning-free, it doesn't leak memory. It does not contain UB. I am not able to provide you with the greatest performance out there, but I can give some correctness guarantees - this is where I focus with the development of the VM.