From c94ab0cde1c3a8e9475df25c9b7f6f8a4eaee9f9 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Wed, 5 Jun 2024 19:21:30 +0200 Subject: [PATCH] Update changelog, some other minor fixes --- CHANGELOG.md | 15 +++++++++++++++ tests/luau/safeenv.luau | 4 ++-- types/luau.luau | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7d222c..7f159e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + - Added a builtin API for hashing and calculating HMACs as part of the `serde` library Basic usage: @@ -26,6 +28,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 The returned hashes are sequences of lowercase hexadecimal digits. The following algorithms are supported: `md5`, `sha1`, `sha224`, `sha256`, `sha384`, `sha512`, `sha3-224`, `sha3-256`, `sha3-384`, `sha3-512`, `blake3` +- Added two new options to `luau.load`: + + - `codegenEnabled` - whether or not codegen should be enabled for the loaded chunk. + - `injectGlobals` - whether or not to inject globals into a passed `environment`. + + By default, globals are injected and codegen is disabled. + Check the documentation for the `luau` standard library for more information. + +### Changed + +- Sandboxing and codegen in the Luau VM is now fully enabled, resulting in up to 2x or faster code execution. + This should not result in any behavior differences in Lune, but if it does, please open an issue. + ## `0.8.5` - June 1st, 2024 ### Changed diff --git a/tests/luau/safeenv.luau b/tests/luau/safeenv.luau index f1a9d06..be653a7 100644 --- a/tests/luau/safeenv.luau +++ b/tests/luau/safeenv.luau @@ -24,9 +24,9 @@ local safeCodegenFunction = luau.load(TEST_BYTECODE, { }) local unsafeCodegenFunction = luau.load(TEST_BYTECODE, { debugName = "unsafeCodegenFunction", - codegenEnabled = true, environment = {}, injectGlobals = true, + codegenEnabled = true, }) local safeFunction = luau.load(TEST_BYTECODE, { debugName = "safeFunction", @@ -34,9 +34,9 @@ local safeFunction = luau.load(TEST_BYTECODE, { }) local unsafeFunction = luau.load(TEST_BYTECODE, { debugName = "unsafeFunction", - codegenEnabled = false, environment = {}, injectGlobals = true, + codegenEnabled = false, }) -- Run the functions to get the timings diff --git a/types/luau.luau b/types/luau.luau index 379c07d..ab40c4f 100644 --- a/types/luau.luau +++ b/types/luau.luau @@ -29,7 +29,7 @@ export type CompileOptions = { * `debugName` - The debug name of the closure. Defaults to `luau.load(...)`. * `environment` - A custom environment to load the chunk in. Setting a custom environment will deoptimize the chunk and forcefully disable codegen. Defaults to the global environment. * `injectGlobals` - Whether or not to inject globals in the custom environment. Has no effect if no custom environment is provided. Defaults to `true`. - * `codegenEnabled` - Whether or not to enable codegen. Defaults to `true`. + * `codegenEnabled` - Whether or not to enable codegen. Defaults to `false`. ]=] export type LoadOptions = { debugName: string?,