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

Comments

Projects
None yet
4 participants
@josharian
Contributor

josharian commented Aug 21, 2017

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

This comment has been minimized.

Contributor

josharian commented Aug 21, 2017

@huguesb

This comment has been minimized.

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

This comment has been minimized.

Contributor

randall77 commented Aug 22, 2017

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 label Aug 28, 2017

@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Mar 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment