Make cranelift-interpreter non-generic over value#6178
Make cranelift-interpreter non-generic over value#6178afonso360 merged 4 commits intobytecodealliance:mainfrom
Conversation
| pub type ValueResult<T> = Result<T, ValueError>; | ||
|
|
||
| pub trait Value: Clone + From<DataValue> { | ||
| pub trait DataValueExt: Sized { |
There was a problem hiding this comment.
Left this as extension trait to make this PR smaller. We can always move methods to DataValue directly or inline them at the call site in cranelift-interpreter in the future.
| } | ||
| fn le(&self, other: &Self) -> ValueResult<bool> { | ||
| Ok(other.eq(self)? || other.gt(self)?) | ||
| } |
There was a problem hiding this comment.
These needed conflicted with PartialEq/PartialOrd impls of DataValue causing ambiguity during method resolution. I took the opportunity to inline them all.
| pub trait Value: Clone + From<DataValue> { | ||
| pub trait DataValueExt: Sized { | ||
| // Identity. | ||
| fn ty(&self) -> Type; |
There was a problem hiding this comment.
This method directly forwards to the equivalent method on DataValue.
| pub trait Value: Clone + From<DataValue> { | ||
| pub trait DataValueExt: Sized { | ||
| // Identity. | ||
| fn ty(&self) -> Type; |
There was a problem hiding this comment.
This method directly forwards to the equivalent method on DataValue.
|
@afonso360 or @abrown: do one of you want to review this one? |
|
Yeah, I'll take a look at this. |
jameysharp
left a comment
There was a problem hiding this comment.
I'm excited about this so I took a quick look. It appears to be exactly the almost-mechanical changes necessary, which is exactly what I hoped to see.
@afonso360, I'd still appreciate your review just in case I missed something. Feel free to merge when you're ready.
Co-authored-by: Jamey Sharp <jamey@minilop.net>
|
Looks like we are still missing one place where we use the generics version of DataValue |
|
Updated the doc comments for the |
) * Make cranelift-interpreter non-generic over value Fixes bytecodealliance#5793 * Review suggestion Co-authored-by: Jamey Sharp <jamey@minilop.net> * Fix fuzz target * Update doc comments --------- Co-authored-by: Jamey Sharp <jamey@minilop.net>
) * Make cranelift-interpreter non-generic over value Fixes bytecodealliance#5793 * Review suggestion Co-authored-by: Jamey Sharp <jamey@minilop.net> * Fix fuzz target * Update doc comments --------- Co-authored-by: Jamey Sharp <jamey@minilop.net>
Fixes #5793