0 Replies Latest reply on Apr 25, 2018 3:20 PM by peterz

    Counting instructions while JVM executes them

    peterz

      Hi there,

       

      The system I'm working on loads user-supplied code from a byte array and executes it. I need to put a limit on the number of steps executed by that code, and throw an exception if that limit is violated. What options do I have? Is there a way to count JVM instructions while executing them?

       

      I realize I can use a custom classloader to instrument bytecode and add counters etc, I just feel there must be some simpler way.

       

      Thanks!