No description
Find a file
Sei Lisa 3669bbb06e Only add a label and a jump for default and break when necessary.
Well, within reasonable limits.

For break, it's explained in the code. If the block is empty of actual code (code that generates output), then the break position is eliminated.

For default, if the default label is at the top of the block, the jump and the label are both eliminated. This check doesn't include verifying that there are other non-code-generating statements in between, so there's room for improvement (added corresponding TODO item).

This way, we're on par with FS, in case someone (ab)used the FS brokeness when the 'default' label was absent. All one has to do now is add the default label at the top, and the generated code will be the same as it was in FS when abusing that bug, with no extra burden.

Example: In FS, the code at the top acted as default and there was no jump for it:

  default { timer() {
    switch(1)
    {
      0;
     case 1:
      1;
    }
  }}

This generated roughly:
  default { timer() {
    {
      if (1 == 1) jump CASE_1;
      0;
      @CASE_1;
      1;
    }
  }}

In this system, it would trigger an error by default. To obtain the FS behaviour, the scripter can do instead:
  default { timer() {
    switch(1)
    {
     default:
      0;
     case 1:
      1;
    }
  }}

Thanks to this optimization, the code will be the same as in FS. Without it, an extra default label and corresponding jump would be present.
2016-05-07 04:40:37 +02:00
lslopt Only add a label and a jump for default and break when necessary. 2016-05-07 04:40:37 +02:00
.gitignore Meta - add .gitignore 2014-07-26 03:06:33 +02:00
builtins-unittest.txt Get rid of builtins.txt.dat by adding a parameter to the parser ctor. 2015-07-09 20:35:14 +02:00
builtins.txt New upstream version of builtins.txt 2016-01-22 20:56:20 +01:00
COPYING Add copyright notices to all files, to prepare the program for release. 2015-03-05 23:18:41 +01:00
main.py Fix bug with tab handling. 2016-05-07 03:18:50 +02:00
README.md Update URL. 2015-04-29 00:49:34 +02:00
seftable.txt llModPow has a delay so exclude it from SEF table. 2014-08-17 16:03:20 +02:00
testfuncs.py Another str -> repr change affecting a float. 2015-12-09 03:43:59 +01:00
testparser.py Parse_unary_postfix_expression shouldn't accept the token (i.e. advance to the next) if it's not processed. This caused a mismatch between the reported syntax error and the position where it should have been detected. Fixed. 2016-01-03 01:29:57 +01:00

LSL PyOptimizer

LSL PyOptimizer is a LSL2 script optimizer written in Python 2. Currently it only supports code memory optimization (no speed optimization), only for Mono (no LSO), and only for the Second Life flavour of LSL (no OpenSim etc.).

HTML introduction, list of features and documentation available at http://lsl.project.li/lsl-pyoptimizer/