Journal of Information Processing
Online ISSN : 1882-6652
ISSN-L : 1882-6652
 
Design and Implementation of a Java Bytecode Manipulation Library for Clojure
Seiji UmataniTomoharu UgawaMasahiro Yasugi
Author information
JOURNAL FREE ACCESS

2015 Volume 23 Issue 5 Pages 716-729

Details
Abstract

Recently, the Java Virtual Machine (JVM) has become widely used as a common execution platform for various applications. There is often the need to manipulate bytecodes at class-load time, particularly in application domains that demand dynamic modification of program behaviors. Whereas several bytecode manipulation tools for Java exist for implementing such behaviors, JVM is also the platform for various modern programming languages, and there is no need to write bytecode manipulation programs exclusively in Java. In this paper, we propose a novel bytecode manipulation library for Clojure, a Lisp dialect running on JVM. Our library is as expressive and flexible as ASM, the de facto standard bytecode manipulation tool in Java, while enabling more concise representation of typical manipulation cases. Our library works at class-load time as a series of rewrites of (parts of) the tree representing the target class file, basically in a similar way to Lisp's macro system. However, our library differs from Lisp's macro system in the following significant respects. First, instead of matching a single name against the first item of the target form (tree), our library matches a tree pattern against the target tree itself during macro expansion so that users can define rewriting rules for raw class files that cannot contain any special tags (names) for pattern matching. Furthermore, along with matching tree patterns, our library can extract any information from the static context easily and thus allows users to avoid cumbersome manual management of such information.

Content from these authors
© 2015 by the Information Processing Society of Japan
Previous article Next article
feedback
Top