Research in Compilers and How it Relates to Software Engineering Part III: Relation to SE Tomofumi...
-
Upload
beverly-carroll -
Category
Documents
-
view
216 -
download
0
Transcript of Research in Compilers and How it Relates to Software Engineering Part III: Relation to SE Tomofumi...
Research in Compilers and How it Relates to Software EngineeringPart III: Relation to SE
Tomofumi Yuki
EJCP 2015June 22, Nancy
What is Software Engineering? Can you describe SE? Engineering applied to software
What is engineering?
Goals of SE easy to understand easy to modify easy to debug with little cost in performance
2
EJCP 2015, June 22, Nancy
The Problem
Building software pyramids
EJCP 2015, June 22, Nancy
3
If software developers built the pyramids …
EJCP 2015, June 22, Nancy
4
Software Engineering
Programmers
Software Engineers
SE Researcher
s
no gotoclass hierarchygenericsdesign patterns
development cyclesUML specificationsgenerative methods
Application(Local)
Application(Global)
Develop/InventTechniques
structured prog.software coveragefault injectionproduct-linesfind cause of failure
5
compilertechniques
EJCP 2015, June 22, Nancy
5
Quick and Dirty View
Compiler is all about abstraction Software Engineering is all about abstraction
Compiler = Software Engineering it is a stretch (of course)
Programming Languages probably a better intersection how to better write in a language how to design a language to ease
programming6
EJCP 2015, June 22, Nancy
Example 1: Object-Orientation Initial motivation was modularity
More SE developments later on design patterns polymorphism
7
op1 a, b, cop2 a, d, eop3 f, c, e...
main() { ... foo(..); ... bar(..); ...}
class A { ... foo() ...}
class B {...}
EJCP 2015, June 22, Nancy
Example 2: Deadlock Detection Many approaches
check if a problem can deadlock ensure its absence by language design ensure its absence by coding principles catch and resolve at run-time
Is it SE problem or PL problem? papers appear in both domains
8
EJCP 2015, June 22, Nancy
Today’s Focus: MDE
Specific instance where compiler and SE meet
Model Driven Engineering
Key Connection
9
EJCP 2015, June 22, Nancy
Model Instance = Program Instance Model = Grammar
Many Tools and Problems are Shared
MDE: A Solution
Goal of MDE: reducing accidental complexities bridging wide abstraction gaps
Key Element: support rigorous transformation of
abstractions to software implementations
MDE is concerned with developing software tools to support the work of software
developers
10
MDE helps make a software developer a software engineerEJCP 2015, June 22, Nancy
What is a Model?
A description of an aspect of a software-based system that may or may not exist. A model is created to serve one or more purposes.
11
EJCP 2015, June 22, Nancy
Early focus of MDE
Models for documentation/communication Foundation: early work on CASE
Models for generating implementations OMG’s work on UML and MDA
Model Transformations Software development viewed as a
transformative process Key enablers of MDA
12
EJCP 2015, June 22, Nancy
MDE Example 1
Discuss the desired software with model stay high-level easy to visualize model
Transform to another model fill some details check for properties
Generate code (skeleton) implement the details
EJCP 2015, June 22, Nancy
13
Model
Model’
Code
Evolution of MDE
Breathing life into models Models as analyzable artifacts Foundation from formal specification
Models for managing runtime behavior [email protected]
Supporting domain-specific software development
Applying MDE technologies in other CS domains
14
EJCP 2015, June 22, Nancy
MDE Example 2
There exists a software corresponding model
Develop another one similar but different
How to maximize reuse productivity reliability ...
EJCP 2015, June 22, Nancy
15
Model ATool A
Model BTool B
Tools for MDE
Mapping concrete syntax parser generation graphical language
Constraint checking check if rules of the model is satisfied more advanced check (e.g., cycles)
Code generation from model
EJCP 2015, June 22, Nancy
16
Optimizing Compilers
Goal: generate “efficient” code Execution time Energy consumption Code size
Wide range of optimizations Register allocation Dead code elimination Automatic parallelization Run-time optimizations
17
EJCP 2015, June 22, Nancy
Optimizing Compiler Research Prototype implementations
“Proof of Concept” Evaluation
Compilers are complicated pieces of software Need for rapid development Development spans generations of
students Performance of compiler prototype not
critical18
EJCP 2015, June 22, Nancy
Optimizing Compiler Examples High-level flow of two research
compilers:
19
1.Parse source language
2.Transform intermediate representations (IRs) for efficiency. May take domain specific knowledge as additional inputs.
3.Output code or binary
EJCP 2015, June 22, Nancy
Research Compiler Challenges Maintainable and Sustainable Code
Developers may not have good SE background
Structural Validity of IR Is the IR consistent after
parsing/transformation? Complex Querying of IR
Find where to apply transformations Interfacing with External Tools
Avoid as much re-implementation as possible
20
EJCP 2015, June 22, Nancy
More Challenges
Semantics Preserving Transformations Compilers should not alter semantics
Use of Domain Specific Knowledge How to incorporate domain specific
knowledge Code Generation
Generate code for different target architecture programming model
21
EJCP 2015, June 22, Nancy
Bridging with MDE
View compiler IRs as models
2222
DSLs and
Tooling
Model Transformations and
Analyses
Code Generation
EJCP 2015, June 22, Nancy
Challenges
Analyses and Manipulation of IRs
23
Structural ValidationStructural ValidationStructural ValidationStructural ValidationStructural ValidationStructural ValidationStructural ValidationStructural Validation
Complex Querying and Transformati
ons
Complex Querying and Transformati
ons
Complex Querying and Transformati
ons
Complex Querying and Transformati
ons
Complex Querying and Transformati
ons
Complex Querying and Transformati
ons
Complex Querying and Transformati
ons
Complex Querying and Transformati
ons
Complex Querying and Transformatio
ns
Complex Querying and Transformatio
ns
EJCP 2015, June 22, Nancy
Challenges and MDE Solutions Analyses and Manipulation of IRs
24
Structural ValidationStructural ValidationStructural ValidationStructural ValidationStructural ValidationStructural ValidationStructural ValidationStructural Validation
Complex Querying and Transformati
ons
Complex Querying and Transformati
ons
Complex Querying and Transformati
ons
Complex Querying and Transformati
ons
Complex Querying and Transformati
ons
Complex Querying and Transformati
ons
Complex Querying and Transformati
ons
Complex Querying and Transformati
ons
Complex Querying and Transformati
ons
Complex Querying and Transformati
ons
Structural Properties on models
(conformity)OCL constraints
Structural Properties on models
(conformity)OCL constraints
OCL queriesM2M tools
Rewriting rules
OCL queriesM2M tools
Rewriting rules
EJCP 2015, June 22, Nancy
Challenges
Domain specific knowledge is heavily utilized
25
Domain Specific Knowledge
Representation
EJCP 2015, June 22, Nancy
Challenges and MDE Solutions Domain specific knowledge is heavily
utilized
26
Domain Specific Knowledge
Representation
MDE-based DSLsGenerative approaches
(editor, parser)
EJCP 2015, June 22, Nancy
Challenges
Code generation and external tools
27
Domain Specific Knowledge as additional
inputs
Domain Specific Knowledge as additional
inputsCode GenerationCode Generation
Use of External Tools(term rewriting, ML, LP,
CSP, …)
Code GenerationCode Generation
Use of External Tools(term rewriting, ML, LP,
CSP, …)
Use of External Tools(term rewriting, ML, LP,
CSP, …)
EJCP 2015, June 22, Nancy
Challenges and MDE Solutions Code generation and external tools
28
Domain Specific Knowledge as additional
inputs
Domain Specific Knowledge as additional
inputsCode GenerationCode Generation
Use of External Tools(term rewriting, ML, LP,
CSP, …)
Code GenerationCode Generation
Use of External Tools(term rewriting, ML, LP,
CSP, …)
Use of External Tools(term rewriting, ML, LP,
CSP, …)
M2T tools (Xpand/Xtend)M2T tools (Xpand/Xtend)
MetatoolsMetamodel instrumentation
Defining new generative tools
MetatoolsMetamodel instrumentation
Defining new generative tools
EJCP 2015, June 22, Nancy
Limitations of MDE
MDE does not let you do something “new” It may take more time, but you can do it
MDE does not help if your idea isn’t right You may have your prototype in 2 weeks but, it does not help you get good
numbers
29
EJCP 2015, June 22, Nancy
Some Remaining Challenges Model transformation verification and
testing Property preserving model transformations
Coping with a multitude of DSLs Avoid defining and tooling of a DSL from
scratch Inter-language reasoning
Scalability Compilers handle large models
Maturity of MDE tools30
EJCP 2015, June 22, Nancy
Perspectives
MDE can learn from optimizing compilers in: Knowledge of the platform (PDM) Efficiency and scalability culture
Anticipate use of DSLs to grow Thus, every software engineer will have
to deal with compilation chains for DSLs
31
EJCP 2015, June 22, Nancy
Main Message
Compiler may not be so far away from you!
3 years is short, but don’t just look at your tiny little domain many fields are closely connected of course, sometimes it’s good to focus
32
EJCP 2015, June 22, Nancy
Acknowledgements
Some slides in this talk was taken from my a talk for our paper done by Robert France Benoit Combemale Steven Derrien Sanjay Rajopadhye Clement Guy Antoine Floch
EJCP 2015, June 22, Nancy
33