请问string.find无法jit,怎样修改?

84 views
Skip to first unread message

ty javac

unread,
Jun 27, 2016, 8:03:00 PM6/27/16
to openresty
nginx version: openresty/1.9.15.1

LuaJIT 2.1.0-beta2 -- Copyright (C) 2005-2016 Mike Pall. http://luajit.org/

lua代码:

 1 function explode ( _str,seperator )
  2     local pos, arr = 0, {}
  3         for st, sp in function() return string.find( _str, seperator, pos, true     ) end do
  4             table.insert( arr, string.sub( _str, pos, st-1 ) )
  5             pos = sp + 1
  6         end
  7     table.insert( arr, string.sub( _str, pos ) )
  8     return arr
  9 end

函数调用时,seperator为普通字符,看http://wiki.luajit.org/NYI#libraries_string-library :
string.find2.1 partialOnly fixed string searches (no patterns).

/tmp/jit.log:
[TRACE --- imgresize.lua:1 -- NYI: bytecode 51 at imgresize.lua:3]
[TRACE --- imgresize.lua:3 -- leaving loop in root trace]
[TRACE --- imgresize.lua:1 -- NYI: bytecode 51 at imgresize.lua:9]
[TRACE --- imgresize.lua:1 -- NYI: bytecode 51 at imgresize.lua:3]
[TRACE --- imgresize.lua:1 -- NYI: bytecode 51 at imgresize.lua:9]
[TRACE --- imgresize.lua:3 -- leaving loop in root trace]

./luajit/bin/luajit nginx/lua/ljbc.lua 51
opcode 51:
FNEW

DeJiang Zhu

unread,
Jun 28, 2016, 11:05:20 AM6/28/16
to open...@googlegroups.com
你是如何判断是 string.find 无法 jit 的呢
opcode 51: FNEW,是指的:function()  end

--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty...@googlegroups.com
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
归档: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
教程: http://openresty.org/download/agentzh-nginx-tutorials-zhcn.html

Reply all
Reply to author
Forward
0 new messages