Code Monkey home page Code Monkey logo

llilc's Introduction

LLILC Is Now Archived

LLILC was an experimental project to build a .NET compatible JIT from LLVM. It is no longer under active development.

For questions or concerns please open an issue on https://github.com/dotnet/core.

Welcome to LLILC

Join the chat at https://gitter.im/dotnet/llilc

Build Status

Windows Linux
Debug Build status Build Status
Release Build status Build Status

Introduction

LLILC is an LLVM based MSIL Compiler - we pronounce it 'lilac' - with a goal of producing a set of cross-platform .NET code generation tools. Today LLILC is being developed against dotnet/CoreCLR for use as a JIT, as well as an cross platform platform object emitter and disassembler that is used by CoreRT as well as other dotnet utilites.

See the documentation for more information. It has a more complete discussion of our background and goals as well as "getting started" details and developer information.

ObjectWriter for CoreRT: CoreRT project uses ObjectWriter that lives in its own branch in this repo, if you want to build it then follow instructions from getting started, but use the following branches:

  1. latest LLVM version and apply this patch or take the known working version from Microsoft/llvm/CoreRT_ObjectWriter branch;
  2. llilc/ObjectWriter branch;

libcoredistools: CoreCLR has a ongoing dependency on libcoredistools which is built out of this repo and placed into build/lib/libcoredistools.dylib|so|dll. To build coredistools follow the default workflow for building llilc/llvm on the master branch.

Supported Platforms

Our initial supported platform is Windows, but Linux and Mac OS X support are under development.

Contributions

Please see our issues or the contributing document for how to pitch in.

llilc's People

Contributors

acmyu avatar andreenkos avatar andyayersms avatar bevinsky avatar dotnet-bot avatar erozenfeld avatar gfoidl avatar gitter-badger avatar janvorli avatar jashook avatar jkotas avatar josephtremoulet avatar krk avatar krytarowski avatar kyulee1 avatar mewmew avatar michellemcdaniel avatar mjsabby avatar mmitche avatar nattress avatar pgavlin avatar phomes avatar richardlford avatar richlander avatar russellhadley avatar swaroop-sridhar avatar terrajobst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

llilc's Issues

Basic tests vs CoreCLR require catching an exception

In the current CoreCLR/CoreFX drops, tests that write to the console will require the jit to generate code that can handle exceptions, unless the current code page is 65001 (my cmd shell defaults to CP 437).

In particular we see a throw from a protected block in System.Text.Encoding.GetEncoding(int32 codePage) with a local catch.

Given that MSILC won't be in a position to generate correct code for catches for a while, we need a workaround -- either set the code page when running the tests, avoid tests that write to the console, get CoreFx to look at whether this behavior is reasonable, or blacklist that method in our jit and allow the production jit to handle it.

GC: Develop a methodology for identifying interior pointers

Our GC reporting requires us to distinguish object pointers from interior pointers. We are using address spaces to track all reportable pointers, but we need some extra mechanism to determine which of these are object pointers and which are interior pointers.

Modify source base to use stdint.h fixed size integers

For portability move to a fixed size types across all the source.

This should not at this point change the headers we're importing from the CLR. The effort to make those more xplat friendly will need to be separate.

EH: Expand arithmetic overflow checks in reader

Need to handle the *.ovf family of arithmetic instrructions.
Expand with explicit checks, following the pattern of #63.
If this needs to be two operations in LLVM IR (check for ovf conditions followed by actual arithmetic), make sure to use the .nuw/.nsw form after the check.

Part of #13.

Find a way to refer symbolically to the addresses handed out by the EE

We get a lot of raw addresses from the EE for things like methods and static fields. For instance:

%1 = call %System.Text.Encoding addrspace(1)* inttoptr (i64 140733439908056 to %System.Text.Encoding addrspace(1)* (i32)*)(i32 %0)

They make the IR dumps somewhat cryptic. Also these addresses vary from run to run so we have to strip them out when we diff the dumps. Sure would be nice to have names here instead of numbers, like so:

%1 = call %System.Text.Encoding addrspace(1)*System.Text.Encoding::GetEncoding(i32 %0)

Remove uncalled functions

Sweep the ported reader code for any calls that are not reference (can log what the linkers /opt:ref removes for the list) and remove them. Any calls that we will start using in the immediate future can be left.

