Jvm OpenJDK8中的“线程”宏是什么

Jvm OpenJDK8中的“线程”宏是什么,jvm,jvm-hotspot,Jvm,Jvm Hotspot,在hotspot/src/share/vm/utilities/exceptions.hpp中,有一些代码: // The THREAD & TRAPS macros facilitate the declaration of functions that throw exceptions. // Convention: Use the TRAPS macro as the last argument of such a function; e.g.: // // int this_fu

在hotspot/src/share/vm/utilities/exceptions.hpp中,有一些代码:

// The THREAD & TRAPS macros facilitate the declaration of functions that throw exceptions.
// Convention: Use the TRAPS macro as the last argument of such a function; e.g.:
//
// int this_function_may_trap(int x, float y, TRAPS)

#define THREAD __the_thread__
#define TRAPS  Thread* THREAD
线程
宏仅用于引发异常:

// The THROW... macros should be used to throw an exception. They require a THREAD variable to be
// visible within the scope containing the THROW. Usually this is achieved by declaring the function
// with a TRAPS argument.

#define THREAD_AND_LOCATION                      THREAD, __FILE__, __LINE__

#define THROW_OOP(e)                                \
  { Exceptions::_throw_oop(THREAD_AND_LOCATION, e);                             return;  }

#define THROW_HANDLE(e)                                \
  { Exceptions::_throw(THREAD_AND_LOCATION, e);                             return;  }

// the real place to use __the_thread__ macro
void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exception, const char* message) {......}
但是,我使用
grep
搜索所有OpenJDK8的代码,结果发现这里只有一个地方有这个
\uu线程\uuu
宏。
有人能告诉我真正的宏定义了什么吗?

\uu线程\uuuu
这里是一个变量的名称,或者说是一个可能引发异常的VM函数的参数。它总是通过
线程
陷阱
宏访问,这就是为什么没有其他引用,变量的真实名称并不重要

例如,定义

    jint find_field_offset(jobject field, int must_be_static, TRAPS)
由预处理器扩展为

    jint find_field_offset(jobject field, int must_be_static, Thread* __the_thread__)

\uuu线程\uuuu
这里是可能引发异常的VM函数的变量名或参数名。它总是通过
线程
陷阱
宏访问,这就是为什么没有其他引用,变量的真实名称并不重要

例如,定义

    jint find_field_offset(jobject field, int must_be_static, TRAPS)
由预处理器扩展为

    jint find_field_offset(jobject field, int must_be_static, Thread* __the_thread__)