Automatic derivation of Semantic Properties in 'NET - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Automatic derivation of Semantic Properties in 'NET

Description:

Extract semantics from an assembly using a tool (IL reader) Store ... Used internal by MS for compiling Windows, PowerPoint, games and for building test tools. ... – PowerPoint PPT presentation

Number of Views:44
Avg rating:3.0/5.0
Slides: 15
Provided by: mich277
Category:

less

Transcript and Presenter's Notes

Title: Automatic derivation of Semantic Properties in 'NET


1
Automatic derivation of Semantic Properties in
.NET
  • Analyze the behaviour of an assembly using Phoenix

2
Problems/issues
  • Weaving is currently only possible on the
    syntactic level
  • Set also matches Setup
  • Not certain of actual implementation
  • Possible conflicts while using aspects
  • SECRET uses custom attributes
  • There is no knowledge about
  • the method body itself

3
Goals
  • Semantic weaving points
  • Fine grained weaving
  • Inside the method body
  • Based on conditions, loops, exception handling,
    method calling, branching
  • Detection of possible conflicts
  • Read/write actions on same fields
  • Resource conflicts (files, ports etc)
  • Providing information for SECRET

4
How to
  • Must support multiple .NET languages
  • Parser for each language is inefficient
  • Use of the Common Intermediate Language
  • Extract semantics from an assembly using a tool
    (IL reader)
  • Store the semantics in a model
  • Allow tools to query this model using API

5
Read IL using Phoenix
  • Microsoft research project named Phoenix
  • An unified framework for building compilers and
    software development tools.
  • Used internal by MS for compiling Windows,
    PowerPoint, games and for building test tools.
  • Contains readers, analysis tools (control/data
    flow etc), inserters and writers.
  • Targets different architectures and languages

6
Phoenix
  • Multiple phases executed in sequential order
  • Add own phases between others
  • A common Intermediate Representation (IR)
  • Accessible in each phase
  • Represents a function at multiple levels of
    abstraction
  • Flows, AST on top of IR
  • IL instructions are converted to IR objects

7
Phoenix Architecture
High Level Analysis and Optimization
Machine Independent Optimization
Front End
Reader
Code Generation
Phoenix API
Machine Dependent Optimization
Code Emission
8
Instructions in Phoenix
  • Pseudo instructions
  • Not directly mapped to machine code
  • E.g. labels, data
  • Real instructions
  • ValueInstr assignment, add, mul, neg
  • CallInstr call, jmp
  • CmpInstr gt, lt, eq, neq
  • BranchInstr br, brfalse, bgt, bne
  • SwitchInstr switch
  • OutlineInstr inline assembly code

9
New model needed
  • Why another model?
  • Phoenix model very general and large
  • Structure not directly mapped to .NET assembly
    structure
  • We only use HIR to analyse
  • Need own API to reason about semantics
  • Semantic tools independent of Phoenix

10
Meta Model
11
Meta Model
12
Creating an API
  • Find certain instruction in method
  • Is instruction in loop, for, conditional?
  • Has instruction exception handling?
  • Is parameter X assigned a value?
  • Is field Y assigned a value in this
    method/property?
  • Each method where value of Z gt 10
  • Which operations are used on the ReifiedMessage
    parameter?

13
Remarks
  • Static analysis
  • Some minor code changes between the real source
    and IL
  • However JIT does most of optimalization
  • Local variable names are missing in IL
  • Phoenix and Whidbey needed
  • Phoenix very powerful

14
JIT Optimalization
  • Constant folding
  • Constant and copy propagation
  • Common subexpression elimination
  • Code motion of loop invariants
  • Dead store and dead code elimination
  • Register allocation
  • Method inlining
  • Loop unrolling (small loops with small bodies)
Write a Comment
User Comments (0)
About PowerShow.com