a front-end for gcc bernhard rabe martin von lwis jan mller operating systems middleware group...

Post on 18-Jan-2018

223 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

3.NET Technologies'2006, Plzeň May 29 - June 1, 2006 Vision Extending the reach of Middleware Today What else?

TRANSCRIPT

A Microsoft .NET Front-End for GCCBernhard RabeMartin von LöwisJan Möller Operating Systems & Middleware GroupHasso-Plattner-Institute, University of Potsdam

.NET Technologies'2006, PlzeňMay 29 - June 1, 2006 2

Outline Motivation GCC CIL Front-End

Targets Internals Example Status

Conclusions

.NET Technologies'2006, PlzeňMay 29 - June 1, 2006 3

Vision Extending the reach of Middleware Today

What else?

.NET Technologies'2006, PlzeňMay 29 - June 1, 2006 4

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

x86asm

armasm

mipsasm

GCC

.NET Technologies'2006, PlzeňMay 29 - June 1, 2006 5

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

ILAssembly GCC

x86asm

h8/300asm

.NET Technologies'2006, PlzeňMay 29 - June 1, 2006 6

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)

.NET Technologies'2006, PlzeňMay 29 - June 1, 2006 7

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

.NET Technologies'2006, PlzeňMay 29 - June 1, 2006 8

excerpt from example.csc=a+b*3; tree nodes

ldloc.0ldloc.1ldc.i4.3muladdstloc.2

VAR_DECLLOC0

VAR_DECLLOC1

INTEGER_CST3

MUL_EXPR

.NET Technologies'2006, PlzeňMay 29 - June 1, 2006 9

excerpt from example.csc=a+b*3; tree nodes

ldloc.0ldloc.1ldc.i4.3muladdstloc.2

VAR_DECLLOC0

VAR_DECLLOC1

INTEGER_CST3

MUL_EXPR

ADD_EXPR

.NET Technologies'2006, PlzeňMay 29 - June 1, 2006 10

excerpt from example.csc=a+b*3; tree nodes

ldloc.0ldloc.1ldc.i4.3muladdstloc.2

VAR_DECLLOC0

VAR_DECLLOC1

INTEGER_CST3

MUL_EXPR

ADD_EXPR VAR_DECLLOC2

.NET Technologies'2006, PlzeňMay 29 - June 1, 2006 11

excerpt from example.csc=a+b*3; tree nodes

ldloc.0ldloc.1ldc.i4.3muladdstloc.2

VAR_DECLLOC0

VAR_DECLLOC1

INTEGER_CST3

MUL_EXPR

ADD_EXPR VAR_DECLLOC2

MODIFY_EXPR

.NET Technologies'2006, PlzeňMay 29 - June 1, 2006 12

excerpt from example.csc=a+b*3; tree nodes

ldloc.0ldloc.1ldc.i4.3muladdstloc.2

VAR_DECLLOC0

VAR_DECLLOC1

INTEGER_CST3

MUL_EXPR

expand_expr(MODIFY_EXPR) Backend emits assembly language

ADD_EXPR VAR_DECLLOC2

MODIFY_EXPR

.NET Technologies'2006, PlzeňMay 29 - June 1, 2006 13

gcc –O2 –S example.dll x86 Backend, excerpt from example.s

movl 12(%ebp), %eax ; eax = b leal (%eax,%eax,2), %eax ; eax = eax+2*eaxaddl 8(%ebp), %eax ; eax += a

.NET Technologies'2006, PlzeňMay 29 - June 1, 2006 14

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)

.NET Technologies'2006, PlzeňMay 29 - June 1, 2006 15

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

.NET Technologies'2006, PlzeňMay 29 - June 1, 2006 16

Questions?

gcc@hpi.uni-potsdam.de

top related