Virtual Machine Showdown: Stack Versus Registers
http://www.usenix.org/events/vee05/full_papers/p153-yunhe.pdf

오래만에 잼나게 본 논문이다.
stack based vm이냐, register based vm이 어떤가 해서 봤는데.. 역쉬

sun(oracle) jvm의 경우는 어떤 환경에서도 돌릴 수 있도록 디자인 되어 있기 때문에, stack based로 가게 된다. 대신 성능이 조금 떨어질 수 있겠다.
그러나 android jvm의 경우는 특정 환경에 돌려야 하기 때문에 빠른 성능이 중요하다. 따라서, 구글은 register based jvm으로 선택했다.

예전에 임베디드 분야에 일 할때, pjava, cldc, cvm 기반 위에서 동작했던 부분을 생각했을 때, 이 부분을 고려했었으면 더 좋은 성과가 나지 않았을 까 생각도 든다.
구글은 참 머리가 좋았다. 바로 과거의 실패를 생각하고 정말 중요한 부분이 무엇인지 파악하고 그 부분에 대해서 고민을 했다라는 생각이 들었다.


머 하여튼..
논문으로 돌아가서. stack based bytecode들을 register based bytecode로 바꿨더니 45%의 instuction 이 줄어들고, size도 25%나 줄어들었다고 한다. 사실 생각해보면, operand가 들어가고, 약간 고급스러워진 bytecode덕택이라고 생각한다. 펜티움 4에서 실행속도도 32.3%도로 줄어들었다고 한다.
수치는 약간 테스트환경이라 다를 수 있지만, 이처럼 굳이 특정 target 플랫폼에서 동작한다고 가정한다면, register 기반이 훨씬 좋을 것 같다.


The result is that we eliminate an average
of more than 47% of executed VM instructions, with the
register machine bytecode size only 25% larger than that of
the corresponding stack bytecode. Secondly we present an
implementation of a register machine in a fully standardcompliant
implementation of the Java VM. We find that,
on the Pentium 4, the register architecture requires an average
of 32.3% less time to execute standard benchmarks if
dispatch is performed using a C switch statement. Even if
more efficient threaded dispatch is available (which requires
labels as first class values), the reduction in running time is
still approximately 26.5% for the register architecture.
Posted by '김용환'
,