![]() We have implemented our reflection analysis in an open-source tool, called SOLAR, and evaluated its effectiveness extensively with large Java programs and libraries. In this article, we provide a comprehensive understanding of Java reflection through examining its underlying concept, API, and real-world usage, and, building on this, we introduce a new static approach to resolving Java reflection effectively in practice. Therefore, improving or even achieving soundness in static reflection analysis-an analysis that infers statically the behaviour of reflective code-will provide significant benefits to many analysis clients, such as bug detectors, security analyzers, and program verifiers. As a result, existing static analysis tools either ignore reflection or handle it partially, resulting in missed, important behaviours, i.e., unsound results. However, this dynamic language feature imposes significant challenges to static analysis, because the behaviour of reflection-rich software is logically complex and statically hard to predict. It allows a software system to inspect and change the behaviour of its classes, interfaces, methods, and fields at runtime, enabling the software to adapt to dynamically changing runtime environments. Java reflection has been widely used in a variety of applications and frameworks. The positive eect of such a behavioral middle layer is twofold: on the one hand it pro- vides us with a standard API for all dynamic analysis based tools to use, on the other hand it allows the tool developer to abstract from the actual implementation technique. This has the advantage that the task of collecting dynamic information is not concerned with low level details of a spe- cific language or virtual machine. We propose to achieve this by introduc- ing a layer of abstraction, i.e., a behavioral middle layer. We want to be able to deal with the runtime system as a collection of reified first-class entities. We focus on object- oriented virtual machine based languages. In this paper, we argue that we need to adopt a higher level view of a software system when considering the task of abstracting runtime information. ![]() Obtaining and exploiting this knowledge to build better analysis tools is cumbersome and often distracts the tool builder from the actual goal, which is the analysis of the runtime behavior of a system. ![]() However, detailed knowl- edge of the target programming language or virtual machine is required to implement dynamic analysis tools. Current approaches for byte-code based systems like Java and Smalltalk rely often on inserting byte-code into the program under analysis. Typically, dynamic analysis involves instrumenting the program under investigation to record its runtime be- havior. The developers of tools for dynamic analysis are faced with choosing from the many approaches to gathering runtime data. This paper is focused on speeding up the reification and the invocation of methods, i.e., on the class SmartMethod that replaces the class Method of the standard reflection library. The efficiency improvement has been proved by providing a new reflection library compliant – that is, it provides exactly the same services –, with the standard Java reflection library based on the proposed approach. The basic idea of the proposed approach consists of moving most of the overhead due to the dynamic introspection from run-time to compiletime. In this work, we have investigated about the performance issue in the context of the Java reflection library and presented a different approach to the introspection in Java that improves its performances. In spite of its evident usefulness, reflection has many detractors, who claim that it is too inefficient to be used with real profit. In the last few years the interest in reflection has grown and many modern programming languages/environments (e.g., Java and.NET) have provided the programmer with reflective mechanisms, i.e., with the ability of dynamically looking into (introspect) the structure of the code from the code itself. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |