From b8ebf36b18949f1b90382651b04a3897e8a5dec8 Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Wed, 8 Nov 2017 07:31:36 +0000 Subject: [PATCH 1/2] lj_record.c: Record IFUNC/IFUNCV the same as FUNC/FUNCV Record calls to blacklisted functions the same way as calls to uncompiled functions. This allows for the possibility that a blacklisted function can be successfully recorded as part of a larger trace. This is specifically intended to fix the problem where a tiny utility function somewhere, such as `ntohs`, is not able to be compiled in isolation for some reason and that ends up preventing all of its callers from compiling too. This has tended to happen for obscure reasons like "the utility function ends with a tail-call to a C library routine" and with this patch we should not need to worry about such minutiae anymore. (We should be able to retire the "wrap in parenthesis to prevent a tailcall" trick that some people are familiar with.) More background: - How the trace recorder treats function calls: raptorjit/raptorjit#118. - Why this can be a problem: raptorjit/raptorjit#119. - More on this specific solution: raptorjit/raptorjit#120. --- lib/luajit/src/lj_record.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/luajit/src/lj_record.c b/lib/luajit/src/lj_record.c index 532e7ffda7..1190bb2809 100644 --- a/lib/luajit/src/lj_record.c +++ b/lib/luajit/src/lj_record.c @@ -2332,8 +2332,6 @@ void lj_record_ins(jit_State *J) case BC_IFORL: case BC_IITERL: case BC_ILOOP: - case BC_IFUNCF: - case BC_IFUNCV: lj_trace_err(J, LJ_TRERR_BLACKL); break; @@ -2345,6 +2343,7 @@ void lj_record_ins(jit_State *J) /* -- Function headers -------------------------------------------------- */ case BC_FUNCF: + case BC_IFUNCF: rec_func_lua(J); break; case BC_JFUNCF: @@ -2352,6 +2351,7 @@ void lj_record_ins(jit_State *J) break; case BC_FUNCV: + case BC_IFUNCV: rec_func_vararg(J); rec_func_lua(J); break; From 84695bc8486409606d674a9a2ce755f78c45b0cb Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Mon, 14 May 2018 14:47:57 +0200 Subject: [PATCH 2/2] Update changelog for v3.1.10 --- src/program/lwaftr/doc/CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/program/lwaftr/doc/CHANGELOG.md b/src/program/lwaftr/doc/CHANGELOG.md index 1b83637093..3c55a58ec7 100644 --- a/src/program/lwaftr/doc/CHANGELOG.md +++ b/src/program/lwaftr/doc/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## [3.1.10] - 2018-05-14 + +* Apply hot-fix to LuaJIT to prevent blacklisted functions from + permanently preventing optimization, even after a JIT flush. For more + details, see: + + https://github.com/snabbco/snabb/pull/1244 + ## [3.1.9] - 2017-05-18 * Add "snabb --version" command-line argument.