Question

I noticed that when there is finally clause in the java code, there is always .catchall generated to identify the finally block or to inline it using the .catchall label, but I haven't found any online information about whether is the case or more explanation, does anybody know about this?

Was it helpful?

Solution

Yes, A finally block is one case when a .catchall may be generated. However, it can be used for other things as well. For example, it can also be generated in the case of a synchronized method, to ensure the lock is released.

The catch all handler is documented in the dex-format specification. Specifically, in the encoded_catch_handler item that is contained in the code_item.

Also related is the equivalent piece of data in the classfile specification. See the catch_type item, in the exception_table.

OTHER TIPS

I think you might be expecting too much.

What you are asking about is (in effect) the code generation patterns of the davlik code generator / translator. In my experience, people don't write detailed descriptions of what compilers / code generators do under the cover:

  • These behaviors don't require specifying. Indeed a specification is liable to do harm, by over-constraining the implementation.
  • Such documentation would be expensive to write and maintain.
  • Such documentation would have few readers to justify the expense.

I suggest that you look at the source code for the davlik translator and see what it actually does. (Try grepping for "catchall" ...)


Note that the dex format specification gives you the output "language" and what it means. That constrains what the davlik translator could do, but it won't tell you what the translator is actually going to do in all cases.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top