src/cpu/x86/vm/frame_x86.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6893081 Sdiff src/cpu/x86/vm

src/cpu/x86/vm/frame_x86.cpp

Print this page
rev 1081 : imported patch indy-cleanup-6893081.patch


 313   JavaFrameAnchor* jfa = entry_frame_call_wrapper()->anchor();
 314   assert(!entry_frame_is_first(), "next Java fp must be non zero");
 315   assert(jfa->last_Java_sp() > sp(), "must be above this frame on stack");
 316   map->clear();
 317   assert(map->include_argument_oops(), "should be set by clear");
 318   if (jfa->last_Java_pc() != NULL ) {
 319     frame fr(jfa->last_Java_sp(), jfa->last_Java_fp(), jfa->last_Java_pc());
 320     return fr;
 321   }
 322   frame fr(jfa->last_Java_sp(), jfa->last_Java_fp());
 323   return fr;
 324 }
 325 
 326 frame frame::sender_for_interpreter_frame(RegisterMap* map) const {
 327   // sp is the raw sp from the sender after adapter or interpreter extension
 328   intptr_t* sp = (intptr_t*) addr_at(sender_sp_offset);
 329 
 330   // This is the sp before any possible extension (adapter/locals).
 331   intptr_t* unextended_sp = interpreter_frame_sender_sp();
 332 








 333   // The interpreter and compiler(s) always save EBP/RBP in a known
 334   // 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
 336   // the saved copy no matter what it called.
 337 
 338   // Since the interpreter always saves EBP/RBP if we record where it is then
 339   // we don't have to always save EBP/RBP on entry and exit to c2 compiled
 340   // code, on entry will be enough.
 341 #ifdef COMPILER2
 342   if (map->update_map()) {
 343     map->set_location(rbp->as_VMReg(), (address) addr_at(link_offset));
 344 #ifdef AMD64
 345     // this is weird "H" ought to be at a higher address however the
 346     // oopMaps seems to have the "H" regs at the same address and the
 347     // vanilla register.
 348     // XXXX make this go away
 349     if (true) {
 350       map->set_location(rbp->as_VMReg()->next(), (address)addr_at(link_offset));
 351     }
 352 #endif // AMD64
 353   }
 354 #endif /* COMPILER2 */
 355   return frame(sp, unextended_sp, link(), sender_pc());
 356 }
 357 
 358 
 359 //------------------------------sender_for_compiled_frame-----------------------
 360 frame frame::sender_for_compiled_frame(RegisterMap* map) const {
 361   assert(map != NULL, "map must be set");
 362   const bool c1_compiled = _cb->is_compiled_by_c1();
 363 
 364   // frame owned by optimizing compiler
 365   intptr_t* sender_sp = NULL;
 366 
 367   assert(_cb->frame_size() >= 0, "must have non-zero frame size");
 368   sender_sp = unextended_sp() + _cb->frame_size();
 369 
 370   // On Intel the return_address is always the word on the stack
 371   address sender_pc = (address) *(sender_sp-1);
 372 
 373   // 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?)
 375 
 376   intptr_t *saved_fp = (intptr_t*)*(sender_sp - frame::sender_sp_offset);
 377 












 378   if (map->update_map()) {
 379     // 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
 381     // outside of update_register_map.
 382     map->set_include_argument_oops(_cb->caller_must_gc_arguments(map->thread()));
 383     if (_cb->oop_maps() != NULL) {
 384       OopMapSet::update_register_map(this, map);
 385     }
 386     // Since the prolog does the save and restore of epb there is no oopmap
 387     // for it so we must fill in its location as if there was an oopmap entry
 388     // since if our caller was compiled code there could be live jvm state in it.
 389     map->set_location(rbp->as_VMReg(), (address) (sender_sp - frame::sender_sp_offset));
 390 #ifdef AMD64
 391     // this is weird "H" ought to be at a higher address however the
 392     // oopMaps seems to have the "H" regs at the same address and the
 393     // vanilla register.
 394     // XXXX make this go away
 395     if (true) {
 396       map->set_location(rbp->as_VMReg()->next(), (address) (sender_sp - frame::sender_sp_offset));
 397     }
 398 #endif // AMD64
 399   }
 400 
 401   assert(sender_sp != sp(), "must have changed");
 402   return frame(sender_sp, saved_fp, sender_pc);
 403 }
 404 
 405 frame frame::sender(RegisterMap* map) const {
 406   // Default is we done have to follow them. The sender_for_xxx will
 407   // update it accordingly
 408   map->set_include_argument_oops(false);
 409 
 410   if (is_entry_frame())       return sender_for_entry_frame(map);
 411   if (is_interpreted_frame()) return sender_for_interpreter_frame(map);
 412   assert(_cb == CodeCache::find_blob(pc()),"Must be the same");
 413 
 414   if (_cb != NULL) {
 415     return sender_for_compiled_frame(map);
 416   }
 417   // Must be native-compiled frame, i.e. the marshaling code for native
 418   // methods that exists in the core system.
 419   return frame(sender_sp(), link(), sender_pc());
 420 }
 421 
 422 




 313   JavaFrameAnchor* jfa = entry_frame_call_wrapper()->anchor();
 314   assert(!entry_frame_is_first(), "next Java fp must be non zero");
 315   assert(jfa->last_Java_sp() > sp(), "must be above this frame on stack");
 316   map->clear();
 317   assert(map->include_argument_oops(), "should be set by clear");
 318   if (jfa->last_Java_pc() != NULL ) {
 319     frame fr(jfa->last_Java_sp(), jfa->last_Java_fp(), jfa->last_Java_pc());
 320     return fr;
 321   }
 322   frame fr(jfa->last_Java_sp(), jfa->last_Java_fp());
 323   return fr;
 324 }
 325 
 326 frame frame::sender_for_interpreter_frame(RegisterMap* map) const {
 327   // sp is the raw sp from the sender after adapter or interpreter extension
 328   intptr_t* sp = (intptr_t*) addr_at(sender_sp_offset);
 329 
 330   // This is the sp before any possible extension (adapter/locals).
 331   intptr_t* unextended_sp = interpreter_frame_sender_sp();
 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 
 341   // The interpreter and compiler(s) always save EBP/RBP in a known
 342   // location on entry. We must record where that location is
 343   // so this if EBP/RBP was live on callout from c2 we can find
 344   // the saved copy no matter what it called.
 345 
 346   // Since the interpreter always saves EBP/RBP if we record where it is then
 347   // we don't have to always save EBP/RBP on entry and exit to c2 compiled
 348   // code, on entry will be enough.
 349 #ifdef COMPILER2
 350   if (map->update_map()) {
 351     map->set_location(rbp->as_VMReg(), (address) addr_at(link_offset));
 352 #ifdef AMD64
 353     // this is weird "H" ought to be at a higher address however the
 354     // oopMaps seems to have the "H" regs at the same address and the
 355     // vanilla register.
 356     // XXXX make this go away
 357     if (true) {
 358       map->set_location(rbp->as_VMReg()->next(), (address)addr_at(link_offset));
 359     }
 360 #endif // AMD64
 361   }
 362 #endif /* COMPILER2 */
 363   return frame(sp, unextended_sp, link(), sender_pc);
 364 }
 365 
 366 
 367 //------------------------------sender_for_compiled_frame-----------------------
 368 frame frame::sender_for_compiled_frame(RegisterMap* map) const {
 369   assert(map != NULL, "map must be set");
 370   const bool c1_compiled = _cb->is_compiled_by_c1();
 371 
 372   // frame owned by optimizing compiler
 373   intptr_t* sender_sp = NULL;
 374 
 375   assert(_cb->frame_size() >= 0, "must have non-zero frame size");
 376   sender_sp = unextended_sp() + _cb->frame_size();
 377 
 378   // On Intel the return_address is always the word on the stack
 379   address sender_pc = (address) *(sender_sp-1);
 380 
 381   // This is the saved value of ebp which may or may not really be an fp.
 382   // it is only an fp if the sender is an interpreter frame (or c1?)
 383 
 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   }
 397 
 398   if (map->update_map()) {
 399     // Tell GC to use argument oopmaps for some runtime stubs that need it.
 400     // For C1, the runtime stub might not have oop maps, so set this flag
 401     // outside of update_register_map.
 402     map->set_include_argument_oops(_cb->caller_must_gc_arguments(map->thread()));
 403     if (_cb->oop_maps() != NULL) {
 404       OopMapSet::update_register_map(this, map);
 405     }
 406     // Since the prolog does the save and restore of epb there is no oopmap
 407     // for it so we must fill in its location as if there was an oopmap entry
 408     // since if our caller was compiled code there could be live jvm state in it.
 409     map->set_location(rbp->as_VMReg(), (address) (sender_sp - frame::sender_sp_offset));
 410 #ifdef AMD64
 411     // this is weird "H" ought to be at a higher address however the
 412     // oopMaps seems to have the "H" regs at the same address and the
 413     // vanilla register.
 414     // XXXX make this go away
 415     if (true) {
 416       map->set_location(rbp->as_VMReg()->next(), (address) (sender_sp - frame::sender_sp_offset));
 417     }
 418 #endif // AMD64
 419   }
 420 
 421   assert(sender_sp != sp(), "must have changed");
 422   return frame(sender_sp, unextended_sp, saved_fp, sender_pc);
 423 }
 424 
 425 frame frame::sender(RegisterMap* map) const {
 426   // Default is we done have to follow them. The sender_for_xxx will
 427   // update it accordingly
 428   map->set_include_argument_oops(false);
 429 
 430   if (is_entry_frame())       return sender_for_entry_frame(map);
 431   if (is_interpreted_frame()) return sender_for_interpreter_frame(map);
 432   assert(_cb == CodeCache::find_blob(pc()),"Must be the same");
 433 
 434   if (_cb != NULL) {
 435     return sender_for_compiled_frame(map);
 436   }
 437   // Must be native-compiled frame, i.e. the marshaling code for native
 438   // methods that exists in the core system.
 439   return frame(sender_sp(), link(), sender_pc());
 440 }
 441 
 442 


src/cpu/x86/vm/frame_x86.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File