Fwd: cross compile OpenJDK-9+158 minimal variant failed when link libjvm.so
David Holmes
david.holmes at oracle.com
Wed Mar 1 09:31:57 UTC 2017
On 1/03/2017 6:45 PM, Zhu Yong wrote:
> OK, for the Whetstone Benchmark, I added debug printing and found it's
> due to function getTime(), it only get good value on 1st call, all
> following calls get 0s.
> Debug printing of itime value is correct. So reason should be the return
> division line. Could it because toolchain's floating point operation???
> But why server VM Ok?
Server and client implement FP logic differently, and particularly as
this is soft-fp, they may well not be in sync. Does -Xint work?
Can you isolate to a simple FP test?
David
> public static double getTime()
> {
> double q;
> long itime;
> itime = System.currentTimeMillis();
> q = (double) itime;
> return q / 1000.0;
> }
>
> On Wed, Mar 1, 2017 at 3:14 PM, David Holmes <david.holmes at oracle.com
> <mailto:david.holmes at oracle.com>> wrote:
>
> On 1/03/2017 4:26 PM, Zhu Yong wrote:
>
> We use armv7-marvell-linux-gnueabi-softfp toolchain
>
> gcc version 4.6.4 (Marvell GCC release 20150204-c4af733b 64K
> MAXPAGESIZE
> ALIGN CVE-2015-0235)
>
> Is this toolchain too old? I am asking because I saw other strange
> issues as well:
>
>
> We last used gcc 4.7.2. I can't really say if 4.6.4 is "too old".
>
> I have successfully build server, client and minimal VM, when I run
> Dhrystone benchmark file (the same jar file from
> http://www.okayan.jp/DhrystoneApplet/
> <http://www.okayan.jp/DhrystoneApplet/>), the performance from
> server VM
> is much better than client and minimal VM.
> (minimal: 1629852, client: 1615508, server: 2338871 )
>
>
> That's expected. The server VM is high performance.
>
> And when run Whetstone Benchmark
> from http://www.roylongbottom.org.uk/online/whetjava2.html
> <http://www.roylongbottom.org.uk/online/whetjava2.html>, server VM
> finished with good result, client and minimal VM not able to finish
> (program stuck there forever after print 1st line of output).
>
>
> That needs investigating. You need to try and generate a stackdump
> to see where things are stuck.
>
> David
>
>
> On Wed, Mar 1, 2017 at 1:56 PM, David Holmes
> <david.holmes at oracle.com <mailto:david.holmes at oracle.com>
> <mailto:david.holmes at oracle.com
> <mailto:david.holmes at oracle.com>>> wrote:
>
> On 1/03/2017 3:39 PM, Zhu Yong wrote:
>
> Thank you for the information, I managed to make minimal
> build
> pass now.
>
> Initially I though JVM_EXCLUDE_FILES need to add
> additional 3
> generated
> files (they appeared
> in _BUILD_LIBJVM_objectfilenames.txt) :
> bytecodeInterpreterWithChecks.cpp jvmtiEnter.cpp
> jvmtiEnterTrace.cpp
> But build still fail with same error message.
>
> Finally I figured out it's due to those 8 doit() functions
> implementation in jvmtiEnvBase.hpp file. After move all
> those 8
> doit()
> implementations to jvmtiEnvBase.cpp, build of minimal VM
> passed
> without
> any issue.
>
>
> That seems to be a compiler issue. jvmtiEnvBase.hpp is
> unconditionally included in a couple of places because we
> have to
> have enough of the JVMTI code to say JVMTI is not available.
> Those
> doit() implementations, though arguably could be conditional on
> INCLUDE_JVMTI, are not referenced by any called code and so
> should
> not linked in. But in your case it seems they are.
>
> What toolchain are you using?
>
> David
> -----
>
> Changes appended
> =============
>
> ---
> .../src/share/vm/prims/jvmtiEnvBase.cpp | 74
> ++++++++++++++++++++++
> .../src/share/vm/prims/jvmtiEnvBase.hpp | 68
> +++-----------------
> 2 files changed, 82 insertions(+), 60 deletions(-)
> mode change 100644 => 100755
> hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.cpp
> mode change 100644 => 100755
> hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.hpp
>
> diff --git
> a/hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.cpp
> b/hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.cpp
> old mode 100644
> new mode 100755
> index dd241a0..e5832ba
> ---
> a/hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.cpp
> +++
> b/hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.cpp
> @@ -1283,6 +1283,80 @@
> VM_GetMultipleStackTraces::allocate_and_fill_stacks(jint
> thread_count) {
> "the last copied frame info must be the last
> record");
> }
>
> +void
> +VM_UpdateForPopTopFrame::doit() {
> + JavaThread* jt = _state->get_thread();
> + if (Threads::includes(jt) && !jt->is_exiting() &&
> jt->threadObj() !=
> NULL) {
> + _state->update_for_pop_top_frame();
> + } else {
> + _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
> + }
> +}
> +
> +void
> +VM_SetFramePop::doit() {
> + JavaThread* jt = _state->get_thread();
> + if (Threads::includes(jt) && !jt->is_exiting() &&
> jt->threadObj() !=
> NULL) {
> + int frame_number = _state->count_frames() - _depth;
> +
>
> _state->env_thread_state((JvmtiEnvBase*)_env)->set_frame_pop(frame_number);
> + } else {
> + _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
> + }
> +}
> +
> +void
> +VM_GetOwnedMonitorInfo::doit() {
> + _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
> + if (Threads::includes(_java_thread) &&
> !_java_thread->is_exiting()
> + &&
> _java_thread->threadObj() !=
> NULL) {
> + _result = ((JvmtiEnvBase
> *)_env)->get_owned_monitors(_calling_thread, _java_thread,
> +
> _owned_monitors_list);
> + }
> +}
> +
> +void
> +VM_GetObjectMonitorUsage::doit() {
> + _result = ((JvmtiEnvBase*)
> _env)->get_object_monitor_usage(_calling_thread, _object,
> _info_ptr);
> +}
> +
> +void
> +VM_GetCurrentContendedMonitor::doit() {
> + _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
> + if (Threads::includes(_java_thread) &&
> !_java_thread->is_exiting() &&
> + _java_thread->threadObj() != NULL) {
> + _result = ((JvmtiEnvBase
>
> *)_env)->get_current_contended_monitor(_calling_thread,_java_thread,_owned_monitor_ptr);
> + }
> +}
> +
> +void
> +VM_GetStackTrace::doit() {
> + _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
> + if (Threads::includes(_java_thread) &&
> !_java_thread->is_exiting()
> + &&
> _java_thread->threadObj() !=
> NULL) {
> + _result = ((JvmtiEnvBase
> *)_env)->get_stack_trace(_java_thread,
> +
> _start_depth,
> _max_count,
> +
> _frame_buffer,
> _count_ptr);
> + }
> +}
> +
> +void
> +VM_GetFrameCount::doit() {
> + _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
> + JavaThread* jt = _state->get_thread();
> + if (Threads::includes(jt) && !jt->is_exiting() &&
> jt->threadObj() !=
> NULL) {
> + _result =
> ((JvmtiEnvBase*)_env)->get_frame_count(_state,
> _count_ptr);
> + }
> +}
> +
> +void
> +VM_GetFrameLocation::doit() {
> + _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
> + if (Threads::includes(_java_thread) &&
> !_java_thread->is_exiting() &&
> + _java_thread->threadObj() != NULL) {
> + _result =
> ((JvmtiEnvBase*)_env)->get_frame_location(_java_thread,
> _depth,
> +
> _method_ptr,
> _location_ptr);
> + }
> +}
>
> void
> VM_GetThreadListStackTraces::doit() {
> diff --git
> a/hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.hpp
> b/hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.hpp
> old mode 100644
> new mode 100755
> index 04e6869..00b9890
> ---
> a/hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.hpp
> +++
> b/hotspot-9211c2e89c1c/src/share/vm/prims/jvmtiEnvBase.hpp
> @@ -359,14 +359,7 @@ public:
> }
> VMOp_Type type() const { return
> VMOp_UpdateForPopTopFrame; }
> jvmtiError result() { return _result; }
> - void doit() {
> - JavaThread* jt = _state->get_thread();
> - if (Threads::includes(jt) && !jt->is_exiting() &&
> jt->threadObj()
> != NULL) {
> - _state->update_for_pop_top_frame();
> - } else {
> - _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
> - }
> - }
> + void doit();
> };
>
> // VM operation to set frame pop.
> @@ -389,15 +382,7 @@ public:
> bool allow_nested_vm_operations() const { return true; }
> VMOp_Type type() const { return VMOp_SetFramePop; }
> jvmtiError result() { return _result; }
> - void doit() {
> - JavaThread* jt = _state->get_thread();
> - if (Threads::includes(jt) && !jt->is_exiting() &&
> jt->threadObj()
> != NULL) {
> - int frame_number = _state->count_frames() - _depth;
> -
>
> _state->env_thread_state((JvmtiEnvBase*)_env)->set_frame_pop(frame_number);
> - } else {
> - _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
> - }
> - }
> + void doit();
> };
>
>
> @@ -421,14 +406,7 @@ public:
> _result = JVMTI_ERROR_NONE;
> }
> VMOp_Type type() const { return
> VMOp_GetOwnedMonitorInfo; }
> - void doit() {
> - _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
> - if (Threads::includes(_java_thread) &&
> !_java_thread->is_exiting()
> - &&
> _java_thread->threadObj() !=
> NULL) {
> - _result = ((JvmtiEnvBase
> *)_env)->get_owned_monitors(_calling_thread, _java_thread,
> -
> _owned_monitors_list);
> - }
> - }
> + void doit();
> jvmtiError result() { return _result; }
> };
>
> @@ -451,10 +429,7 @@ public:
> }
> VMOp_Type type() const { return
> VMOp_GetObjectMonitorUsage; }
> jvmtiError result() { return _result; }
> - void doit() {
> - _result = ((JvmtiEnvBase*)
> _env)->get_object_monitor_usage(_calling_thread, _object,
> _info_ptr);
> - }
> -
> + void doit();
> };
>
> // VM operation to get current contended monitor.
> @@ -475,13 +450,7 @@ public:
> }
> VMOp_Type type() const { return
> VMOp_GetCurrentContendedMonitor; }
> jvmtiError result() { return _result; }
> - void doit() {
> - _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
> - if (Threads::includes(_java_thread) &&
> !_java_thread->is_exiting() &&
> - _java_thread->threadObj() != NULL) {
> - _result = ((JvmtiEnvBase
>
> *)_env)->get_current_contended_monitor(_calling_thread,_java_thread,_owned_monitor_ptr);
> - }
> - }
> + void doit();
> };
>
> // VM operation to get stack trace at safepoint.
> @@ -508,15 +477,7 @@ public:
> }
> jvmtiError result() { return _result; }
> VMOp_Type type() const { return VMOp_GetStackTrace; }
> - void doit() {
> - _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
> - if (Threads::includes(_java_thread) &&
> !_java_thread->is_exiting()
> - &&
> _java_thread->threadObj() !=
> NULL) {
> - _result = ((JvmtiEnvBase
> *)_env)->get_stack_trace(_java_thread,
> -
> _start_depth,
> _max_count,
> -
> _frame_buffer,
> _count_ptr);
> - }
> - }
> + void doit();
> };
>
> // forward declaration
> @@ -606,13 +567,7 @@ public:
> }
> VMOp_Type type() const { return VMOp_GetFrameCount; }
> jvmtiError result() { return _result; }
> - void doit() {
> - _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
> - JavaThread* jt = _state->get_thread();
> - if (Threads::includes(jt) && !jt->is_exiting() &&
> jt->threadObj()
> != NULL) {
> - _result =
> ((JvmtiEnvBase*)_env)->get_frame_count(_state,
> _count_ptr);
> - }
> - }
> + void doit();
> };
>
> // VM operation to frame location at safepoint.
> @@ -636,14 +591,7 @@ public:
> }
> VMOp_Type type() const { return VMOp_GetFrameLocation; }
> jvmtiError result() { return _result; }
> - void doit() {
> - _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
> - if (Threads::includes(_java_thread) &&
> !_java_thread->is_exiting() &&
> - _java_thread->threadObj() != NULL) {
> - _result =
> ((JvmtiEnvBase*)_env)->get_frame_location(_java_thread,
> _depth,
> -
> _method_ptr,
> _location_ptr);
> - }
> - }
> + void doit();
> };
>
>
> --
> 2.1.4
>
>
> On Tue, Feb 28, 2017 at 6:11 PM, David Holmes
> <david.holmes at oracle.com
> <mailto:david.holmes at oracle.com> <mailto:david.holmes at oracle.com
> <mailto:david.holmes at oracle.com>>
> <mailto:david.holmes at oracle.com
> <mailto:david.holmes at oracle.com>
>
> <mailto:david.holmes at oracle.com
> <mailto:david.holmes at oracle.com>>>> wrote:
>
> On 28/02/2017 7:35 PM, David Holmes wrote:
>
> On 28/02/2017 6:51 PM, Zhu Yong wrote:
>
> Dear All,
>
> I am testing cross compile OpenJDK-9+158 for our
> embedded
> system using
> buildroot, I can build server and client
> variants
> successfully, but the
> output compact1 profile file size is too
> big, then I
> tried
> to build
> minimal
> variant, failed when linking libjvm.so.
>
> I checked
>
>
> build/linux-arm-normal-minimal-release/hotspot/variant-minimal/
> libjvm/objs/_BUILD_LIBJVM_objectfilenames.txt,
> jvmtiEnvBase.o
> and jvmtiEnvThreadState.o are not listed in
> the file
> (which
> is required
> from the error message below).
>
>
> Right - JVM TI is not part of the Minimal VM. At the
> moment it looks
> like some service has either been enabled when
> it should not
> have been,
> or has not been correctly if'def in the source.
>
>
> As far as I can see your error messages are
> complaining about
> missing functions that are called from the same
> sources as the
> functions that are missing! ie.
>
> undefined reference to
>
> `JvmtiEnvBase::get_current_contended_monitor(JavaThread*,
> JavaThread*,
> _jobject**)'
> /tmp/cc27HS5M.ltrans0.ltrans.o: In function
> `VM_GetOwnedMonitorInfo::doit()
>
> but VM_GetOwnedMonitorInfo is defined in
> jvmtiEnv.cpp which
> should
> be included or excluded the same as jvmtiEnBase.cpp.
> Here's the
> logic in the makefile that controls this:
>
> ifneq ($(call check-jvm-feature, jvmti), true)
> JVM_CFLAGS_FEATURES += -DINCLUDE_JVMTI=0
> JVM_EXCLUDE_FILES += jvmtiGetLoadedClasses.cpp
> jvmtiThreadState.cpp jvmtiExtensions.cpp \
> jvmtiImpl.cpp jvmtiManageCapabilities.cpp
> jvmtiRawMonitor.cpp
> jvmtiUtil.cpp jvmtiTrace.cpp \
> jvmtiCodeBlobEvents.cpp jvmtiEnv.cpp
> jvmtiRedefineClasses.cpp
> jvmtiEnvBase.cpp jvmtiEnvThreadState.cpp \
> jvmtiTagMap.cpp jvmtiEventController.cpp
> evmCompat.cpp
> jvmtiEnter.xsl jvmtiExport.cpp \
> jvmtiClassFileReconstituter.cpp
> endif
>
> Can you run with LOG=trace so that each compiled file is
> listed in
> the build log, then see if there are any jvmti*
> files listed
> there.
>
> Thanks,
> David
>
>
>
>
> Can you provide the lines from your spec.gmk
> that define the
> JVM_FEATURES_* variables please.
>
> Thanks,
> David
> ------
>
>
> === Output from failing command(s) repeated
> here ===
> * For target
>
> hotspot_variant-minimal_libjvm_objs_BUILD_LIBJVM_link:
> /tmp/cc27HS5M.ltrans0.ltrans.o: In function
> `VM_GetStackTrace::doit()
> [clone .local.640]':
> cc27HS5M.ltrans0.o:(.text+0xce5e): undefined
> reference to
> `JvmtiEnvBase::get_stack_trace(JavaThread*,
> int, int,
> _jvmtiFrameInfo*,
> int*)'
> /tmp/cc27HS5M.ltrans0.ltrans.o: In function
> `VM_GetCurrentContendedMonitor::doit()
> [clone .local.639]':
> cc27HS5M.ltrans0.o:(.text+0xcec2): undefined
> reference to
>
> `JvmtiEnvBase::get_current_contended_monitor(JavaThread*,
> JavaThread*,
> _jobject**)'
> /tmp/cc27HS5M.ltrans0.ltrans.o: In function
> `VM_GetOwnedMonitorInfo::doit()
> [clone .local.638]':
> cc27HS5M.ltrans0.o:(.text+0xcf26): undefined
> reference to
> `JvmtiEnvBase::get_owned_monitors(JavaThread*,
> JavaThread*,
> GrowableArray<_
> jvmtiMonitorStackDepthInfo*>*)'
> /tmp/cc27HS5M.ltrans0.ltrans.o: In function
> `VM_GetFrameCount::doit()
> [clone .local.637]':
> cc27HS5M.ltrans0.o:(.text+0xcf8a): undefined
> reference to
>
> `JvmtiEnvBase::get_frame_count(JvmtiThreadState*, int*)'
> /tmp/cc27HS5M.ltrans0.ltrans.o: In function
> `VM_SetFramePop::doit()
> [clone
> .local.636]':
> cc27HS5M.ltrans0.o:(.text+0xcfea): undefined
> reference to
> `JvmtiThreadState::count_frames()'
> cc27HS5M.ltrans0.o:(.text+0xd030): undefined
> reference to
> `JvmtiEnvThreadState::set_frame_pop(int)'
> /tmp/cc27HS5M.ltrans0.ltrans.o: In function
> `VM_GetFrameLocation::doit()
> [clone .local.641]':
> ... (rest of output omitted)
>
>
> My configuration:
>
> --with-jdk-variant=normal \
> --with-jvm-variants=minimal \
> --with-debug-level=release \
> --disable-warnings-as-errors \
> --disable-hotspot-gtest \
> --with-abi-profile=arm-vfp-sflt \
> --openjdk-target=$(GNU_TARGET_NAME) \
> --with-sys-root=$(STAGING_DIR) \
> --with-tools-dir=$(HOST_DIR) \
>
> --with-freetype-include=$(STAGING_DIR)/usr/include \
> --with-freetype-lib=$(STAGING_DIR)/usr/lib \
> --with-freetype=$(STAGING_DIR)/usr/ \
> --with-alsa-include=$(STAGING_DIR)/usr/include \
> --with-alsa-lib=$(STAGING_DIR)/usr/lib \
> --with-alsa=$(STAGING_DIR)/usr/ \
> --with-cups=$(STAGING_DIR)/usr/ \
> --with-x=$(STAGING_DIR)/usr/include \
> --with-extra-ldflags=--sysroot=$(STAGING_DIR) \
> --enable-headless-only \
> --disable-freetype-bundling \
> --enable-unlimited-crypto \
> --with-boot-jdk=/opt/java/jdk1.8.0_102
>
>
>
>
More information about the build-dev
mailing list