]> git.ipfire.org Git - thirdparty/LuaJIT.git/log
thirdparty/LuaJIT.git
10 days agoMerge branch 'master' into v2.1 v2.1
Mike Pall [Mon, 30 Mar 2026 18:43:18 +0000 (20:43 +0200)] 
Merge branch 'master' into v2.1

10 days agoFFI: Shrink container of packed bitfield. master v2.0
Mike Pall [Mon, 30 Mar 2026 18:41:59 +0000 (20:41 +0200)] 
FFI: Shrink container of packed bitfield.

Reported by Huang Haiyang. #1451

13 days agoFix VM event error handling for finalizers.
Mike Pall [Fri, 27 Mar 2026 19:04:50 +0000 (20:04 +0100)] 
Fix VM event error handling for finalizers.

Reported by Sergey Kaplun. #1445

13 days agoAvoid use of subnormals for internal registry keys.
Mike Pall [Fri, 27 Mar 2026 18:54:29 +0000 (19:54 +0100)] 
Avoid use of subnormals for internal registry keys.

Non-ABI-compliant FPU modes (-ffast-math, -Ofast, FTZ/DAZ set) may
still cause erratic behavior and are not supported. #1448

13 days agoMerge branch 'master' into v2.1
Mike Pall [Fri, 27 Mar 2026 18:51:15 +0000 (19:51 +0100)] 
Merge branch 'master' into v2.1

13 days agoPrevent false positive sanitizer warning in unpack().
Mike Pall [Fri, 27 Mar 2026 18:49:05 +0000 (19:49 +0100)] 
Prevent false positive sanitizer warning in unpack().

Reported by Sergey Bronnikov. #1450

13 days agoFFI: Fix pointer difference operation on 64 bit platforms.
Mike Pall [Fri, 27 Mar 2026 18:47:27 +0000 (19:47 +0100)] 
FFI: Fix pointer difference operation on 64 bit platforms.

Thanks to cuiweixie. #1449

5 weeks agoMerge branch 'master' into v2.1
Mike Pall [Wed, 4 Mar 2026 10:20:47 +0000 (11:20 +0100)] 
Merge branch 'master' into v2.1

5 weeks agoFix edge cases when recording string.byte/sub.
Mike Pall [Wed, 4 Mar 2026 10:18:28 +0000 (11:18 +0100)] 
Fix edge cases when recording string.byte/sub.

Thanks to Sergey Kaplun. #1443

6 weeks agoAdd ffi.abi("dualnum").
Mike Pall [Thu, 26 Feb 2026 23:33:30 +0000 (00:33 +0100)] 
Add ffi.abi("dualnum").

Thanks to Sergey Kaplun. #1442

6 weeks agoMerge branch 'master' into v2.1
Mike Pall [Tue, 24 Feb 2026 21:17:01 +0000 (22:17 +0100)] 
Merge branch 'master' into v2.1

6 weeks agoFFI: Fix constructor index resolution in JIT compiler.
Mike Pall [Tue, 24 Feb 2026 21:13:15 +0000 (22:13 +0100)] 
FFI: Fix constructor index resolution in JIT compiler.

Reported by Vladimir Davydov and Sergey Kaplun. #1441

7 weeks agoDUALNUM: Fix recording of loops broken by previous change.
Mike Pall [Mon, 16 Feb 2026 17:00:33 +0000 (18:00 +0100)] 
DUALNUM: Fix recording of loops broken by previous change.

Thanks to Nicholas Davies. #1432 #1433 #1438

7 weeks agoMerge branch 'master' into v2.1
Mike Pall [Fri, 13 Feb 2026 13:24:23 +0000 (14:24 +0100)] 
Merge branch 'master' into v2.1

7 weeks agoFix compiler warning.
Mike Pall [Fri, 13 Feb 2026 13:21:42 +0000 (14:21 +0100)] 
Fix compiler warning.

Thanks to Holger Hoffstätte. #1436

8 weeks agoFix G->jit_base relocation on stack resize.
Mike Pall [Wed, 11 Feb 2026 22:16:59 +0000 (23:16 +0100)] 
Fix G->jit_base relocation on stack resize.

Reported by f32y. #1435

8 weeks agoPrevent recording of loops with -0 step or NaN values.
Mike Pall [Wed, 11 Feb 2026 22:14:13 +0000 (23:14 +0100)] 
Prevent recording of loops with -0 step or NaN values.

