SlideShare una empresa de Scribd logo
1 de 87
Descargar para leer sin conexión
Modules
                            Doug Gregor, Apple




Wednesday, November 7, 12
Roadmap

                   • The fundamental brokenness of headers
                   • A module system for the C family
                   • Building better tools


Wednesday, November 7, 12
On the Fundamental
                 Brokenness of Headers



Wednesday, November 7, 12
C Preprocessing Model
     #include <stdio.h>

     int main() {
       printf(“Hello, world!n”);
     }




Wednesday, November 7, 12
C Preprocessing Model
     #include <stdio.h>             // stdio.h

     int main() {                   typedef struct {
       printf(“Hello, world!n”);     ...
     }                              } FILE;
                                    int printf(const char*, ...);
                                    int fprintf(FILE *,
                                          const char*, ...);
                                    int remove(const char*);
                                    // on and on...




Wednesday, November 7, 12
C Preprocessing Model
     #include <stdio.h>             // stdio.h

     int main() {                   typedef struct {
       printf(“Hello, world!n”);     ...
     }                              } FILE;
                                    int printf(const char*, ...);
                                    int fprintf(FILE *,
                                          const char*, ...);
                                    int remove(const char*);
                                    // on and on...




Wednesday, November 7, 12
C Preprocessing Model
     // from stdio.h

     typedef struct {
       ...
     } FILE;
     int printf(const char*, ...);
     int fprintf(FILE *,
           const char*, ...);
     int remove(const char*);
     // on and on...

     int main() {
       printf(“Hello, world!n”);
     }




Wednesday, November 7, 12
Problems with the Model
     // from stdio.h

     typedef struct {
       ...
     } FILE;
     int printf(const char*, ...);
     int fprintf(FILE *,
           const char*, ...);
                                     • Fragility
     int remove(const char*);
     // on and on...
                                     • Performance
     int main() {
       printf(“Hello, world!n”);
     }




Wednesday, November 7, 12
Header Fragility
     #define FILE “MyFile.txt”
     #include <stdio.h>

     int main() {
       printf(“Hello, world!n”);
     }




Wednesday, November 7, 12
Header Fragility
     #define FILE “MyFile.txt”      // stdio.h
     #include <stdio.h>
                                    typedef struct {
     int main() {                     ...
       printf(“Hello, world!n”);   } FILE;
     }
                                    int printf(const char*, ...);
                                    int fprintf(FILE *,
                                          const char*, ...);
                                    int remove(const char*);
                                    // on and on...




Wednesday, November 7, 12
Header Fragility
     #define FILE “MyFile.txt”      // stdio.h
     #include <stdio.h>
                                    typedef struct {
     int main() {                     ...
       printf(“Hello, world!n”);   } FILE;
     }
                                    int printf(const char*, ...);
                                    int fprintf(FILE *,
                                          const char*, ...);
                                    int remove(const char*);
                                    // on and on...




Wednesday, November 7, 12
Header Fragility
     // from stdio.h

     typedef struct {
       ...
     } “MyFile.txt”;
     int printf(const char*, ...);
     int fprintf(“MyFile.txt” *,
           const char*, ...);
     int remove(const char*);
     // on and on...

     int main() {
       printf(“Hello, world!n”);
     }




Wednesday, November 7, 12
Conventional Workarounds




Wednesday, November 7, 12
Conventional Workarounds
                   • LLVM_WHY_PREFIX_UPPER_MACROS




Wednesday, November 7, 12
Conventional Workarounds
                   • LLVM_WHY_PREFIX_UPPER_MACROS
                   • LLVM_CLANG_INCLUDE_GUARD_H




Wednesday, November 7, 12
Conventional Workarounds
                   • LLVM_WHY_PREFIX_UPPER_MACROS
                   • LLVM_CLANG_INCLUDE_GUARD_H
                   • template<class        _Tp>
                            const _Tp& min(const _Tp &__a,
                                           const _Tp &__b);




Wednesday, November 7, 12
Conventional Workarounds
                   • LLVM_WHY_PREFIX_UPPER_MACROS
                   • LLVM_CLANG_INCLUDE_GUARD_H
                   • template<class        _Tp>
                            const _Tp& min(const _Tp &__a,
                                           const _Tp &__b);

                   • #include        <windows.h>
                            #undef min // because #define NOMINMAX
                            #undef max // doesn’t always work



Wednesday, November 7, 12
How Big is a Source File?




Wednesday, November 7, 12
How Big is a Source File?
     #include <stdio.h>

     int main() {
       printf(“Hello, world!n”);
     }




Wednesday, November 7, 12
How Big is a Source File?
     #include <stdio.h>

     int main() {
       printf(“Hello, world!n”);
     }




                              C Hello   C++ Hello   SemaOverload

                     Source     64         81         469,939

                    Headers   11,072    1,161,033     3,824,521




Wednesday, November 7, 12
How Big is a Source File?
     #include <stdio.h>                         #include <iostream>

     int main() {                               int main() {
       printf(“Hello, world!n”);                 std::cout << “Hello, world!”
     }                                                       << std::endl;
                                                }




                              C Hello   C++ Hello    SemaOverload

                     Source     64         81          469,939

                    Headers   11,072    1,161,033      3,824,521




Wednesday, November 7, 12
How Big is a Source File?
     #include <stdio.h>                         #include <iostream>

     int main() {                               int main() {
       printf(“Hello, world!n”);                 std::cout << “Hello, world!”
     }                                                       << std::endl;
                                                }




                              C Hello   C++ Hello    SemaOverload

                     Source     64         81          469,939

                    Headers   11,072    1,161,033      3,824,521




Wednesday, November 7, 12
How Big is a Source File?
     #include <stdio.h>                         #include <iostream>

     int main() {                               int main() {
       printf(“Hello, world!n”);                 std::cout << “Hello, world!”
     }                                                       << std::endl;
                                                }




                              C Hello   C++ Hello    SemaOverload

                     Source     64         81          469,939

                    Headers   11,072    1,161,033      3,824,521




Wednesday, November 7, 12
Inherently Non-Scalable

                   • M headers with N source files
                    • M x N build cost
                   • C++ templates exacerbate the problem
                   • Precompiled headers are a terrible solution

Wednesday, November 7, 12
A Module System for
                         the C Family



Wednesday, November 7, 12
What Is a Module?

                   • A module is a package describing a library
                    • Interface of the library (API)
                    • Implementation of the library


