Mercurial > hg > truffle
comparison src/cpu/x86/vm/x86_32.ad @ 17809:a433eb716ce1
8037821: Account for trampoline stubs when estimating code buffer sizes
Summary: Take into account space needed for "trampoline code" used by calls on PPC64.
Reviewed-by: kvn
Contributed-by: lutz.schmidt@sap.com
author | goetz |
---|---|
date | Tue, 25 Mar 2014 12:54:21 -0700 |
parents | f040cf9fc9c0 |
children | 62c54fcc0a35 |
comparison
equal
deleted
inserted
replaced
17808:d623bc507723 | 17809:a433eb716ce1 |
---|---|
1295 return OptoBreakpoint ? 11 : 12; | 1295 return OptoBreakpoint ? 11 : 12; |
1296 } | 1296 } |
1297 | 1297 |
1298 | 1298 |
1299 //============================================================================= | 1299 //============================================================================= |
1300 uint size_exception_handler() { | |
1301 // NativeCall instruction size is the same as NativeJump. | |
1302 // exception handler starts out as jump and can be patched to | |
1303 // a call be deoptimization. (4932387) | |
1304 // Note that this value is also credited (in output.cpp) to | |
1305 // the size of the code section. | |
1306 return NativeJump::instruction_size; | |
1307 } | |
1308 | |
1309 // Emit exception handler code. Stuff framesize into a register | |
1310 // and call a VM stub routine. | |
1311 int emit_exception_handler(CodeBuffer& cbuf) { | |
1312 | |
1313 // Note that the code buffer's insts_mark is always relative to insts. | |
1314 // That's why we must use the macroassembler to generate a handler. | |
1315 MacroAssembler _masm(&cbuf); | |
1316 address base = | |
1317 __ start_a_stub(size_exception_handler()); | |
1318 if (base == NULL) return 0; // CodeBuffer::expand failed | |
1319 int offset = __ offset(); | |
1320 __ jump(RuntimeAddress(OptoRuntime::exception_blob()->entry_point())); | |
1321 assert(__ offset() - offset <= (int) size_exception_handler(), "overflow"); | |
1322 __ end_a_stub(); | |
1323 return offset; | |
1324 } | |
1325 | |
1326 uint size_deopt_handler() { | |
1327 // NativeCall instruction size is the same as NativeJump. | |
1328 // exception handler starts out as jump and can be patched to | |
1329 // a call be deoptimization. (4932387) | |
1330 // Note that this value is also credited (in output.cpp) to | |
1331 // the size of the code section. | |
1332 return 5 + NativeJump::instruction_size; // pushl(); jmp; | |
1333 } | |
1334 | |
1335 // Emit deopt handler code. | |
1336 int emit_deopt_handler(CodeBuffer& cbuf) { | |
1337 | |
1338 // Note that the code buffer's insts_mark is always relative to insts. | |
1339 // That's why we must use the macroassembler to generate a handler. | |
1340 MacroAssembler _masm(&cbuf); | |
1341 address base = | |
1342 __ start_a_stub(size_exception_handler()); | |
1343 if (base == NULL) return 0; // CodeBuffer::expand failed | |
1344 int offset = __ offset(); | |
1345 InternalAddress here(__ pc()); | |
1346 __ pushptr(here.addr()); | |
1347 | |
1348 __ jump(RuntimeAddress(SharedRuntime::deopt_blob()->unpack())); | |
1349 assert(__ offset() - offset <= (int) size_deopt_handler(), "overflow"); | |
1350 __ end_a_stub(); | |
1351 return offset; | |
1352 } | |
1353 | 1300 |
1354 int Matcher::regnum_to_fpu_offset(int regnum) { | 1301 int Matcher::regnum_to_fpu_offset(int regnum) { |
1355 return regnum - 32; // The FP registers are in the second chunk | 1302 return regnum - 32; // The FP registers are in the second chunk |
1356 } | 1303 } |
1357 | 1304 |