6 research outputs found
Object and Reference Immutability using Java Generics
A compiler-checked immutability guarantee provides useful documentation, facilitates reasoning, and enables optimizations. This paper presents Immutability Generic Java (IGJ), a novel language extension that expresses immutability without changing Javas syntax by building upon Javas generics and annotation mechanisms. In IGJ, each class has one additional generic parameter that is Immutable, Mutable, or ReadOnly. IGJ guarantees both reference immutability (only mutable references can mutate an object) and object immutability (an immutable reference points to an immutable object). IGJ is the first proposal for enforcing object immutability, and its reference immutability is more expressive than previous work. IGJ also permits covariant changes of generic arguments in a type-safe manner, e.g., a readonly list of integers is a subtype of a readonly list of numbers. IGJ extends Javas type system with a few simple rules. We formalize this type system and prove it sound. Our IGJ compiler works by type-erasure and generates byte-code that can be executed on any JVM without runtime penalty
Type Interference for Java Bytecodes
Dynamic binding (dispatch) in object-oriented languages prevents compilers from performing static optimizations, such as method inlining. Type Inference, a static optimization technique, helps eliminate dynamic binding by providing compilers with receiver class type information for virtual method invocations during compile time instead of runtime. Type Inference has been implemented on SELF, a pure object-oriented language, and proven effective by inlining (statically binding) 95% of virtual method calls. It has also been tested on other object-oriented languages, and results indicate that the technique is just as effective on other languages as it is on SELF. This research evaluates the effectiveness of Type Inference on Java Bytecodes using the Cartesian Product Algorithm. The technique is applied to a bytecode-to-bytecode optimizer, which reads and parses a Java class file, perforins dataflow analysis and type inference on the bytecodes, performs optimization by eliminating virtual method invocations, and recompiles the modified bytecode into a new Java class file. Evidence resulting from this research indicates that Concrete Type Inference is an effective optimization technique for object-oriented languages, including Java. More importantly, the technique was successfully implemented and tested on Java Bytecodes. The results are not outstanding; however, some improvements are evident from the results. Further improvements should be possible by implementing other optimization techniques, such as method inlining and side-effect analysis
LambdaTransformer : uma solução para o tratamento de Expressões Lambda no JimpleFramework
Trabalho de conclusão de curso (graduação)—Universidade de Brasília, Instituto de Ciências Exatas, Departamento de Ciência da Computação, 2021.Análise de fluxo de dados é um tipo de análise estática que permite a coleta de informações
sobre o comportamento dos dados de um programa em tempo de execução sem que esse código
seja executado. Isso é feito com o uso de ferramentas como Grafos de Controle de Fluxo, CFG,
uma representação de programa que facilita a visualização do comportamento do código e o
desenvolvimento de análises. Códigos Java possuem bytecode baseado em pilha o que torna a
criação de CFGs mais difícil. Frameworks como o Soot utilizam Representações Intermediárias,
RIs, com estruturas mais amigáveis a criação do CFGs e escrita de análises para analisar códi-
gos Java. O Jimple Framework implementa sua própria versão de Jimple, a principal RI de
Soot, utilizando a linguagem de meta-programação Rascal com o intuito de tornar a escrita de
análises menos verbosas em comparação ao Soot. A descompilação de bytecode Java da origem
a código Jimple que pode passar por refinamentos com o intuito de tornar o código mais legível
ou simplificar a realização de alguma análise. A partir de Java 8, expressões lambda foram
introduzidas a linguagem, essas expressões são traduzidas em bytecodecomo instruções invoke-
dynamic. Como todas as instruções presentes no bytecode Java, o Jimple Framework deve
oferecer ferramentas que permitam a realização de análises estáticas, como análise de fluxo de
dados, em códigos que possuam instruções esse tipo, porém esse tipo de instrução faz uso de
ferramentas dentro da JVM que escondem o caminho dos dados, dessa forma impossibilitando
a análise de fluxo e criação do CFG. O Jimple Framework deve refinar código Jimple para per-
mitir análises de códigos com esse tipo de instruções. Este trabalho descreve o processo de
desenvolvimento do LambdaTransformer um módulo do Jimple Framework capaz de transfor-
mar instruções invokedynamic em invokestatic com o uso de funções de travessia de árvore e
casamento de padrões.Dataflow analysis is a type of static analysis that allows gathering information about the behav-
ior of a program’s data at runtime without executing the code. This is done using tools such as
Control Flow Graphs, CFG, a program representation that facilitates the visualization of code
behavior and the development of analysis. Java code has stack-based bytecode which makes
CFG creation more difficult, sometimes impossible. Frameworks like Soot use Intermediate
Representations, IRs, with more user-friendly structures for creating CFGs and writing analyzes
to analyze Java code. Jimple Framework implements its own version of Jimple, Soot’s main IR,
using the Rascal meta-programming language in order to make writing analysis less verbose
compared to Soot. The decompilation of Java bytecode creates a Jimple code that can undergo
refinements in order to make the code more readable or simplify performing some analysis. As
of Java 8, lambda expressions were introduced to the language, these expressions are translated
into bytecode as invokedynamic instructions. Like all instructions present in Java bytecode, Jim-
ple Framework must offer tools that allow static analysis, such as data flow analysis, in codes
that have instructions of this type, but this type of instruction makes use of tools within the
JVM that hide the data flow, thus making flow analysis and CFG creation impossible. The Jim-
ple Frameworkmust refine the Jimple code to allow code parsing with this type of instructions.
This work describes the process of developing LambdaTransformer, a Jimple Framework mod-
ule capable of transforming invokedynamic instructions into invokestatic instructions using tree
traversal and pattern matching functions
Parameterized Object Sensitivity for Points-to Analysis for Java
The goal of points-to analysis for Java is to determine the set of objects pointed to by a reference variable or a reference object field. We present object sensitivity, a new form of context sensitivity for flow-insensitive points-to analysis for Java. The key idea of our approach is to analyze a method separately for each of the object names that represent runtime objects on which this method may be invoked. To ensure flexibility and practicality, we propose a parameterization framework that allows analysis designers to control the tradeo#s between cost and precision in the object-sensitive analysis
Dynamic optimization through the use of automatic runtime specialization
Thesis (S.B. and M.Eng.)--Massachusetts Institute of Technology, Dept. of Electrical Engineering and Computer Science, 1999.Includes bibliographical references (leaves 99-115).by John Whaley.S.B.and M.Eng
Dynamically fighting bugs : prevention, detection and elimination
Thesis (Ph. D.)--Massachusetts Institute of Technology, Dept. of Electrical Engineering and Computer Science, 2009.Cataloged from PDF version of thesis.Includes bibliographical references (p. 147-160).This dissertation presents three test-generation techniques that are used to improve software quality. Each of our techniques targets bugs that are found by different stake-holders: developers, testers, and maintainers. We implemented and evaluated our techniques on real code. We present the design of each tool and conduct experimental evaluation of the tools with available alternatives. Developers need to prevent regression errors when they create new functionality. This dissertation presents a technique that helps developers prevent regression errors in object-oriented programs by automatically generating unit-level regression tests. Our technique generates regressions tests by using models created dynamically from example executions. In our evaluation, our technique created effective regression tests, and achieved good coverage even for programs with constrained APIs. Testers need to detect bugs in programs. This dissertation presents a technique that helps testers detect and localize bugs in web applications. Our technique automatically creates tests that expose failures by combining dynamic test generation with explicit state model checking. In our evaluation, our technique discovered hundreds of faults in real applications. Maintainers have to reproduce failing executions in order to eliminate bugs found in deployed programs. This dissertation presents a technique that helps maintainers eliminate bugs by generating tests that reproduce failing executions. Our technique automatically generates tests that reproduce the failed executions by monitoring methods and storing optimized states of method arguments.(cont.) In our evaluation, our technique reproduced failures with low overhead in real programs Analyses need to avoid unnecessary computations in order to scale. This dissertation presents a technique that helps our other techniques to scale by inferring the mutability classification of arguments. Our technique classifies mutability by combining both static analyses and a novel dynamic mutability analysis. In our evaluation, our technique efficiently and correctly classified most of the arguments for programs with more than hundred thousand lines of code.by Shay Artzi.Ph.D