Giter Site home page Giter Site logo

dibyendumajumdar / dmr_c Goto Github PK

View Code? Open in Web Editor NEW
52.0 52.0 2.0 9.5 MB

dmr_C is a C parser and JIT compiler with LLVM, Eclipse OMR and NanoJIT backends

License: Other

CMake 0.07% C 58.17% C++ 0.05% Shell 0.06% LLVM 40.81% Objective-C 0.01% Lua 0.68% Brainfuck 0.07% Python 0.09%
c compiler eclipse-omr jit llvm nanojit parser preprocessor programming-language

dmr_c's People

Contributors

dibyendumajumdar 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dmr_c's Issues

Review error handling to avoid program termination on error

The sparse implementation simply exits on encountering errors ... but as a library we cannot do that, so we need an alternative method. Perhaps we can supply an error handler that is called - and this can do a long jmp. We can then allow the caller to handle it. Obviously once an error has occurred then the dmr_C instance should not be used anymore.

Avoid using long type

In some places sparse code uses long type. This should be changed to int or long long type as long type is not portable

A conditional branch may be omitted by NanoJIT

It seems that NanoJIT may decide to omit a conditional branch if the code can simply fall through. The branch instructions is returned as NULL in this case causing a crash. We need to detect and avoid trying to add the NULL instruction to the list of jumps to be resolved.

Reinstate type specific ptr list

When I ported Sparse to Windows, I removed all the type specific ptr_list types - and instead used ptr_list directly. However, this makes the code less readable as the list type is not evident, and also creates unnecessary differences when comparing with Sparse. This issue is to restore the type specific ptr_list definitions but do it in a way that I can understand.

Missing liveness information causes stack being over-written

It seems that allocas need to have liveness information added else when NanoJIT's spills registers it may overwrite stack slots.

There are two situations:

  1. Phi instructions generate allocas - these should be handled when a jump goes back to a prior block. Any phi related allocas in the target block must be marked live.
  2. For allocas arising from local var declarations that were not converted to pseudos, we can add liveness instructions for all the allocas, as we do not have better information at present.

Work out how to avoid global allocator for ptr_list nodes

The Sparse library uses a pointer linked list implementation called ptr_list. The list is maintained as a circular list and there is no defined head or tail - any node can be treated as the head. The library relies upon this feature. The list is represented simply by a pointer to one of the nodes. The problem is that there is no way to associate an allocator with a list, so the ptr_list nodes are managed via a global allocator. Unfortunately the lists created by the parser are not "destroyed" individually - the entire allocator can be destroyed but because this is global, then the issue is that there must not be any active dmr_C instances.

Error Building without a backend

dmr_c/build>$ make

[ 71%] Built target dmr_c
[ 77%] Built target runtests
[ 80%] Building C object CMakeFiles/showsymbols.dir/samples/show-symbols.c.o
/home/guest/Gits/Compiler/dmr_c/samples/show-symbols.c:34:10: fatal error: dmr_c.h: No such file or directory
 #include <dmr_c.h>
          ^~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/showsymbols.dir/build.make:63: CMakeFiles/showsymbols.dir/samples/show-symbols.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:142: CMakeFiles/showsymbols.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

how fix?

Change the LLVM api to accept a Module

Allowing the user to create the LLVM module is important to allow the user to add additional stuff to the module. So it is better to accept the Module as a parameter rather than creating it within the API.

Refactor code to avoid simplification

The sparse simplification phase is error prone and given there is no active compiler experts looking at this it is unlikely to improve. Given Jit backends such as llvm and omr have robust optimizers we don't really need sparse to do it's simplifications

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.