GithubHelp home page GithubHelp logo

compiler's People

Contributors

kemurphy avatar mrwright avatar msullivan avatar rbenua avatar rntz avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

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

compiler's Issues

const declarations should allow casting

When trying to define a constant pointer: const uart_base: *u32 = 0x80001000 as *u32;
I get the following error: Non-constant expression where constant expected.
This should be possible, as otherwise there's no way to initialize an arbitrary constant pointer.

ICE in typechecker

fn main() -> u32 {
    let s: *u8 = 0 as *u8;
    let t = *(&s as u8 + 3);

    0
}

This is not well-typed, but it should print a type error. Instead it has an ICE:

task '<main>' failed at 'internal error: entered unreachable code', src/typechecker.rs:771
stack backtrace:
   1:     0x7f6bf0f0eda0 - rt::backtrace::imp::write::h2626651a2fc94766OLq
   2:     0x7f6bf0f11d90 - failure::on_fail::h03ed7212d81a2db7w7q
   3:     0x7f6bf0f21500 - unwind::begin_unwind_inner::hf47eb3d89161428crje
   4:     0x7f6bf0a00b80 - unwind::begin_unwind::h422749655183734816
   5:     0x7f6bf0a09e80 - typechecker::Typechecker<'a>::expr_to_ty::hc5ae88c33eb50683w6c
   6:     0x7f6bf0a16e30 - typechecker::Typechecker<'a>::block_to_ty::h4332730153b79d2enGd
   7:     0x7f6bf0a1fa10 - typechecker::Typechecker<'a>.Visitor::visit_item::closure.33696
   8:     0x7f6bf0a12240 - typechecker::Typechecker<'a>::with_generics::h2646355133747685451
   9:     0x7f6bf0a04e60 - typechecker::Typechecker<'a>.Visitor::visit_item::h6d83b4e8824299c5jee
  10:     0x7f6bf0a043c0 - typechecker::Typechecker<'a>::typecheck::h2648d77ca069b5b25Hc
  11:     0x7f6bf0b9d0a0 - mc::main::hd765d4b4ec89fe2eeZF
  12:     0x7f6bf0bf6fd0 - start::closure.8431
  13:     0x7f6bf0f22250 - rust_try_inner
  14:     0x7f6bf0f22240 - rust_try
  15:     0x7f6bf0f1f780 - unwind::try::h2d20ff3e4d5ebe36H7d
  16:     0x7f6bf0f1f550 - task::Task::run::h6c06266aca975e6cNdd
  17:     0x7f6bf0bf6d00 - start::h0795d18d071ca9e5soe
  18:     0x7f6bf0bf6c70 - lang_start::h1b3ea2e9962b8f3fLne
  19:     0x7f6bef573a50 - __libc_start_main
  20:     0x7f6bf09fb1f8 - <unknown>
  21:                0x0 - <unknown>

Assignment operators

Supporting +=, |=, etc would be nice. Probably follow rust and don't have ++/--.

IR compiler miscompiles &&

The result of && expressions seems to always be true?

fn main() {
    if (false && false) {
        printf0_("u wot m8\n");
    }
}

prints "u wot m8"

"unconstrained type" in ccross with templates

The following code:

enum X<T> {
    Some(*T)
}

fn f<T>() -> *T {
    match *(null as *X<T>) {
        Some(x) => null as *T,
    }
}

fails with:

task '<main>' failed at 'Type is not fully constrained: <unconstrained>', src/target/ccross.rs:436

If the cast of null to *T is removed, it works.

Fix scheduler bug and re-enable the scheduler

Right now, the scheduler assumes that any two loads or any two stores can commute, which is not the case when the memory addresses are the same. It should be updated with stricter rules, and then re-enabled.

Comment parsing bug

/*
  //*
*/

is treated as an unterminated multi-line comment, even though it shouldn't be.

store/store commute rule is a little overzealous

joshua@bruges:~/projects/moroso/cpu/sim/cpu_sim$ ./cpu_sim -g --input mandelbrot.bin
OSOROM simulator starting
Reading from mandelbrot.bin
mdb@0x00000000> dis 0x3db0
      3d80 { nop; r4 <- *l(r30 + -0x4); nop; r30 <- r30 - 0x4; }
      3d90 { nop; r31 <- *l(r30 + -0x4); nop; r30 <- r30 - 0x4; }
      3da0 { B r31 + 0x10; }
 >    3db0 { r0 <- r0 *s r1; }
      3dc0 { r1 <- ovf; }
      3dd0 { *l(r2 + 0x0) <- r1; *l(r3 + 0x0) <- r0; }
      3de0 { B r31 + 0x10; }
      3df0 { nop; }

A write from 3dd0 could be moved to 3dc0, and then 3de0 could get merged with 3dd0.

Refactor compiler testing

We should have a bunch of unit tests, each testing a specific feature, instead of the more ad-hoc test programs we have right now.

conditional won't work without a semicolon at the end

at least, this is what I've observed. when I try to use an if-statement, I get "task '

' failed at 'LHS of assignment is not an lvalue', src/typechecker.rs:422" unless I add a semicolon at the end of the closing brace.

I claim this is a bug

break statement

I would like to have a break statement. For breaking out of loops and such :)

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.