From my understanding, throw
is a primative jvm command. When this is called, the JVM "checks if the current call stack can catch it". if it can't, then java simply pops the call stack almost exactly as if a return was called. then the jvm "checks if the current call stack can catch it" and so on recursively.
My question: how is it algorithmically possible for the JVM to know where in the call stack can catch a given exception? Is there metadata stored in each call stack entry mapping exceptions to code blocks? is there a static data structure in the heap that somehow keeps track of this? because somewhere there has to be data keeping track of that.