Commit Graph

9181 Commits

Author SHA1 Message Date
Nick Fitzgerald
012f4b04d7 Update TODO 2021-11-11 15:56:55 -08:00
Nick Fitzgerald
5f5484ddbc Use matches!(..) to make TrieNode::is_empty more concise 2021-11-11 15:56:55 -08:00
Nick Fitzgerald
66ba1d89b5 Remove TODO we don't want to do
If the extern types are represented with associated types, then we can't match
on them.
2021-11-11 15:56:55 -08:00
Chris Fallin
91904aa756 TODO items from call with fitzgen 2021-11-11 15:56:55 -08:00
Chris Fallin
20bc5ca7a8 Support extern constants of any primitive type. 2021-11-11 15:56:55 -08:00
Chris Fallin
d0ace640a2 TODO update. 2021-11-11 15:56:55 -08:00
Chris Fallin
521010cc4f Split into isle and islec crates 2021-11-11 15:56:55 -08:00
Chris Fallin
e751f12ac5 Refactor to allow use as library, in order to allow build.rs usage. 2021-11-11 15:56:55 -08:00
Chris Fallin
83672a88cc bugfix to macro template generation: exclude Pos on ident from equality (broken by recent commit) 2021-11-11 15:56:55 -08:00
Chris Fallin
3ed146b782 README update. 2021-11-11 15:56:55 -08:00
Chris Fallin
2a574b1b42 Properly track locations on every AST node. Semantic errors are much more useful now. Also print parse errors in same (pseudo-standard compiler error) output format. 2021-11-11 15:56:55 -08:00
Chris Fallin
7d38b3b6d8 Revamped error handling: keep going beyond some errors to accumulate a list of build errors, like most conventional compilers. 2021-11-11 15:56:55 -08:00
Chris Fallin
b46fa6acb0 Remove old/no longer used lower.rs 2021-11-11 15:56:55 -08:00
Chris Fallin
af9e01a456 Remove old .gitmodules -- no longer using wasmtime as a submodule 2021-11-11 15:56:55 -08:00
Chris Fallin
5a8e35b253 Some fixes to the internal-extractor macro substitution 2021-11-11 15:56:55 -08:00
Chris Fallin
3f96068f94 Some test cases for arg-less enums. 2021-11-11 15:56:55 -08:00
Chris Fallin
edc95c51a0 Support for bools. Also fix fallible/infallible mixup for ctors. 2021-11-11 15:56:55 -08:00
Chris Fallin
a412cce615 Infallible extractors, and some fixes to fallibility in return types (Option<T> vs T). 2021-11-11 15:56:55 -08:00
Chris Fallin
6daa55af82 Initial draft of DSL semantics complete.
This latest refactor adds "extractor macros" in place of the
very-confusing-even-to-the-DSL-author reverse-rules-as-extractors
concept. It was beautifully symmetric but also just too mind-bending to
be practical.

It also adds argument polarity to external extractors. This is inspired
by Prolog's similar notion (see e.g. the "+x" vs. "-x" argument notation
in library documentation) where the unification-based semantics allow
for bidirectional flow through arguments. We don't want polymorphism
or dynamism w.r.t. directions/polarities here; the polarities are
static; but it is useful to be able to feed values *into* an extractor
(aside from the one value being extracted). Semantically this still
correlates to a term-rewriting/value-equivalence world since we can
still translate all of this to a list of equality constraints.

To make that work, this change also adds expressions into patterns,
specifically only for extractor "input" args. This required quite a bit
of internal refactoring but is only a small addition to the language
semantics.

I plan to build out the little instruction-selector sketch further but
the one that is here (in `test3.isle`) is starting to get interesting
already with the current DSL semantics.
2021-11-11 15:56:55 -08:00
Chris Fallin
1ceef04680 (and ...) combinator in patterns 2021-11-11 15:56:55 -08:00
Chris Fallin
602b8308ce More work on sketch for isel and some TODO items derived from it. 2021-11-11 15:56:55 -08:00
Chris Fallin
d725ac13b2 Codegen: parameterize on a generated Context trait that contains external ctors/etors. 2021-11-11 15:56:55 -08:00
Chris Fallin
3ccbaf0f69 Generate match {} statements by merging adjacent MatchVariant trie edges. 2021-11-11 15:56:55 -08:00
Chris Fallin
ed4c857082 Priority-trie: merge edges with different priorities into ranges when possible. 2021-11-11 15:56:55 -08:00
Chris Fallin
7865191093 Update long block comment describing priority trie in codegen.rs. 2021-11-11 15:56:55 -08:00
Chris Fallin
b8e916a0ab Another example, testing rule priorities a bit 2021-11-11 15:56:55 -08:00
Chris Fallin
bc91a4e5f6 Add TODO 2021-11-11 15:56:55 -08:00
Chris Fallin
4a2cd78827 Working example and README 2021-11-11 15:56:55 -08:00
Chris Fallin
d7efd9f219 Working extractor and constructor generation from rules! 2021-11-11 15:56:55 -08:00
Chris Fallin
be1140e80a WIP. 2021-11-11 15:56:55 -08:00
Chris Fallin
cd55dc9568 WIP. 2021-11-11 15:56:55 -08:00
Chris Fallin
e5d76db97a WIP. 2021-11-11 15:56:55 -08:00
Chris Fallin
8c727b175a more codegen WIP: start to generate functions 2021-11-11 15:56:55 -08:00
Chris Fallin
638c9edd01 Support for file input and output, including multiple input files with proper position tracking. 2021-11-11 15:56:55 -08:00
Chris Fallin
e9a57d854d Generate internal enum types. 2021-11-11 15:56:54 -08:00
Chris Fallin
5aa72bc060 skeleton for codegen 2021-11-11 15:56:54 -08:00
Chris Fallin
02ec77a45b trie insertion 2021-11-11 15:56:54 -08:00
Chris Fallin
77ed861857 Start of significant rework: compile to a trie, not an FSM, and handle rule priorities appropriately.
See long block comment in codegen.rs. In brief, I think we actually want
to compile to a trie with priority-intervals, a sort of hybrid of a
priority tree and a trie representing decisions keyed on match-ops
(PatternInsts).

