c*m 发帖数: 836 | 1 前两天看到一个面试题,怎么确定stack grow的方向,是从高地址到低地址,还是相反
。这个问题用C很容易,写两个nested function call, 在每个里面分配一个变量,然
后检查指针就行了。Java 有什么办法呢? | m******t 发帖数: 2416 | 2 Are you sure it was an interview for a Java job? | c*m 发帖数: 836 | 3 I read it sometime ago on internet, and the question says, 'using java or c+
+', this really got me | m******t 发帖数: 2416 | 4 Don't know how to do this in Java - calling a JNI function from two nested
Java methods? What's the point anyway? | c*****t 发帖数: 1879 | 5 The interpreter stack is different from the native method stack.
The interpreter stack (1) can be allocated on heaps, may be expandable,
and need not to be contiguous.
The native method stack (2) is a C calling stack, not expandable.
So using JNI would only provide you C-calling stack information.
However, maybe you could inspect the VM to generate the necessary
information for stack. Throwable.fillStackTrace() (spelling?) is
a native function call. If you have the source code of that piece
of
【在 m******t 的大作中提到】 : Don't know how to do this in Java - calling a JNI function from two nested : Java methods? What's the point anyway?
|
|