global gcc project - rmll2008.rmll.info/img/pdf/ggcc_rmll2008_2.pdfitea 2 - 7 in software-intensive...
TRANSCRIPT
![Page 1: Global GCC PROJECT - RMLL2008.rmll.info/IMG/pdf/ggcc_rmll2008_2.pdfITEA 2 - 7 in Software-intensive Systems and Services Static checking European Leadership • Step 3: static rule](https://reader034.vdocuments.us/reader034/viewer/2022050500/5f932e2646a62d48dd50271d/html5/thumbnails/1.jpg)
Global GCC PROJECT
![Page 2: Global GCC PROJECT - RMLL2008.rmll.info/IMG/pdf/ggcc_rmll2008_2.pdfITEA 2 - 7 in Software-intensive Systems and Services Static checking European Leadership • Step 3: static rule](https://reader034.vdocuments.us/reader034/viewer/2022050500/5f932e2646a62d48dd50271d/html5/thumbnails/2.jpg)
• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
ITEA 2 - 2
in Software-intensiveSystems and Services
European Leadership
MotivationImprove software safety, efficiency and quality
![Page 3: Global GCC PROJECT - RMLL2008.rmll.info/IMG/pdf/ggcc_rmll2008_2.pdfITEA 2 - 7 in Software-intensive Systems and Services Static checking European Leadership • Step 3: static rule](https://reader034.vdocuments.us/reader034/viewer/2022050500/5f932e2646a62d48dd50271d/html5/thumbnails/3.jpg)
• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
ITEA 2 - 3
in Software-intensiveSystems and Services
European Leadership
GoalEnhance existing open source gcc
• Give quality feedback to programmer as early as possible
• Enhance existing open source gcc used by hundred of thousands of developers in the world
Implementation Testing MaintenanceDesignRequirements
1
10
100
1000
cost
Time
![Page 4: Global GCC PROJECT - RMLL2008.rmll.info/IMG/pdf/ggcc_rmll2008_2.pdfITEA 2 - 7 in Software-intensive Systems and Services Static checking European Leadership • Step 3: static rule](https://reader034.vdocuments.us/reader034/viewer/2022050500/5f932e2646a62d48dd50271d/html5/thumbnails/4.jpg)
• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
ITEA 2 - 4
in Software-intensiveSystems and Services
European Leadership
GoalExtend open source compiler infrastructure for :
• Coding rule checking
• Static analysis and threat detection
• Improved optimization
![Page 5: Global GCC PROJECT - RMLL2008.rmll.info/IMG/pdf/ggcc_rmll2008_2.pdfITEA 2 - 7 in Software-intensive Systems and Services Static checking European Leadership • Step 3: static rule](https://reader034.vdocuments.us/reader034/viewer/2022050500/5f932e2646a62d48dd50271d/html5/thumbnails/5.jpg)
• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
ITEA 2 - 5
in Software-intensiveSystems and Services
European LeadershipStructure of the project
• WP2 – test and examples• WP3 – infrastructures• WP4 – static checking• WP5 – global optimisation• WP6 – coding rule checking
![Page 6: Global GCC PROJECT - RMLL2008.rmll.info/IMG/pdf/ggcc_rmll2008_2.pdfITEA 2 - 7 in Software-intensive Systems and Services Static checking European Leadership • Step 3: static rule](https://reader034.vdocuments.us/reader034/viewer/2022050500/5f932e2646a62d48dd50271d/html5/thumbnails/6.jpg)
• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
ITEA 2 - 6
in Software-intensiveSystems and Services
European LeadershipStatic checking
• Goal : Detect at compile time coding errors• Mean : Use gcc powerful infrastructure and add directly check
there
• Step 1 : compiler probe• Add a compiler probe allowing to display during the compilation,
the compiler behaviour trough a graphical UI
• Step 2 : gcc infrastructure• Integration of a new garbage collector in gcc for small, dynamic
data structures. Integration of a lisp like dynamic translator in gcc to have a simpler way to express ggcc analysis algorithms
probe cc1
file.c
file.s
requests
replies
![Page 7: Global GCC PROJECT - RMLL2008.rmll.info/IMG/pdf/ggcc_rmll2008_2.pdfITEA 2 - 7 in Software-intensive Systems and Services Static checking European Leadership • Step 3: static rule](https://reader034.vdocuments.us/reader034/viewer/2022050500/5f932e2646a62d48dd50271d/html5/thumbnails/7.jpg)
• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
ITEA 2 - 7
in Software-intensiveSystems and Services
European LeadershipStatic checking
• Step 3 : static rule coding • Coding of rules in lisp for ensuring rules
• Special branch (melt) in gcc tree with all melt advances• generation of ~500 000 code lines
int n=4;double*zone=malloc(n*sizeof(double));sum=0for (int i=0; i <= n; i++) { sum=sum+data[i]; zone[i]=sum;}
int n=4;double*zone=malloc(n*sizeof(double));sum=0for (int i=0; i <= n; i++) { sum=sum+data[i]; zone[i]=sum;}
compilation
Beware writingout of memoryfor zone
![Page 8: Global GCC PROJECT - RMLL2008.rmll.info/IMG/pdf/ggcc_rmll2008_2.pdfITEA 2 - 7 in Software-intensive Systems and Services Static checking European Leadership • Step 3: static rule](https://reader034.vdocuments.us/reader034/viewer/2022050500/5f932e2646a62d48dd50271d/html5/thumbnails/8.jpg)
• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
ITEA 2 - 8
in Software-intensiveSystems and Services
European LeadershipCoding Rule Conformance
• Standard coding rules sets do exist e.g.: – MISRA-C (C language): automotive industry standard– High-Integrity C++ (HICPP): sponsored by a private company– Javacard: addressing specific restrictions of Java Smart Cards
• Some projects and organisations need to adapt standard coding rule sets or write their own rules.
• Rules written in natural language are ambiguous, which undermines any effort to automatically enforce them.
![Page 9: Global GCC PROJECT - RMLL2008.rmll.info/IMG/pdf/ggcc_rmll2008_2.pdfITEA 2 - 7 in Software-intensive Systems and Services Static checking European Leadership • Step 3: static rule](https://reader034.vdocuments.us/reader034/viewer/2022050500/5f932e2646a62d48dd50271d/html5/thumbnails/9.jpg)
• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
ITEA 2 - 9
in Software-intensiveSystems and Services
European LeadershipCoding rule conformance
• Rule formalisation• Based on first order logic and written in a declarative domain
specific language. A prolog engine is used in order to check for compliance.
• A rule is not coded itself but its negation.
::Animal
::Mammal ::WingedAnimal
::Bat
virtual
Rule HICPP 3.3.15:
“Ensure base classes common to more than onederived class are virtual.”
Rule translation :
violate_hicpp_3_3_15(A,B, C, D):-
class(A), class(B), class(C),
class(D), B \= C,
direct_base_of(A, B),
direct_base_of(A, C),
base_of(B, D), base_of(C, D),
\+ virtual_base_of(A, C).
![Page 10: Global GCC PROJECT - RMLL2008.rmll.info/IMG/pdf/ggcc_rmll2008_2.pdfITEA 2 - 7 in Software-intensive Systems and Services Static checking European Leadership • Step 3: static rule](https://reader034.vdocuments.us/reader034/viewer/2022050500/5f932e2646a62d48dd50271d/html5/thumbnails/10.jpg)
• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
ITEA 2 - 10
in Software-intensiveSystems and Services
European LeadershipCoding rule conformance
Coding RuleFormalisation
Coding RuleCompiler
Prolog Repr.of Coding
Rules
Coding RuleChecker
Coding RuleComplianceDiagnosis
GGCC coding rulecompliance architecture
Global Optimizer
StaticAnalysers
Other GGCCtools
Source files :.c, .cpp, .java
GCC Front-End
Gimple, SSA,and other
GCC internalrepr.
GCCBack-end
Object Code
Gnu Compiler Collection (GCC)
![Page 11: Global GCC PROJECT - RMLL2008.rmll.info/IMG/pdf/ggcc_rmll2008_2.pdfITEA 2 - 7 in Software-intensive Systems and Services Static checking European Leadership • Step 3: static rule](https://reader034.vdocuments.us/reader034/viewer/2022050500/5f932e2646a62d48dd50271d/html5/thumbnails/11.jpg)
• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
ITEA 2 - 11
in Software-intensiveSystems and Services
European LeadershipEnabling Interactivity in GCC for Optimizations
• Interface GCC with external research tools.• iterative optimizations• design space exploration• machine learning techniques• feature extraction• fine-grain instrumentation/modification of the compiler-flow
• With clean internals in GCC :• homogeneous data extraction decoupled from internals• central data-management system
![Page 12: Global GCC PROJECT - RMLL2008.rmll.info/IMG/pdf/ggcc_rmll2008_2.pdfITEA 2 - 7 in Software-intensive Systems and Services Static checking European Leadership • Step 3: static rule](https://reader034.vdocuments.us/reader034/viewer/2022050500/5f932e2646a62d48dd50271d/html5/thumbnails/12.jpg)
• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
ITEA 2 - 12
in Software-intensiveSystems and Services
European LeadershipInteractivity in optimisation
![Page 13: Global GCC PROJECT - RMLL2008.rmll.info/IMG/pdf/ggcc_rmll2008_2.pdfITEA 2 - 7 in Software-intensive Systems and Services Static checking European Leadership • Step 3: static rule](https://reader034.vdocuments.us/reader034/viewer/2022050500/5f932e2646a62d48dd50271d/html5/thumbnails/13.jpg)
• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
ITEA 2 - 13
in Software-intensiveSystems and Services
European LeadershipInteractive Compilation Interface
• IC Interface defines the set of functions accessible by the controller
• IC Controller is dynamically linked with GCC. It doesn't depend on GCC internals
• The controller can interact with external tools enabling GCC to be controlled from other applications written in any programming language
![Page 14: Global GCC PROJECT - RMLL2008.rmll.info/IMG/pdf/ggcc_rmll2008_2.pdfITEA 2 - 7 in Software-intensive Systems and Services Static checking European Leadership • Step 3: static rule](https://reader034.vdocuments.us/reader034/viewer/2022050500/5f932e2646a62d48dd50271d/html5/thumbnails/14.jpg)
• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
ITEA 2 - 14
in Software-intensiveSystems and Services
European LeadershipResults
• Melt branch in gcc tree– generation of 500 000 lines from the lisp to C generator allowing the
writing of lisp code to create static analysis with full access to all gcc internal data structures
– will allow the creation of optimisation pass in lisp
• Release of UPM : http://git.infradead.org/gcc.git – dump information about a C++ program in Prolog facts– a Prolog engine is used for codifying coding rules and search the
dumped data for violations of the rules.– Very few rules are implemented right now but, hopefully, some more
rules will be added in the next days/weeks.– At time being, only structural information (classes, inheritance,
methods, variables, types) is dumped, and only the middle-end of the compiler has been modified.
• ICI compiler implemented but still not released.
![Page 15: Global GCC PROJECT - RMLL2008.rmll.info/IMG/pdf/ggcc_rmll2008_2.pdfITEA 2 - 7 in Software-intensive Systems and Services Static checking European Leadership • Step 3: static rule](https://reader034.vdocuments.us/reader034/viewer/2022050500/5f932e2646a62d48dd50271d/html5/thumbnails/15.jpg)
• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
ITEA 2 - 15
in Software-intensiveSystems and Services
European LeadershipConclusion
• GGCC will increase the safety of products
• GGCC will increase the efficiency of development (and save money)
• GGCC is unique among open source
![Page 16: Global GCC PROJECT - RMLL2008.rmll.info/IMG/pdf/ggcc_rmll2008_2.pdfITEA 2 - 7 in Software-intensive Systems and Services Static checking European Leadership • Step 3: static rule](https://reader034.vdocuments.us/reader034/viewer/2022050500/5f932e2646a62d48dd50271d/html5/thumbnails/16.jpg)
Thank you for your attention