Thread Setup in Dalvik:
1. dvmThreadStartup() (vm/Thread.c)
-called by dvmStartup()
-This function will setup the thread list and the main
thread's environment
-important codes
thread = allocThread(gDvm.stackSize);
2. allocThread(int interpStackSize)
-Default stack size per stack: 3 * 4k pages
-Important codes
stackBottom = (u1*) malloc(interpStackSize);
thread->interpStackSize = interpStackSize;
thread->interpStackStart = stackBottom + interpStackSize;
thread->interpStackEnd = stackBottom +
STACK_OVERFLOW_RESERVE;(768 bytes)
-The initialized stack in a thread
Stack Push/Pop in Dalvik:
1. At first, dalvik vm main function will invoke
dvmCallMethodV() to interpret the java main
method
2. dvmCallMethodV() will invoke callPrep to push the
stack frame.
-callPrep will invoke dvmPushInterpFrame() to push
the related method frame on the thread's stack.
-The Dalvik vm thread stack frame
沒有留言:
張貼留言