Difference between revisions of "Mono"
Line 25: | Line 25: | ||
'''Mono is not yet available for public preview. The instructions below are for discussion purposes only. Target date for the Mono beta is 31 January 2008.''' | '''Mono is not yet available for public preview. The instructions below are for discussion purposes only. Target date for the Mono beta is 31 January 2008.''' | ||
Suppose you have some scripts you want to test under Mono. You will need to go to a Mono-enabled region and you will need to run a Mono viewer. | Suppose you have some scripts you want to test under Mono. You will need to go to a Mono-enabled region and you will need to run a Mono viewer. Detailed instructions are available on the [[Mono beta FAQ]]. | ||
* Download a Mono viewer: <Not yet available> | |||
** This viewer will automatically connect you to the beta grid. | |||
** It also contains the UI to enable compiling your script to Mono | |||
* Launch the Mono viewer and log in as usual. | |||
* Teleport to a Mono-enabled region of the beta grid. | |||
** Most regions are running Havok4, not Mono | |||
** Mono regions are: <TBD> | |||
* Rez the object containing the script. | * Rez the object containing the script. | ||
* Edit the object and open the script. | * Edit the object and open the script. | ||
Line 34: | Line 41: | ||
* Confirm that the scripted object runs the same under Mono as it has before. | * Confirm that the scripted object runs the same under Mono as it has before. | ||
** Any differences in behavior should be noted in a JIRA ticket. | ** Any differences in behavior should be noted in a JIRA ticket. | ||
** | ** First check this meta JIRA to see if anyone has reported the issue already | ||
*** This may not be doable unless you've drilled down into your script to locate what is breaking. | |||
** If a JIRA already exists, and it appears to be the same failure, then simply add your information as a comment and attachment to that issue. | |||
** If not, open a new SVC ticket for each bug you find. In the ticket subject please use the words "Mono beta" so that we can filter for them. | |||
** In addition to your description of the problem please attach your script itself, or (ideally) a smaller script which illustrates the difference in behavior between the two virtual machines. | ** In addition to your description of the problem please attach your script itself, or (ideally) a smaller script which illustrates the difference in behavior between the two virtual machines. | ||
** Link your JIRA to the meta JIRA. |
Revision as of 10:58, 25 January 2008
Linden Lab Studio Icehouse is now testing a simulator upgrade which will dramatically speed the running of scripts. The Linden Scripting Language ( LSL ) will not change in any way, so all of your existing scripted objects and attachments will continue to function as before, only faster. The key to this improvement is an open-sourced virtual machine called Mono.
The plan is to continue testing Mono for LSL through the end of the month, and then make some mono-enabled regions available on the beta grid through February. Below you'll find a non-technical description of how LSL and Mono will work together. Later we'll add sections on how to compile your LSL script into Mono, and how to participate in the beta. Look for updates here and on the SL blog.
How LSL scripts work
All your LSL scripts are run by the simulator (Linden Lab server program) that also runs the region you are in. When you teleport, or region cross, your new region's simulator takes on the duty of running all your scripted attachments. But the simulators cannot understand LSL directly -- the language was designed for human readability, not machine. So before the script can be executed, it must be turned into a machine readable format. This process is called compilation, and the resulting machine readable version of the script is called bytecode. LSL scripts are compiled when they are created by resident-programmers. The bytecode itself is stored on the Linden Lab asset servers and never needs to be referred to directly by residents. Instead, when you rez a scripted object, the simulator for the region you are in notes the name of the script(s) in the object, and requests the appropriate bytecode from the asset database. The simulator program has several parts, and the part which runs the script bytecode is called the LSL virtual machine.
In today's Second Life, scripts are everywhere in regions: from simple rotating objects to complicated vehicles, vendors, or attachments that respond to your chat commands. For many regions the LSL virtual machine is kept busy trying to execute hundreds of scripts all at once. As the number and complexity of scripts in a region rises, so do the demands upon the simulator. After a certain point the virtual machine starts taking up so much processing time that the rest of the simulator (particularly the physics engine) bogs down, and server-side lag results. Thus anything that can speed up the execution of scripts can push out the point where server lag starts to occur.
Enter Mono
Mono is another kind of virtual machine. It is fully open-sourced and has a proven record of speed and versatility. For over a year now Mono has been considered by Linden Lab as an alternative to the LSL virtual machine. But there are difficulties with switching virtual machines. The most fundamental problem is that all bytecodes are different. So the LSL bytecode is just gibberish to Mono, and vice versa. Before we could start using a Mono virtual machine, we need to develop a compiler which can take LSL scripts and turn them into Mono bytecode. This is tricky, because the goal is to make scripts running under Mono behave 'exactly' like scripts running under the current virtual machine. It's painstaking work, and requires an extraordinary amount of testing. The final sprint of coding was completed in the third quarter of 2007, and since November Linden Lab QA has been rigorously pounding on the new virtual machine with an assortment of tests both automated and manual.
The Plan
The ultimate test of the new virtual machine will be when residents can start to use Mono for their LSL scripts. Once Mono passes our internal QA we are going to deploy it to our beta grid. That grid is currently being used by Havok 4, the new version of our physics engine. However, through the wonders of Het Grid, we will be able to share the grid with Havok. Het Grid allows us to make some regions on a grid run different simulator software than others. So we can have some regions on the beta grid running Havok, and some running Mono!
We'll use the same Het Grid strategy when Mono is ready for the main grid -- initially it will be deployed only to a few regions, and residents will be able to tp over to them to confirm that their scripts still behave properly under Mono. Eventually we will release Mono gridwide and the LSL compiler will be deprecated.
Early results
We've run some benchmarks to compare the performance of the LSL2 virtual machine and the Mono VM. When we run the tests side by side we found that Mono is up to 220x faster than LSL2. These benchmarks were math intensive scripts usually used to evaluate performance. Once we get the beta program going we hope to get input from residents on Mono performance with more typical SL scripts.
Mono How-to
Mono is not yet available for public preview. The instructions below are for discussion purposes only. Target date for the Mono beta is 31 January 2008.
Suppose you have some scripts you want to test under Mono. You will need to go to a Mono-enabled region and you will need to run a Mono viewer. Detailed instructions are available on the Mono beta FAQ.
- Download a Mono viewer: <Not yet available>
- This viewer will automatically connect you to the beta grid.
- It also contains the UI to enable compiling your script to Mono
- Launch the Mono viewer and log in as usual.
- Teleport to a Mono-enabled region of the beta grid.
- Most regions are running Havok4, not Mono
- Mono regions are: <TBD>
- Rez the object containing the script.
- Edit the object and open the script.
- You will see a new checkbox for compiling this script to Mono instead of LSL. Check the box for Mono, then save.
- If you fail to see the checkbox, you are not running a Mono viewer.
- If the checkbox is grayed out for Mono, you are not in a Mono enabled region.
- I suggest you append the word "Mono" to the object/script name. This way you'll be able to identify which objects in your inventory will only run in Mono regions.
- Confirm that the scripted object runs the same under Mono as it has before.
- Any differences in behavior should be noted in a JIRA ticket.
- First check this meta JIRA to see if anyone has reported the issue already
- This may not be doable unless you've drilled down into your script to locate what is breaking.
- If a JIRA already exists, and it appears to be the same failure, then simply add your information as a comment and attachment to that issue.
- If not, open a new SVC ticket for each bug you find. In the ticket subject please use the words "Mono beta" so that we can filter for them.
- In addition to your description of the problem please attach your script itself, or (ideally) a smaller script which illustrates the difference in behavior between the two virtual machines.
- Link your JIRA to the meta JIRA.