Apparat (software)
Encyclopedia
Apparat is an open-source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

 language manipulation and optimization framework for the ActionScript
ActionScript
ActionScript is an object-oriented language originally developed by Macromedia Inc. . It is a dialect of ECMAScript , and is used primarily for the development of websites and software targeting the Adobe Flash Player platform, used on Web pages in the form of...

 language released under the GNU Lesser General Public License
GNU Lesser General Public License
The GNU Lesser General Public License or LGPL is a free software license published by the Free Software Foundation . It was designed as a compromise between the strong-copyleft GNU General Public License or GPL and permissive licenses such as the BSD licenses and the MIT License...

 (LGPL). It may also be used to perform static code analysis
Static code analysis
Static program analysis is the analysis of computer software that is performed without actually executing programs built from that software In most cases the analysis is performed on some version of the source code and in the other cases some form of the object code...

 like reaching definitions and dominance analysis.

The Apparat framework is inspired by Soot and written in the Scala programming language on the Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 platform. It contains command-line tools to work with SWF
SWF
SWF is an Adobe Flash file format used for multimedia, vector graphics and ActionScript. Originating with FutureWave Software, then transferred to Macromedia, and then coming under the control of Adobe, SWF files can contain animations or applets of varying degrees of interactivity and function.,...

 files.

Dump

The Dump tool extracts information of a compiled SWF file by analyzing its bytecode
Bytecode
Bytecode, also known as p-code , is a term which has been used to denote various forms of instruction sets designed for efficient execution by a software interpreter as well as being suitable for further compilation into machine code...

 and structure. It can generate UML
Unified Modeling Language
Unified Modeling Language is a standardized general-purpose modeling language in the field of object-oriented software engineering. The standard is managed, and was created, by the Object Management Group...

 diagrams and inheritance graphs
Inheritance (object-oriented programming)
In object-oriented programming , inheritance is a way to reuse code of existing objects, establish a subtype from an existing object, or both, depending upon programming language support...

.

TDSI

TDSI is a command-line tool which allows ActionScript developers to use the fast Alchemy
Alchemy (Adobe)
Alchemy is a research project from Adobe Systems that allows compiling C and C++ code to ActionScript Virtual Machine , so that it can be run on Flash Player or Adobe AIR. This is achieved by compiling C/C++ code to LLVM bytecode and then translating LLVM to ActionScript 3 with inlined AVM2...

 opcode
Opcode
In computer science engineering, an opcode is the portion of a machine language instruction that specifies the operation to be performed. Their specification and format are laid out in the instruction set architecture of the processor in question...

s. The use of predefined functions will be replaced with the corresponding bytecode resulting in a significant speed improvement.

Example

The following example shows the behaviour of TDSI. Since the call to a static method is considered slow it will be replaced with the corresponding Alchemy opcode.

ActionScript:
Memory.writeInt( 1, 0 );

Pseudo bytecode:
GetLex Memory
PushByte 1
PushByte 0
CallVoid writeInt, 2

After inline expansion:
PushByte 1
PushByte 0
WriteInt

TAAS

TreeAddressActionScript (TAAS) is an intermediate representation of ActionScript Bytecode in optional SSA form
Static single assignment form
In compiler design, static single assignment form is a property of an intermediate representation , which says that each variable is assigned exactly once...

. The TAAS compiler is an optimizing compiler supporting:
  • Copy propagation
    Copy propagation
    In compiler theory, copy propagation is the process of replacing the occurrences of targets of direct assignments with their values. A direct assignment is an instruction of the form x = y, which simply assigns the value of y to x.From the following code:...

  • Constant folding
    Constant folding
    Constant folding and constant propagation are related compiler optimizations used by many modern compilers. An advanced form of constant propagation known as sparse conditional constant propagation can more accurately propagate constants and simultaneously remove dead code.- Constant folding...

  • Strength reduction
    Strength reduction
    Strength reduction is a compiler optimization where expensive operations are replaced with equivalent but less expensive operations. The classic example of strength reduction converts "strong" multiplications inside a loop into "weaker" additions – something that frequently occurs in array...

  • Loop-invariant code motion
    Loop-invariant code motion
    In computer programming, loop-invariant code consists of statements or expressions which can be moved outside the body of a loop without affecting the semantics of the program...

  • Inline expansion
    Inline expansion
    In computing, inline expansion, or inlining, is a manual or compiler optimization that replaces a function call site with the body of the callee. This optimization may improve time and space usage at runtime, at the possible cost of increasing the final size of the program In computing, inline...

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK