tnachen opened PR #5319 from tnachen/sigdata_size
to main
:
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
jameysharp submitted PR review.
jameysharp submitted PR review.
jameysharp created PR review comment:
This isn't important, but I personally prefer to not use a closure if it's just passing its argument to a function or a tuple constructor. Like this:
self.0.checked_sub(1).map(Sig)
jameysharp created PR review comment:
This version of
num_args
would be slightly simpler if it looked more like the old definition ofCaller::num_args
:let len = self.args(sig).len(); if self.sigs[sig].stack_ret_arg.is_some() { len - 1 } else { len }
jameysharp created PR review comment:
The result of calling
slice::len
is ausize
, so this call tousize::from
isn't necessary in this version.
tnachen updated PR #5319 from tnachen/sigdata_size
to main
.
tnachen updated PR #5319 from tnachen/sigdata_size
to main
.
tnachen updated PR #5319 from tnachen/sigdata_size
to main
.
tnachen updated PR #5319 from tnachen/sigdata_size
to main
.
tnachen updated PR #5319 from tnachen/sigdata_size
to main
.
tnachen updated PR #5319 from tnachen/sigdata_size
to main
.
tnachen edited PR #5319 from tnachen/sigdata_size
to main
:
Addressing #5183
<!--Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
cfallin submitted PR review.
cfallin submitted PR review.
cfallin created PR review comment:
Pre-existing, but since
Sig
is now a newtype wrapper aroundu32
and isCopy
, we should probably just take an argabi: Sig
and avoid this dereference.
cfallin created PR review comment:
Can we add a note here on the indexing scheme? Something like "Arguments for a given
sig
are in the args array at indiciesargs_end[sig - 1]..args_end[sig]
, or0..args_end[sig]
ifsig
is0
.(And the
args_end
value is an exclusive endpoint, i.e. not included, so..
above is correct, right?)
cfallin created PR review comment:
Or, reading more below, I guess it's a little more complex because args and rets are contiguous for a given
Sig
, but we should give the appropriate ranges here and describe the scheme regardless.
cfallin edited PR review comment.
jameysharp submitted PR review.
jameysharp created PR review comment:
I had @tnachen make some changes along these lines in a previous PR, but I decided not to ask for that in function signatures that weren't otherwise changed in this PR.
It would be a good follow-up PR to fix all the functions that currently take
&Sig
to takeSig
instead. I currently see examples incranelift/codegen/src/isa/s390x/lower/isle.rs
,cranelift/codegen/src/machinst/abi.rs
, andcranelift/codegen/src/machinst/isle.rs
.
tnachen updated PR #5319 from tnachen/sigdata_size
to main
.
tnachen created PR review comment:
@cfallin added more comments, let me know if this looks good?
tnachen submitted PR review.
tnachen submitted PR review.
tnachen created PR review comment:
Sg will make these changes after this one merged
cfallin created PR review comment:
Looks great, thanks!
cfallin submitted PR review.
cfallin submitted PR review.
cfallin merged PR #5319.
tnachen submitted PR review.
tnachen created PR review comment:
I try to make this change but looks like &Sig is generated from isle as generated code, and all non-primitive types declared as arg funcs in isle seems to be all generated as references. Should we leave this or try to change how isle code gen works?
tnachen submitted PR review.
tnachen created PR review comment:
Or change (type Sig extern (enum)) into (type Sig (primitive u32)) ?
tnachen submitted PR review.
tnachen created PR review comment:
Actually that doesn't work as it only generate args with u32 and not Sig anymore
jameysharp created PR review comment:
Oh, I see! I just learned how ISLE decides when to borrow last week while I've been rewriting its code generation, so this hadn't occurred to me.
It isn't important to get rid of the
&Sig
borrows. But if you'd like to try working on the ISLE compiler, I think I can now guide you through fixing this. Let me know if you're interested; if so, I'll write up a plan.
jameysharp submitted PR review.
tnachen submitted PR review.
tnachen created PR review comment:
@jameysharp I'm game! I think I kind of have a idea looking at a codebase, but I'm still new :)
jameysharp submitted PR review.
jameysharp created PR review comment:
So I looked into this more, and I think this doesn't need ISLE compiler changes. I think it should work to change
(type Sig extern (enum))
to(type Sig (primitive Sig))
and then fix the hand-written parts to match. Do you want to give that a try?
Last updated: Nov 22 2024 at 17:03 UTC