JonathanSalwan / Triton

Triton is a dynamic binary analysis library. Build your own program analysis tools, automate your reverse engineering, perform software verification or just emulate code.
https://triton-library.github.io
Apache License 2.0
3.4k stars 524 forks source link

Is `processing` noexcept? #1252

Closed illera88 closed 1 year ago

illera88 commented 1 year ago

Hi,

I'm wondering if the method processing from context should be noexcept. I believe so since the method now returns an error code.

I'm asking because of this

Thanks

SweetVishnya commented 1 year ago

I think I've seen it throwing exceptions.

illera88 commented 1 year ago

Shouldn't it better be no except since it's already returning an error? Otherwise we should wrap processing under a try/catch and that impacts performance on a function call that it's called on every single instruction.

Regards

SweetVishnya commented 1 year ago

Shouldn't it better be no except since it's already returning an error? Otherwise we should wrap processing under a try/catch and that impacts performance on a function call that it's called on every single instruction.

Regards

cc @JonathanSalwan, @cnheitman

JonathanSalwan commented 1 year ago

It's a design choice that is not easy to take. Currently, when calling processing you can still have some exceptions raised for internal error. Returning an error from really deep in the code to processing will "pollute" this really beautiful base code :P. Is the try/catch really impact the performance? Did you bench it?

illera88 commented 1 year ago

I did not bench it. I just thought it would never except since it's already returning an error code and my next thought was that having to try/catch will slow things down. Also doing some grepping in the code I didn't see any instance of processing being wrapped in a try/catch.

In any case, I don't have any specific data to backup that the code will slow down by adding a try/catch so I'm closing the ticket.

Thanks guys!