Thanks to Sergey Kaplun. #1432 #1433

8 weeks agoAvoid recording interference due to invocation of VM hooks.
Mike Pall [Wed, 11 Feb 2026 22:12:53 +0000 (23:12 +0100)] 
Avoid recording interference due to invocation of VM hooks.

Thanks to Sergey Kaplun. #1429 #1434

8 weeks agox64/!LJ_GC64: The allocation limit is required for a no-JIT build, too.
Mike Pall [Wed, 11 Feb 2026 22:09:57 +0000 (23:09 +0100)] 
x64/!LJ_GC64: The allocation limit is required for a no-JIT build, too.

Thanks to Sergey Kaplun. #1430

8 weeks agoMIPS64: Avoid unaligned load in lj_vm_exit_interp.
Mike Pall [Wed, 11 Feb 2026 22:06:36 +0000 (23:06 +0100)] 
MIPS64: Avoid unaligned load in lj_vm_exit_interp.

Thanks to Sergey Kaplun. #1428

8 weeks agoPrevent snapshot purge while recording a function header.
Mike Pall [Wed, 11 Feb 2026 22:04:42 +0000 (23:04 +0100)] 
Prevent snapshot purge while recording a function header.

Thanks to Sergey Kaplun. #1425

2 months agoDUALNUM: Improve/fix edge cases of unary minus.
Mike Pall [Fri, 9 Jan 2026 17:46:32 +0000 (18:46 +0100)] 
DUALNUM: Improve/fix edge cases of unary minus.

Thanks to Sergey Kaplun. #1422 #1418

2 months agoMerge branch 'master' into v2.1
Mike Pall [Fri, 9 Jan 2026 16:37:57 +0000 (17:37 +0100)] 
Merge branch 'master' into v2.1

2 months agoFix minilua undefined behavior in bit.tohex.
Mike Pall [Fri, 9 Jan 2026 16:34:15 +0000 (17:34 +0100)] 
Fix minilua undefined behavior in bit.tohex.

Note: this is not a vulnerability! minilua is only used during the LuaJIT
build process. It only runs controlled and static Lua code (DynASM),
which is entirely contained within this repo and does not trigger the
undefined behavior.

This change is solely for the benefit of others, who might possibly use
minilua for purposes other than running DynASM.

Reported by quart27219. #1424

2 months agoMerge branch 'master' into v2.1
Mike Pall [Fri, 9 Jan 2026 16:27:35 +0000 (17:27 +0100)] 
Merge branch 'master' into v2.1

2 months agoIgnore PDB files for git.
Mike Pall [Fri, 9 Jan 2026 16:26:13 +0000 (17:26 +0100)] 
Ignore PDB files for git.

Thanks to Michael Fisher. #1423

2 months agoMerge branch 'master' into v2.1
Mike Pall [Fri, 9 Jan 2026 16:25:02 +0000 (17:25 +0100)] 
Merge branch 'master' into v2.1

2 months agoBump copyright date.
Mike Pall [Fri, 9 Jan 2026 16:18:03 +0000 (17:18 +0100)] 
Bump copyright date.

4 months agoFix string.format for limited precision FP conversions.
Mike Pall [Mon, 8 Dec 2025 21:18:40 +0000 (22:18 +0100)] 
Fix string.format for limited precision FP conversions.

Enforce round-to-even semantics. #1363

4 months agoPPC: Fix soft-float lj_num2u64().
Mike Pall [Sat, 6 Dec 2025 07:44:03 +0000 (08:44 +0100)] 
PPC: Fix soft-float lj_num2u64().

Reported by Doug Crawford. #1411

4 months agoARM64: More fixes for ARM BTI.
Mike Pall [Sat, 6 Dec 2025 07:42:18 +0000 (08:42 +0100)] 
ARM64: More fixes for ARM BTI.

Reported by Yuichiro Naito. #1415

4 months agoDUALNUM: Fix narrowing of unary minus.
Mike Pall [Sat, 6 Dec 2025 07:39:11 +0000 (08:39 +0100)] 
DUALNUM: Fix narrowing of unary minus.

Reported by Sergey Kaplun. #1418

4 months agoMerge branch 'master' into v2.1
Mike Pall [Sat, 6 Dec 2025 07:38:49 +0000 (08:38 +0100)] 
Merge branch 'master' into v2.1

