Publication Details: UM-CS-2013-011

The Doppio JVM: Building a Complete Language in the Browser

Publication Type:Technical Report
Author(s):J. W. Vilk, C. M. Carey, J. Ng, E. D. Berger
Abstract:Web browsers are rapidly overtaking native environments as the central focus of application development. Developers are building increasingly rich and responsive applications that run entirely in the browser. However, web applications must be written in JavaScript, the only language available in all browsers. Developers thus cannot reuse existing code in other languages; rewriting this code in JavaScript can be onerous and error-prone.

An attractive alternative is to enable the execution of standard programming languages within the browser. This approach would let programmers use familiar languages and reuse the large body of existing code. However, targeting JavaScript and the browser environment presents significant challenges to language implementors: the vagaries of JavaScript and idiosyncrasies of the browser environment, such as asynchronous-only APIs; a single thread of execution; a lack of standard runtime and OS services; and the diversity of browser implementations.

This paper analyzes the challenges that anyone building a complete language implementation in the browser must face, and shows how to overcome them. We present the design and implementation of Doppio, the first complete implementation of the Java Virtual Machine in JavaScript that runs entirely in the browser. We describe how Doppio provides the full range of JVM functionality in the browser environment, including language implementation, runtime, and system services. While complete, Doppio remains slow: across a set of complex JVM applications, Doppio runs between 11× and 60× slower than Oracle’s HotSpot JVM interpreter (geometric mean: 29×).
Document: [AVAILABLE HERE]
Submitted on:2013-03-30