23.11.2013 Views

Obfuscation of Abstract Data-Types - Rowan

Obfuscation of Abstract Data-Types - Rowan

Obfuscation of Abstract Data-Types - Rowan

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 2. OBFUSCATIONS FOR INTERMEDIATE LANGUAGE 41<br />

be useful to have loops in our language and so we need to recover loops as<br />

well as expressions from IL. Baker [5] gives an algorithm for transforming a<br />

flow graph into a program which contains constructs such as if/then/else and<br />

repeat and Ramshaw [44] shows how many goto statements can be eliminated.<br />

An algorithm is given in [24] which eliminates goto statements by applying<br />

a sequence <strong>of</strong> transformations to move a goto. This is followed by a gotoeliminating<br />

transformation which introduces extra variables and predicates.<br />

Extensions <strong>of</strong> EIL and PLP are discussed in [47] in which the specification<br />

language has a new primitive:<br />

paths(B,P)<br />

which states that all paths through B satisfy the pattern P and the language<br />

can match expressions <strong>of</strong> the form:<br />

while(Cond,Body)<br />

These extensions should allow the specification in Section 2.3.8 to be written<br />

more succinctly.<br />

2.4.2 Transformation Systems<br />

PLP uses the idea <strong>of</strong> Universal Regular Path Queries [14] in which transformations<br />

are expressed as logic predicates using regular expressions. The APTS<br />

system <strong>of</strong> Paige [41] was also a major source <strong>of</strong> inspiration. In APTS, program<br />

transformations are expressed as rewrite rules, with side conditions expressed<br />

as Boolean functions on the abstract syntax tree, and data obtained by program<br />

analyses. As mentioned in Section 2.3.5, the strategy language used in<br />

the toolkit was based on Stratego [55].<br />

Some other transformation systems that provided inspiration for PLP are<br />

briefly described below.<br />

• TyRuBa [17] is based on representing programs as logic propositions. The<br />

system is not really used for program transformations; instead it is used<br />

for the implementation <strong>of</strong> classes and interfaces.<br />

• Gospel [56] is a specification language to express program-improving transformations.<br />

This needs a declaration <strong>of</strong> variables (which might be statements),<br />

a precondition consisting <strong>of</strong> a code pattern and dependencies and<br />

an action.<br />

• TRANS [31] is a language in which temporal logic is used to specify transformations<br />

with rewrite rules. The specification language has constructors<br />

such as E (there exist a path) and A (for all paths) for expressing paths<br />

in a control flow graph.<br />

2.4.3 Correctness<br />

Throughout this chapter we have not been concerned with the correctness <strong>of</strong> the<br />

transformations, i.e. whether a transformation is behaviour-preserving. Proving<br />

the correctness <strong>of</strong> a transformation is a challenging task. In [33] a framework is<br />

provided for proving the correctness <strong>of</strong> compiler optimisations that are expressed

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!