Sun, 25 Oct 2020 00:26:52 +0800
#15368 mips port of pd_get_top_frame_for_profiling
src/os_cpu/linux_mips/vm/thread_linux_mips.cpp | file | annotate | diff | comparison | revisions | |
src/os_cpu/linux_mips/vm/thread_linux_mips.hpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/os_cpu/linux_mips/vm/thread_linux_mips.cpp Sat Oct 24 16:43:47 2020 +0800 1.2 +++ b/src/os_cpu/linux_mips/vm/thread_linux_mips.cpp Sun Oct 25 00:26:52 2020 +0800 1.3 @@ -1,6 +1,6 @@ 1.4 /* 1.5 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 - * Copyright (c) 2015, 2019, Loongson Technology. All rights reserved. 1.7 + * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. 1.8 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.9 * 1.10 * This code is free software; you can redistribute it and/or modify it 1.11 @@ -45,13 +45,20 @@ 1.12 void* ucontext, bool isInJava) { 1.13 1.14 assert(Thread::current() == this, "caller must be current thread"); 1.15 + return pd_get_top_frame(fr_addr, ucontext, isInJava); 1.16 +} 1.17 + 1.18 +bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava) { 1.19 + return pd_get_top_frame(fr_addr, ucontext, isInJava); 1.20 +} 1.21 + 1.22 +bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) { 1.23 assert(this->is_Java_thread(), "must be JavaThread"); 1.24 - 1.25 JavaThread* jt = (JavaThread *)this; 1.26 1.27 // If we have a last_Java_frame, then we should use it even if 1.28 // isInJava == true. It should be more reliable than ucontext info. 1.29 - if (jt->has_last_Java_frame()) { 1.30 + if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) { 1.31 *fr_addr = jt->pd_last_frame(); 1.32 return true; 1.33 }
2.1 --- a/src/os_cpu/linux_mips/vm/thread_linux_mips.hpp Sat Oct 24 16:43:47 2020 +0800 2.2 +++ b/src/os_cpu/linux_mips/vm/thread_linux_mips.hpp Sun Oct 25 00:26:52 2020 +0800 2.3 @@ -1,6 +1,6 @@ 2.4 /* 2.5 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 2.6 - * Copyright (c) 2015, 2019, Loongson Technology. All rights reserved. 2.7 + * Copyright (c) 2015, 2020, Loongson Technology. All rights reserved. 2.8 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.9 * 2.10 * This code is free software; you can redistribute it and/or modify it 2.11 @@ -23,6 +23,9 @@ 2.12 * 2.13 */ 2.14 2.15 +#ifndef OS_CPU_LINUX_MIPS_VM_THREAD_LINUX_MIPS_HPP 2.16 +#define OS_CPU_LINUX_MIPS_VM_THREAD_LINUX_MIPS_HPP 2.17 + 2.18 private: 2.19 void pd_initialize(); 2.20 2.21 @@ -36,6 +39,7 @@ 2.22 } 2.23 } 2.24 2.25 + 2.26 public: 2.27 // Mutators are highly dangerous.... 2.28 intptr_t* last_Java_fp() { return _anchor.last_Java_fp(); } 2.29 @@ -57,6 +61,11 @@ 2.30 bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext, 2.31 bool isInJava); 2.32 2.33 + bool pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava); 2.34 +private: 2.35 + bool pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava); 2.36 +public: 2.37 + 2.38 // These routines are only used on cpu architectures that 2.39 // have separate register stacks (Itanium). 2.40 static bool register_stack_overflow() { return false; } 2.41 @@ -67,3 +76,5 @@ 2.42 volatile address _handle_wrong_method_stub; 2.43 static ByteSize handle_wrong_method_stub_offset() { return byte_offset_of(JavaThread, _handle_wrong_method_stub); } 2.44 void set_handle_wrong_method_stub(address stub) { _handle_wrong_method_stub = stub; } 2.45 + 2.46 +#endif // OS_CPU_LINUX_MIPS_VM_THREAD_LINUX_MIPS_HPP