Mercurial > hg > graal-compiler
comparison src/cpu/x86/vm/runtime_x86_32.cpp @ 304:dc7f315e41f7
5108146: Merge i486 and amd64 cpu directories
6459804: Want client (c1) compiler for x86_64 (amd64) for faster start-up
Reviewed-by: kvn
author | never |
---|---|
date | Wed, 27 Aug 2008 00:21:55 -0700 |
parents | a61af66fc99e |
children | 9ee9cf798b59 |
comparison
equal
deleted
inserted
replaced
303:fa4d1d240383 | 304:dc7f315e41f7 |
---|---|
76 | 76 |
77 OopMapSet *oop_maps = new OopMapSet(); | 77 OopMapSet *oop_maps = new OopMapSet(); |
78 | 78 |
79 address start = __ pc(); | 79 address start = __ pc(); |
80 | 80 |
81 __ pushl(rdx); | 81 __ push(rdx); |
82 __ subl(rsp, return_off * wordSize); // Prolog! | 82 __ subptr(rsp, return_off * wordSize); // Prolog! |
83 | 83 |
84 // rbp, location is implicitly known | 84 // rbp, location is implicitly known |
85 __ movl(Address(rsp,rbp_off *wordSize),rbp); | 85 __ movptr(Address(rsp,rbp_off *wordSize), rbp); |
86 | 86 |
87 // Store exception in Thread object. We cannot pass any arguments to the | 87 // Store exception in Thread object. We cannot pass any arguments to the |
88 // handle_exception call, since we do not want to make any assumption | 88 // handle_exception call, since we do not want to make any assumption |
89 // about the size of the frame where the exception happened in. | 89 // about the size of the frame where the exception happened in. |
90 __ get_thread(rcx); | 90 __ get_thread(rcx); |
91 __ movl(Address(rcx, JavaThread::exception_oop_offset()), rax); | 91 __ movptr(Address(rcx, JavaThread::exception_oop_offset()), rax); |
92 __ movl(Address(rcx, JavaThread::exception_pc_offset()), rdx); | 92 __ movptr(Address(rcx, JavaThread::exception_pc_offset()), rdx); |
93 | 93 |
94 // This call does all the hard work. It checks if an exception handler | 94 // This call does all the hard work. It checks if an exception handler |
95 // exists in the method. | 95 // exists in the method. |
96 // If so, it returns the handler address. | 96 // If so, it returns the handler address. |
97 // If not, it prepares for stack-unwinding, restoring the callee-save | 97 // If not, it prepares for stack-unwinding, restoring the callee-save |
98 // registers of the frame being removed. | 98 // registers of the frame being removed. |
99 // | 99 // |
100 __ movl(Address(rsp, thread_off * wordSize), rcx); // Thread is first argument | 100 __ movptr(Address(rsp, thread_off * wordSize), rcx); // Thread is first argument |
101 __ set_last_Java_frame(rcx, noreg, noreg, NULL); | 101 __ set_last_Java_frame(rcx, noreg, noreg, NULL); |
102 | 102 |
103 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, OptoRuntime::handle_exception_C))); | 103 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, OptoRuntime::handle_exception_C))); |
104 | 104 |
105 // No registers to map, rbp is known implicitly | 105 // No registers to map, rbp is known implicitly |
106 oop_maps->add_gc_map( __ pc() - start, new OopMap( framesize, 0 )); | 106 oop_maps->add_gc_map( __ pc() - start, new OopMap( framesize, 0 )); |
107 __ get_thread(rcx); | 107 __ get_thread(rcx); |
108 __ reset_last_Java_frame(rcx, false, false); | 108 __ reset_last_Java_frame(rcx, false, false); |
109 | 109 |
110 // Restore callee-saved registers | 110 // Restore callee-saved registers |
111 __ movl(rbp, Address(rsp, rbp_off * wordSize)); | 111 __ movptr(rbp, Address(rsp, rbp_off * wordSize)); |
112 | 112 |
113 __ addl(rsp, return_off * wordSize); // Epilog! | 113 __ addptr(rsp, return_off * wordSize); // Epilog! |
114 __ popl(rdx); // Exception pc | 114 __ pop(rdx); // Exception pc |
115 | 115 |
116 | 116 |
117 // rax,: exception handler for given <exception oop/exception pc> | 117 // rax,: exception handler for given <exception oop/exception pc> |
118 | 118 |
119 // We have a handler in rax, (could be deopt blob) | 119 // We have a handler in rax, (could be deopt blob) |
120 // rdx - throwing pc, deopt blob will need it. | 120 // rdx - throwing pc, deopt blob will need it. |
121 | 121 |
122 __ pushl(rax); | 122 __ push(rax); |
123 | 123 |
124 // rcx contains handler address | 124 // rcx contains handler address |
125 | 125 |
126 __ get_thread(rcx); // TLS | 126 __ get_thread(rcx); // TLS |
127 // Get the exception | 127 // Get the exception |
128 __ movl(rax, Address(rcx, JavaThread::exception_oop_offset())); | 128 __ movptr(rax, Address(rcx, JavaThread::exception_oop_offset())); |
129 // Get the exception pc in case we are deoptimized | 129 // Get the exception pc in case we are deoptimized |
130 __ movl(rdx, Address(rcx, JavaThread::exception_pc_offset())); | 130 __ movptr(rdx, Address(rcx, JavaThread::exception_pc_offset())); |
131 #ifdef ASSERT | 131 #ifdef ASSERT |
132 __ movl(Address(rcx, JavaThread::exception_handler_pc_offset()), 0); | 132 __ movptr(Address(rcx, JavaThread::exception_handler_pc_offset()), (int32_t)NULL_WORD); |
133 __ movl(Address(rcx, JavaThread::exception_pc_offset()), 0); | 133 __ movptr(Address(rcx, JavaThread::exception_pc_offset()), (int32_t)NULL_WORD); |
134 #endif | 134 #endif |
135 // Clear the exception oop so GC no longer processes it as a root. | 135 // Clear the exception oop so GC no longer processes it as a root. |
136 __ movl(Address(rcx, JavaThread::exception_oop_offset()), 0); | 136 __ movptr(Address(rcx, JavaThread::exception_oop_offset()), (int32_t)NULL_WORD); |
137 | 137 |
138 __ popl(rcx); | 138 __ pop(rcx); |
139 | 139 |
140 // rax,: exception oop | 140 // rax,: exception oop |
141 // rcx: exception handler | 141 // rcx: exception handler |
142 // rdx: exception pc | 142 // rdx: exception pc |
143 __ jmp (rcx); | 143 __ jmp (rcx); |