comparison agent/src/share/classes/sun/jvm/hotspot/runtime/sparc/SPARCFrame.java @ 218:a5838065ab24

6620329: jstack prints double native methods on Solaris/sparc Summary: Fixed stack walking code in sparc to start frame walk from last_java_sp. Reviewed-by: sgoldman
author swamyv
date Tue, 24 Jun 2008 21:37:10 -0700
parents a61af66fc99e
children c18cbe5936b8
comparison
equal deleted inserted replaced
217:411c61adc994 218:a5838065ab24
420 return false; 420 return false;
421 } 421 }
422 if (getFP().addOffsetTo(INTERPRETER_FRAME_VM_LOCAL_WORDS * VM.getVM().getAddressSize()).lessThan(getSP())) { 422 if (getFP().addOffsetTo(INTERPRETER_FRAME_VM_LOCAL_WORDS * VM.getVM().getAddressSize()).lessThan(getSP())) {
423 return false; 423 return false;
424 } 424 }
425
426 OopHandle methodHandle = addressOfInterpreterFrameMethod().getOopHandleAt(0);
427
428 if (VM.getVM().getObjectHeap().isValidMethod(methodHandle) == false) {
429 return false;
430 }
431
425 // These are hacks to keep us out of trouble. 432 // These are hacks to keep us out of trouble.
426 // The problem with these is that they mask other problems 433 // The problem with these is that they mask other problems
427 if (getFP().lessThanOrEqual(getSP())) { // this attempts to deal with unsigned comparison above 434 if (getFP().lessThanOrEqual(getSP())) { // this attempts to deal with unsigned comparison above
428 return false; 435 return false;
429 } 436 }
431 return false; 438 return false;
432 } 439 }
433 // FIXME: this is not atomic with respect to GC and is unsuitable 440 // FIXME: this is not atomic with respect to GC and is unsuitable
434 // for use in a non-debugging, or reflective, system. Need to 441 // for use in a non-debugging, or reflective, system. Need to
435 // figure out how to express this. 442 // figure out how to express this.
436 if (addressOfInterpreterFrameBCX().getAddressAt(0) == null) { 443 Address bcx = addressOfInterpreterFrameBCX().getAddressAt(0);
437 return false; // BCP not yet set up 444
438 } 445 Method method;
446 try {
447 method = (Method) VM.getVM().getObjectHeap().newOop(methodHandle);
448 } catch (UnknownOopException ex) {
449 return false;
450 }
451 int bci = bcpToBci(bcx, method);
452 //validate bci
453 if (bci < 0) return false;
454
439 return true; 455 return true;
440 } 456 }
441 457
442 //-------------------------------------------------------------------------------- 458 //--------------------------------------------------------------------------------
443 // Accessors: 459 // Accessors:
469 485
470 // Default is we don't have to follow them. The sender_for_xxx 486 // Default is we don't have to follow them. The sender_for_xxx
471 // will update it accordingly 487 // will update it accordingly
472 map.setIncludeArgumentOops(false); 488 map.setIncludeArgumentOops(false);
473 489
474 if (cb == null && isEntryFrame()) { 490 if (isEntryFrame()) {
475 return senderForEntryFrame(map); 491 return senderForEntryFrame(map);
476 } 492 }
477 493
478 Address youngerSP = getSP(); 494 Address youngerSP = getSP();
479 Address sp = getSenderSP(); 495 Address sp = getSenderSP();
537 // our numbering of the registers and this one don't match up. 553 // our numbering of the registers and this one don't match up.
538 int PC_OFFSET_IN_GREGSET = 1; 554 int PC_OFFSET_IN_GREGSET = 1;
539 int SP_OFFSET_IN_GREGSET = 17; 555 int SP_OFFSET_IN_GREGSET = 17;
540 raw_sp = fp.getAddressAt(VM.getVM().getAddressSize() * SP_OFFSET_IN_GREGSET); 556 raw_sp = fp.getAddressAt(VM.getVM().getAddressSize() * SP_OFFSET_IN_GREGSET);
541 Address pc = fp.getAddressAt(VM.getVM().getAddressSize() * PC_OFFSET_IN_GREGSET); 557 Address pc = fp.getAddressAt(VM.getVM().getAddressSize() * PC_OFFSET_IN_GREGSET);
542 // System.out.println(" next frame's SP: " + sp + " PC: " + pc);
543 return new SPARCFrame(raw_sp, pc); 558 return new SPARCFrame(raw_sp, pc);
544 } 559 }
545 } 560 }
546 561
547 if (!VM.getVM().isCore()) { 562 if (!VM.getVM().isCore()) {
560 575
561 // The constructor of the sender must know whether this frame is interpreted so it can set the 576 // The constructor of the sender must know whether this frame is interpreted so it can set the
562 // sender's _interpreter_sp_adjustment field. 577 // sender's _interpreter_sp_adjustment field.
563 if (VM.getVM().getInterpreter().contains(pc)) { 578 if (VM.getVM().getInterpreter().contains(pc)) {
564 isInterpreted = true; 579 isInterpreted = true;
565 if (VM.getVM().isClientCompiler()) { 580 map.makeIntegerRegsUnsaved();
566 map.makeIntegerRegsUnsaved(); 581 map.shiftWindow(sp, youngerSP);
567 map.shiftWindow(sp, youngerSP);
568 }
569 } else { 582 } else {
570 // Find a CodeBlob containing this frame's pc or elide the lookup and use the 583 // Find a CodeBlob containing this frame's pc or elide the lookup and use the
571 // supplied blob which is already known to be associated with this frame. 584 // supplied blob which is already known to be associated with this frame.
572 cb = VM.getVM().getCodeCache().findBlob(pc); 585 cb = VM.getVM().getCodeCache().findBlob(pc);
573 if (cb != null) { 586 if (cb != null) {