Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standalone Compiler #140

Merged
merged 25 commits into from
Jan 13, 2024
Merged

Conversation

CompeyDev
Copy link
Contributor

@CompeyDev CompeyDev commented Jan 2, 2024

This PR aims to enable the long-awaited standalone compilation feature, which allows for building luau source files to OS-native executables. It should be noted, however, that this PR only implements an initial interface for the above, and future PRs much implement more advanced features such as requires in such standalone environments.

TODO:

  • Binary compilation
    • Maintain a standard binary format
    • Parse binary format and execute at runtime
      • Create a documented struct for META Chunk (de)serialization
    • Make system highly performant
      • Swap out GLOBAL alloc for Jemalloc^
      • Multithread building & bytecode discovery process
        • Parallel Iterators
  • Tests & QA? (How do I exactly add tests for standalone compilation?)

^ Jemalloc is performant in multithreaded scenarios with multiple simultaneous reads across threads.

Closes #8.

Copy link
Collaborator

@filiptibell filiptibell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR, this is really cool and a great start for this feature! I left some comments to resolve.

src/cli/build.rs Outdated Show resolved Hide resolved
src/cli/build.rs Outdated Show resolved Hide resolved
src/cli/build.rs Outdated Show resolved Hide resolved
src/cli/mod.rs Outdated Show resolved Hide resolved
src/executor.rs Outdated Show resolved Hide resolved
src/executor.rs Outdated Show resolved Hide resolved
src/executor.rs Outdated Show resolved Hide resolved
src/executor.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
@CompeyDev
Copy link
Contributor Author

BTW, can we please fix the failing lint tests? Those have nothing to do with this PR, but it's a bit a annoying seeing an ❌ on the checks!

@filiptibell
Copy link
Collaborator

BTW, can we please fix the failing lint tests? Those have nothing to do with this PR, but it's a bit a annoying seeing an ❌ on the checks!

Fixed in 5040ded

@CompeyDev
Copy link
Contributor Author

CompeyDev commented Jan 13, 2024

@filiptibell Do note that the bytecode discovery is currently broken, due to the bytecode offset integer being inaccurately recovered at runtime, even though the value is somewhat close to the actual offset. The bytecode size seems to not be affected, however.

Since I'll not be able to work on this much over the next few days, I will allow you write access so that you can finalize and merge this as discussed on Discord.

Copy link
Collaborator

@filiptibell filiptibell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for implementing this!

@filiptibell filiptibell merged commit 6f8b1e4 into lune-org:main Jan 13, 2024
5 checks passed
@CompeyDev
Copy link
Contributor Author

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pack a lune script into a standalone executable
2 participants