Wednesday, November 7, 12
Module Imports
     import std;

     int main() {
       printf(“Hello, World!n”);
     }




                   • ‘import’ makes the API of the named module
                            available


Wednesday, November 7, 12
Module Imports
                                        // std module (includes stdio)
     import std;
                                        typedef struct {
     int main() {                         ...
       printf(“Hello, World!n”);       } FILE;
     }
                                        int printf(const char*, ...);
                                        int fprintf(FILE *,
                                              const char*, ...);
                                        int remove(const char*);
                                        // on and on...



                   • ‘import’ makes the API of the named module
                            available


Wednesday, November 7, 12
Module Imports
                                        // std module (includes stdio)
     import std;
                                        typedef struct {
     int main() {                         ...
       printf(“Hello, World!n”);       } FILE;
     }
                                        int printf(const char*, ...);
                                        int fprintf(FILE *,
                                              const char*, ...);
                                        int remove(const char*);
                                        // on and on...



                   • ‘import’ makes the API of the named module
                            available


Wednesday, November 7, 12
Import Resilience




                   • ‘import’ ignores preprocessor state within the
                            source file


Wednesday, November 7, 12
Import Resilience
     #define FILE “MyFile.txt”
     import std;

     int main() {
       printf(“Hello, World!n”);
     }




                   • ‘import’ ignores preprocessor state within the
                            source file


Wednesday, November 7, 12
Import Resilience
                                         // std module (includes stdio)
     #define FILE “MyFile.txt”
     import std;                         typedef struct {
                                           ...
     int main() {                        } FILE;
       printf(“Hello, World!n”);
     }                                   int printf(const char*, ...);
                                         int fprintf(FILE *,
                                               const char*, ...);
                                         int remove(const char*);
                                         // on and on...



                   • ‘import’ ignores preprocessor state within the
                            source file


Wednesday, November 7, 12
Import Resilience
                                         // std module (includes stdio)
     #define FILE “MyFile.txt”
     import std;                         typedef struct {
                                           ...
     int main() {                        } FILE;
       printf(“Hello, World!n”);
     }                                   int printf(const char*, ...);
                                         int fprintf(FILE *,
                                               const char*, ...);
                                         int remove(const char*);
                                         // on and on...



                   • ‘import’ ignores preprocessor state within the
                            source file


Wednesday, November 7, 12
Selective Import
                                    // std module
                                     // stdio submodule

                                     typedef struct {
                                       ...
                                     } FILE;
                                     int printf(const char*, ...);
                                     int fprintf(FILE *,
                                           const char*, ...);
                                     int remove(const char*);
                                     // on and on...


                                     // stdlib submodule

                                     void abort(void);
                                     int rand(void);
                                     // on and on...

Wednesday, November 7, 12
Selective Import
                                    // std module
     import std.stdio;               // stdio submodule
     int main() {                    typedef struct {
       printf(“Hello, World!n”);      ...
     }                               } FILE;
                                     int printf(const char*, ...);
                                     int fprintf(FILE *,
                                           const char*, ...);
                                     int remove(const char*);
                                     // on and on...


                                     // stdlib submodule

                                     void abort(void);
                                     int rand(void);
                                     // on and on...

Wednesday, November 7, 12
Selective Import
                                    // std module
     import std.stdio;               // stdio submodule
     int main() {                    typedef struct {
       printf(“Hello, World!n”);      ...
     }                               } FILE;
                                     int printf(const char*, ...);
                                     int fprintf(FILE *,
                                           const char*, ...);
                                     int remove(const char*);
                                     // on and on...


                                     // stdlib submodule

                                     void abort(void);
                                     int rand(void);
                                     // on and on...

Wednesday, November 7, 12
What Does import
                           Import?
                   • Functions, variables, types, templates,
                            macros, etc.
                   • Only public API -- everything else can be
                            hidden.
                   • No special namespace mechanism.

Wednesday, November 7, 12
Writing a Module
                                Futuristic Version




Wednesday, November 7, 12
Writing a Module
           // stdio.c
           export std.stdio:

           public:
           typedef struct {
             ...
           } FILE;

           int printf(const char*, ...) {
             // ...
           }

           int fprintf(FILE *,
                       const char*, ...) {
             // ...
           }

           int remove(const char*) {
             // ...
           }

Wednesday, November 7, 12
Writing a Module
           // stdio.c
           export std.stdio:

           public:
           typedef struct {
             ...
           } FILE;
                                             • Specify module name
                                               in source file
           int printf(const char*, ...) {
             // ...
           }

           int fprintf(FILE *,
                       const char*, ...) {
             // ...
           }

           int remove(const char*) {
             // ...
           }

Wednesday, November 7, 12
Writing a Module
           // stdio.c
           export std.stdio:

           public:
           typedef struct {
             ...
           } FILE;
                                             • Specify module name
                                               in source file
           int printf(const char*, ...) {
           }
             // ...
                                             • Public access
           int fprintf(FILE *,                 describes API
                       const char*, ...) {
             // ...
           }

           int remove(const char*) {
             // ...
           }

Wednesday, November 7, 12
Writing a Module
           // stdio.c
           export std.stdio:

           public:
           typedef struct {
             ...
           } FILE;
                                             • Specify module name
                                               in source file
           int printf(const char*, ...) {
           }
             // ...
                                             • Public access
           int fprintf(FILE *,                 describes API
                       const char*, ...) {
           }
             // ...
                                             • No headers!
           int remove(const char*) {
             // ...
           }

Wednesday, November 7, 12
Problems With This
                                  Future

                   • Transitioning existing header-based libraries
                   • Interoperability with compilers that don’t
                            implement modules
                   • Requires tools that understand modules


Wednesday, November 7, 12
Writing a Module
                                Transitional Version




Wednesday, November 7, 12
Embracing Headers

                   • Build modules directly from the headers
                   • Headers remain “the truth”
                    • Good for interoperability
                    • Doesn’t change the programmer model

Wednesday, November 7, 12
Module Maps
                              // /usr/include/module.map

                              module std {
                                module stdio { header “stdio.h” }
                                module stdlib { header “stdlib.h” }
                                module math { header “math.h” }
                              }




                   • module defines a named (sub)module
                   • header includes the contents of the
                            named header in the current (sub)module

