{"title":"Elephant Tracks: generating program traces with object death records","authors":"Nathan P. Ricci, Samuel Z. Guyer, J. Moss","doi":"10.1145/2093157.2093178","DOIUrl":"https://doi.org/10.1145/2093157.2093178","url":null,"abstract":"We introduce Elephant Tracks (ET), a dynamic program analysis tool for producing traces of garbage collection events, including object allocations, object deaths, and pointer updates. Like prior work, our tracing tool is based on the Merlin algorithm Hertz et al. [2002], but offers several substantial new capabilities. First, it is much more precise than previous tools: it measures time in terms of method entries and exits, allowing it to place events precisely in the context of the program structure. Furthermore, we exploit this notion of time to actually reduce the amount of work required to compute precise object death times. Second, it is implemented using a combination of JVM Tool Interface (JVMTI) Microsystems [2004] callbacks and bytecode rewriting, and works with any standard JVM. Finally, it properly handles Java Reference objects, including weak references, finalization, and multithreaded programs.","PeriodicalId":169989,"journal":{"name":"Principles and Practice of Programming in Java","volume":"1 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2011-08-24","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"122904183","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Trace-based compilation for the Java HotSpot virtual machine","authors":"Christian Häubl, H. Mössenböck","doi":"10.1145/2093157.2093176","DOIUrl":"https://doi.org/10.1145/2093157.2093176","url":null,"abstract":"Traditional method-based just-in-time (JIT) compilation translates whole methods to optimized machine code. Trace-based compilation only generates machine code for frequently executed paths, so-called traces, that may span multiple methods.\u0000 In this paper, we present our implementation of a trace-based JIT compiler in which we modified the mature, method-based Java HotSpot client compiler. To simplify trace recording, we added a bytecode preprocessing step that detects and directly marks loops within the bytecodes. We duplicated the existing bytecode interpreter and instrumented it for trace recording. In our implementation, traces can be anchored both at loop headers and at method entries. When a trace anchor has been executed frequently enough, trace recording is started. After several times of trace recording, our modified JIT compiler merges the recorded traces into a structure suitable for compilation. During compilation, trace-specific optimizations are applied and guarded with runtime checks if necessary. The generated machine code is then invoked by the interpreter or by already compiled traces. If a method part must be executed that was not covered by traces and therefore not compiled, or if a runtime guard fails, execution falls back to the interpreter.\u0000 Benchmarks show an improved performance, less generated machine code and faster compilation compared to the method-based Java HotSpot client compiler. The peak performance of the SPECjvm2008 benchmarks is increased by 9% on average, while 29% less machine code is generated. Similarly, the performance of the SPECjbb2005 benchmark is increased by 13% and the DaCapo 9.12 Bach benchmarks show a peak performance increase of 5% on average.","PeriodicalId":169989,"journal":{"name":"Principles and Practice of Programming in Java","volume":"36 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2011-08-24","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"129543348","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Object reuse and behavior adaptation in Java-like languages","authors":"Lorenzo Bettini, B. Venneri","doi":"10.1145/2093157.2093173","DOIUrl":"https://doi.org/10.1145/2093157.2093173","url":null,"abstract":"Inheritance, which is a basic mechanism in mainstream object-oriented languages, introduces a strong coupling which limits modularity and code reuse. Furthermore, static class hierarchies cannot easily deal with unpredictable dynamic adaptations of the object behavior. In order to overcome these limitations, we propose new linguistic constructs for composing objects in a Java-like language. Objects are intended as featherweight components which can be used in multiple compositions, and object types specify not only the implemented functionalities, but also the required methods, which will be provided by other components during composition. Thus the language supports flexible object reuse and adaptation of the object behavior at run time. The static type discipline guarantees that method calls on well-typed object compositions are safe.","PeriodicalId":169989,"journal":{"name":"Principles and Practice of Programming in Java","volume":"163 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2011-08-24","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"125920798","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"A DSL for writing type systems for Xtext languages","authors":"Lorenzo Bettini","doi":"10.1145/2093157.2093163","DOIUrl":"https://doi.org/10.1145/2093157.2093163","url":null,"abstract":"Xtext is a framework for the development of languages, which also generates all the typical and recurrent artifacts for a fully-fledged IDE on top of Eclipse. The validation (e.g., checking the correctness of programs from the point of view of types) of languages developed in Xtext has to be implemented by the programmer writing Java code. In this paper we present XTypeS (Xtext TypeSystem), a DSL for writing the type system for an Xtext language. A type system definition in XTypeS is a set of rules which act on the elements of the AST of a program, which in Xtext is represented by an EMF model. Then, XTypeS will generate the corresponding Java code that can be used to implement the validation part for a language developed in Xtext. We describe the features of XTypeS by writing the type system of two languages implemented in Xtext: Featherweight Java and λ-calculus.","PeriodicalId":169989,"journal":{"name":"Principles and Practice of Programming in Java","volume":"18 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2011-08-24","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"115630790","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Well-typings for Javaλ","authors":"Martin Plümicke","doi":"10.1145/2093157.2093171","DOIUrl":"https://doi.org/10.1145/2093157.2093171","url":null,"abstract":"In the last decade Java has been extended by some features, which are well-known from functional programming languages. In Java 8 the language will be expanded by closures (λ-expressions).\u0000 In our contribution we give a formal definition for an abstract syntax of a reduced language Javaλ with closures, define the type system, and formalize the subtyping relation. We define the set of types as an extension of the generic type definition for Java 5 types.\u0000 Finally, we give a type inference system, which describes the typings of Javaλ expressions and statements and we present a type inference algorithm. The type inference algorithm is an adaptation of a type inference algorithm for a typed λ--calculus.\u0000 The inferred types are well-typings. A well-typing is a conditional type for an expression, where the conditions are given by a set of consistent coercions.","PeriodicalId":169989,"journal":{"name":"Principles and Practice of Programming in Java","volume":"9 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2011-08-24","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"124663140","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Quarantine: a framework to mitigate memory errors in JNI applications","authors":"Du Li, W. Srisa-an","doi":"10.1145/2093157.2093159","DOIUrl":"https://doi.org/10.1145/2093157.2093159","url":null,"abstract":"By using Java Native Interface (JNI), programmers can integrate Java programs with legacy applications or third-party libraries written in other languages (e.g., C, C++, and Pascal). However, the use of JNI can bypass the Java boundary checking and exception-handling mechanisms. Furthermore, its use can violate Java's type-safety feature because of the type-mismatches between native programs and Java programs. As a result, such integration can cause various security issues including heap errors that can be dangerous and difficult to detect.\u0000 In this paper, we introduce Quarantine, a runtime system that can identify objects accessible by native methods and then migrate these objects to a quarantine area, which is used specifically to host this type of object. The goal of Quarantine is to create a runtime platform that allows programmers to apply existing heap protection techniques that have been designed for native languages but do not work well in the Java domain. We implemented Quarantine in Jikes RVM and evaluated its performance using the optimizing compiler. Our results using nine benchmark programs indicate that Quarantine, on average, incurs execution overhead of 14% and 13% when the heap is two and five times larger than the minimum heap requirement for an application, respectively.","PeriodicalId":169989,"journal":{"name":"Principles and Practice of Programming in Java","volume":"1 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2011-08-24","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"126852936","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Vincent Cavé, Jisheng Zhao, J. Shirako, Vivek Sarkar
{"title":"Habanero-Java: the new adventures of old X10","authors":"Vincent Cavé, Jisheng Zhao, J. Shirako, Vivek Sarkar","doi":"10.1145/2093157.2093165","DOIUrl":"https://doi.org/10.1145/2093157.2093165","url":null,"abstract":"In this paper, we present the Habanero-Java (HJ) language developed at Rice University as an extension to the original Java-based definition of the X10 language. HJ includes a powerful set of task-parallel programming constructs that can be added as simple extensions to standard Java programs to take advantage of today's multi-core and heterogeneous architectures. The language puts a particular emphasis on the usability and safety of parallel constructs. For example, no HJ program using async, finish, isolated, and phaser constructs can create a logical deadlock cycle. In addition, the future and data-driven task variants of the async construct facilitate a functional approach to parallel programming. Finally, any HJ program written with async, finish, and phaser constructs that is data-race free is guaranteed to also be deterministic.\u0000 HJ also features two key enhancements that address well known limitations in the use of Java in scientific computing --- the inclusion of complex numbers as a primitive data type, and the inclusion of array-views that support multidimensional views of one-dimensional arrays. The HJ compiler generates standard Java class-files that can run on any JVM for Java 5 or higher. The HJ runtime is responsible for orchestrating the creation, execution, and termination of HJ tasks, and features both work-sharing and work-stealing schedulers. HJ is used at Rice University as an introductory parallel programming language for second-year undergraduate students. A wide variety of benchmarks have been ported to HJ, including a full application that was originally written in Fortran 90. HJ has a rich development and runtime environment that includes integration with DrJava, the addition of a data race detection tool, and service as a target platform for the Intel Concurrent Collections coordination language","PeriodicalId":169989,"journal":{"name":"Principles and Practice of Programming in Java","volume":"01 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2011-08-24","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"117123240","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Space-based multi-core programming in Java","authors":"S. Gudenkauf, W. Hasselbring","doi":"10.1145/2093157.2093164","DOIUrl":"https://doi.org/10.1145/2093157.2093164","url":null,"abstract":"Multi-core processors require programmers to exploit concurrency in software as far as possible. Unfortunately, our current concurrency abstractions make multi-core programming harder than necessary because we have to reduce unintended non-determinism on a very low level of abstraction, for instance via synchronisation mechanisms. In this experience paper we analyse if space-based systems can mitigate multi-core programming in the Java programming language and present the Procol programming model that introduces the space-based choreography of active components, which internally orchestrate fine-grained workflow activities. The main contributions are (1) the Procol programming model, (2) benchmark results of the scalability of different tuple space implementation techniques that we evaluated on different multi-core architectures, (3) benchmark results of the scalability of two equivalent Mandelbrot applications for best-case measurements -- one implemented with the standard Java thread model, one with our Procol programming model. The conclusions drawn from these experiments are (1) tuple space data structures that scale reasonably well can be provided, (2) the performance overhead that Procol imposes is at least for the considered application a reasonable trade-off for the ease of programming provided for multi-core architectures.","PeriodicalId":169989,"journal":{"name":"Principles and Practice of Programming in Java","volume":"1 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2011-08-24","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"125693055","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Evaluating Java runtime reflection for implementing cross-language method invocations","authors":"Stefan Sobernig, Uwe Zdun","doi":"10.1145/1852761.1852781","DOIUrl":"https://doi.org/10.1145/1852761.1852781","url":null,"abstract":"Cross-language method invocations are commonly used for integrating objects residing in different programming language environments. In this experience report, we evaluate the performance and the design impact of alternative implementations of cross-language method invocations for the object-oriented scripting language Frag, implemented and embedded in Java. In particular, we compare reflective integration and generative integration techniques. For that, we present a performance evaluation based on a large set of test cases. In addition, we propose a new method for quantifying and comparing the implementation efforts needed for cross-language method invocations based on cross-language refactorings. We report on the lessons learnt and discuss the consequences of the implementation variants under review.","PeriodicalId":169989,"journal":{"name":"Principles and Practice of Programming in Java","volume":"13 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2010-09-15","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"114666227","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Cross-compiling Android applications to the iPhone","authors":"A. Puder","doi":"10.1145/1852761.1852772","DOIUrl":"https://doi.org/10.1145/1852761.1852772","url":null,"abstract":"Smartphones such as Android-based devices and Apple's iPhone have become popular platforms for mobile applications. In particular, they allow the development of native applications that can take advantage of special purpose hardware such as accelerometers or GPS. While similar in capabilities, smartphones differ greatly in the way native applications have to be written for them. Google's Android is based on Java with an Android-specific set of widgets, while Objective-C is Apple's first choice for developing iPhone applications. In fact, Apple explicitly prohibits Java virtual machines on the iPhone per license agreement. Objective-C and Java are two radically different programming languages. While Java features strong typing and garbage collection, Objective-C supports dynamic typing but no garbage collection. This paper describes a technique how Java-based Android applications can be cross-compiled to native iPhone applications. Furthermore, it is shown how the Android API can be mapped to the iPhone-specific Cocoa Touch API.","PeriodicalId":169989,"journal":{"name":"Principles and Practice of Programming in Java","volume":"15 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2010-09-15","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"128117492","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}