Presentation is loading. Please wait.

Presentation is loading. Please wait.

Phoenix John LeforShahrokh Mortazavi Microsoft ResearchDeveloper Division.

Similar presentations


Presentation on theme: "Phoenix John LeforShahrokh Mortazavi Microsoft ResearchDeveloper Division."— Presentation transcript:

1 Phoenix John LeforShahrokh Mortazavi Microsoft ResearchDeveloper Division

2 Overview What is Phoenix? A little Background Phoenix Internals + demos Phoenix Academic Program Q&A

3 What is Phoenix? Framework for Analysis, Optimization & Codegen Used by Microsoft Tools Available to academic community and 3 rd parties Core tech for all future Microsoft compilers JITs, PreJITs, C++ Backend Phoenix supports research Compiler / tools Development Test bed for algorithm comparison Robust enough for large code bases

4 Why Phoenix? Robust, stable, documented, supported, long- lived Wide API JIT, PreJIT, batch modes Dual Mode:.NET / native Plug-ins Real-world Apps

5 Why Phoenix (Microsoft)? No duplicated effort Faster re-targetting Research  product xfer Increase academic presence

6 Phoenix : Now Builds Longhorn (next Windows release) JITs Avalon, Powerpoint (msil version) Passes large test suites: C++, C# Supports Whidbey (next Visual Studio release) Used in tools development 3 rd party partners Used in research But – few optimizations, as yet! (slated for mid 05)

7 What’s changed since last year? Research group merged with Product group MSR still very much involved Much more robust – still ways to go AST support X64, IA64 support improved Verifier added Several internal clients Academic program kicked off (more later) Shipped two Phx Research Dev Kit CD’s

8 Phx uses inside Msft Various code generation configs slated for next Visual Studio release FxCop on Phx: DF based Analysis Obfuscation Assembly analysis & rewriting Security related tools Program Discovery tools

9

10 Phoenix Configurations CLR JITer CLR PreJITer VC++ VC++ BE The Phoenix Building Blocks Core Structures And Utilities High Level Optimizations Low Level Optimizations Machine Abstractions Dynamic Tools BBT Vulcan Static Tools Error Detection

11 HIRLIR HL Opts Retarget LL Opts Code Gen HL Opts LL Opts HL Opts Phx + Tools 10k foot view PEs VB C++ C# Phx Core Lib Core structures, Utils; AST, CodeGen Srvcs I/O Sync Trans mgr Master Program DB + Profiles PreFix PreFast Designer1 Designer2 Visualizer Modeler Editor+ Browser Xlator Formatter Readers: CIL, MSIL, HIR, PE Program Representation [ AST] Custom Extended Pgm Rep [AST+] Phx APIs Conv Checker Obfuscator Security Checker FxCop Phx APIs EXE X86 IA64 X64 ARM MSIL

12 Dual Mode Entire source base compilable as managed or unmanaged code (C++ feature) Plug-ins can be in any language Company Direction: Managed APIs Managed API required by Research Community JIT & PreJIT still require native MC++ Dogfooding

13 Coding Conventions and Documentation Standardized style and naming Phoenix uses formatting and convention checking tools Documentation extracted from sources [Doc Demo] Working on shipping sources and design docs

14 Internals Units IR ASTs Symbols Types Fields Object Description Language (PDL) Graph package Alias Package EH Representation Multi-Threading Support SSA

15 Current Phases In Compiler Reader TypeChecker MIR Lower Simple RVD Lower RegAlloc StackAlloc FrameGeneration SwitchLower LIR PhaseList BlockLayout Encode/Emit Finalize

16 Phx Based Compiler Organization Global (whole program) Func Symbol Table Instruction Stream Flow Graph Exception Handling Info Type System Region Graph Framework supports multi-threaded compilation at the function level. Data Data Instrs

17 IR Instruction Stream Example of pre-lowered and post-lowered instructions: *p += 1 [p] ADD 1p [p(eax)] x86add 1p(eax)cc HIR LIR int32 ptr-int32 int32 ptr-int32 int32 condCode EH handler

18 IR Opcodes High Level Opcode::NewObj Opcode::CastClass Opcode::ChkTypeInit Opcode::CallVirt Mid Level Opcode::Add Opcode::Call Opcode::Assign Opcode::StrCmp Lower Level Opcode::x86add Opcode::x86mov

19 IR From Source to Machine Source: z = a + b + c; HIR: t1 = ADD a, b t2 = ADD t1, c z = ASSIGN t2 LIR: t1(EAX), cc = x86add a(EAX), b(EDX) t2(EAX), cc = x86add t1(EAX), c(EBX) z = x86mov t2(eax)

20 Views of IR Functions Enter IF LOOP Exit Enter IF LOOP Exit Instruction Stream Flow Graph Regions

21 IRExplorer Demo

22 Type system Type system is internal to Phoenix Independent of source language type system(s) Own rules for consistency. It is extensible (can add new primitive types and rules for typechecking). Rich types Spans source-level to machine types All operands have types Used for code generation, GC tracking, optimization.

23 Extensibility Most Phoenix objects can have extensibility objects attached. Maintained by compare and copy routines User determines how extensions are used: New fields/properties on instructions New fields/properties on operands Possibility: subclassing/factories to extend instructions and operands with target specific info

24 Phx Definition Language Header/CodeGen Tool to assist with Dual-Mode Compilation Extensibility Benefits Automatic declarations of property variables Automatic generation of Kind/Is/As tests Automatic packing of boolean variables Automatic generation of two-level API Open classes for extensibility Unmanaged “Metadata”

25 Example of PDL Solution public [gc,extensible] class Sym { [dump] virtual void Dump(); virtual property PhxString NameString get; property Phx::Boolean IsToolGenerated { isToolGenerated } }

26 Static Extensibility Example // In Phoenix common PDL file public [gc,extensible] class Sym {... } // In a JIT-specific PDL file extend class Sym { property Phx::RTAddr RTAddr { rtAddr } }

27 Phoenix: Exception Handling Support EH models present in C++, Microsoft CLR, and SEH. Allow an efficient mapping to existing target specific EH interfaces Express explicit control flow in the presence of exceptions. Permit precise data-flow information to be built easily. Allow traditional global optimizations in the presence of exceptions. Allow optimizations of exception constructs in the IR.

28 ASTs ASTs can be imported from C++ and C# Available for static analysis or code gen CCI functionality being merged into Phx FxCop being ported over Should be available in next 1 or 2 RDK drops [AST Demo]

29 Academic Program

30 Phoenix Academic Program Provides very early access to Phoenix Use Phoenix for research and/or teaching Gives us feedback on functionality and robustness

31 Phoenix Licensing Evaluation License – MS and individual Access to Phoenix binaries and documentation Access to Phoenix Academic Forum No rights to publish Research License – MS and institution Access as before Publication rights Instructional opportunities

32 Academic Users of Phoenix Bayesian reasoning for crash analysis Software phase detection Optimization investigation – register allocation algorithms Refactoring analysis – outlining opportunities Path profiling Graduate level compiler course

33 Phoenix Academic (cont’d) Phoenix Academic Forum (PAF) Support website Monitored by Phoenix team Your participation leads to success http://research.microsoft.com/phoenix

34

35 Phoenix Availability (cont’d) Phoenix is Confidential Email PhxAP@microsoft.com Sign an NDA Register at PAF support website “Current bits” binary; docs; samples; tools

36 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.


Download ppt "Phoenix John LeforShahrokh Mortazavi Microsoft ResearchDeveloper Division."

Similar presentations


Ads by Google