4 months agoDUALNUM: Add missing type conversion for FORI slots.
Mike Pall [Sat, 6 Dec 2025 07:35:19 +0000 (08:35 +0100)] 
DUALNUM: Add missing type conversion for FORI slots.

Reported by Sergey Kaplun. #1413

4 months agoRemove pointless GCC/MSVC const function attributes.
Mike Pall [Mon, 1 Dec 2025 12:50:32 +0000 (13:50 +0100)] 
Remove pointless GCC/MSVC const function attributes.

They are only called from JIT-compiled code and not from C.
Reported by Richard Beckmann. #1414

4 months agoFix MSVC LJ_CONSTF declaration.
Mike Pall [Thu, 27 Nov 2025 19:04:42 +0000 (20:04 +0100)] 
Fix MSVC LJ_CONSTF declaration.

Reading MS docs is hard. #1412

4 months agoBack out MSVC LJ_CONSTF declaration.
Mike Pall [Thu, 27 Nov 2025 19:02:00 +0000 (20:02 +0100)] 
Back out MSVC LJ_CONSTF declaration.

The reason for the error message is still unclear. #1412.

4 months agoRemove compiler flag for FP conversions. Now unnecessary.
Mike Pall [Thu, 27 Nov 2025 16:48:44 +0000 (17:48 +0100)] 
Remove compiler flag for FP conversions. Now unnecessary.

Undo #1355. #1397 #1411

4 months agoUnify Lua number to FFI integer conversions.
Mike Pall [Thu, 27 Nov 2025 16:45:17 +0000 (17:45 +0100)] 
Unify Lua number to FFI integer conversions.

Phew. #1411

4 months agoARM64: Fix disassembly of certain sub-word-size loads/stores.
Mike Pall [Thu, 27 Nov 2025 15:39:15 +0000 (16:39 +0100)] 
ARM64: Fix disassembly of certain sub-word-size loads/stores.

4 months agoELF/Mach-O: Force default visibility for public API functions.
Mike Pall [Sun, 16 Nov 2025 18:41:51 +0000 (19:41 +0100)] 
ELF/Mach-O: Force default visibility for public API functions.

Thanks to Dymphna. #1409

4 months agoMerge branch 'master' into v2.1
Mike Pall [Sun, 16 Nov 2025 18:36:40 +0000 (19:36 +0100)] 
Merge branch 'master' into v2.1

4 months agox86/x64: Backport fix for math.min()/math.max() argument check.
Mike Pall [Sun, 16 Nov 2025 18:34:11 +0000 (19:34 +0100)] 
x86/x64: Backport fix for math.min()/math.max() argument check.

Reported by puffy.

4 months agoMerge branch 'master' into v2.1
Mike Pall [Fri, 14 Nov 2025 19:22:24 +0000 (20:22 +0100)] 
Merge branch 'master' into v2.1

4 months agoFix edge cases when generating IR for string.byte/sub/find.
Mike Pall [Fri, 14 Nov 2025 19:15:44 +0000 (20:15 +0100)] 
Fix edge cases when generating IR for string.byte/sub/find.

Contributed by XmiliaH. #1407

4 months agoMerge branch 'master' into v2.1
Mike Pall [Mon, 10 Nov 2025 17:18:19 +0000 (18:18 +0100)] 
Merge branch 'master' into v2.1

4 months agoFFI: Avoid dangling cts->L.
Mike Pall [Mon, 10 Nov 2025 17:15:11 +0000 (18:15 +0100)] 
FFI: Avoid dangling cts->L.

Reported by ZumiKua. #1405

4 months agoRun VM events and finalizers in separate state.
Mike Pall [Mon, 10 Nov 2025 17:11:26 +0000 (18:11 +0100)] 
Run VM events and finalizers in separate state.

Reported by Sergey Kaplun. #1403

5 months agomacOS: Change Mach-O object file layout required by XCode 15.0.
Mike Pall [Sat, 8 Nov 2025 15:54:00 +0000 (16:54 +0100)] 
macOS: Change Mach-O object file layout required by XCode 15.0.

Reported by George Zhao. #1404

