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

runtime: audit mapfast routines for indirectvalue support #21547

Open
josharian opened this issue Aug 21, 2017 · 3 comments
Open

runtime: audit mapfast routines for indirectvalue support #21547

josharian opened this issue Aug 21, 2017 · 3 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@josharian
Copy link
Contributor

On reflection, the most recent CLs I mailed suggest that mapdelete_fast* might not be handing indirect value maps correctly. I'm out of computer time for today and maybe tomorrow as well. Filing this as a reminder, and because these were newly introduced in 1.9, and if they're not well-handled, it could cause memory corruption. Should double check all routines, really.

@josharian
Copy link
Contributor Author

cc @randall77 @martisch

@huguesb
Copy link
Contributor

huguesb commented Aug 21, 2017

@josharian indirect values always use the slow map:

See cmd/compile/internal/gc/walk.go

2838 func mapfast(t *types.Type) int {
2839     // Check ../../runtime/hashmap.go:maxValueSize before changing.
2840     if t.Val().Width > 128 {
2841         return mapslow
2842     }
2843     switch algtype(t.Key()) {
2844     case AMEM32:
2845         return mapfast32
2846     case AMEM64:
2847         return mapfast64
2848     case ASTRING:
2849         return mapfaststr
2850     }
2851     return mapslow
2852 }

@randall77
Copy link
Contributor

Yes, this should be fine. Fast versions do not need to handle indirect values.
It would be nice to have a test, though.

@josharian josharian added the Testing An issue that has been verified to require only test changes, not just a test failure. label Aug 28, 2017
@ianlancetaylor ianlancetaylor added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 30, 2018
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Mar 30, 2018
@martisch martisch self-assigned this Jan 18, 2019
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

6 participants