Mercurial > hg > graal-jvmci-8
comparison src/cpu/x86/vm/frame_x86.cpp @ 1135:e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
Summary: During the work for 6829187 we have fixed a number of basic bugs which are logically grouped with 6815692 and 6858164 but which must be reviewed and pushed separately.
Reviewed-by: kvn, never
author | twisti |
---|---|
date | Mon, 04 Jan 2010 18:38:08 +0100 |
parents | bd02caa94611 |
children | ba263cfb7611 |
comparison
equal
deleted
inserted
replaced
1134:0910903272e5 | 1135:e66fd840cb6b |
---|---|
328 intptr_t* sp = (intptr_t*) addr_at(sender_sp_offset); | 328 intptr_t* sp = (intptr_t*) addr_at(sender_sp_offset); |
329 | 329 |
330 // This is the sp before any possible extension (adapter/locals). | 330 // This is the sp before any possible extension (adapter/locals). |
331 intptr_t* unextended_sp = interpreter_frame_sender_sp(); | 331 intptr_t* unextended_sp = interpreter_frame_sender_sp(); |
332 | 332 |
333 address sender_pc = this->sender_pc(); | |
334 CodeBlob* sender_cb = CodeCache::find_blob_unsafe(sender_pc); | |
335 assert(sender_cb, "sanity"); | |
336 nmethod* sender_nm = sender_cb->as_nmethod_or_null(); | |
337 if (sender_nm != NULL && sender_nm->is_method_handle_return(sender_pc)) { | |
338 unextended_sp = (intptr_t*) at(link_offset); | |
339 } | |
340 | |
333 // The interpreter and compiler(s) always save EBP/RBP in a known | 341 // The interpreter and compiler(s) always save EBP/RBP in a known |
334 // location on entry. We must record where that location is | 342 // location on entry. We must record where that location is |
335 // so this if EBP/RBP was live on callout from c2 we can find | 343 // so this if EBP/RBP was live on callout from c2 we can find |
336 // the saved copy no matter what it called. | 344 // the saved copy no matter what it called. |
337 | 345 |
350 map->set_location(rbp->as_VMReg()->next(), (address)addr_at(link_offset)); | 358 map->set_location(rbp->as_VMReg()->next(), (address)addr_at(link_offset)); |
351 } | 359 } |
352 #endif // AMD64 | 360 #endif // AMD64 |
353 } | 361 } |
354 #endif /* COMPILER2 */ | 362 #endif /* COMPILER2 */ |
355 return frame(sp, unextended_sp, link(), sender_pc()); | 363 return frame(sp, unextended_sp, link(), sender_pc); |
356 } | 364 } |
357 | 365 |
358 | 366 |
359 //------------------------------sender_for_compiled_frame----------------------- | 367 //------------------------------sender_for_compiled_frame----------------------- |
360 frame frame::sender_for_compiled_frame(RegisterMap* map) const { | 368 frame frame::sender_for_compiled_frame(RegisterMap* map) const { |
372 | 380 |
373 // This is the saved value of ebp which may or may not really be an fp. | 381 // This is the saved value of ebp which may or may not really be an fp. |
374 // it is only an fp if the sender is an interpreter frame (or c1?) | 382 // it is only an fp if the sender is an interpreter frame (or c1?) |
375 | 383 |
376 intptr_t *saved_fp = (intptr_t*)*(sender_sp - frame::sender_sp_offset); | 384 intptr_t *saved_fp = (intptr_t*)*(sender_sp - frame::sender_sp_offset); |
385 | |
386 intptr_t* unextended_sp = sender_sp; | |
387 // If we are returning to a compiled method handle call site, | |
388 // the saved_fp will in fact be a saved value of the unextended SP. | |
389 // The simplest way to tell whether we are returning to such a call | |
390 // site is as follows: | |
391 CodeBlob* sender_cb = CodeCache::find_blob_unsafe(sender_pc); | |
392 assert(sender_cb, "sanity"); | |
393 nmethod* sender_nm = sender_cb->as_nmethod_or_null(); | |
394 if (sender_nm != NULL && sender_nm->is_method_handle_return(sender_pc)) { | |
395 unextended_sp = saved_fp; | |
396 } | |
377 | 397 |
378 if (map->update_map()) { | 398 if (map->update_map()) { |
379 // Tell GC to use argument oopmaps for some runtime stubs that need it. | 399 // Tell GC to use argument oopmaps for some runtime stubs that need it. |
380 // For C1, the runtime stub might not have oop maps, so set this flag | 400 // For C1, the runtime stub might not have oop maps, so set this flag |
381 // outside of update_register_map. | 401 // outside of update_register_map. |
397 } | 417 } |
398 #endif // AMD64 | 418 #endif // AMD64 |
399 } | 419 } |
400 | 420 |
401 assert(sender_sp != sp(), "must have changed"); | 421 assert(sender_sp != sp(), "must have changed"); |
402 return frame(sender_sp, saved_fp, sender_pc); | 422 return frame(sender_sp, unextended_sp, saved_fp, sender_pc); |
403 } | 423 } |
404 | 424 |
405 frame frame::sender(RegisterMap* map) const { | 425 frame frame::sender(RegisterMap* map) const { |
406 // Default is we done have to follow them. The sender_for_xxx will | 426 // Default is we done have to follow them. The sender_for_xxx will |
407 // update it accordingly | 427 // update it accordingly |