LSO / LSL ByteCode

The task I’ve taken on me is to create script support for the OpenSim server.

This involves reading the compiled LSL script (LSL ByteCode, machine code for those who haven’t heard of ByteCode) and executing it somehow.

The plan is to convert LSL ByteCode into .Net ByteCode, passing it through .Net CLR (MSIL/.Net Assembly Language) and having the JIT (Just In Time) compiler to optimizations.

The result should be blazing fast execution (operating system specific native code) operating within the .Net Virtual Machine.

Security will be through .Net’s AppDomain restrictions. Powerfull enough in itself so we don’t have to worry about anything security-related.

LSL Builtin function implementation will be done through a C# middle layer, since it is mostly specific to LSL. This will also allow other developers to implement the functions while I continue hacking on the rest of LSL-support.

There are two tricky parts to this project.

  1. Running multiple scripts simultaneous
  2. Allowing scripts to cross regions while running, thus moving script to another server.

Running multiple scripts simultaneous can not be done by assigning threads to scripts, because the number of scripts will be too high. Therefore user space threading (fibres) has to be implemented. The plan is to do this by inserting breakpoints into the CLR code that allows script execution to jump out and continue execution at a later point.

Solving multitasking in that manner also makes it easier solving the problem of allowing scripts to cross regions while running, since their current execution state can be saved to file and resumed later. The trick is to make sure that stack/heap/all memory is saved in the same manner.

So, let’s see how it goes… 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Tedds blog

Subscribe now to keep reading and get access to the full archive.

Continue reading