EH: implement translation of converts with overflow

This includes the following msil instructions: conv.ovf.i1, conv.ovf.u1, conv.ovf.i1.un, conv.ovf.u1.un, conv.ovf.i2, conv.ovf.u2, conv.ovf.i2.un, conv.ovf.u2.un, conv.ovf.i4, conv.ovf.u4, conv.ovf.i4.un, conv.ovf.u4.un, conv.ovf.i8, conv.ovf.u8, conv.ovf.i8.un, conv.ovf.u8.un, conv.ovf.i, conv.ovf.u, conv.ovf.i.un, conv.ovf.u.un.

EH: Catch handler support in reader

Need to generate an appropriate landingpad for each catch-protected region.
Need to update call generation to generate invoke with edge to landingpad as well.

Part of #13.

Enable conservative mode in GC, verify all is good

For the initial GC bring up, we need to set up all our testing (and user docs) to enable the GC's conservative mode. We should then verify that the current simple GC Info we report is sufficient for this mode, and add tests we can pass where GC happens when there is LLILC compiled code on the stack.

EH: Funclet prolog/epilog generation

Funclet outlining should take care of inserting a standard prolog/epilog. However, we'll need to look at how the frame closure is found and make sure that the Previous Stack Pointer Symbol handshake with the runtime is respected.

Part of #13.

EH: Implement rethrow

