GithubHelp home page GithubHelp logo

lau's People

Contributors

rerumu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

whitewingz2017

lau's Issues

`FORPREP`, `FORLOOP`, `TFORPREP`, and `TFORLOOP` only support 1-way jumps

Lua 5.4 implements the 4 for loop instructions by storing the offset of the jump in Bx. This makes sense, as the compiler will never need to generate a FORPREP that jumps backwards or a FORLOOP that jumps forwards. However, it's less than ideal for code produced by any source other than the vanilla compiler.

The proposed solution is to generate a surrogate JMP after 1-way instructions and zero-out their jump target. It's important to note that FORPREP is an odd one in the bunch, and will advance the program counter by Bx + 1, not just Bx.

Points of interest:

`LFALSESKIP` is handled incorrectly

LFALSESKIP is a special opcode which loads a false into a register and skips the next instruction unconditionally. Generally, the next instruction is a LOADTRUE, but this is not guaranteed in an altered environment. This seems to be strictly an assembling issue, but in the case where LFALSESKIP is not followed by exactly 1 instruction, or its target is not the instruction directly after that one, a miscompilation will happen.

Proposed solutions, on invalid target...

  • Replace LFALSESKIP with LOADFALSE and a JMP to the appropriate target.
  • Generate LFALSESKIP followed by a dummy instruction and then a JMP to the appropriate target.

Points of interest:

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.