Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eval: Allow reslicing a slice up to its cap, rather than its length #3796

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

Jille
Copy link
Contributor

@Jille Jille commented Aug 20, 2024

fix a couple of places where we needed to track the cap

@Jille Jille force-pushed the reslice-grow branch 3 times, most recently from 8956776 to 394f9ea Compare August 21, 2024 07:37
@@ -956,7 +956,7 @@ func TestRangeOverFuncNext(t *testing.T) {
"result", "[]int len: 0, cap: 0, nil"),
nx(87), // if w == 2000
assertLocals(t, "result", "w"),
assertEval(t, "result", "[]int len: 1, cap: 1, [1000]"),
assertEval(t, "result", "[]int len: 1, cap: 2, [1000]"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you changed this to make the linux/386 tests pass, the fix is different: see #3795

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right. I was confused by that. I've rebased on top of your PR.

@@ -690,7 +690,7 @@ func newVariable(name string, addr uint64, dwarfType godwarf.Type, bi *BinaryInf
v.Kind = reflect.Array
v.Base = v.Addr
v.Len = t.Count
v.Cap = -1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we changing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was more correct to record the actual capacity of an array rather than -1. Go doesn't allow us to call cap() on a string, but it does allow it on an array, so I thought it'd be cleaner to have it.

Alternatively we can give reslicing a special case for arrays too, but this felt cleaner in the long run.

Let me know if you'd prefer this to remain -1 and I'll change reslice instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think it's fine to change it.

Copy link
Member

@aarzilli aarzilli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Jille
Copy link
Contributor Author

Jille commented Aug 26, 2024

@SnoozeThis #3795

@SnoozeThis
Copy link

(https://snoozeth.is/dZ3T-dmNzAY) I will wait until #3795 is merged and then add a comment.

@SnoozeThis
Copy link

Resolved.

fix a couple of places where we needed to track the cap
@Jille
Copy link
Contributor Author

Jille commented Aug 27, 2024

I've rebased on master.

Copy link
Member

@derekparker derekparker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@derekparker derekparker merged commit a164b89 into go-delve:master Aug 28, 2024
2 checks passed
yurishkuro pushed a commit to jaegertracing/jaeger that referenced this pull request Sep 23, 2024
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/go-delve/delve](https://redirect.github.com/go-delve/delve)
| `v1.23.0` -> `v1.23.1` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fgo-delve%2fdelve/v1.23.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fgo-delve%2fdelve/v1.23.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fgo-delve%2fdelve/v1.23.0/v1.23.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fgo-delve%2fdelve/v1.23.0/v1.23.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>go-delve/delve (github.com/go-delve/delve)</summary>

###
[`v1.23.1`](https://redirect.github.com/go-delve/delve/releases/tag/v1.23.1)

[Compare
Source](https://redirect.github.com/go-delve/delve/compare/v1.23.0...v1.23.1)

#### What's Changed

- proc: move stepping test to their own file by
[@&#8203;aarzilli](https://redirect.github.com/aarzilli) in
[go-delve/delve#3784
- proc: fix step stuttering when entering range-over-func bodies by
[@&#8203;aarzilli](https://redirect.github.com/aarzilli) in
[go-delve/delve#3788
- proc: fix TestRangeOverFuncNext on linux/386 by
[@&#8203;aarzilli](https://redirect.github.com/aarzilli) in
[go-delve/delve#3795
- eval: Allow reslicing a slice up to its cap, rather than its length by
[@&#8203;Jille](https://redirect.github.com/Jille) in
[go-delve/delve#3796
- chore: fix function name by
[@&#8203;linchizhen](https://redirect.github.com/linchizhen) in
[go-delve/delve#3803
- terminal/starbind: fix starlark conversion of named consts by
[@&#8203;arvidfm](https://redirect.github.com/arvidfm) in
[go-delve/delve#3802
- proc: workaround for macOS section name truncation by
[@&#8203;aarzilli](https://redirect.github.com/aarzilli) in
[go-delve/delve#3799
- service/dap: make handlesMap generic by
[@&#8203;aarzilli](https://redirect.github.com/aarzilli) in
[go-delve/delve#3798
- service/dap: fix test failure with 1.24 by
[@&#8203;aarzilli](https://redirect.github.com/aarzilli) in
[go-delve/delve#3805
- proc: fix result type of division of untyped constants by
[@&#8203;aarzilli](https://redirect.github.com/aarzilli) in
[go-delve/delve#3794
- proc: improve Rosetta check by
[@&#8203;aarzilli](https://redirect.github.com/aarzilli) in
[go-delve/delve#3810
- proc: for optimized functions allow .closureptr to not exist by
[@&#8203;aarzilli](https://redirect.github.com/aarzilli) in
[go-delve/delve#3808
- proc: cache module data by
[@&#8203;aarzilli](https://redirect.github.com/aarzilli) in
[go-delve/delve#3800
- \*: release version 1.23.1 by
[@&#8203;aarzilli](https://redirect.github.com/aarzilli) in
[go-delve/delve#3816

#### New Contributors

- [@&#8203;Jille](https://redirect.github.com/Jille) made their first
contribution in
[go-delve/delve#3796
- [@&#8203;linchizhen](https://redirect.github.com/linchizhen) made
their first contribution in
[go-delve/delve#3803
- [@&#8203;arvidfm](https://redirect.github.com/arvidfm) made their
first contribution in
[go-delve/delve#3802

**Curated Changelog**:
https://github.com/go-delve/delve/blob/master/CHANGELOG.md#1231-2024-09-23

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/jaegertracing/jaeger).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC44MC4wIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiY2hhbmdlbG9nOmRlcGVuZGVuY2llcyJdfQ==-->

Signed-off-by: Mend Renovate <bot@renovateapp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants