Download presentation
Presentation is loading. Please wait.
Published byNigel Shepherd Modified over 9 years ago
1
A Microsoft.NET Front-End for GCC Bernhard Rabe Martin von Löwis Jan Möller Operating Systems & Middleware Group Hasso-Plattner-Institute, University of Potsdam
2
2.NET Technologies'2006, Plzeň May 29 - June 1, 2006 Outline Motivation GCC CIL Front-End Targets Internals Example Status Conclusions
3
3.NET Technologies'2006, Plzeň May 29 - June 1, 2006 Vision Extending the reach of Middleware Today What else?
4
4.NET Technologies'2006, Plzeň May 29 - June 1, 2006 GNU Compiler Collection Different programming languages (C, C++, Java, Ada,…) Various (micro)processor architectures (H8300, ARM, AVR, i386, …) Easy extensibility to new architectures C C++ Java Front-ends RTL Back-ends x86 asm arm asm mips asm GCC
5
5.NET Technologies'2006, Plzeň May 29 - June 1, 2006 CIL Front-End We use the “Portable.NET IL libraries” to read.NET assemblies Transforms IL code into GCC internal tree representation memory layout of objects vtables and emits RTL code for each method All.NET concepts except dynamic loading can be supported C++ C# VB.NET Compiler IL Assembly GCC x86 asm h8/300 asm
6
6.NET Technologies'2006, Plzeň May 29 - June 1, 2006 Target platforms Lego Mindstorm Robots Lego.NET RCX 2.0 (Renesas H8/300, 16Bit, 16 Mhz) 32K RAM no floating point support Real-Time Control System Real-Time.Net Windows CE (x86,600 Mhz) Thread support (delegates) (Hard) real-time constraints (Higher Striker)
7
7.NET Technologies'2006, Plzeň May 29 - June 1, 2006 Implementation Internals Runtime system for each supported target Mono application binary interface (ABI) object layout (MonoObject) string and array layout vtable layout method calling convention Floating point support (emulation or hardware if available) support only beforefieldinit classes anytime before first access initialization is done at program start
8
8.NET Technologies'2006, Plzeň May 29 - June 1, 2006 excerpt from example.cs c=a+b*3; tree nodes ldloc.0 ldloc.1 ldc.i4.3 mul add stloc.2 VAR_DECL LOC0 VAR_DECL LOC1 INTEGER_CST 3 MUL_EXPR
9
9.NET Technologies'2006, Plzeň May 29 - June 1, 2006 excerpt from example.cs c=a+b*3; tree nodes ldloc.0 ldloc.1 ldc.i4.3 mul add stloc.2 VAR_DECL LOC0 VAR_DECL LOC1 INTEGER_CST 3 MUL_EXPR ADD_EXPR
10
10.NET Technologies'2006, Plzeň May 29 - June 1, 2006 excerpt from example.cs c=a+b*3; tree nodes ldloc.0 ldloc.1 ldc.i4.3 mul add stloc.2 VAR_DECL LOC0 VAR_DECL LOC1 INTEGER_CST 3 MUL_EXPR ADD_EXPR VAR_DECL LOC2
11
11.NET Technologies'2006, Plzeň May 29 - June 1, 2006 excerpt from example.cs c=a+b*3; tree nodes ldloc.0 ldloc.1 ldc.i4.3 mul add stloc.2 VAR_DECL LOC0 VAR_DECL LOC1 INTEGER_CST 3 MUL_EXPR ADD_EXPR VAR_DECL LOC2 MODIFY_EXPR
12
12.NET Technologies'2006, Plzeň May 29 - June 1, 2006 excerpt from example.cs c=a+b*3; tree nodes ldloc.0 ldloc.1 ldc.i4.3 mul add stloc.2 VAR_DECL LOC0 VAR_DECL LOC1 INTEGER_CST 3 MUL_EXPR expand_expr(MODIFY_EXPR) Backend emits assembly language ADD_EXPR VAR_DECL LOC2 MODIFY_EXPR
13
13.NET Technologies'2006, Plzeň May 29 - June 1, 2006 gcc –O2 –S example.dll x86 Backend, excerpt from example.s movl12(%ebp), %eax; eax = b leal(%eax,%eax,2), %eax; eax = eax+2*eax addl8(%ebp), %eax; eax += a
14
14.NET Technologies'2006, Plzeň May 29 - June 1, 2006 Supported Constructs primitive data types, enums classes, attributes (static, instance), properties, inheritance methods (static, instance), parameters, local variables and constructors arrays and strings delegates arithmetic operations control flow operations (conditional, unconditional branch, switch)
15
15.NET Technologies'2006, Plzeň May 29 - June 1, 2006 Conclusions CIL front-end for GCC Support for target processors not supported otherwise (commercial framework, or compact framework) Programming Lego Mindstorms Robots http://www.dcl.hpi.uni-potsdam.de/research/lego.NET/ Future Work Real-time extensions (Real-Time.Net) interfaces, reflection, exception handling GC
16
16.NET Technologies'2006, Plzeň May 29 - June 1, 2006 Questions? gcc@hpi.uni-potsdam.de
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.