Add ConcreteBytecode.{instr_at_code_offset, index_at_code_offset}#10
Add ConcreteBytecode.{instr_at_code_offset, index_at_code_offset}#10eric-wieser wants to merge 1 commit intoMatthieuDartiailh:mainfrom
Conversation
|
Re: naming:
|
c92c25c to
dd5a66c
Compare
dd5a66c to
7410ccf
Compare
|
Hum, I expect new user requests in the future for new methods using byte offset rather than index in the list of instructions. I suggest to experiment a different design: add a method to get a read-only view of a ConcreteBytecode object which only works with offset. Something like: Your frame.f_lasti usecase becomes obvious with such view. It's a view, so the view is modified if the code is modified. |
|
That's a neat idea. How would Also, without directly exposing the index, I'm still stuck trying to index a I should probably point out that issue I'm trying to workaround is that the following can fail due to absolute jump targets:
So the abstraction needs to happen before the slicing, |
|
Sorry, but I still don't understand your use case :-( And I think that it's important to understand it to design the "right" API. Can you give an example of the final expected output? Do you want to display bytecode as text? Abstract or concrete bytecode? |
|
I want to obtain abstract bytecode corresponding to the code executed between two |
As discussed in #9.
Suggestions welcome for better method names