Update: Now that the asker's actual problem has been revealed, here's my updated answer.
First off, there is no need to determine instructions that are "always executed". If you look at the paper, it is referring to the trace of instructions when the program is executed with one particular input. To find the instructions, simply execute the program with that input and record which instructions are executed (of course this assumes the program is purely functional, one of many problems in the paper).
The big question though is why you would want to implement this. From my understanding of the paper, this isn't a very useful or interesting obfuscation+watermarking technique. And implementing it in Java instead only makes it even worse.
If you're just implementing it for fun, knock yourself out, but if you simply want a Java watermarking tool, I'd take a look at an existing project like Sandmark.
Original answer
There are no instructions which are guaranteed to be executed, because execution could stop at any point thanks to Thread.stop()
.
In order to do meaningful analysis, you have to ignore certain types of errors. For example, Krakatau ignores the possibility of Thread.stop
as well as most VirtualMachineErrors
.
At that point, it's just a matter of following the control flow. I'm not sure what your problem is there. If you explain what you're trying to accomplish and what the project requirements are I might be able to suggest a tool.
Edit: If you are trying to find all instructions which are guaranteed to be executed by the program at runtime, rather than guaranteed by static analysis, that is of course an intractable problem. In fact, it's undecideable. And I'm not sure what the use case of this is anyway.