Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os_linux_riscv32.cpp中注释掉的函数体问题解决 #117

Closed
DingliZhang opened this issue Apr 22, 2021 · 3 comments
Closed

os_linux_riscv32.cpp中注释掉的函数体问题解决 #117

DingliZhang opened this issue Apr 22, 2021 · 3 comments
Assignees

Comments

@DingliZhang
Copy link

DingliZhang commented Apr 22, 2021

#21 中提到的

issue #15 , PR #24 中涉及到的os_linux_riscv32.cpp中还有注释掉的函数体,需要后续解决。
提交结点为:6e8391a630b5f6af59dc7756cf86e65f9de4d6ba
函数名称为:atomic_load_long_bootstrap, atomic_store_long_bootstrap.

@DingliZhang DingliZhang self-assigned this Apr 22, 2021
@DingliZhang
Copy link
Author

DingliZhang commented Apr 23, 2021

删除了os_linux_riscv32.cpp以及os_linux_riscv32.hpp中的函数:

  • atomic_load_long_bootstrap
  • atomic_store_long_bootstrap
  • atomic_load_long_func
  • atomic_store_long_func

这些函数在实际流程中不会执行到,只是因为如果完全参考bishengJDK中的atomic_linux_riscv64.hpp(即不在atomic_linux_riscv32.hpp中增加模板Atomic::PlatformLoad及Atomic::PlatformStore),会出现以下报错:

/home/dingli/isrc-jdk11u/jdk11u/src/hotspot/share/runtime/atomic.hpp: In instantiation of 'void Atomic::PlatformStore<byte_size>::operator()(T, volatile T*) const [with T = long long int; unsigned int byte_size = 8]':
/home/dingli/isrc-jdk11u/jdk11u/src/hotspot/share/runtime/atomic.hpp:435:17:   required from 'void Atomic::StoreImpl<T, T, PlatformOp, typename EnableIf<(IsIntegral<T>::value || IsRegisteredEnum<T>::value)>::type>::operator()(T, volatile T*) const [with T = long long int; PlatformOp = Atomic::PlatformStore<8>; typename EnableIf<(IsIntegral<T>::value || IsRegisteredEnum<T>::value)>::type = void]'
/home/dingli/isrc-jdk11u/jdk11u/src/hotspot/share/runtime/atomic.hpp:599:47:   required from 'static void Atomic::store(T, volatile D*) [with T = long long int; D = long long int]'
/home/dingli/isrc-jdk11u/jdk11u/src/hotspot/share/utilities/vmError.cpp:399:44:   required from here
/home/dingli/isrc-jdk11u/jdk11u/src/hotspot/share/utilities/debug.hpp:203:38: error: incomplete type 'STATIC_ASSERT_FAILURE<false>' used in nested name specifier
  203 |     STATIC_ASSERT_FAILURE< (Cond) >::value ]
      |                                      ^~~~~
/home/dingli/isrc-jdk11u/jdk11u/src/hotspot/share/runtime/atomic.hpp:489:5: note: in expansion of macro 'STATIC_ASSERT'
  489 |     STATIC_ASSERT(sizeof(T) <= sizeof(void*)); // wide atomics need specialization
      |     ^~~~~~~~~~~~~
/home/dingli/isrc-jdk11u/jdk11u/src/hotspot/share/runtime/atomic.hpp: In instantiation of 'T Atomic::PlatformLoad<byte_size>::operator()(const volatile T*) const [with T = long long int; unsigned int byte_size = 8]':
/home/dingli/isrc-jdk11u/jdk11u/src/hotspot/share/runtime/atomic.hpp:383:24:   required from 'T Atomic::LoadImpl<T, PlatformOp, typename EnableIf<((IsIntegral<T>::value || IsRegisteredEnum<T>::value) || IsPointer<T>::value)>::type>::operator()(const volatile T*) const [with T = long long int; PlatformOp = Atomic::PlatformLoad<8>; typename EnableIf<((IsIntegral<T>::value || IsRegisteredEnum<T>::value) || IsPointer<T>::value)>::type = void]'
/home/dingli/isrc-jdk11u/jdk11u/src/hotspot/share/runtime/atomic.hpp:594:49:   required from 'static T Atomic::load(const volatile T*) [with T = long long int]'
/home/dingli/isrc-jdk11u/jdk11u/src/hotspot/share/utilities/vmError.cpp:403:45:   required from here
/home/dingli/isrc-jdk11u/jdk11u/src/hotspot/share/utilities/debug.hpp:203:38: error: incomplete type 'STATIC_ASSERT_FAILURE<false>' used in nested name specifier
  203 |     STATIC_ASSERT_FAILURE< (Cond) >::value ]
      |                                      ^~~~~
/home/dingli/isrc-jdk11u/jdk11u/src/hotspot/share/runtime/atomic.hpp:419:5: note: in expansion of macro 'STATIC_ASSERT'
  419 |     STATIC_ASSERT(sizeof(T) <= sizeof(void*)); // wide atomics need specialization
      |     ^~~~~~~~~~~~~

因此参考arm中的实现,定义两个空的模板Atomic::PlatformLoad及Atomic::PlatformStore,保证编译顺利通过。

@DingliZhang
Copy link
Author

提交了PR #124 ,编译过程:
build.log
@shining1984 review和验证。

@DingliZhang
Copy link
Author

使用qemu用户模式执行java -version:

$ /home/dingli/qemu_install/qemu-5.2.0/bin/qemu-riscv32 -L /home/dingli/toolchain/riscv32/sysroot ./java -version

运行报错:

# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/macroAssembler_riscv32.cpp:2632
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/dingli/isrc-jdk11u/jdk11u/src/hotspot/cpu/riscv32/macroAssembler_riscv32.cpp:2632), pid=32200, tid=32208
#  assert(ReservedCodeCacheSize < 4*G) failed: branch out of range
#
# JRE version:  (11.0.9) (fastdebug build )
# Java VM: OpenJDK Core VM (fastdebug 11.0.9-internal+0-adhoc.dingli.jdk11u, interpreted mode, sharing, serial gc, linux-riscv32)
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P %E" (or dumping to /home/dingli/isrc-jdk11u/jdk11u/fastdebug_32_core/jvm/openjdk-11.0.9-internal/bin/core.32200)
#
# An error report file with more information is saved as:
# /home/dingli/isrc-jdk11u/jdk11u/fastdebug_32_core/jvm/openjdk-11.0.9-internal/bin/hs_err_pid32200.log
#
#
Current thread is 32208
Dumping core ...
Aborted (core dumped)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant