From fcce67041bd46e05225ff521a65e2403e3ef1ade Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Fri, 24 Nov 2023 10:00:19 -0500 Subject: [PATCH] `luau`: remove `--jit` option as we don't need a Just In Time compiler anyway as we're compiling to bytecode by default for the main block when debugging is off. --- Cargo.lock | 8 ++--- Cargo.toml | 1 - src/cmd/luau.rs | 6 +--- tests/test_luau.rs | 89 ---------------------------------------------- 4 files changed, 5 insertions(+), 99 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8d1c34866..21c15485f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2004,9 +2004,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "glob" @@ -5755,9 +5755,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" [[package]] name = "whatlang" diff --git a/Cargo.toml b/Cargo.toml index 2928bc13e..dcbd53673 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -131,7 +131,6 @@ log = "0.4" mimalloc = { version = "0.1", default-features = false, optional = true } mlua = { version = "0.9", features = [ "luau", - "luau-jit", "serialize", ], optional = true } num_cpus = "1" diff --git a/src/cmd/luau.rs b/src/cmd/luau.rs index e36927de9..002ea790b 100644 --- a/src/cmd/luau.rs +++ b/src/cmd/luau.rs @@ -185,7 +185,6 @@ Luau options: can "require" lua/luau library files from. See https://www.lua.org/pil/8.1.html [default: ?;?.luau;?.lua] - --no-jit Don't use Luau's JIT compiler. --max-errors The maximum number of errors to tolerate before aborting. Set to zero to disable error limit. [default: 100] @@ -259,7 +258,6 @@ struct Args { flag_begin: Option, flag_end: Option, flag_luau_path: String, - flag_no_jit: bool, flag_output: Option, flag_no_headers: bool, flag_delimiter: Option, @@ -522,8 +520,6 @@ pub fn run(argv: &[&str]) -> CliResult<()> { // set default Luau compiler luau.set_compiler(luau_compiler.clone()); - luau.enable_jit(!args.flag_no_jit); - let globals = luau.globals(); // check the QSV_CKAN_API environment variable @@ -2068,7 +2064,7 @@ fn setup_helpers( // // returns: Luau table of header names excluding the first header. // Luau runtime error if the CSV could not be loaded, or - // if called from the MAIN or END scripts, or + // if called from the MAIN or END scripts, or // if the lookup table is empty. // let qsv_register_lookup = luau.create_function(move |luau, (lookup_name, mut lookup_table_uri, cache_age_secs): (String, String, i64)| { diff --git a/tests/test_luau.rs b/tests/test_luau.rs index 655482f86..3859fed6c 100644 --- a/tests/test_luau.rs +++ b/tests/test_luau.rs @@ -320,95 +320,6 @@ END { wrk.assert_success(&mut cmd); } -#[test] -fn luau_aggregation_with_embedded_begin_end_using_file_no_jit() { - let wrk = Workdir::new("luau_embedded_begin_end"); - wrk.create( - "data.csv", - vec![ - svec!["letter", "Amount"], - svec!["a", "13"], - svec!["b", "24"], - svec!["c", "72"], - svec!["d", "7"], - ], - ); - - wrk.create_from_string( - "testbeginend.luau", - r#" -BEGIN { - -- this is the BEGIN block, which is executed once at the beginning - -- where we typically initialize variables, setup functions - -- and load additional Lua libraries as required - running_total = 0; - grand_total = 0; - amount_array = {}; - adjusted_array = {}; - - function margin(x: number, y: number ): number - return x * y; - end - - function sum(numbers_array: table): number - local sum: number = 0; - for _, v in ipairs(numbers_array) do - sum = sum + v; - end - return sum; - end -}! - - --- this is the MAIN script loop, which is executed for each row --- note how we use the _IDX special variable to get the row index -amount_array[_IDX] = Amount; -running_total = running_total + Amount; - -adjusted_array[_IDX] = Amount + margin(Amount, 0.25); - --- running_total is the value we "map" to the "Running Total" column of each row -return running_total; - - -END { - -- and this is the END block, which is executed once at the end - grand_total = running_total; - min_amount = math.min(unpack(amount_array)); - max_amount = math.max(unpack(amount_array)); - adjusted_total = sum(adjusted_array); - - -- note how we use the _ROWCOUNT special variable to get the number of rows - -- the value returned from the END script is sent to stderr - return (`Min/Max: {min_amount}/{max_amount} Grand total of {_ROWCOUNT} rows: {grand_total} adjusted: {adjusted_total}`); -}! -"#, - ); - - let mut cmd = wrk.command("luau"); - cmd.arg("map") - .arg("Running Total") - .arg("file:testbeginend.luau") - .arg("--no-jit") - .arg("data.csv"); - - let got: Vec> = wrk.read_stdout(&mut cmd); - let expected = vec![ - svec!["letter", "Amount", "Running Total"], - svec!["a", "13", "13"], - svec!["b", "24", "37"], - svec!["c", "72", "109"], - svec!["d", "7", "116"], - ]; - assert_eq!(got, expected); - - let end = wrk.output_stderr(&mut cmd); - let expected_end = "Min/Max: 7/72 Grand total of 4 rows: 116 adjusted: 145\n".to_string(); - assert_eq!(end, expected_end); - - wrk.assert_success(&mut cmd); -} - #[test] fn luau_register_lookup_table() { let wrk = Workdir::new("luau_register_lookup_table");