5 months agoARM64: Enable unaligned accesses if indicated by the toolchain.
Mike Pall [Sat, 8 Nov 2025 14:41:42 +0000 (15:41 +0100)] 
ARM64: Enable unaligned accesses if indicated by the toolchain.

If you get a crash in jit_init() then you need to fix your toolchain.

5 months agoAllow mcode allocations outside of the jump range to the support code.
Mike Pall [Wed, 5 Nov 2025 23:42:02 +0000 (00:42 +0100)] 
Allow mcode allocations outside of the jump range to the support code.

Thank you for your patience. #285

5 months agoARM64: Fix disassembly of >2GB branch targets.
Mike Pall [Wed, 5 Nov 2025 23:30:22 +0000 (00:30 +0100)] 
ARM64: Fix disassembly of >2GB branch targets.

5 months agox64: Fix CET IBT.
Mike Pall [Wed, 29 Oct 2025 08:38:41 +0000 (09:38 +0100)] 
x64: Fix CET IBT.

Reported by Yuichiro Naito. #1400

5 months agoARM64: Fix ARM BTI.
Mike Pall [Wed, 29 Oct 2025 08:38:31 +0000 (09:38 +0100)] 
ARM64: Fix ARM BTI.

Reported by Yuichiro Naito. #1400

5 months agoWindows: Fix lua52compat option for msvcbuild.bat.
Mike Pall [Tue, 28 Oct 2025 03:59:18 +0000 (04:59 +0100)] 
Windows: Fix lua52compat option for msvcbuild.bat.

Thanks to Alex Orlenko. #1395 #1366

5 months agoARM64: Add support for ARM BTI.
Mike Pall [Tue, 28 Oct 2025 03:46:10 +0000 (04:46 +0100)] 
ARM64: Add support for ARM BTI.

Note: this is not enabled by default, look for CET in lj_arch.h.
Thanks to Yuichiro Naito. #1398

5 months agox64: Various fixes for CET IBT.
Mike Pall [Mon, 27 Oct 2025 23:27:15 +0000 (00:27 +0100)] 
x64: Various fixes for CET IBT.

Also add ELF notes. #1391

5 months agox64: Add support for CET IBT.
Mike Pall [Thu, 16 Oct 2025 12:24:52 +0000 (14:24 +0200)] 
x64: Add support for CET IBT.

Note: this is not enabled by default, look for CET in lj_arch.h
Contributed by Yuichiro Naito. #1391

5 months agoGracefully handle broken custom allocator.
Mike Pall [Thu, 16 Oct 2025 11:23:51 +0000 (13:23 +0200)] 
Gracefully handle broken custom allocator.

Reported by Alex Orlenko. #1393

5 months agoAdd GNU/Hurd build support.
Mike Pall [Thu, 16 Oct 2025 11:17:45 +0000 (13:17 +0200)] 
Add GNU/Hurd build support.

Note: this is not an officially supported target.
Contributed by Pino Toscano and Samuel Thibault. #1383 #1384

5 months agoFix io.write() of newly created buffer.
Mike Pall [Thu, 16 Oct 2025 11:13:51 +0000 (13:13 +0200)] 
Fix io.write() of newly created buffer.

Reported by vfprintf. #1386

5 months agoFix reporting of an error during error handling.
Mike Pall [Thu, 16 Oct 2025 11:11:02 +0000 (13:11 +0200)] 
Fix reporting of an error during error handling.

Reported by Sergey Kaplun. #1381

8 months agoWindows: Add lua52compat option to msvcbuild.bat.
Mike Pall [Thu, 24 Jul 2025 13:45:24 +0000 (15:45 +0200)] 
Windows: Add lua52compat option to msvcbuild.bat.

Thanks to Gil Reis. #1366

8 months agoMerge branch 'master' into v2.1
Mike Pall [Thu, 24 Jul 2025 13:41:35 +0000 (15:41 +0200)] 
Merge branch 'master' into v2.1

8 months agox86/x64: Don't use undefined MUL/IMUL zero flag.
Mike Pall [Thu, 24 Jul 2025 13:38:45 +0000 (15:38 +0200)] 
x86/x64: Don't use undefined MUL/IMUL zero flag.

Reported by VrIgHtEr. #1376

8 months agoAvoid out-of-range PC for stack overflow error from snapshot restore.
Mike Pall [Thu, 24 Jul 2025 13:35:56 +0000 (15:35 +0200)] 
Avoid out-of-range PC for stack overflow error from snapshot restore.

