Git Product home page Git Product logo

graallua's Introduction

GraalLua

Gradle Check

Note: This project is not available yet.

Build

./gradlew jar

Goals

At present, the project is still in the early stage and is temporarily unavailable. We have some goals for this project in the future:

  • Five times faster than lua interpreter.
  • Fully compatible with pure Lua code.
  • Support Lua's C API (by sulong and NFI).
  • Call Java and other language easily and efficiently.
  • Easily accessible in other languages.

Discussions

GitHub Discussions: GraalLua/discussions

QQ Group: 314968684

graallua's People

Contributors

glavo avatar schrodingerzhu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

graallua's Issues

Small Tables

It may be useful to consider use inline fields if the table is very small. For example:

@SuppressWarnings("deprecation")
class LuaSmallTable extends DynamicObject implements TruffleObject {
    @DynamicField Object field0;
    @DynamicField Object field1;
    @DynamicField Object field2;
    @DynamicField Object field3;
    LuaSmallTable(Shape shape) {
        super(shape);
    }
}

with this we can have a small dynamic object with 4 fields inlined. The identifier for the fields are then stored in the shape.

OSM of GraalVM

An object consists of two separate parts:

  • the object storage, containing per-instance data,
  • and the shape, which provides a mapping of member names to locations in the object storage (similar to a Java class).

Details:

image-20210209183524167

  • Primitive Area and Object Area are separate; the later one is managed by GC.

  • Object is fixed sized. Use Extension Array for resize

  • Shapes are immutable, but we can switch to a new shape.

image-20210209184039186

  • Locations are final andvolatile

  • Root of a shape is empty

  • Transitions:

    • Add property
    • Delete property
    • Change attribute
    • Change storage location
    • Transitions are acyclic. (covariant)

Implementation

  • Annotation: @DynamicField

  • Need to decide: How many primitive/object fields should be provided.

  • Shapes use hidden classes, more friendlier to the guest languages with less runtime property changing.

    In special cases, one can store the shape in Hashmap.

Memory Issue

  • The transition map uses SoftReferences for successor shapes, so that they can be released by the garbage collector under memory pressure

  • The properties collection in a shape is created lazily and only when actually used. It can be reconstructed (recursively) from the property collection of the predecessor shape by applying the changes of the transition that lead to this shape.

  • The system handles extremely large objects by de-grading to a fallback representation based on a hash table that does not require any shapes

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.