Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/jniHandles.cpp @ 24102:d1a869fb73c2
Performance fix for JNI handle allocation.
author | Christian Haeubl <christian.haeubl@oracle.com> |
---|---|
date | Tue, 14 Feb 2017 11:10:26 +0100 |
parents | dd9cc155639c |
children |
comparison
equal
deleted
inserted
replaced
24101:efea6cfade16 | 24102:d1a869fb73c2 |
---|---|
418 assert(Universe::heap()->is_in_reserved(obj), "sanity check"); | 418 assert(Universe::heap()->is_in_reserved(obj), "sanity check"); |
419 if (_top == 0) { | 419 if (_top == 0) { |
420 // This is the first allocation or the initial block got zapped when | 420 // This is the first allocation or the initial block got zapped when |
421 // entering a native function. If we have any following blocks they are | 421 // entering a native function. If we have any following blocks they are |
422 // not valid anymore. | 422 // not valid anymore. |
423 for (JNIHandleBlock* current = _next; current != NULL; | 423 JNIHandleBlock* current = _next; |
424 current = current->_next) { | 424 while (current != NULL) { |
425 assert(current->_last == NULL, "only first block should have _last set"); | 425 assert(current->_last == NULL, "only first block should have _last set"); |
426 assert(current->_free_list == NULL, | 426 assert(current->_free_list == NULL, |
427 "only first block should have _free_list set"); | 427 "only first block should have _free_list set"); |
428 | |
429 // all blocks after the first free block must already be empty | |
430 if (current->_top == 0) break; | |
431 | |
428 current->_top = 0; | 432 current->_top = 0; |
429 if (ZapJNIHandleArea) current->zap(); | 433 if (ZapJNIHandleArea) current->zap(); |
430 } | 434 |
435 current = current->_next; | |
436 } | |
437 | |
438 #ifdef ASSERT | |
439 while (current != NULL) { | |
440 assert(current->_top == 0, "all blocks must already have been reset before"); | |
441 current = current->_next; | |
442 } | |
443 #endif // ASSERT | |
444 | |
431 // Clear initial block | 445 // Clear initial block |
432 _free_list = NULL; | 446 _free_list = NULL; |
433 _allocate_before_rebuild = 0; | 447 _allocate_before_rebuild = 0; |
434 _last = this; | 448 _last = this; |
435 if (ZapJNIHandleArea) zap(); | 449 if (ZapJNIHandleArea) zap(); |