Coder Social home page Coder Social logo

michaeleischer / luajit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from luajit/luajit

0.0 1.0 1.0 4.16 MB

Mirror of the LuaJIT git repository

Home Page: http://luajit.org

License: Other

Makefile 1.13% C 84.11% Lua 13.65% Groff 0.10% C++ 0.48% Batchfile 0.54%

luajit's Introduction

Deterministic LuaJIT 2.0.4
--------------------------

This modification of LuaJIT aims to ensure deterministic execution of lua scripts.
The motivation for a deterministic execution is that running a script multiple times
with the same inputs always yields the same results. This can be used for fault-
tolerance using state machine replication or, as intended here, to simplify debugging
by looking at the problem over and over again.

This requires recording and replaying all inputs that are observable by the program.
These inputs comprise of every input directly passed to the program, everything read
by the program, but also of indirect inputs like memory layout. Another way to
avoid recording too much is to hide inputs by introducing certain conventions that
replace an undefined behavior of an implementation by a deterministic one.

In LUA memory addresses can't be observed directly (ignoring the FFI-library),
however some information is leaked by tostring and pairs/next. The first returns
a string containing the objects memory address, whereas the latter may produce
a different ordering during iteration. This is caused by deriving the hash codes
from the memory address. The problem is solved by ensuring that the iteration
always proceeds in insertion order.



LuaJIT modifications:
Implemented:
- pairs/next -> iteration in insertion order

Todo:
- Prevent Memory address leaks (tostring, lua_tostring)
- "Deterministic" Garbage collection? (collectgarbage, lua_gc, weak tables)
- Input recording (either input data or result of function call)
-- luaL_loadfile
-- file:*, io.*
-- package.{loaders, loadlib, searchpath}
-- os.*
-- debug.debug



Possibly problematic (must be reviewed):
- Random numbers (ensure that math.randomseed input is recorded)
- Garbage collection with __gc metafunction
- Debugging hook (debug.sethook, lua_sethook, triggering is dependent on JIT activation)
- Environment variables (LUA_CPATH, LUA_INIT, LUA_PATH)
- ffi.*
- jit.*
- Own C functions (ensure determinism or remember results)
- External modules



LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language.

Project Homepage: http://luajit.org/

LuaJIT is Copyright (C) 2005-2016 Mike Pall.
LuaJIT is free software, released under the MIT license.
See full Copyright Notice in the COPYRIGHT file or in luajit.h.

Documentation for LuaJIT is available in HTML format.
Please point your favorite browser to:

 doc/luajit.html

luajit's People

Contributors

michaeleischer avatar

Watchers

 avatar

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.