Wednesday, November 7, 12
Umbrella Headers
                               // clang/include/clang/module.map

                               module ClangAST {
                                 umbrella header “AST/AST.h”
                                 module * { }
                               }


                   • An umbrella header includes all of the
                            headers in its directory




Wednesday, November 7, 12
Umbrella Headers
                               // clang/include/clang/module.map

                               module ClangAST {
                                 umbrella header “AST/AST.h”
                                 module * { }
                               }


                   • An umbrella header includes all of the
                            headers in its directory
                   • Wildcard submodules (module            *) create
                            a submodule for each included header
                        • AST/Decl.h -> ClangAST.Decl
                        • AST/Expr.h -> ClangAST.Expr
Wednesday, November 7, 12
Module Map Features




Wednesday, November 7, 12
Module Map Features
                                            module LLVMADT {

                   • Umbrella directories   }
                                              umbrella “llvm/ADT”
                                              module * { export * }




Wednesday, November 7, 12
Module Map Features
                                              module LLVMADT {

                   • Umbrella directories     }
                                                umbrella “llvm/ADT”
                                                module * { export * }



                                              module _Builtin {
                                                module avx {

                   • Submodule requirements     }
                                                  requires avx
                                                  header “avxintrin.h”
                                              }




Wednesday, November 7, 12
Module Map Features
                                               module LLVMADT {

                   • Umbrella directories      }
                                                 umbrella “llvm/ADT”
                                                 module * { export * }



                                               module _Builtin {
                                                 module avx {

                   • Submodule requirements      }
                                                   requires avx
                                                   header “avxintrin.h”
                                               }




                   • Excluded headers
                                              module std {
                                                exclude header “assert.h”
                                              }




Wednesday, November 7, 12
Compilation Model
                              import std.stdio;

                              int main() {
                                printf(“Hello, World!n”);
                              }




Wednesday, November 7, 12
Compilation Model
                              import std.stdio;

                              int main() {
                                printf(“Hello, World!n”);
                              }


                   1. Find a module map for the named module




Wednesday, November 7, 12
Compilation Model
                                 import std.stdio;

                                 int main() {
                                   printf(“Hello, World!n”);
                                 }


                   1. Find a module map for the named module
                   2. Spawn a separate instance of the compiler:
                        •   Parse the headers in the module map
                        •   Write the module file



Wednesday, November 7, 12
Compilation Model
                                 import std.stdio;

                                 int main() {
                                   printf(“Hello, World!n”);
                                 }


                   1. Find a module map for the named module
                   2. Spawn a separate instance of the compiler:
                        •   Parse the headers in the module map
                        •   Write the module file
                   3. Load the module file at the ‘import’ declaration


Wednesday, November 7, 12
Compilation Model
                                 import std.stdio;

                                 int main() {
                                   printf(“Hello, World!n”);
                                 }


                   1. Find a module map for the named module
                   2. Spawn a separate instance of the compiler:
                        •   Parse the headers in the module map
                        •   Write the module file
                   3. Load the module file at the ‘import’ declaration
                   4. Cache module file for later re-use
Wednesday, November 7, 12
Adopting Modules:
                                Libraries
                   • Eliminate non-modular behavior:
                    • Multiply-defined structs, functions,
                            macros, must be consolidated
                        • Headers should import what they
                            depend on
                   • Write module maps covering the library

Wednesday, November 7, 12
Adopting Modules:
                                 Users
     #include <stdio.h>

     int main() {
       printf(“Hello, World!n”);
     }




Wednesday, November 7, 12
Adopting Modules:
                                 Users
     #include <stdio.h>                    import std.stdio;

     int main() {                          int main() {
       printf(“Hello, World!n”);            printf(“Hello, World!n”);
     }                                     }




                   • “Simply” rewrite each #include as an import

Wednesday, November 7, 12
Translating #include to
                          import
     #include <stdio.h>             import std.stdio;

     int main() {                   int main() {
       printf(“Hello, World!n”);     printf(“Hello, World!n”);
     }                              }




Wednesday, November 7, 12
Translating #include to
                          import
     #include <stdio.h>                           import std.stdio;

     int main() {                                 int main() {
       printf(“Hello, World!n”);                   printf(“Hello, World!n”);
     }                                            }


                   • Use module maps to determine (sub)module
                            corresponding to an #include’d header




Wednesday, November 7, 12
Translating #include to
                          import
     #include <stdio.h>                           import std.stdio;

     int main() {                                 int main() {
       printf(“Hello, World!n”);                   printf(“Hello, World!n”);
     }                                            }


                   • Use module maps to determine (sub)module
                            corresponding to an #include’d header
                   • Optional Fix-Its, tooling to finalize the
                            rewrite


Wednesday, November 7, 12
Translating #include to
                          import
     #include <stdio.h>                           import std.stdio;

     int main() {                                 int main() {
       printf(“Hello, World!n”);                   printf(“Hello, World!n”);
     }                                            }


                   • Use module maps to determine (sub)module
                            corresponding to an #include’d header
                   • Optional Fix-Its, tooling to finalize the
                            rewrite
                   • Enabling modules is transparent to the user
Wednesday, November 7, 12
Building Better Tools
                              (For the Future)




Wednesday, November 7, 12
Compilation
                            Performance
                   • Algorithmic improvement for parsing time
                    • Module headers parsed once, cached
                    • MxN M+N
                   • Benefits for all source-based tools

Wednesday, November 7, 12
Automatic Linking
                            // clang/include/clang/module.map

                            module ClangAST {
                              umbrella header “AST/AST.h”
                              module * { }
                              link “-lclangAST”
                            }




                   • Drastically simplifies use of a library

Wednesday, November 7, 12
Automatic Import
                              int main() {
                                std::vector<int> v;
                              }




                   • Forgotten #include               terrible diagnostic




Wednesday, November 7, 12
Automatic Import
                                 int main() {
                                   std::vector<int> v;
                                 }




                   • Forgotten #include                  terrible diagnostic
                   • vector.cpp:2:6:        error: ‘vector‘
                                template is not available
                              std::vector<int> v;
                                   ^
                            note: import ‘std.vector‘ to use
                                ‘std::vector’

Wednesday, November 7, 12
Debugging Flow




Wednesday, November 7, 12
Debugging Flow

     <iostream>             foo.cpp




Wednesday, November 7, 12
Debugging Flow

     <iostream>             foo.cpp   Clang ASTs




