Skip to content

runtime: improve runtime.overLoadFactor calculation #20195

Closed
@josharian

Description

@josharian

runtime.overLoadFactor could use some improvement.

First, a bug: uintptr is 32 bits wide on a 32 bit system, so calculating uintptr(1<<B) can overflow when B >= 32. That's Go 1.9 material, and I'll send a CL shortly. Maybe even 1.8.2, given the devastating result (infinite loop) and simplicity of fix. Marking 1.8.2 for discussion.

Second, an improvement: We should rewrite this to use integer arithmetic and pay more careful attention to potential overflow. That should probably wait for Go 1.10.

Exposed by CL 40854 when working with a hint of 1 << 62. CL 40854 will also help with the bug, once it is correctly implemented.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions