Re: Any LuaJIT "continue" patch?

  • From: Luke Gorrie <luke@xxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sat, 15 Apr 2017 07:03:32 +0200

On 14 April 2017 at 21:52, Glenn Maynard <glenn@xxxxxxxx> wrote:

This generates a branch, so it gives exactly the same bytecode as the
equivalent goto (break does the same thing).


My word of caution here is that I believe 'break' and 'goto' do cause the
bytecode compiler to produce surprisingly sub-optimal code, in practice
today with the standard software version, and so your 'continue' mechanism
may encounter these same problems. (I apologize for not showing a test case
-- I don't have one handy and don't recall the exact details.)


(Avoiding fundamental control flow like break, return and continue isn't
"boring", it's just bad code.  I've had to untangle way too much twisted
code from people who apparently heard from a professor 25 years ago never
to use return in the middle of a function...)


That may be a satisfying argument to have with Dijkstra's ghost but I don't
think you will persuade the bytecode compiler with rhetoric... :-)

Other related posts: