Skip to content

Commit

Permalink
Avoid copying structs in loops
Browse files Browse the repository at this point in the history
  • Loading branch information
swesonga committed Feb 13, 2024
1 parent b428c48 commit a86d8a8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/hotspot/os/windows/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4083,9 +4083,9 @@ DWORD os::win32::active_processors_in_job_object() {
assert(false, "Unexpected group count");
}

GROUP_AFFINITY* group_affinity_data = ((GROUP_AFFINITY*)job_object_information);
for (DWORD i = 0; i < groups_found; i++) {
KAFFINITY group_affinity = ((GROUP_AFFINITY*)job_object_information)[i].Mask;
processors += population_count(group_affinity);
processors += population_count(group_affinity_data[i].Mask);
}

if (processors == 0) {
Expand Down Expand Up @@ -4126,9 +4126,9 @@ DWORD os::win32::system_logical_processor_count() {
} else {
DWORD processor_groups = system_logical_processor_info->Group.ActiveGroupCount;

PROCESSOR_GROUP_INFO* group_info = (PROCESSOR_GROUP_INFO*)system_logical_processor_info->Group.GroupInfo;
for (DWORD i = 0; i < processor_groups; i++) {
PROCESSOR_GROUP_INFO group_info = system_logical_processor_info->Group.GroupInfo[i];
logical_processors += group_info.ActiveProcessorCount;
logical_processors += group_info[i].ActiveProcessorCount;
}

if (logical_processors == 0) {
Expand Down

0 comments on commit a86d8a8

Please sign in to comment.