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

Use a set in SymbolValidationManager::recordExists #4259

Merged
merged 2 commits into from
Jan 12, 2019

Conversation

jdmpapin
Copy link
Contributor

This reduces the running time of recordExists from linear to log time. Furthermore, by using a separate data structure here, it's now possible to seed the set with records that should not be generated.

An ordering comparison is defined on validation records in order to allow them to be kept in a set.

LexicalOrder() : _result(EQUAL) { }
LexicalOrder(const LexicalOrder &other) : _result(other._result) { }

static LexicalOrder by(void *a, void *b) { return LexicalOrder().thenBy(a, b); }
Copy link
Contributor

@dsouzai dsouzai Jan 11, 2019

Choose a reason for hiding this comment

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

Should the return type be LexicalOrder & (because of LexicalOrder &thenBy(void *a, void *b))?

Copy link
Contributor Author

@jdmpapin jdmpapin Jan 11, 2019

Choose a reason for hiding this comment

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

There's no LexicalOrder we could reference here that lives past the return, edit: so this returns a copy

Copy link
Contributor

Choose a reason for hiding this comment

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

I see; then I guess my question is, why have thenBy return a reference when passed in void * but return by value when passed in uintptr_t ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, thanks - I didn't mean to copy in thenBy(uintptr_t, uintptr_t)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

The symbol validation manager uses a linear search along with an
equality comparison in order to detect and filter out duplicate records.
This commit replaces the equality comparison with an ordering comparison
in order to allow the linear scan to be replaced by a set lookup.

Signed-off-by: Devin Papineau <devinmp@ca.ibm.com>
This reduces the running time of recordExists from linear to log time.
Furthermore, by using a separate data structure here, it's now possible
to seed the set with records that should not be generated.

Signed-off-by: Devin Papineau <devinmp@ca.ibm.com>
@dsouzai
Copy link
Contributor

dsouzai commented Jan 11, 2019

Jenkins test sanity xlinux,win,plinux jdk8,jdk11

1 similar comment
@dsouzai
Copy link
Contributor

dsouzai commented Jan 11, 2019

Jenkins test sanity xlinux,win,plinux jdk8,jdk11

@dsouzai
Copy link
Contributor

dsouzai commented Jan 11, 2019

Jenkins copyright check

@dsouzai
Copy link
Contributor

dsouzai commented Jan 11, 2019

Jenkins line endings check

@dsouzai dsouzai merged commit 030df22 into eclipse-openj9:master Jan 12, 2019
@jdmpapin jdmpapin deleted the svm.record-set branch April 9, 2021 22:08
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.

2 participants