Request for Comments: Backport of JDK-8166317: InterpreterCodeSize should be computed

Leslie Zhai zhaixiang at loongson.cn
Mon Sep 17 07:26:20 UTC 2018


Hi all,

I would like to backport the fix for:

https://bugs.openjdk.java.net/browse/JDK-8166317

To OpenJDK 8 updates dev:

http://hg.openjdk.java.net/jdk8u/jdk8u-dev

The fix is mostly the same as the version that was committed in 10 
except that there are:

* no _code_end or _data_end private members in the 
hotspot/src/share/vm/code/codeBlob.hpp

* no get_code_heap(...) function in the 
hotspot/src/share/vm/code/codeCache.cpp

in OpenJDK 8, so I just:

* use _data_offset private member to update code_end() and data_end() in 
the adjust_size

* use _heap private member to call deallocate_tail(...) function

* leave the opportunity for MIPS if need to override `g1_barrier_stubs_init`

Here is the patch:

https://raw.githubusercontent.com/xiangzhai/jdk8u-dev/master/JDK-8166317-Backport.patch

Please review it and give me some comments, thanks a lot!

----- 8< -------- 8< -------- 8< -------- 8< -------- 8< -------- 8< ---

$ jtreg -vmoptions:"-XX:+UnlockDiagnosticVMOptions 
-XX:+PrintInterpreter" -dir:/home/loongson/zhaixiang/jdk8-mips/jdk/test 
-verbose:all 
-exclude:/home/loongson/zhaixiang/jdk8-mips/jdk/test/ProblemList.txt 
-conc:2 -Xmx512m -a -ignore:quiet -timeoutFactor:5 -agentvm 
-testjdk:/home/loongson/zhaixiang/jdk8-mips/build/linux-mips64-normal-server-release/images/j2sdk-image 
com/sun/jdi/AccessSpecifierTest.java

* Applied the patch, theres no more waste in the CodeCache after 
interpreter generation and the output of -XX:+PrintInterpreter looks as 
follows for jdk8u-dev on mips64el:

Agent[0].stdout: 
----------------------------------------------------------------------
Agent[0].stdout: Interpreter
Agent[0].stdout:
Agent[0].stdout: code size        =    163K bytes
Agent[0].stdout: total space      =    163K bytes
Agent[0].stdout: wasted space     =      0K bytes
Agent[0].stdout:
Agent[0].stdout: # of codelets    =    263
Agent[0].stdout: avg codelet size =    636 bytes

...

AccessSpecifierTest: passed

* Dropped the patch, the used/wasted ratio for the interpreter part of 
the code cache (which can be dumped with -XX:+PrintInterpreter) looks as 
follows for jdk8u-dev on mips64el:

Agent[0].stdout: 
----------------------------------------------------------------------
Agent[0].stdout: Interpreter
Agent[0].stdout:
Agent[0].stdout: code size        =    163K bytes
Agent[0].stdout: total space      =    499K bytes
Agent[0].stdout: wasted space     =    336K bytes
Agent[0].stdout:
Agent[0].stdout: # of codelets    =    263
Agent[0].stdout: avg codelet size =    636 bytes

...

STDOUT:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (interpreter.hpp:109), pid=23725, tid=0x000000fff2f9b1f0
#  guarantee(codelet_size > 0 && (size_t)codelet_size > 2*K) failed: not 
enough space for interpreter generation


Thanks,

Leslie Zhai




More information about the jdk8u-dev mailing list