Wednesday, November 7, 12
Debugging Flow
                                                   foo.o
                                                   iostream
                                                   DWARF
     <iostream>             foo.cpp   Clang ASTs      foo
                                                   DWARF
                                                    object
                                                     code




Wednesday, November 7, 12
Debugging Flow
                                                   foo.o
                                                   iostream
                                                   DWARF
     <iostream>             foo.cpp   Clang ASTs      foo     LLDB
                                                   DWARF
                                                    object
                                                     code




Wednesday, November 7, 12
Debugging Flow
                                                   foo.o
                                                   iostream
                                                   DWARF
     <iostream>             foo.cpp   Clang ASTs      foo     LLDB   Clang ASTs
                                                   DWARF
                                                    object
                                                     code




Wednesday, November 7, 12
Debugging Flow
                                                   foo.o
                                                   iostream
                                                   DWARF
     <iostream>             foo.cpp   Clang ASTs      foo     LLDB   Clang ASTs
                                                   DWARF
                                                    object
                                                     code



                   • Round-trip through DWARF is lossy
                    • Only ‘used’ types, functions available
                    • Inline functions, template definitions lost
Wednesday, November 7, 12
Redundant Debug Info
                                                   foo.o
                                                   iostream
                                                   DWARF
     <iostream>             foo.cpp   Clang ASTs      foo     LLDB   Clang ASTs
                                                   DWARF
                                                    object
                                                     code




Wednesday, November 7, 12
Redundant Debug Info
                                                   foo.o
                                                   iostream
                                                   DWARF
     <iostream>             foo.cpp   Clang ASTs      foo     LLDB   Clang ASTs
                                                   DWARF
                                                    object
                                                     code

                                                   bar.o
                                                   iostream
                                                   DWARF
     <iostream>             bar.cpp   Clang ASTs      foo
                                                   DWARF
                                                    object
                                                     code


Wednesday, November 7, 12
Redundant Debug Info
                                                   foo.o
                                                   iostream
                                                   DWARF
     <iostream>             foo.cpp   Clang ASTs      foo     LLDB   Clang ASTs
                                                   DWARF
                                                    object
                                                     code

                                                   bar.o
                                                   iostream
                                                   DWARF
     <iostream>             bar.cpp   Clang ASTs      foo
                                                   DWARF
                                                    object
                                                     code


Wednesday, November 7, 12
Debugging with
                              Modules

                                                   foo.o
     <iostream>             foo.cpp   Clang ASTs     foo
                                                   DWARF
                                                    object
                                                    code
                                                             LLDB   Clang ASTs
                                                   bar.o
     <iostream>             bar.cpp   Clang ASTs     foo
                                                   DWARF
                                                    object
                                                    code


Wednesday, November 7, 12
Debugging with
                              Modules
                                      std.iostream module


                                                    foo.o
     <iostream>             foo.cpp   Clang ASTs      foo
                                                    DWARF
                                                     object
                                                     code
                                                              LLDB   Clang ASTs
                                                    bar.o
     <iostream>             bar.cpp   Clang ASTs      foo
                                                    DWARF
                                                     object
                                                     code


Wednesday, November 7, 12
Debugging with
                              Modules
                   • Improved build performance
                    • Compiler emits less DWARF
                    • Linker de-duplicates less DWARF



Wednesday, November 7, 12
Debugging with
                              Modules
                   • Improved build performance
                    • Compiler emits less DWARF
                    • Linker de-duplicates less DWARF
                   • Improved debugging experience
                    • Perfect AST fidelity in debugger
                    • Debugger doesn’t need to search DWARF
Wednesday, November 7, 12
Modules Summary




Wednesday, November 7, 12
Modules Summary
                   • Modules are a huge potential win for C(++)
                    • Compile/build time improvements
                    • Fix various preprocessor problems
                    • Far better tool experience


Wednesday, November 7, 12
Modules Summary
                   • Modules are a huge potential win for C(++)
                    • Compile/build time improvements
                    • Fix various preprocessor problems
                    • Far better tool experience
                   • Design enables smooth transition path

Wednesday, November 7, 12
Modules Summary
                   • Modules are a huge potential win for C(++)
                    • Compile/build time improvements
                    • Fix various preprocessor problems
                    • Far better tool experience
                   • Design enables smooth transition path
                   • Clang implementation underway
Wednesday, November 7, 12

Más contenido relacionado

La actualidad más candente

Clojure and the Web
Clojure and the WebClojure and the Web
Clojure and the Webnickmbailey
 
Php and threads ZTS
Php and threads ZTSPhp and threads ZTS
Php and threads ZTSjulien pauli
 
An (abridged) Ruby Plumber's Guide to *nix
An (abridged) Ruby Plumber's Guide to *nixAn (abridged) Ruby Plumber's Guide to *nix
An (abridged) Ruby Plumber's Guide to *nixEleanor McHugh
 
Understanding PHP objects
Understanding PHP objectsUnderstanding PHP objects
Understanding PHP objectsjulien pauli
 
Profiling php5 to php7
Profiling php5 to php7Profiling php5 to php7
Profiling php5 to php7julien pauli
 
PHP 5.3 And PHP 6 A Look Ahead
PHP 5.3 And PHP 6 A Look AheadPHP 5.3 And PHP 6 A Look Ahead
PHP 5.3 And PHP 6 A Look Aheadthinkphp
 
Php7 extensions workshop
Php7 extensions workshopPhp7 extensions workshop
Php7 extensions workshopjulien pauli
 
(Greach 2015) Dsl'ing your Groovy
(Greach 2015) Dsl'ing your Groovy(Greach 2015) Dsl'ing your Groovy
(Greach 2015) Dsl'ing your GroovyAlonso Torres
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+ConFoo
 
Node.js System: The Landing
Node.js System: The LandingNode.js System: The Landing
Node.js System: The LandingHaci Murat Yaman
 
Penumbra: Automatically Identifying Failure-Relevant Inputs (ISSTA 2009)
Penumbra: Automatically Identifying Failure-Relevant Inputs (ISSTA 2009)Penumbra: Automatically Identifying Failure-Relevant Inputs (ISSTA 2009)
Penumbra: Automatically Identifying Failure-Relevant Inputs (ISSTA 2009)James Clause
 
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
[2007 CodeEngn Conference 01] seaofglass - Linux Virus AnalysisGangSeok Lee
 
Fantastic DSL in Python
Fantastic DSL in PythonFantastic DSL in Python
Fantastic DSL in Pythonkwatch
 
