Commit Graph

6 Commits

Author SHA1 Message Date
Dan Gohman
cb37c25d3a Introduce Builder and Product types to the Module workflow.
This eliminates API confusion and surface area with respect to what state
the `Backend` needs to be in at different points.

Now, API users will construct a `Builder`, and pass it into the `Module`
which uses it to constrct a `Backend`. The `Backend` instance only lives
inside the `Module`. And when finished, the `Module` can return a
`Product` back to the user providing any outputs it has.
2018-04-19 11:19:14 -07:00
Dan Gohman
07576d3ed0 Make test-all.sh run unit tests in debug mode.
It turns out that "cargo test --release" doesn't use
`[profile.release]`; it uses `[profile.bench]` instead; see
[here](https://doc.rust-lang.org/cargo/reference/manifest.html) for details.
So the plan to run the tests in optimized mode but with debug-assertions
enabled didn't actually work, and we had an actual failing unit test that
was hidden because assertions were disabled.

So, this makes test-all.sh just run the unit tests in debug mode, as is
the norm for Rust packages, and fixes the buggy test.

This also removes the `[profile.release]` override from the top-level
Cargo.toml file too. We don't need it now that we're not running tests
in release mode, and it had confused multiple people because it made
Cretonne's in-tree builds different from how Cretonne is built when used as
a dependency in other projects.
2018-04-19 07:07:41 -07:00
Dan Gohman
1ba468b230 Bump version to 0.5.1 2018-04-17 22:18:30 -07:00
Dan Gohman
bf597b7abf Enable and fix several more clippy lints. 2018-04-17 17:05:03 -07:00
Dan Gohman
1f43ec09f3 Bump version to 0.5.0 2018-04-17 10:58:33 -07:00
Dan Gohman
76db9f022d [WIP] Module API (#294)
* Initial skeleton.

* Add basic faerie support.

This adds enough functionality to enable simple .o file writing through
faerie. This included adding the functionality to Module to support
RelocSink implementations.

* Add basic SimpleJIT support.

This adds enough functionality to enable a simple program to be jitted
and executed.

* Make declare_func_in_func take a Function instead of a Context.

It only needs the Function, and sometimes it's useful to call it from
places that don't have a full Context.

* Temporarily disable local and exported global variables in the Faerie backend.

Faerie assumes these variables use pc-relative offset instructions, and
Cretonne is not yet emitting those instructions.

* FaerieBackend depends on PIC.

Faerie itself only supports PIC objects for now, so add an assert to
Cretonne to check that it's using a PIC target flag.

* SimpleJIT support for data objects.

* Preliminary faerie support for data objects.

* Support for data objects in faerie using the new colocated flag.

* Unit tests for DataContext and friends.

* Add a Module::consume() function.

This consumes the Module and returns the contained Backend, so that
users can call Backend-specific functions with it. For example, the
Faerie backend has functions to write an object file.

* Update the new crates to version 0.4.4.

* Make FaerieBackend own its TargetIsa.

This simplifies its interface, as it eliminates a lifetime parameter.
While we may eventually want to look into allowing multiple clients to
share a TargetIsa, it isn't worth the complexity for FaerieBackend
right now.

* Don't try to protect faerie from multiple declarations.

Let faerie decide for itself whether it wants to consider two
declarations to be compatible.

* Use debug_assert_eq rather than debug_assert with ==.

* Fix FaerieRelocSink's reloc_external to handle data object names.

* Relax the asserts in get_function_definition and get_data_definition.

These functions don't require definable symbols, but they do require
that definable symbols be defined. This is needed for the simplejit
backend.

* Add a function to the faerie backend to retrieve the artifact name.

* Sync up with cretonne changes.
2018-04-17 10:52:36 -07:00