-
Sub-task
-
Resolution: Fixed
-
P4
-
23
-
b24
Found bugs:
- When refreshing CompilerDirectivesAddDCmd::execute will call DirectivesStack::hasMatchingDirectives(mh, true) which only considers the compiler directive which is on the top of the directives stack. As more than one directive can be added, CompilerDirectivesAddDCmd::execute will not behave as expected.
- A Java method with old directives might be in the compilation queue. A request to recompile it with new directives will be ignored.
There are other concerns: bugs and performance issues.
Possible bugs:
- `has_matching_directives` might not be cleared. A nmethod might get into the unloading state before CodeCache::recompile_marked_directives_matches. If the nmethod has been used to mark a Java method and it is the only nmethod, there will be no nmethod in CodeCache to reach the Java method to clear the mark.
- A Java method might have been compiled with new directives before CodeCache::recompile_marked_directives_matches. CodeCache::recompile_marked_directives_matches will recompile it again.
- JIT compiler might be compiling a Java method with old directives. A request to recompile it with new directives will be ignored.
Performance issues:
- Usually directives are updated for a small number of Java methods. If CodeCache has thousands of nmethods, CodeCache::recompile_marked_directives_matches will be redundantly traversing nmethods which need to be kept in CodeCache.