RFR: 8184337: CodeCache::get_code_cache_containing wrongly asserts that start can not be NULL

Vladimir Kozlov vladimir.kozlov at oracle.com
Thu Jul 13 16:02:33 UTC 2017


I added evaluation into the bug report based on call stack. It is normal case when NULL is passed to 
CodeCache::find_blob_unsafe() and then to get_code_heap_containing().

May be we should add NULL check to CodeCache::find_blob_unsafe() too:

  CodeBlob* CodeCache::find_blob_unsafe(void* start) {
    // NMT can walk the stack before code cache is created
-  if (_heaps != NULL) {
+  if (start != NULL && _heaps != NULL) {
      CodeHeap* heap = get_code_heap_containing(start);
      if (heap != NULL) {

Thanks,
Vladimir

On 7/13/17 5:34 AM, Claes Redestad wrote:
> Hi,
> 
> the assert added in the implementation of get_code_cache_containing
> is wrong, as some tests in nightly have been seen to intermittently fail
> when capturing certain frames. The behavior in product builds is sound
> ((heap*)->contains(NULL) will return false..), so the assert should
> simply be removed.
> 
> Bug: https://bugs.openjdk.java.net/browse/JDK-8184337
> 
> Patch is trivial, see below.
> 
> Thanks!
> 
> /Claes
> 
> diff -r 9c54cd2cdf09 src/share/vm/code/codeCache.cpp
> --- a/src/share/vm/code/codeCache.cpp    Mon Jul 10 23:28:25 2017 +0200
> +++ b/src/share/vm/code/codeCache.cpp    Thu Jul 13 14:29:00 2017 +0200
> @@ -423,7 +423,6 @@
>   }
> 
>   CodeHeap* CodeCache::get_code_heap_containing(void* start) {
> -  assert(start != NULL, "start is null");
>     FOR_ALL_HEAPS(heap) {
>       if ((*heap)->contains(start)) {
>         return *heap;
> 


More information about the hotspot-compiler-dev mailing list