Coder Social home page Coder Social logo

saladdais / lummao Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 1.0 364 KB

Toolkit for compiling and executing the Linden Scripting Language as Python.

License: GNU General Public License v3.0

Python 47.42% C++ 31.53% LSL 21.05%
secondlife lsl second-life

lummao's People

Contributors

elvahardwick avatar saladdais avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

elvahardwick

lummao's Issues

goto.py bytecode patching likely broken with CPython 3.11 bytecode changes

From https://docs.python.org/3.11/whatsnew/3.11.html#cpython-bytecode-changes:

Replaced JUMP_IF_NOT_EXC_MATCH by CHECK_EXC_MATCH which performs the check but does not jump.

Replaced JUMP_IF_NOT_EG_MATCH by CHECK_EG_MATCH which performs the check but does not jump.

Replaced JUMP_ABSOLUTE by the relative JUMP_BACKWARD.

Added JUMP_BACKWARD_NO_INTERRUPT, which is used in certain loops where it is undesirable to handle interrupts.

Replaced POP_JUMP_IF_TRUE and POP_JUMP_IF_FALSE by the relative POP_JUMP_FORWARD_IF_TRUE, POP_JUMP_BACKWARD_IF_TRUE, POP_JUMP_FORWARD_IF_FALSE and POP_JUMP_BACKWARD_IF_FALSE.

Added POP_JUMP_FORWARD_IF_NOT_NONE, POP_JUMP_BACKWARD_IF_NOT_NONE, POP_JUMP_FORWARD_IF_NONE and POP_JUMP_BACKWARD_IF_NONE opcodes to speed up conditional jumps.

Looks like the most important change is that absolute jumps no longer exist, and we have to use separate forward / backward relative jump types now. Will need separate codegen paths for 3.11+.

Some float<->str conversions have incorrect results, sometimes fail

We use LSL-PyOptimizer's typecast function for runtime casts, but it's failing on a couple of cases from the second LSL language conformance test:

>>> lslopt.lslfuncs.typecast(lslopt.lslfuncs.F32(1.4e-45), str)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/source/LSL-PyOptimizer/lslopt/lslbasefuncs.py", line 649, in typecast
    return InternalTypecast(val, out, InList, f32)
  File "/home/user/source/LSL-PyOptimizer/lslopt/lslbasefuncs.py", line 470, in InternalTypecast
    if out == unicode: return f2s(val, 6)
  File "/home/user/source/LSL-PyOptimizer/lslopt/lslbasefuncs.py", line 391, in f2s
    while s[i] in u'0.':
IndexError: string index out of range

because it gets formatted as 0.00000 internally, but its float val is not equal to 0.0, making that loop explode.

also:

>>> lslopt.lslfuncs.typecast("-0.0", float)
0.0

when it should be -0.0 seems to be due to a missing math.copysign() call when replacing things equivalent to 0.0 with 0.0 itself.

LSL-PyOptimizer itself doesn't run into either of these issues when optimizing an LSL script. Need to dig in more, things might be special-cased further up in the folding code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.