SymfonyCon 2017 php7 performances
SymfonyCon 2017 php7 performancesSymfonyCon 2017 php7 performances
SymfonyCon 2017 php7 performancesjulien pauli
 
JavaScript Proxy (ES6)
JavaScript Proxy (ES6)JavaScript Proxy (ES6)
JavaScript Proxy (ES6)Aries Cs
 

La actualidad más candente (19)

Clojure and the Web
Clojure and the WebClojure and the Web
Clojure and the Web
 
Php and threads ZTS
Php and threads ZTSPhp and threads ZTS
Php and threads ZTS
 
An (abridged) Ruby Plumber's Guide to *nix
An (abridged) Ruby Plumber's Guide to *nixAn (abridged) Ruby Plumber's Guide to *nix
An (abridged) Ruby Plumber's Guide to *nix
 
Understanding PHP objects
Understanding PHP objectsUnderstanding PHP objects
Understanding PHP objects
 
Profiling php5 to php7
Profiling php5 to php7Profiling php5 to php7
Profiling php5 to php7
 
PHP 5.3 And PHP 6 A Look Ahead
PHP 5.3 And PHP 6 A Look AheadPHP 5.3 And PHP 6 A Look Ahead
PHP 5.3 And PHP 6 A Look Ahead
 
Php7 extensions workshop
Php7 extensions workshopPhp7 extensions workshop
Php7 extensions workshop
 
C99
C99C99
C99
 
(Greach 2015) Dsl'ing your Groovy
(Greach 2015) Dsl'ing your Groovy(Greach 2015) Dsl'ing your Groovy
(Greach 2015) Dsl'ing your Groovy
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
 
Node.js System: The Landing
Node.js System: The LandingNode.js System: The Landing
Node.js System: The Landing
 
Penumbra: Automatically Identifying Failure-Relevant Inputs (ISSTA 2009)
Penumbra: Automatically Identifying Failure-Relevant Inputs (ISSTA 2009)Penumbra: Automatically Identifying Failure-Relevant Inputs (ISSTA 2009)
Penumbra: Automatically Identifying Failure-Relevant Inputs (ISSTA 2009)
 
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
 
Book
BookBook
Book
 
Fantastic DSL in Python
Fantastic DSL in PythonFantastic DSL in Python
Fantastic DSL in Python
 
SymfonyCon 2017 php7 performances
SymfonyCon 2017 php7 performancesSymfonyCon 2017 php7 performances
SymfonyCon 2017 php7 performances
 
Php engine
Php enginePhp engine
Php engine
 
C99
C99C99
C99
 
JavaScript Proxy (ES6)
JavaScript Proxy (ES6)JavaScript Proxy (ES6)
JavaScript Proxy (ES6)
 

Similar a Gregor modules

C++totural file
C++totural fileC++totural file
C++totural filehalaisumit
 
File & Exception Handling in C++.pptx
File & Exception Handling in C++.pptxFile & Exception Handling in C++.pptx
File & Exception Handling in C++.pptxRutujaTandalwade
 
3 1. preprocessor, math, stdlib
3 1. preprocessor, math, stdlib3 1. preprocessor, math, stdlib
3 1. preprocessor, math, stdlib웅식 전
 
Exmaples of file handling
Exmaples of file handlingExmaples of file handling
Exmaples of file handlingsparkishpearl
 
File handling complete programs in c++
File handling complete programs in c++File handling complete programs in c++
File handling complete programs in c++zain ul hassan
 
Start Wrap Episode 11: A New Rope
Start Wrap Episode 11: A New RopeStart Wrap Episode 11: A New Rope
Start Wrap Episode 11: A New RopeYung-Yu Chen
 
file handling final3333.pptx
file handling final3333.pptxfile handling final3333.pptx
file handling final3333.pptxradhushri
 
finalprojtemplatev5finalprojtemplate.gitignore# Ignore the b
finalprojtemplatev5finalprojtemplate.gitignore# Ignore the bfinalprojtemplatev5finalprojtemplate.gitignore# Ignore the b
finalprojtemplatev5finalprojtemplate.gitignore# Ignore the bChereCheek752
 
Take advantage of C++ from Python
Take advantage of C++ from PythonTake advantage of C++ from Python
Take advantage of C++ from PythonYung-Yu Chen
 
Institute management
Institute managementInstitute management
Institute managementvarun arora
 
streams and files
 streams and files streams and files
streams and filesMariam Butt
 
Python utan-stodhjul-motorsag
Python utan-stodhjul-motorsagPython utan-stodhjul-motorsag
Python utan-stodhjul-motorsagniklal
 
Sample file processing
Sample file processingSample file processing
Sample file processingIssay Meii
 

Similar a Gregor modules (20)

C++totural file
C++totural fileC++totural file
C++totural file
 
C++ tutorial
C++ tutorialC++ tutorial
C++ tutorial
 
Cpp lab 13_pres
Cpp lab 13_presCpp lab 13_pres
Cpp lab 13_pres
 
Sbaw091006
Sbaw091006Sbaw091006
Sbaw091006
 
File & Exception Handling in C++.pptx
File & Exception Handling in C++.pptxFile & Exception Handling in C++.pptx
File & Exception Handling in C++.pptx
 
3 1. preprocessor, math, stdlib
3 1. preprocessor, math, stdlib3 1. preprocessor, math, stdlib
3 1. preprocessor, math, stdlib
 
Exmaples of file handling
Exmaples of file handlingExmaples of file handling
Exmaples of file handling
 
File handling complete programs in c++
File handling complete programs in c++File handling complete programs in c++
File handling complete programs in c++
 
Start Wrap Episode 11: A New Rope
Start Wrap Episode 11: A New RopeStart Wrap Episode 11: A New Rope
Start Wrap Episode 11: A New Rope
 
file handling final3333.pptx
file handling final3333.pptxfile handling final3333.pptx
file handling final3333.pptx
 
finalprojtemplatev5finalprojtemplate.gitignore# Ignore the b
finalprojtemplatev5finalprojtemplate.gitignore# Ignore the bfinalprojtemplatev5finalprojtemplate.gitignore# Ignore the b
finalprojtemplatev5finalprojtemplate.gitignore# Ignore the b
 
Take advantage of C++ from Python
Take advantage of C++ from PythonTake advantage of C++ from Python
Take advantage of C++ from Python
 
