What does mterp mean?

In the source code of dalvik there is a folder called mterp . Its path is /vm/mterp .
I want to know what the word mterp means?

+6
source share
3 answers

"m" means "modular" - mterp is a modular interpreter.

This was an evolution of a previous implementation, which was actually an expression of a monster switch . As noted in mterp README :

This is the source code for the Dalvik translator. The core of the original version was implemented as the only C function, but to improve performance, we rewrote it in the assembly. To make this and future assembly ports easier and less error prone, we used a modular approach that allows you to develop platform-specific code, one operation code at a time.

The ability to switch implementations while detailing the details of an operation was extremely valuable, since it allowed us to switch between C and assembly implementations with a quick change of the configuration file - it is very convenient if you suspected that something in the assembly version was not working perfectly correctly. When we wanted to add floating point support, we simply wrote new fragments of the operation code and created a new configuration file that replaced the commands that depend on the float.

The structure also facilitates the transfer of the interpreter to completely new platforms, because you can switch from a โ€œportableโ€ translator to a โ€œfastโ€ translator in bite-sized pieces.

+2
source

From the Dalvik "mterp" README :

 ==== Overview ==== This is the source code for the Dalvik interpreter. 

Apparently mterp is the name of the interpreter used by Dalvik. It is part of a virtual machine and directly executes or executes code.

0
source

mterp - dalvik vm interpreter module

In the VM language, VM has many modules, such as HeapManager (GC), JNI (native Java interface), Bytecode interpreter, etc.

Here mterp is the Bytecode interpreter module. And you should know that Dalvik vm bytecode is a DEX format. And in the implementation of the vm, mterp interpreter, there are many different arches, such as X86, arm, misp.

If you want to learn this module, I offer you an overview of Dalvik VM / docs / java-bytecode.html. Then study the implementation of mterp c.

0
source

All Articles