2020 Volume 28 Pages 169-177
For accurate garbage collection (GC), all pointers belonging to the root set must be found. In a virtual machine (VM) implemented in C language, local variables of C language may contain pointers. Thus, some VMs add the values or addresses of local variables to a table that is visible to GC. However, this approach is error-prone because it requires adding local variables and removing them correctly though the entire source code of the VM. In this research, we checked if local variables are added and removed correctly by pattern matching against control flow graphs of the source code of the VM. We applied this check to the VM of a subset of JavaScript we are developing and found that it could identify many cases of missed adding and redundant adding.