Reported by Sergey Kaplun. #1369

8 months agoFFI: Fix dangling CType references (again).
Mike Pall [Thu, 24 Jul 2025 13:29:54 +0000 (15:29 +0200)] 
FFI: Fix dangling CType references (again).

Reported by Sergey Kaplun. Collateral of #1360

10 months agoMerge branch 'master' into v2.1
Mike Pall [Wed, 28 May 2025 19:14:47 +0000 (21:14 +0200)] 
Merge branch 'master' into v2.1

10 months agoFix JIT slot overflow during up-recursion.
Mike Pall [Wed, 28 May 2025 19:13:17 +0000 (21:13 +0200)] 
Fix JIT slot overflow during up-recursion.

Reported by Sergey Kaplun. #1358

10 months agoMerge branch 'master' into v2.1
Mike Pall [Wed, 28 May 2025 19:06:44 +0000 (21:06 +0200)] 
Merge branch 'master' into v2.1

10 months agoAvoid out-of-range PC for stack overflow error from snapshot restore.
Mike Pall [Wed, 28 May 2025 19:02:31 +0000 (21:02 +0200)] 
Avoid out-of-range PC for stack overflow error from snapshot restore.

Reported by Sergey Kaplun. #1359

10 months agoMerge branch 'master' into v2.1
Mike Pall [Wed, 28 May 2025 18:39:05 +0000 (20:39 +0200)] 
Merge branch 'master' into v2.1

10 months agoFFI: Fix dangling CType references.
Mike Pall [Wed, 28 May 2025 18:36:24 +0000 (20:36 +0200)] 
FFI: Fix dangling CType references.

Reported by Sergey Kaplun. Collateral of #1360

11 months agoPrevent Clang UB 'optimization' which breaks integerness checks.
Mike Pall [Thu, 10 Apr 2025 20:53:50 +0000 (22:53 +0200)] 
Prevent Clang UB 'optimization' which breaks integerness checks.

Thanks to Kacper Michajłow. #1351 #1355

11 months agoARM: Fix soft-float math.min()/math.max().
Mike Pall [Thu, 10 Apr 2025 20:45:38 +0000 (22:45 +0200)] 
ARM: Fix soft-float math.min()/math.max().

Reported by Dong Jianqiang. #1356

11 months agoARM64: Fix pass-by-value struct calling conventions.
Mike Pall [Thu, 10 Apr 2025 20:06:47 +0000 (22:06 +0200)] 
ARM64: Fix pass-by-value struct calling conventions.

Reported by AnthonyK213. #1357

12 months agoMerge branch 'master' into v2.1
Mike Pall [Mon, 7 Apr 2025 08:33:15 +0000 (10:33 +0200)] 
Merge branch 'master' into v2.1

12 months agoFix error generation in load*.
Mike Pall [Mon, 7 Apr 2025 08:27:40 +0000 (10:27 +0200)] 
Fix error generation in load*.

Reported by Sergey Kaplun. #1353

12 months agoInitialize unused value when specializing to cdata metatable.
Mike Pall [Mon, 7 Apr 2025 07:22:07 +0000 (09:22 +0200)] 
Initialize unused value when specializing to cdata metatable.

Reported by jakitliang. #1354

12 months agoChange handling of nil value markers in template tables.
Mike Pall [Tue, 11 Mar 2025 22:04:30 +0000 (23:04 +0100)] 
Change handling of nil value markers in template tables.

Reported by Bernhard M. Wiedemann. #1348 #1155
Fixes from Peter Cawley, Christian Clason, Lewis Russell.

13 months agoREVERT: Change handling of nil value markers in template tables.
Mike Pall [Mon, 10 Mar 2025 01:56:07 +0000 (02:56 +0100)] 
REVERT: Change handling of nil value markers in template tables.

13 months agomacOS: Fix Apple hardened runtime support and put behind build option.
Mike Pall [Mon, 10 Mar 2025 01:53:20 +0000 (02:53 +0100)] 
macOS: Fix Apple hardened runtime support and put behind build option.

Reported by vanc. #1334

13 months agomacOS: Fix support for Apple hardened runtime.
Mike Pall [Sun, 9 Mar 2025 23:05:08 +0000 (00:05 +0100)] 
macOS: Fix support for Apple hardened runtime.