Once catch handlers are implemented (#66), we'll need to be able to process rethrow. This should be a straightforward invoke of the rethrow helper.

Part of #13.

Fix errors in staticcontract.h and reader.h

We are getting the following build errors in staticcontract.h and reader.h during win32 debug build:

D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\include\clr\staticcontract.h(326): error C2061: syntax error : identifier 'UINT' (D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\lib\Reader\GenIRStubs.cpp) [d:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\build_debug_win32\tools\llvm-msilc\lib\Reader\msilcReader.vcxproj]
D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\include\clr\staticcontract.h(326): error C2061: syntax error : identifier 'UINT' (D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\lib\Reader\reader.cpp) [d:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\build_debug_win32\tools\llvm-msilc\lib\Reader\msilcReader.vcxproj]
D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\include\clr\staticcontract.h(350): error C2992: 'BlockMarker' : invalid or missing template parameter list (D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\lib\Reader\GenIRStubs.cpp) [d:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\build_debug_win32\tools\llvm-msilc\lib\Reader\msilcReader.vcxproj]
D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\include\clr\staticcontract.h(350): error C2992: 'BlockMarker' : invalid or missing template parameter list (D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\lib\Reader\reader.cpp) [d:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\build_debug_win32\tools\llvm-msilc\lib\Reader\msilcReader.vcxproj]
D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\lib\Reader\reader.cpp(6565): error C2079: '__marker_onlyOneAllowedPerScope' uses undefined class 'BlockMarker' [d:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\build_debug_win32\tools\llvm-msilc\lib\Reader\msilcReader.vcxproj]
D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\lib\Reader\reader.cpp(6565): error C2228: left of '.markBlock' must have class/struct/union [d:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\build_debug_win32\tools\llvm-msilc\lib\Reader\msilcReader.vcxproj]
D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\lib\Reader\reader.cpp(6565): error C2228: left of '.useMarkedBlockAnnotation' must have class/struct/union [d:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\build_debug_win32\tools\llvm-msilc\lib\Reader\msilcReader.vcxproj]
D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\lib\Reader\reader.cpp(8088): error C2079: '__marker_onlyOneAllowedPerScope' uses undefined class 'BlockMarker' [d:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\build_debug_win32\tools\llvm-msilc\lib\Reader\msilcReader.vcxproj]
D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\lib\Reader\reader.cpp(8088): error C2228: left of '.markBlock' must have class/struct/union [d:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\build_debug_win32\tools\llvm-msilc\lib\Reader\msilcReader.vcxproj]
D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\lib\Reader\reader.cpp(8088): error C2228: left of '.useMarkedBlockAnnotation' must have class/struct/union [d:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\build_debug_win32\tools\llvm-msilc\lib\Reader\msilcReader.vcxproj]
D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\include\clr\staticcontract.h(326): error C2061: syntax error : identifier 'UINT' (D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\lib\Reader\readerir.cpp) [d:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\build_debug_win32\tools\llvm-msilc\lib\Reader\msilcReader.vcxproj]
D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\include\clr\staticcontract.h(350): error C2992: 'BlockMarker' : invalid or missing template parameter list (D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\lib\Reader\readerir.cpp) [d:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\build_debug_win32\tools\llvm-msilc\lib\Reader\msilcReader.vcxproj]
D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\lib\Reader\readerir.cpp(3188): error C2079: '__marker_onlyOneAllowedPerScope' uses undefined class 'BlockMarker' [d:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\build_debug_win32\tools\llvm-msilc\lib\Reader\msilcReader.vcxproj]
D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\lib\Reader\readerir.cpp(3188): error C2228: left of '.markBlock' must have class/struct/union [d:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\build_debug_win32\tools\llvm-msilc\lib\Reader\msilcReader.vcxproj]
D:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\LLVM\tools\llvm-msilc\lib\Reader\readerir.cpp(3188): error C2228: left of '.useMarkedBlockAnnotation' must have class/struct/union [d:\j\workspace\dotnet_llvm-msilc_windows_debug_win32_prtest\build_debug_win32\tools\llvm-msilc\lib\Reader\msilcReader.vcxproj]

EH: Generate EH clauses to report back to runtime

The EH clauses we're generating aren't exactly the same as the pdata that LLVM will be generating; need to override/translate as appropriate.

The plan is to first implement this when just catch handlers are processed in the reader, so the initial implementation can take advantage of that if convenient.

Part of #13.

Implement Exception Handling Support

What's currently implemented is a stub to allow testing programs that may statically include EH constructs, but don't dynamically raise exceptions. We will of course need a functional implementation; this is an overall tracking issue for that.

The tree contains a document describing the overall status/plan for exception handling.

Current status:

  1. Stub EH support
    • Reader discards catch/filter/fault handlers
    • Explicit throw becomes helper call
    • Continuation passing for finally handlers invoked by leave (#260)
    • Implicit exceptions expanded to explicit test/throw sequences
      • Null dereference (#63)
      • Divide by zero (#64)
      • Arithmetic overflow (#65)
      • Convert with overflow (#48)
      • Array bounds checks (#187/#188)
      • Array store checks (#188)
  2. Handler bring-up in EH branch
    • Catch handler support
      • In reader (includes updating throws to use invoke rather than call with EH edge to landingpad) (#66)
      • Funclet prolog/epilog generation, Previous Stack Pointer Symbol handshake implemented (#67)
      • EH Clause generation (#68)
      • Reporting funclets back to EE with parent functions in .text (#69)
    • Support for rethrow (#70)
    • Finally handler support
      • In reader (includes leave processing, continuation selection) (#71)
      • EH Clause generation (#73)
    • Filter handler support
      • In reader (includes early outlining) (#74)
      • EH Clause generation (#75)
    • Fault handler support (#76)
  3. Migrate changes back into master branch
  4. EH-specific optimizations
    • Finally cloning
    • Others TBD
  5. Support for other target architectures
  6. Support for ahead-of-time compilation

Consider alternatives to MCJIT

Currently we're building with the LLVM MCJIT. Consider the new ORC infrastructure. Look at options or improvements that would help our model.

FP remainder needs to use a helper call

When we see an MSIL remainder on floating types, we create an LLVM frem instruction, which lowers to a call to the CRT's fmod(), which we then fail to handle when processing coff relocations.

Instead float remainder needs to be translated to a call to the appropriate JIT helper. We can do this in the reader or figure out how to override the lowering and do it there so the remainder is exposed to optimizations in between.

This impacts the DblRem and FPRem tests in the CoreCLR test suite.

EH: Expand implicit null checks in reader

Add null checks against the object pointer for ldfld, stfld, ldloca, ldelema, ldflda, ldelema.
Checks should use an explicit compare+branch+throw sequence.
Throw will use call rather than invoke for now (stub EH support).
Use separate throw block for each test, at least for now (it facilitates debugging, vs. shared throw block for all tests in the same EH context).
Tricky bit will be making sure the reader's flow graph bookkeeping doesn't get messed up as blocks are split. May need separate notions of MSIL block and LLVM block.

Part of #13.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.