Institute management
Institute managementInstitute management
Institute management
 
C++ idioms.pptx
C++ idioms.pptxC++ idioms.pptx
C++ idioms.pptx
 
streams and files
 streams and files streams and files
streams and files
 
Usp
UspUsp
Usp
 
C Language Unit-5
C Language Unit-5C Language Unit-5
C Language Unit-5
 
working with files
working with filesworking with files
working with files
 
Python utan-stodhjul-motorsag
Python utan-stodhjul-motorsagPython utan-stodhjul-motorsag
Python utan-stodhjul-motorsag
 
Sample file processing
Sample file processingSample file processing
Sample file processing
 

Gregor modules

  • 1. Modules Doug Gregor, Apple Wednesday, November 7, 12
  • 2. Roadmap • The fundamental brokenness of headers • A module system for the C family • Building better tools Wednesday, November 7, 12
  • 3. On the Fundamental Brokenness of Headers Wednesday, November 7, 12
  • 4. C Preprocessing Model #include <stdio.h> int main() { printf(“Hello, world!n”); } Wednesday, November 7, 12
  • 5. C Preprocessing Model #include <stdio.h> // stdio.h int main() { typedef struct { printf(“Hello, world!n”); ... } } FILE; int printf(const char*, ...); int fprintf(FILE *, const char*, ...); int remove(const char*); // on and on... Wednesday, November 7, 12
  • 6. C Preprocessing Model #include <stdio.h> // stdio.h int main() { typedef struct { printf(“Hello, world!n”); ... } } FILE; int printf(const char*, ...); int fprintf(FILE *, const char*, ...); int remove(const char*); // on and on... Wednesday, November 7, 12
  • 7. C Preprocessing Model // from stdio.h typedef struct { ... } FILE; int printf(const char*, ...); int fprintf(FILE *, const char*, ...); int remove(const char*); // on and on... int main() { printf(“Hello, world!n”); } Wednesday, November 7, 12
  • 8. Problems with the Model // from stdio.h typedef struct { ... } FILE; int printf(const char*, ...); int fprintf(FILE *, const char*, ...); • Fragility int remove(const char*); // on and on... • Performance int main() { printf(“Hello, world!n”); } Wednesday, November 7, 12
  • 9. Header Fragility #define FILE “MyFile.txt” #include <stdio.h> int main() { printf(“Hello, world!n”); } Wednesday, November 7, 12
  • 10. Header Fragility #define FILE “MyFile.txt” // stdio.h #include <stdio.h> typedef struct { int main() { ... printf(“Hello, world!n”); } FILE; } int printf(const char*, ...); int fprintf(FILE *, const char*, ...); int remove(const char*); // on and on... Wednesday, November 7, 12
  • 11. Header Fragility #define FILE “MyFile.txt” // stdio.h #include <stdio.h> typedef struct { int main() { ... printf(“Hello, world!n”); } FILE; } int printf(const char*, ...); int fprintf(FILE *, const char*, ...); int remove(const char*); // on and on... Wednesday, November 7, 12
  • 12. Header Fragility // from stdio.h typedef struct { ... } “MyFile.txt”; int printf(const char*, ...); int fprintf(“MyFile.txt” *, const char*, ...); int remove(const char*); // on and on... int main() { printf(“Hello, world!n”); } Wednesday, November 7, 12
  • 14. Conventional Workarounds • LLVM_WHY_PREFIX_UPPER_MACROS Wednesday, November 7, 12
  • 15. Conventional Workarounds • LLVM_WHY_PREFIX_UPPER_MACROS • LLVM_CLANG_INCLUDE_GUARD_H Wednesday, November 7, 12
  • 16. Conventional Workarounds • LLVM_WHY_PREFIX_UPPER_MACROS • LLVM_CLANG_INCLUDE_GUARD_H • template<class _Tp> const _Tp& min(const _Tp &__a, const _Tp &__b); Wednesday, November 7, 12
  • 17. Conventional Workarounds • LLVM_WHY_PREFIX_UPPER_MACROS • LLVM_CLANG_INCLUDE_GUARD_H • template<class _Tp> const _Tp& min(const _Tp &__a, const _Tp &__b); • #include <windows.h> #undef min // because #define NOMINMAX #undef max // doesn’t always work Wednesday, November 7, 12
  • 18. How Big is a Source File? Wednesday, November 7, 12
  • 19. How Big is a Source File? #include <stdio.h> int main() { printf(“Hello, world!n”); } Wednesday, November 7, 12
  • 20. How Big is a Source File? #include <stdio.h> int main() { printf(“Hello, world!n”); } C Hello C++ Hello SemaOverload Source 64 81 469,939 Headers 11,072 1,161,033 3,824,521 Wednesday, November 7, 12
  • 21. How Big is a Source File? #include <stdio.h> #include <iostream> int main() { int main() { printf(“Hello, world!n”); std::cout << “Hello, world!” } << std::endl; } C Hello C++ Hello SemaOverload Source 64 81 469,939 Headers 11,072 1,161,033 3,824,521 Wednesday, November 7, 12
  • 22. How Big is a Source File? #include <stdio.h> #include <iostream> int main() { int main() { printf(“Hello, world!n”); std::cout << “Hello, world!” } << std::endl; } C Hello C++ Hello SemaOverload Source 64 81 469,939 Headers 11,072 1,161,033 3,824,521 Wednesday, November 7, 12
  • 23. How Big is a Source File? #include <stdio.h> #include <iostream> int main() { int main() { printf(“Hello, world!n”); std::cout << “Hello, world!” } << std::endl; } C Hello C++ Hello SemaOverload Source 64 81 469,939 Headers 11,072 1,161,033 3,824,521 Wednesday, November 7, 12
  • 24. Inherently Non-Scalable • M headers with N source files • M x N build cost • C++ templates exacerbate the problem • Precompiled headers are a terrible solution Wednesday, November 7, 12
  • 25. A Module System for the C Family Wednesday, November 7, 12
  • 26. What Is a Module? • A module is a package describing a library • Interface of the library (API) • Implementation of the library Wednesday, November 7, 12
  • 27. Module Imports import std; int main() { printf(“Hello, World!n”); } • ‘import’ makes the API of the named module available Wednesday, November 7, 12
  • 28. Module Imports // std module (includes stdio) import std; typedef struct { int main() { ... printf(“Hello, World!n”); } FILE; } int printf(const char*, ...); int fprintf(FILE *, const char*, ...); int remove(const char*); // on and on... • ‘import’ makes the API of the named module available Wednesday, November 7, 12
  • 29. Module Imports // std module (includes stdio) import std; typedef struct { int main() { ... printf(“Hello, World!n”); } FILE; } int printf(const char*, ...); int fprintf(FILE *, const char*, ...); int remove(const char*); // on and on... • ‘import’ makes the API of the named module available Wednesday, November 7, 12
  • 30. Import Resilience • ‘import’ ignores preprocessor state within the source file Wednesday, November 7, 12
  • 31. Import Resilience #define FILE “MyFile.txt” import std; int main() { printf(“Hello, World!n”); } • ‘import’ ignores preprocessor state within the source file Wednesday, November 7, 12
  • 32. Import Resilience // std module (includes stdio) #define FILE “MyFile.txt” import std; typedef struct { ... int main() { } FILE; printf(“Hello, World!n”); } int printf(const char*, ...); int fprintf(FILE *, const char*, ...); int remove(const char*); // on and on... • ‘import’ ignores preprocessor state within the source file Wednesday, November 7, 12
  • 33. Import Resilience // std module (includes stdio) #define FILE “MyFile.txt” import std; typedef struct { ... int main() { } FILE; printf(“Hello, World!n”); } int printf(const char*, ...); int fprintf(FILE *, const char*, ...); int remove(const char*); // on and on... • ‘import’ ignores preprocessor state within the source file Wednesday, November 7, 12
  • 34. Selective Import // std module // stdio submodule typedef struct { ... } FILE; int printf(const char*, ...); int fprintf(FILE *, const char*, ...); int remove(const char*); // on and on... // stdlib submodule void abort(void); int rand(void); // on and on... Wednesday, November 7, 12
  • 35. Selective Import // std module import std.stdio; // stdio submodule int main() { typedef struct { printf(“Hello, World!n”); ... } } FILE; int printf(const char*, ...); int fprintf(FILE *, const char*, ...); int remove(const char*); // on and on... // stdlib submodule void abort(void); int rand(void); // on and on... Wednesday, November 7, 12
  • 36. Selective Import // std module import std.stdio; // stdio submodule int main() { typedef struct { printf(“Hello, World!n”); ... } } FILE; int printf(const char*, ...); int fprintf(FILE *, const char*, ...); int remove(const char*); // on and on... // stdlib submodule void abort(void); int rand(void); // on and on... Wednesday, November 7, 12
  • 37. What Does import Import? • Functions, variables, types, templates, macros, etc. • Only public API -- everything else can be hidden. • No special namespace mechanism. Wednesday, November 7, 12
  • 38. Writing a Module Futuristic Version Wednesday, November 7, 12
  • 39. Writing a Module // stdio.c export std.stdio: public: typedef struct { ... } FILE; int printf(const char*, ...) { // ... } int fprintf(FILE *, const char*, ...) { // ... } int remove(const char*) { // ... } Wednesday, November 7, 12
  • 40. Writing a Module // stdio.c export std.stdio: public: typedef struct { ... } FILE; • Specify module name in source file int printf(const char*, ...) { // ... } int fprintf(FILE *, const char*, ...) { // ... } int remove(const char*) { // ... } Wednesday, November 7, 12
  • 41. Writing a Module // stdio.c export std.stdio: public: typedef struct { ... } FILE; • Specify module name in source file int printf(const char*, ...) { } // ... • Public access int fprintf(FILE *, describes API const char*, ...) { // ... } int remove(const char*) { // ... } Wednesday, November 7, 12
  • 42. Writing a Module // stdio.c export std.stdio: public: typedef struct { ... } FILE; • Specify module name in source file int printf(const char*, ...) { } // ... • Public access int fprintf(FILE *, describes API const char*, ...) { } // ... • No headers! int remove(const char*) { // ... } Wednesday, November 7, 12
  • 43. Problems With This Future • Transitioning existing header-based libraries • Interoperability with compilers that don’t implement modules • Requires tools that understand modules Wednesday, November 7, 12
  • 44. Writing a Module Transitional Version Wednesday, November 7, 12
  • 45. Embracing Headers • Build modules directly from the headers • Headers remain “the truth” • Good for interoperability • Doesn’t change the programmer model Wednesday, November 7, 12
  • 46. Module Maps // /usr/include/module.map module std { module stdio { header “stdio.h” } module stdlib { header “stdlib.h” } module math { header “math.h” } } • module defines a named (sub)module • header includes the contents of the named header in the current (sub)module Wednesday, November 7, 12
  • 47. Umbrella Headers // clang/include/clang/module.map module ClangAST { umbrella header “AST/AST.h” module * { } } • An umbrella header includes all of the headers in its directory Wednesday, November 7, 12
  • 48. Umbrella Headers // clang/include/clang/module.map module ClangAST { umbrella header “AST/AST.h” module * { } } • An umbrella header includes all of the headers in its directory • Wildcard submodules (module *) create a submodule for each included header • AST/Decl.h -> ClangAST.Decl • AST/Expr.h -> ClangAST.Expr Wednesday, November 7, 12
  • 50. Module Map Features module LLVMADT { • Umbrella directories } umbrella “llvm/ADT” module * { export * } Wednesday, November 7, 12
  • 51. Module Map Features module LLVMADT { • Umbrella directories } umbrella “llvm/ADT” module * { export * } module _Builtin { module avx { • Submodule requirements } requires avx header “avxintrin.h” } Wednesday, November 7, 12
  • 52. Module Map Features module LLVMADT { • Umbrella directories } umbrella “llvm/ADT” module * { export * } module _Builtin { module avx { • Submodule requirements } requires avx header “avxintrin.h” } • Excluded headers module std { exclude header “assert.h” } Wednesday, November 7, 12
  • 53. Compilation Model import std.stdio; int main() { printf(“Hello, World!n”); } Wednesday, November 7, 12
  • 54. Compilation Model import std.stdio; int main() { printf(“Hello, World!n”); } 1. Find a module map for the named module Wednesday, November 7, 12
  • 55. Compilation Model import std.stdio; int main() { printf(“Hello, World!n”); } 1. Find a module map for the named module 2. Spawn a separate instance of the compiler: • Parse the headers in the module map • Write the module file Wednesday, November 7, 12
  • 56. Compilation Model import std.stdio; int main() { printf(“Hello, World!n”); } 1. Find a module map for the named module 2. Spawn a separate instance of the compiler: • Parse the headers in the module map • Write the module file 3. Load the module file at the ‘import’ declaration Wednesday, November 7, 12
  • 57. Compilation Model import std.stdio; int main() { printf(“Hello, World!n”); } 1. Find a module map for the named module 2. Spawn a separate instance of the compiler: • Parse the headers in the module map • Write the module file 3. Load the module file at the ‘import’ declaration 4. Cache module file for later re-use Wednesday, November 7, 12
  • 58. Adopting Modules: Libraries • Eliminate non-modular behavior: • Multiply-defined structs, functions, macros, must be consolidated • Headers should import what they depend on • Write module maps covering the library Wednesday, November 7, 12
  • 59. Adopting Modules: Users #include <stdio.h> int main() { printf(“Hello, World!n”); } Wednesday, November 7, 12
  • 60. Adopting Modules: Users #include <stdio.h> import std.stdio; int main() { int main() { printf(“Hello, World!n”); printf(“Hello, World!n”); } } • “Simply” rewrite each #include as an import Wednesday, November 7, 12
  • 61. Translating #include to import #include <stdio.h> import std.stdio; int main() { int main() { printf(“Hello, World!n”); printf(“Hello, World!n”); } } Wednesday, November 7, 12
  • 62. Translating #include to import #include <stdio.h> import std.stdio; int main() { int main() { printf(“Hello, World!n”); printf(“Hello, World!n”); } } • Use module maps to determine (sub)module corresponding to an #include’d header Wednesday, November 7, 12
  • 63. Translating #include to import #include <stdio.h> import std.stdio; int main() { int main() { printf(“Hello, World!n”); printf(“Hello, World!n”); } } • Use module maps to determine (sub)module corresponding to an #include’d header • Optional Fix-Its, tooling to finalize the rewrite Wednesday, November 7, 12
  • 64. Translating #include to import #include <stdio.h> import std.stdio; int main() { int main() { printf(“Hello, World!n”); printf(“Hello, World!n”); } } • Use module maps to determine (sub)module corresponding to an #include’d header • Optional Fix-Its, tooling to finalize the rewrite • Enabling modules is transparent to the user Wednesday, November 7, 12
  • 65. Building Better Tools (For the Future) Wednesday, November 7, 12
  • 66. Compilation Performance • Algorithmic improvement for parsing time • Module headers parsed once, cached • MxN M+N • Benefits for all source-based tools Wednesday, November 7, 12
  • 67. Automatic Linking // clang/include/clang/module.map module ClangAST { umbrella header “AST/AST.h” module * { } link “-lclangAST” } • Drastically simplifies use of a library Wednesday, November 7, 12
  • 68. Automatic Import int main() { std::vector<int> v; } • Forgotten #include terrible diagnostic Wednesday, November 7, 12
  • 69. Automatic Import int main() { std::vector<int> v; } • Forgotten #include terrible diagnostic • vector.cpp:2:6: error: ‘vector‘ template is not available std::vector<int> v; ^ note: import ‘std.vector‘ to use ‘std::vector’ Wednesday, November 7, 12
  • 71. Debugging Flow <iostream> foo.cpp Wednesday, November 7, 12
  • 72. Debugging Flow <iostream> foo.cpp Clang ASTs Wednesday, November 7, 12
  • 73. Debugging Flow foo.o iostream DWARF <iostream> foo.cpp Clang ASTs foo DWARF object code Wednesday, November 7, 12
  • 74. Debugging Flow foo.o iostream DWARF <iostream> foo.cpp Clang ASTs foo LLDB DWARF object code Wednesday, November 7, 12
  • 75. Debugging Flow foo.o iostream DWARF <iostream> foo.cpp Clang ASTs foo LLDB Clang ASTs DWARF object code Wednesday, November 7, 12
  • 76. Debugging Flow foo.o iostream DWARF <iostream> foo.cpp Clang ASTs foo LLDB Clang ASTs DWARF object code • Round-trip through DWARF is lossy • Only ‘used’ types, functions available • Inline functions, template definitions lost Wednesday, November 7, 12
  • 77. Redundant Debug Info foo.o iostream DWARF <iostream> foo.cpp Clang ASTs foo LLDB Clang ASTs DWARF object code Wednesday, November 7, 12
  • 78. Redundant Debug Info foo.o iostream DWARF <iostream> foo.cpp Clang ASTs foo LLDB Clang ASTs DWARF object code bar.o iostream DWARF <iostream> bar.cpp Clang ASTs foo DWARF object code Wednesday, November 7, 12
  • 79. Redundant Debug Info foo.o iostream DWARF <iostream> foo.cpp Clang ASTs foo LLDB Clang ASTs DWARF object code bar.o iostream DWARF <iostream> bar.cpp Clang ASTs foo DWARF object code Wednesday, November 7, 12
  • 80. Debugging with Modules foo.o <iostream> foo.cpp Clang ASTs foo DWARF object code LLDB Clang ASTs bar.o <iostream> bar.cpp Clang ASTs foo DWARF object code Wednesday, November 7, 12
  • 81. Debugging with Modules std.iostream module foo.o <iostream> foo.cpp Clang ASTs foo DWARF object code LLDB Clang ASTs bar.o <iostream> bar.cpp Clang ASTs foo DWARF object code Wednesday, November 7, 12
  • 82. Debugging with Modules • Improved build performance • Compiler emits less DWARF • Linker de-duplicates less DWARF Wednesday, November 7, 12
  • 83. Debugging with Modules • Improved build performance • Compiler emits less DWARF • Linker de-duplicates less DWARF • Improved debugging experience • Perfect AST fidelity in debugger • Debugger doesn’t need to search DWARF Wednesday, November 7, 12
  • 85. Modules Summary • Modules are a huge potential win for C(++) • Compile/build time improvements • Fix various preprocessor problems • Far better tool experience Wednesday, November 7, 12
  • 86. Modules Summary • Modules are a huge potential win for C(++) • Compile/build time improvements • Fix various preprocessor problems • Far better tool experience • Design enables smooth transition path Wednesday, November 7, 12
  • 87. Modules Summary • Modules are a huge potential win for C(++) • Compile/build time improvements • Fix various preprocessor problems • Far better tool experience • Design enables smooth transition path • Clang implementation underway Wednesday, November 7, 12