我正在破解JVM9 源代码,尤其是class os
部分.
我想做的是:
(1) 添加一个static int
named数组gc_tid[64]
来存储一些线程id信息。
(2)加一个static int nr_gc_tid;
来统计上面的线程数
所以,我只在class os
这里添加了另外两个成员,类似于之前的变量成员static size_t _page_sizes[page_sizes_max];
。
(我在这里所做的一切都是为了模仿_page_sizes
中的声明方式os.hpp
)
class os: AllStatic {
public:
...
static int gc_tid[64];
static int nr_gc_tid;
...
};
我也有做两件事的初始化nr_gc_tid
和gc_tid[64]
。
所以,我在这里写了一个static void init_gc_tid(void)
in作为成员函数。hotspot/src/share/vm/runtime/os.hpp
public
static void init_gc_tid(void);
然后,我init_gc_tid(void)
在hotspot/src/os/linux/vm/os_linux.cpp
之前定义了这个函数void os::init(void)
(我在这里所做的一切都是为了模仿如何os::init(void)
在 中声明os.hpp
,并在 中定义os_linux.cpp
)
void os::init_gc_tid(void){
//step 1: init nr_gctid as 0
nr_gc_tid = 0;
//step 2: init all gc tid as -100
int i = 0;
for(i = 0; i < 64; ++i){
gc_tid[i] = -100;
}
}
最后,我在here之后调用我的init_gc_tid
函数。os::init(void)
init_page_sizes((size_t) Linux::page_size());
但它不起作用。当我make
的JVM9项目。我收到类似的错误
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Compiling 11 properties into resource bundles for java.logging
Compiling 3 files for COMPILE_CREATE_SYMBOLS
Compiling 11 properties into resource bundles for jdk.management.agent
Compiling 3 properties into resource bundles for jdk.jdi
Compiling 2 files for BUILD_BREAKITERATOR_BASE
Compiling 11 properties into resource bundles for jdk.jartool
Compiling 2 files for BUILD_BREAKITERATOR_LD
Compiling 4 properties into resource bundles for jdk.jlink
Compiling 3 properties into resource bundles for jdk.jlink
Compiling 1 properties into resource bundles for jdk.jlink
Compiling 224 properties into resource bundles for jdk.localedata
Creating buildtools/jdk.vm.compiler.replacements.verifier.jar
Compiling 6 properties into resource bundles for java.base
Compiling 11 properties into resource bundles for java.base
Creating ct.sym classes
Creating buildtools/jdk.vm.compiler.match.processor.jar
Creating support/symbols/ct.sym
Compiling 100 properties into resource bundles for java.desktop
Compiling 2897 files for java.base
/home/wxf/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/hotspot/variant-server/libjvm/objs/os_linux.o: In function `os::init_gc_tid()':
/home/wxf/sandboxJDK/9jdk/hotspot/src/os/linux/vm/os_linux.cpp:4726: undefined reference to `os::nr_gc_tid'
/home/wxf/sandboxJDK/9jdk/hotspot/src/os/linux/vm/os_linux.cpp:4730: undefined reference to `os::gc_tid'
collect2: error: ld returned 1 exit status
make[3]: *** [/home/wxf/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/support/modules_libs/java.base/server/libjvm.so] Error 1
lib/CompileJvm.gmk:207: recipe for target '/home/wxf/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/support/modules_libs/java.base/server/libjvm.so' failed
make[3]: *** Waiting for unfinished jobs....
/home/wxf/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/hotspot/variant-server/libjvm/objs/os_linux.o: In function `os::init_gc_tid()':
/home/wxf/sandboxJDK/9jdk/hotspot/src/os/linux/vm/os_linux.cpp:4726: undefined reference to `os::nr_gc_tid'
/home/wxf/sandboxJDK/9jdk/hotspot/src/os/linux/vm/os_linux.cpp:4730: undefined reference to `os::gc_tid'
collect2: error: ld returned 1 exit status
lib/CompileGtest.gmk:64: recipe for target '/home/wxf/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/hotspot/variant-server/libjvm/gtest/libjvm.so' failed
make[3]: *** [/home/wxf/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/hotspot/variant-server/libjvm/gtest/libjvm.so] Error 1
make/Main.gmk:263: recipe for target 'hotspot-server-libs' failed
make[2]: *** [hotspot-server-libs] Error 2
make[2]: *** Waiting for unfinished jobs....
ERROR: Build failed for target 'default (exploded-image)' in configuration 'linux-x86_64-normal-server-slowdebug' (exit code 2)
Stopping sjavac server
=== Output from failing command(s) repeated here ===
* For target hotspot_variant-server_libjvm_gtest_objs_BUILD_GTEST_LIBJVM_link:
/home/wxf/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/hotspot/variant-server/libjvm/objs/os_linux.o: In function `os::init_gc_tid()':
/home/wxf/sandboxJDK/9jdk/hotspot/src/os/linux/vm/os_linux.cpp:4726: undefined reference to `os::nr_gc_tid'
/home/wxf/sandboxJDK/9jdk/hotspot/src/os/linux/vm/os_linux.cpp:4730: undefined reference to `os::gc_tid'
collect2: error: ld returned 1 exit status
* For target hotspot_variant-server_libjvm_objs_BUILD_LIBJVM_link:
/home/wxf/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/hotspot/variant-server/libjvm/objs/os_linux.o: In function `os::init_gc_tid()':
/home/wxf/sandboxJDK/9jdk/hotspot/src/os/linux/vm/os_linux.cpp:4726: undefined reference to `os::nr_gc_tid'
/home/wxf/sandboxJDK/9jdk/hotspot/src/os/linux/vm/os_linux.cpp:4730: undefined reference to `os::gc_tid'
collect2: error: ld returned 1 exit status
* All command lines available in /home/wxf/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/make-support/failure-logs.
=== End of repeated output ===
=== Make failed targets repeated here ===
lib/CompileJvm.gmk:207: recipe for target '/home/wxf/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/support/modules_libs/java.base/server/libjvm.so' failed
lib/CompileGtest.gmk:64: recipe for target '/home/wxf/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/hotspot/variant-server/libjvm/gtest/libjvm.so' failed
make/Main.gmk:263: recipe for target 'hotspot-server-libs' failed
=== End of repeated output ===
Hint: Try searching the build log for the name of the first failed target.
Hint: If caused by a warning, try configure --disable-warnings-as-errors.
/home/wxf/sandboxJDK/9jdk/make/Init.gmk:291: recipe for target 'main' failed
make[1]: *** [main] Error 2
/home/wxf/sandboxJDK/9jdk/make/Init.gmk:185: recipe for target 'default' failed
make: *** [default] Error 2
对 `os::nr_gc_tid' 的未定义引用
对 `os::gc_tid' 的未定义引用
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句