Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Feature or enhancement
Proposal:
I would like to add a method to the UOpExecutor type to expose the JIT code via a byte string using thejit_code andjit_size fields of the executor object. This would be useful for testing and debugging, as well as verification code.
from_opcodeimportget_executordefget_executors(func):code=func.__code__co_code=code.co_codeexecutors= {}foriinrange(0,len(co_code),2):try:executors[i]=co_code[i],get_executor(code,i)exceptValueError:passreturnexecutorsdeftestfunc(x):i=0whilei<x:i+=1testfunc(20)ex=get_executors(testfunc)withopen('jit_dump.raw','wb')asdumpfile:fori,executorinex.items():print(i,executor[0],executor[1])try:code=executor[1].get_jit_code()dumpfile.write(code)exceptValueError:print('Failed to get JIT code for',executor[0])deff():a= [0,1,2,3]returna[1]
Has this already been discussed elsewhere?
https://discuss.python.org/t/jit-mapping-bytecode-instructions-and-assembly/50809
Links to previous discussion of this feature:
No response