![](https://csdnimg.cn/release/download_crawler_static/86312343/bg1.jpg)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
JVM
,
Java
,
Hotspot
,
JVM
Java
.
,
,
.
:CallStub
Java
,
Java
invoke
,
Java
Java main()
JVM
JVM
,
Java
,
JavaCalls
.
JavaCalls
,
Java
.
JavaCalls
Java
,
call_virtual(),call_special(),call_static
,
Java
.
call()
:
void JavaCalls::call(JavaValue* result,methodHandle method,JavaCallArguments* args,TRAPS) {
......
os::os_exception_wrapper(call_helper,result,&method,args,THREAD);
}
void os::os_exception_wrapper(java_call_t f,JavaValue* value,methodHandle* method,JavaCallArguments* args,Thread* thread) {
f(value,method,args,thread);
}
f
call()
call_help,
call_help(value,method,args,thread),
call_help
,
JavaCalls
void JavaCalls::call_helper(JavaValue* result,methodHandle* m,JavaCallArguments* args,TRAPS) {
......
StubRoutines::call_stub()(
(address)&link,
// (intptr_t*)&(result->_value),// see NOTE above (compiler problem)
result_val_address, // see NOTE above (compiler problem)
result_type,
method(),
entry_point,
args->parameters(),
args->size_of_parameters(),
CHECK
);
......
}
call_help
StubRoutines::call_stub()
java
;
,call_stub()
.
call_stub()
.
/openjdk/hotspot/src/share/vm/runtime/stubRoutines.hpp
static CallStub call_stub() { return CAST_TO_FN_PTR(CallStub, _call_stub_entry); }
call_stub()
_call_stub_entry
.
,
,
“
”
.
,
,
,
.
,
C
,
,
,“
”
,C
,
.
C
,
,
,
,
,
,
“
”
.
_call_stub_entry
generate_call_stub()
,
,
.
,
,
.JVM
MacroAssembler
.
/openjdk/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
address generate_call_stub(address& return_address) {
StubCodeMark mark(this,"StubRoutines","call_stub");
//
.
,
address start = __ pc();
// stub code parameters / addresses
assert(frame::entry_frame_call_wrapper_offset == 2,"adjust this code");
bool sse_save = false;
const Address rsp_after_call(rbp,-4 * wordSize); // same as in generate_catch_exception()!
const int locals_count_in_bytes (4*wordSize);
//
,
,
,
call_stub
.
//
call_stub
(rbp)
(
).
.
const Address mxcsr_save (rbp,-4 * wordSize);
const Address saved_rbx (rbp,-3 * wordSize);
const Address saved_rsi (rbp,-2 * wordSize);
const Address saved_rdi (rbp,-1 * wordSize);
//
,
,
call_stub
,
call_stub
,
.
//
call_stub
.
const Address result (rbp, 3 * wordSize);
const Address result_type (rbp, 4 * wordSize);
const Address method (rbp, 5 * wordSize);
const Address entry_point (rbp, 6 * wordSize);
const Address parameters (rbp, 7 * wordSize);
const Address parameter_size(rbp, 8 * wordSize);
const Address thread (rbp, 9 * wordSize); // same as in generate_catch_exception()!
sse_save = UseSSE > 0;
//enter()
,
,
call_stub
.
//c
,
JVM
.
---------------------------------------------
| void MacroAssembler::enter() { |
JVM
-
2.txt 12/31/2019 10:13 PM
Page 1 of 4