Hello. I'm poking around lang-js [0] looking if I can make it better (just for fun). First issue I've stumbled upon is mysterious "Bad can_enter_jit() placement" error. It looks like when we do a jump in user code [1], we should do "can_enter_jit" with new instruction pointer, not the old one. I've changed it (s/=pc/=new_pc/) and everything seems to work fine. It looks like in PyPy it works the same way [2]
My questions are: - Did something change wrt can_enter_jit since that code had been written? I mean besides check that raises that error [3]. - Is it correct to not have any _user_ code run between can_enter_jit and jit_merge_point calls but have some _interpreter_ code there? Error message says that there should be _any_ code between them which seems hardly possible. - Why do we need to place this hint in the beginning of the next iteration of the loop but not at the end of current iteration? It would seem logical to say "you might want to compile from here (start of the loop, one of jit_merge_points) and here (end of the loop, can_enter_jit hing) if you like". - It looks like another piece of old RPython code - tutorial (BF implementation [4]) works fine and gets JIT speedup even without can_enter_jit calls. How does this work? - Would it be more beneficial to analyse user code and provide can_enter_jit hint only for real loops instead of all backward jumps? I tried to google around can_enter_jit but it leads mostly to PyPy commit history so I hope to find answers here. [0] https://bitbucket.org/pypy/lang-js [1] https://bitbucket.org/pypy/lang-js/src/e2275b2/js/jscode.py#cl-240 [2] https://bitbucket.org/pypy/pypy/src/d0f031c/pypy/module/pypyjit/interp_jit.py#cl-89 [3] https://bitbucket.org/pypy/pypy/commits/b538c2f [4] https://bitbucket.org/brownan/pypy-tutorial -- Kind regards, Yuriy.
_______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev