Safe implementation of C pointer arithmetics by translation to java

Yuhki Kamijima, Eijiro Sumii

Research output: Contribution to journalArticlepeer-review

3 Citations (Scopus)


We implemented a translator from a subset of C to Java that guarantees safety. For such translation, we need to emulate C's pointer arithmetics in Java. We thus defined Java classes to represent C's pointers and memory blocks. Next, we defined translation rules which use these classes, and implemented a translator following the rules. We also need to translate integers as pointers, because they can be cast to each other in C. However, representing all integers as pointers incurs too much overhead. We therefore implemented optimizations, including a data flow analysis for translating C's integer variables (to which no pointers are assigned) to Java's integer variables. We conducted experiments with 9 benchmark programs. Without optimizations, the translated programs were 3.3-585 times slower than the original C programs. After the optimizations, those numbers improved to 1.3-5.9.

Original languageEnglish
Pages (from-to)139-154
Number of pages16
JournalComputer Software
Issue number1
Publication statusPublished - 2009 Jun 19

ASJC Scopus subject areas

  • Software


Dive into the research topics of 'Safe implementation of C pointer arithmetics by translation to java'. Together they form a unique fingerprint.

Cite this