Page 1 of 1

Idea: Interpreted user-mode code

Posted: Sun Apr 25, 2004 11:00 pm
by Gnome
Just an idea I though of a while ago I thought I'd throw out here to see what the reaction is.

At one point where I was completely frustrated with the x86 architecture, I thought it would be cool to make all user-mode code in my OS executed by a JIT compiler, not directly, much like Java is. I looked at the GNU Lightning library for generating x86 code. It's a really interesting library... I'm not sure if I fully like the idea that it's really just a bunch of preprocessor macros and no actual functions, but it certainly makes embedding it into a kernel real simple. It's all just a gazillion bitwise operations. But, that's another issue.

Some advantages I see to this:
    - Fully customizable instruction set and exposed system architecture
    - Abstraction from the x86 architecture (GNU Lightning is platform independent)
    - Security? Sure, arbitrary native code can't be executed, but if all the system calls are exposed through the interpreted interface, then that doesn't really make much of a difference, does it?
    - Coolness factor :)

Some disadvantages:
    - Lots of work
    - Performance
    - Not really needed

The biggest advantage I see is the customizable instruction set and architecture, and the biggest disadvantage is the performance. GNU Lightning doesn't have a peephole optimizer, so some stuff it generates is redundant or not required (excess pushing/popping of registers, etc.). I'll have to do some digging to see if there is a compatible one out there that I can use.

Any comments/suggestions?

Gnome.