hotspot/src/cpu/sparc/vm/debug_sparc.cpp
author vlivanov
Fri, 04 Dec 2015 23:46:19 +0300
changeset 35086 bbf32241d851
parent 24932 374cc5d929fb
child 37466 287c4ebd11b0
permissions -rw-r--r--
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls Reviewed-by: jrose, dlong, aph, forax
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
     2
 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "code/codeCache.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "code/nmethod.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "runtime/frame.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "runtime/init.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "runtime/os.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "utilities/debug.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#include "utilities/top.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
extern "C" void findpc(int x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
void pd_ps(frame f) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  intptr_t* sp = f.sp();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  intptr_t* prev_sp = sp - 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  intptr_t *pc = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  intptr_t *next_pc = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  int count = 0;
24932
374cc5d929fb 8044735: Print format/argument warnings
mikael
parents: 13728
diff changeset
    45
  tty->print_cr("register window backtrace from " INTPTR_FORMAT ":", p2i(sp));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  while (sp != NULL && ((intptr_t)sp & 7) == 0 && sp > prev_sp && sp < prev_sp+1000) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
    pc      = next_pc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
    next_pc = (intptr_t*) sp[I7->sp_offset_in_saved_window()];
24932
374cc5d929fb 8044735: Print format/argument warnings
mikael
parents: 13728
diff changeset
    49
    tty->print("[%d] sp=" INTPTR_FORMAT " pc=", count, p2i(sp));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
    findpc((intptr_t)pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
    if (WizardMode && Verbose) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
      // print register window contents also
24932
374cc5d929fb 8044735: Print format/argument warnings
mikael
parents: 13728
diff changeset
    53
      tty->print_cr("    L0..L7: {"
374cc5d929fb 8044735: Print format/argument warnings
mikael
parents: 13728
diff changeset
    54
                    INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " "
374cc5d929fb 8044735: Print format/argument warnings
mikael
parents: 13728
diff changeset
    55
                    INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " ",
374cc5d929fb 8044735: Print format/argument warnings
mikael
parents: 13728
diff changeset
    56
                    sp[0+0], sp[0+1], sp[0+2], sp[0+3],
374cc5d929fb 8044735: Print format/argument warnings
mikael
parents: 13728
diff changeset
    57
                    sp[0+4], sp[0+5], sp[0+6], sp[0+7]);
374cc5d929fb 8044735: Print format/argument warnings
mikael
parents: 13728
diff changeset
    58
      tty->print_cr("    I0..I7: {"
374cc5d929fb 8044735: Print format/argument warnings
mikael
parents: 13728
diff changeset
    59
                    INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " "
374cc5d929fb 8044735: Print format/argument warnings
mikael
parents: 13728
diff changeset
    60
                    INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " ",
374cc5d929fb 8044735: Print format/argument warnings
mikael
parents: 13728
diff changeset
    61
                    sp[8+0], sp[8+1], sp[8+2], sp[8+3],
374cc5d929fb 8044735: Print format/argument warnings
mikael
parents: 13728
diff changeset
    62
                    sp[8+4], sp[8+5], sp[8+6], sp[8+7]);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
      // (and print stack frame contents too??)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
      CodeBlob *b = CodeCache::find_blob((address) pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
      if (b != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
        if (b->is_nmethod()) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    68
          Method* m = ((nmethod*)b)->method();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
          int nlocals = m->max_locals();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
          int nparams  = m->size_of_parameters();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
          tty->print_cr("compiled java method (locals = %d, params = %d)", nlocals, nparams);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    prev_sp = sp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    sp = (intptr_t *)sp[FP->sp_offset_in_saved_window()];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    sp = (intptr_t *)((intptr_t)sp + STACK_BIAS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
    count += 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  if (sp != NULL)
24932
374cc5d929fb 8044735: Print format/argument warnings
mikael
parents: 13728
diff changeset
    81
    tty->print("[%d] sp=" INTPTR_FORMAT " [bogus sp!]", count, p2i(sp));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
#endif // PRODUCT