-
Notifications
You must be signed in to change notification settings - Fork 738
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
Eliminate redundant ClassFromCP/ClassByName records #4694
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -760,6 +760,7 @@ class SymbolValidationManager | |
bool abandonRecord(TR::SymbolValidationRecord *record); | ||
|
||
bool recordExists(TR::SymbolValidationRecord *record); | ||
bool anyClassFromCPRecordExists(TR_OpaqueClassBlock *clazz, TR_OpaqueClassBlock *beholder); | ||
void appendNewRecord(void *symbol, TR::SymbolValidationRecord *record); | ||
void appendRecordIfNew(void *symbol, TR::SymbolValidationRecord *record); | ||
|
||
|
@@ -848,6 +849,37 @@ class SymbolValidationManager | |
typedef TR::typed_allocator<J9ClassLoader*, TR::Region&> LoaderAllocator; | ||
typedef std::vector<J9ClassLoader*, LoaderAllocator> LoaderVector; | ||
LoaderVector _loadersOkForWellKnownClasses; | ||
|
||
// Remember which classes have already been found in which beholders' | ||
// constant pools, regardless of CP index. If a class C has already been | ||
// found in the constant pool of class D (producing a ClassFromCP record), | ||
// then ClassByName(C, D) is redundant. | ||
struct ClassFromAnyCPIndex | ||
{ | ||
TR_OpaqueClassBlock *clazz; | ||
TR_OpaqueClassBlock *beholder; | ||
|
||
ClassFromAnyCPIndex(TR_OpaqueClassBlock *clazz, TR_OpaqueClassBlock *beholder) | ||
: clazz(clazz), beholder(beholder) { } | ||
}; | ||
|
||
struct LessClassFromAnyCPIndex | ||
{ | ||
bool operator()(const ClassFromAnyCPIndex &a, const ClassFromAnyCPIndex &b) const | ||
{ | ||
std::less<TR_OpaqueClassBlock*> lt; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curiosity question: how come you didn't use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to keep There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, I think it's fine as is for now; if ever there's a need for another "less" operator, we can then move the |
||
if (lt(a.clazz, b.clazz)) | ||
return true; | ||
else if (lt(b.clazz, a.clazz)) | ||
return false; | ||
else | ||
return lt(a.beholder, b.beholder); | ||
} | ||
}; | ||
|
||
typedef TR::typed_allocator<ClassFromAnyCPIndex, TR::Region&> ClassFromAnyCPIndexAlloc; | ||
typedef std::set<ClassFromAnyCPIndex, LessClassFromAnyCPIndex, ClassFromAnyCPIndexAlloc> ClassFromAnyCPIndexSet; | ||
ClassFromAnyCPIndexSet _classesFromAnyCPIndex; | ||
}; | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea here is that
Is that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, especially since in 2 the ClassFromCP will suppress any later ClassByName that would be equivalent