The reasons are:

1. The lexicographic ordering that is fundamental to the FSM-building in
   the Peepmatic view of the problem is sort of fundamentally limited
   w.r.t. our notion of rule priorities. See the example in the block
   comment.

2. While the FSM is nice for interpreter-based execution, when compiling
   to a language with structured control flow, what we really want is a
   tree; otherwise, if we want to form DAGs to share substructure, we
   need something like a "diamond-recovery" algorithm that finds common
   suffixes of *input match-op sequences*, and then we need to
   incorporate something like phi-nodes in order to allow captures from
   either side of the diamond to be used.

3. One of the main advantages of the automaton/transducer approach,
   namely sharing suffixes of the *output* sequence (emitting partial
   output at each state transition), is unfortunately not applicable if
   we allow the overall function to be partial. Otherwise, there is
   always the possibility that we fail at the last match op, so we
   cannot allow any external constructors to be called until we reach
   the final state anyway.

4. Pragmatically, I found I was having to significantly edit the
   peepmatic_automata implementation to adapt to this use-case
   (compilation to Rust), and it seemed more practical to design the
   data structure we want than to try to shoehorn the existing thing
   into the new problem.

WIP, hopefully working soon.
2021-11-11 15:56:54 -08:00
Chris Fallin
f2399c5384 WIP -- more thinking about how to work priorities into FSM 2021-11-11 15:56:54 -08:00
Chris Fallin
6a567924cd WIP 2021-11-11 15:56:54 -08:00
Chris Fallin
e08160845e WIP: rip out a bunch of stuff and rework 2021-11-11 15:56:54 -08:00
Chris Fallin
84b7612b98 Initial public commit of ISLE prototype DSL compiler. 2021-11-11 15:56:54 -08:00
Chris Fallin
f2939111d9 Merge pull request #3515 from cfallin/wasmtime-meeting-20211111
Wasmtime meeting notes from 2021-11-11.
2021-11-11 09:55:46 -08:00
Chris Fallin
e50d431946 Update meetings/wasmtime/2021/wasmtime-11-11.md
typo fix

Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2021-11-11 09:55:18 -08:00
Chris Fallin
0a8b08a0d5 Wasmtime meeting notes from 2021-11-11. 2021-11-11 09:33:41 -08:00
Peter Huene
990f834e27 Merge pull request #3514 from peterhuene/feature-gate-pooling-allocator
Add the `pooling-allocator` feature.
2021-11-10 14:00:33 -08:00
Peter Huene
58aab85680 Add the pooling-allocator feature.
This commit adds the `pooling-allocator` feature to both the `wasmtime` and
`wasmtime-runtime` crates.

The feature controls whether or not the pooling allocator implementation is
built into the runtime and exposed as a supported instance allocation strategy
in the wasmtime API.

The feature is on by default for the `wasmtime` crate.

Closes #3513.
2021-11-10 13:25:55 -08:00
Alex Crichton
00feefe9a7 Change the bump-version workflow's schedule (#3512)
* Change the bump-version workflow's schedule

Either I don't understand cron or GitHub doesn't understand cron. It's
not clear which. I think that
https://github.com/bytecodealliance/wasmtime/pull/3511 may have fallen
within our schedule but it was supposed to be on a weekday. Otherwise
https://github.com/bytecodealliance/wasmtime/pull/3499 was certainly
spurious. This commit moves to a simpler "just do it on the same day
each month" and we can manually figure out weekdays and such. Hopefully
this should reduce the number of spurious PRs we're getting to bump
versions.

This also removes the script to force a version bump since I found a
button on the GitHub UI to do the same thing. Additionally I've updated
the patch-release documentation to use this button. Note that this
button takes inputs as well which means we can further automate patch
releases to look even more like normal release process, differing only
in one part of the argument used to trigger the workflow.

* Fix a typo
2021-11-08 10:37:53 -06:00
Adam Bratschi-Kaye
12bfbdfaca Skip generating DWARF info for dead code (#3498)
When encountering a subprogram that is dead code (as indicated by the
dead code proposal
https://dwarfstd.org/ShowIssue.php?issue=200609.1), don't generate debug
output for the subprogram or any of its children.
2021-11-08 09:31:04 -06:00
Pat Hickey
2053e972b7 InstancePre can impl Clone (#3510)
Its a manually written impl, not a derive, because InstancePre<T>: Clone
does not require T: Clone.

The clone should be reasonably inexpensive: Clone for Module is just an
Arc, and Clone for Definition should also just be an Arc on the HostFunc
or Instance variants. An InstancePre shouldnt contain any
Definition::Extern variants because there is not yet a Store associated
with it- right?
2021-11-08 09:11:31 -06:00