Skip to content

Introduce conversion size to index in integers - #7986

Merged
babsingh merged 1 commit into
eclipse-omr:masterfrom
dmitripivkine:modifyLOAS
Oct 16, 2025
Merged

Introduce conversion size to index in integers#7986
babsingh merged 1 commit into
eclipse-omr:masterfrom
dmitripivkine:modifyLOAS

Conversation

@dmitripivkine

Copy link
Copy Markdown
Contributor

Introducing simplified size-to-index and index-to-size functions using calculations in integers and making it enabled by default. Old calculation in Float Point math is preserved and can be activated is necessary.
Calculation in integers using hardcoded log base ~1.189 instead of 1.2 for FP. This hardcoded log base can not be changed, so log base parameter is ignored.

@dmitripivkine

Copy link
Copy Markdown
Contributor Author

@amicic Would you please review?

Comment thread gc/base/Math.hpp
*/
MMINLINE static uintptr_t sizeToIndex(uintptr_t size)
{
uintptr_t msb = (J9BITS_BITS_IN_SLOT - 1) - MM_Bits::trailingZeroes(size);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

out of scope for this change, but should eventually rename this macro to OMRBITS_BITS_IN_SLOT

Comment thread gc/stats/LargeObjectAllocateStats.cpp Outdated
sizeClass = MM_Math::indexToSize(MM_Math::sizeToIndex(allocateSize) + 1);
} else {
// to do: remove comment: this is not exactly what was used before but semantically close
// uintptr_t sizeClass = (uintptr_t)(powf(_sizeClassRatio, (float)ceil(logf((float)allocateSize) * _sizeClassRatioLogInversed)));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i'd remove it now

@amicic

amicic commented Oct 15, 2025

Copy link
Copy Markdown
Contributor

@babsingh please review/merge

@amicic amicic added the comp:gc label Oct 15, 2025
Signed-off-by: Dmitri Pivkine <Dmitri_Pivkine@ca.ibm.com>
@babsingh

Copy link
Copy Markdown
Contributor

jenkins build all

@dmitripivkine

Copy link
Copy Markdown
Contributor Author

I don't think failure is related to the change:

18:04:59  30: �[0;32m[----------] �[m16 tests from Special/PPCDirectEncodingTest
18:04:59  30: free(): invalid next size (normal)
18:04:59  30/30 Test #30: compunittest ......................Child aborted***Exception:   0.73 sec
18:04:59  
18:04:59  97% tests passed, 1 tests failed out of 30
18:04:59  
18:04:59  Total Test time (real) = 485.62 sec
18:04:59  
18:04:59  The following tests FAILED:
18:04:59  	 30 - compunittest (Child aborted)
18:04:59  Errors while running CTest

@babsingh babsingh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The above PR build failure is known and unrelated to this PR.

@babsingh
babsingh merged commit 527b74d into eclipse-omr:master Oct 16, 2025
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants