A framework for constructing javascript virtual machines with customized datatype representations
Takafumi Kataoka, Tomoharu Ugawa, Hideya Iwasaki · 2018
Using JavaScript as a description language can increase the productivity of application programs on embedded systems. Since JavaScript is a dynamic language, it is important for a JavaScript virtual machine (VM) to efficiently identify the types of first-class values and perform type-based dispatches while executing VM instructions. Even though the use of tagged pointers is a well-known technique for these operations, the VM implementer has to decide on suitable bit patterns in a tagged pointer according to the characteristics of the target program. This paper presents a novel framework that can generate a customized JavaScript VM on the basis of datatype specifications and operand specifications given by the programmer and instruction definitions supplied by the framework. Datatype specifications describe adequate internal representations of necessary datatypes for a target program and operand specifications do possible operand datatypes for all instructions, while instruction definitions describe the behaviors of all instructions. The generated VM is specialized in the sense that it has efficient and minimum type-based dispatching code for all instructions.