Reported by Christian Clason. #1334

13 months agoFix handling of nil value markers in template tables.
Mike Pall [Sun, 9 Mar 2025 22:11:05 +0000 (23:11 +0100)] 
Fix handling of nil value markers in template tables.

Thanks to Peter Cawley. #1348 #1155

13 months agoMerge branch 'master' into v2.1
Mike Pall [Sun, 9 Mar 2025 22:09:02 +0000 (23:09 +0100)] 
Merge branch 'master' into v2.1

13 months agoAvoid unpatching bytecode twice after a trace flush.
Mike Pall [Sun, 9 Mar 2025 22:04:23 +0000 (23:04 +0100)] 
Avoid unpatching bytecode twice after a trace flush.

Reported by Sergey Kaplun. #1345

13 months agoFix state restore when recording __concat metamethod.
Mike Pall [Sun, 9 Mar 2025 20:28:17 +0000 (21:28 +0100)] 
Fix state restore when recording __concat metamethod.

Reported by Sergey Kaplun. #1338 #1298

13 months agoWindows: Allow mixed builds with msvcbuild.bat.
Mike Pall [Sun, 9 Mar 2025 20:05:06 +0000 (21:05 +0100)] 
Windows: Allow mixed builds with msvcbuild.bat.

Suggested by alex4814. #1341

13 months agomacOS: Add suport for Apple hardened runtime.
Mike Pall [Sun, 9 Mar 2025 19:45:22 +0000 (20:45 +0100)] 
macOS: Add suport for Apple hardened runtime.

Thanks to Peter Cawley. #1334

13 months agoMerge branch 'master' into v2.1
Mike Pall [Sun, 9 Mar 2025 15:25:34 +0000 (16:25 +0100)] 
Merge branch 'master' into v2.1

13 months agoAdd compatibility string coercion for fp:seek() argument.
Mike Pall [Sun, 9 Mar 2025 15:21:29 +0000 (16:21 +0100)] 
Add compatibility string coercion for fp:seek() argument.

Reported by Magnus Wibeck. #1343

13 months agoWindows: Clarify installation directory layout.
Mike Pall [Sun, 9 Mar 2025 15:10:22 +0000 (16:10 +0100)] 
Windows: Clarify installation directory layout.

Suggested by eabase. #1346

13 months agoRemove Cygwin from docs, since it's not a supported target.
Mike Pall [Sun, 9 Mar 2025 15:09:36 +0000 (16:09 +0100)] 
Remove Cygwin from docs, since it's not a supported target.

13 months agoImprove CLI signal handling on POSIX.
Mike Pall [Sun, 9 Mar 2025 14:50:01 +0000 (15:50 +0100)] 
Improve CLI signal handling on POSIX.

13 months agoFFI: Add pre-declared int128_t, uint128_t, __int128 types.
Mike Pall [Sun, 9 Mar 2025 14:37:35 +0000 (15:37 +0100)] 
FFI: Add pre-declared int128_t, uint128_t, __int128 types.

Note: Only declaration and copy (interpreted only) are implemented.

13 months agoUse dylib extension for iOS installs, too.
Mike Pall [Sun, 9 Mar 2025 14:00:15 +0000 (15:00 +0100)] 
Use dylib extension for iOS installs, too.

Reported by Andrey Filipenkov. #1336

13 months agoChange handling of nil value markers in template tables.
Mike Pall [Sun, 9 Mar 2025 13:44:57 +0000 (14:44 +0100)] 
Change handling of nil value markers in template tables.

Reported by Bernhard M. Wiedemann. #1348 #1155

14 months agoMerge branch 'master' into v2.1
Mike Pall [Mon, 13 Jan 2025 15:22:22 +0000 (16:22 +0100)] 
Merge branch 'master' into v2.1

14 months agoFix recording of BC_VARG.
Mike Pall [Mon, 13 Jan 2025 15:19:57 +0000 (16:19 +0100)] 
Fix recording of BC_VARG.

Reported by Bachir Bendrissou.

14 months agoReject negative getfenv()/setfenv() levels to prevent compiler warning.
Mike Pall [Mon, 13 Jan 2025 15:16:27 +0000 (16:16 +0100)] 
Reject negative getfenv()/setfenv() levels to prevent compiler warning.

Thanks to Sergey Kaplun. #1329