Fix dlsym lookup trampoline for @CriticalNative.

For @CriticalNative we do not have the JniEnv* argument to
retrieve the Thread*, we must use the thread register.

The test 178-app-image-native-method was supposed to cover
this but the profile was missing the necessary references.
We add those references and add $noinline$opt$ tags to make
sure the test actually runs the way it was supposed to and
add extra calls to the critical methods as they can take
different paths on subsequent execution.

Also add an extra test for class initialization checks that
ensures correct behavior for planned direct calls from
compiled managed code to registered @CriticalNative code.

Test: testrunner.py --target --optimizing -t 178
Bug: 112189621
Change-Id: I6a63d990bc08236ebaac7dacb0f5979d835ee321
6 files changed