hotspot/src/share/vm/classfile/stackMapTableFormat.hpp
author mchung
Tue, 24 Nov 2015 14:59:17 -0800
changeset 34280 72bfaaffee36
parent 13476 471200fb94fd
child 41542 c705c10c4914
permissions -rw-r--r--
8143911: Reintegrate JEP 259: Stack-Walking API Reviewed-by: coleenp, dfuchs, bchristi, psandoz, sspitsyn Contributed-by: Mandy Chung <mandy.chung@oracle.com>, Brent Christian <brent.christian@oracle.com>, Daniel Fuchs <daniel.fuchs@oracle.com>, Hamlin Li <huaming.li@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
     1
/*
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
     2
 * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
     4
 *
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
     8
 *
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    13
 * accompanied this code).
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    14
 *
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    18
 *
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    21
 * questions.
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    22
 *
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    23
 */
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6974
diff changeset
    25
#ifndef SHARE_VM_CLASSFILE_STACKMAPTABLEFORMAT_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6974
diff changeset
    26
#define SHARE_VM_CLASSFILE_STACKMAPTABLEFORMAT_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6974
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6974
diff changeset
    28
#include "classfile/verificationType.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6974
diff changeset
    29
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    30
// These classes represent the stack-map substructures described in the JVMS
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    31
// (hence the non-conforming naming scheme).
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    32
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    33
// These classes work with the types in their compressed form in-place (as they
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    34
// would appear in the classfile).  No virtual methods or fields allowed.
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    35
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    36
class verification_type_info {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    37
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    38
  // u1 tag
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    39
  // u2 cpool_index || u2 bci (for ITEM_Object & ITEM_Uninitailized only)
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    40
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    41
  address tag_addr() const { return (address)this; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    42
  address cpool_index_addr() const { return tag_addr() + sizeof(u1); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    43
  address bci_addr() const { return cpool_index_addr(); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    44
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    45
 protected:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    46
  // No constructors  - should be 'private', but GCC issues a warning if it is
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    47
  verification_type_info() {}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    48
  verification_type_info(const verification_type_info&) {}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    49
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    50
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    51
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    52
  static verification_type_info* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    53
    return (verification_type_info*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    54
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    55
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    56
  static verification_type_info* create_at(address addr, u1 tag) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    57
    verification_type_info* vti = (verification_type_info*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    58
    vti->set_tag(tag);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    59
    return vti;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    60
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    61
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    62
  static verification_type_info* create_object_at(address addr, u2 cp_idx) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    63
    verification_type_info* vti = (verification_type_info*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    64
    vti->set_tag(ITEM_Object);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    65
    vti->set_cpool_index(cp_idx);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    66
    return vti;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    67
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    68
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    69
  static verification_type_info* create_uninit_at(address addr, u2 bci) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    70
    verification_type_info* vti = (verification_type_info*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    71
    vti->set_tag(ITEM_Uninitialized);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    72
    vti->set_bci(bci);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    73
    return vti;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    74
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    75
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    76
  static size_t calculate_size(u1 tag) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    77
    if (tag == ITEM_Object || tag == ITEM_Uninitialized) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    78
      return sizeof(u1) + sizeof(u2);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    79
    } else {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    80
      return sizeof(u1);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    81
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    82
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    83
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    84
  static size_t max_size() { return sizeof(u1) + sizeof(u2); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    85
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    86
  u1 tag() const { return *(u1*)tag_addr(); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    87
  void set_tag(u1 tag) { *((u1*)tag_addr()) = tag; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    88
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    89
  bool is_object() const { return tag() == ITEM_Object; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    90
  bool is_uninitialized() const { return tag() == ITEM_Uninitialized; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    91
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    92
  u2 cpool_index() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    93
    assert(is_object(), "This type has no cp_index");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    94
    return Bytes::get_Java_u2(cpool_index_addr());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    95
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    96
  void set_cpool_index(u2 idx) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    97
    assert(is_object(), "This type has no cp_index");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    98
    Bytes::put_Java_u2(cpool_index_addr(), idx);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
    99
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   100
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   101
  u2 bci() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   102
    assert(is_uninitialized(), "This type has no bci");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   103
    return Bytes::get_Java_u2(bci_addr());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   104
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   105
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   106
  void set_bci(u2 bci) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   107
    assert(is_uninitialized(), "This type has no bci");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   108
    Bytes::put_Java_u2(bci_addr(), bci);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   109
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   110
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   111
  void copy_from(verification_type_info* from) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   112
    set_tag(from->tag());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   113
    if (from->is_object()) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   114
      set_cpool_index(from->cpool_index());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   115
    } else if (from->is_uninitialized()) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   116
      set_bci(from->bci());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   117
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   118
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   119
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   120
  size_t size() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   121
    return calculate_size(tag());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   122
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   123
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   124
  verification_type_info* next() {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   125
    return (verification_type_info*)((address)this + size());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   126
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   127
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   128
  // This method is used when reading unverified data in order to ensure
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   129
  // that we don't read past a particular memory limit.  It returns false
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   130
  // if any part of the data structure is outside the specified memory bounds.
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   131
  bool verify(address start, address end) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   132
    return ((address)this >= start &&
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   133
            (address)this < end &&
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   134
            (bci_addr() + sizeof(u2) <= end ||
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   135
                !is_object() && !is_uninitialized()));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   136
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   137
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   138
  void print_on(outputStream* st) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   139
    switch (tag()) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   140
      case ITEM_Top: st->print("Top"); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   141
      case ITEM_Integer: st->print("Integer"); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   142
      case ITEM_Float: st->print("Float"); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   143
      case ITEM_Double: st->print("Double"); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   144
      case ITEM_Long: st->print("Long"); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   145
      case ITEM_Null: st->print("Null"); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   146
      case ITEM_UninitializedThis:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   147
        st->print("UninitializedThis"); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   148
      case ITEM_Uninitialized:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   149
        st->print("Uninitialized[#%d]", bci()); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   150
      case ITEM_Object:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   151
        st->print("Object[#%d]", cpool_index()); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   152
      default:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   153
        assert(false, "Bad verification_type_info");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   154
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   155
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   156
};
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   157
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   158
#define FOR_EACH_STACKMAP_FRAME_TYPE(macro, arg1, arg2) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   159
  macro(same_frame, arg1, arg2) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   160
  macro(same_frame_extended, arg1, arg2) \
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   161
  macro(same_locals_1_stack_item_frame, arg1, arg2) \
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   162
  macro(same_locals_1_stack_item_extended, arg1, arg2) \
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   163
  macro(chop_frame, arg1, arg2) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   164
  macro(append_frame, arg1, arg2) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   165
  macro(full_frame, arg1, arg2)
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   166
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   167
#define SM_FORWARD_DECL(type, arg1, arg2) class type;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   168
FOR_EACH_STACKMAP_FRAME_TYPE(SM_FORWARD_DECL, x, x)
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   169
#undef SM_FORWARD_DECL
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   170
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   171
class stack_map_frame {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   172
 protected:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   173
  address frame_type_addr() const { return (address)this; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   174
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   175
  // No constructors  - should be 'private', but GCC issues a warning if it is
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   176
  stack_map_frame() {}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   177
  stack_map_frame(const stack_map_frame&) {}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   178
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   179
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   180
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   181
  static stack_map_frame* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   182
    return (stack_map_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   183
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   184
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   185
  stack_map_frame* next() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   186
    return at((address)this + size());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   187
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   188
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   189
  u1 frame_type() const { return *(u1*)frame_type_addr(); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   190
  void set_frame_type(u1 type) { *((u1*)frame_type_addr()) = type; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   191
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   192
  // pseudo-virtual methods
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   193
  inline size_t size() const;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   194
  inline int offset_delta() const;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   195
  inline void set_offset_delta(int offset_delta);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   196
  inline int number_of_types() const; // number of types contained in the frame
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   197
  inline verification_type_info* types() const; // pointer to first type
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   198
  inline bool is_valid_offset(int offset_delta) const;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   199
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   200
  // This method must be used when reading unverified data in order to ensure
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   201
  // that we don't read past a particular memory limit.  It returns false
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   202
  // if any part of the data structure is outside the specified memory bounds.
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   203
  inline bool verify(address start, address end) const;
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   204
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   205
  inline void print_on(outputStream* st, int current_offset) const;
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   206
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   207
  // Create as_xxx and is_xxx methods for the subtypes
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   208
#define FRAME_TYPE_DECL(stackmap_frame_type, arg1, arg2) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   209
  inline stackmap_frame_type* as_##stackmap_frame_type() const; \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   210
  bool is_##stackmap_frame_type() { \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   211
    return as_##stackmap_frame_type() != NULL; \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   212
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   213
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   214
  FOR_EACH_STACKMAP_FRAME_TYPE(FRAME_TYPE_DECL, x, x)
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   215
#undef FRAME_TYPE_DECL
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   216
};
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   217
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   218
class same_frame : public stack_map_frame {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   219
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   220
  static int frame_type_to_offset_delta(u1 frame_type) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   221
      return frame_type + 1; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   222
  static u1 offset_delta_to_frame_type(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   223
      return (u1)(offset_delta - 1); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   224
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   225
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   226
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   227
  static bool is_frame_type(u1 tag) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   228
    return tag < 64;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   229
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   230
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   231
  static same_frame* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   232
    assert(is_frame_type(*addr), "Wrong frame id");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   233
    return (same_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   234
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   235
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   236
  static same_frame* create_at(address addr, int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   237
    same_frame* sm = (same_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   238
    sm->set_offset_delta(offset_delta);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   239
    return sm;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   240
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   241
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   242
  static size_t calculate_size() { return sizeof(u1); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   243
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   244
  size_t size() const { return calculate_size(); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   245
  int offset_delta() const { return frame_type_to_offset_delta(frame_type()); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   246
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   247
  void set_offset_delta(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   248
    assert(offset_delta <= 64, "Offset too large for same_frame");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   249
    set_frame_type(offset_delta_to_frame_type(offset_delta));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   250
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   251
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   252
  int number_of_types() const { return 0; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   253
  verification_type_info* types() const { return NULL; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   254
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   255
  bool is_valid_offset(int offset_delta) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   256
    return is_frame_type(offset_delta_to_frame_type(offset_delta));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   257
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   258
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   259
  bool verify_subtype(address start, address end) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   260
    return true;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   261
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   262
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   263
  void print_on(outputStream* st, int current_offset = -1) const {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   264
    st->print("same_frame(@%d)", offset_delta() + current_offset);
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   265
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   266
};
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   267
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   268
class same_frame_extended : public stack_map_frame {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   269
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   270
  enum { _frame_id = 251 };
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   271
  address offset_delta_addr() const { return frame_type_addr() + sizeof(u1); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   272
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   273
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   274
  static bool is_frame_type(u1 tag) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   275
    return tag == _frame_id;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   276
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   277
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   278
  static same_frame_extended* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   279
    assert(is_frame_type(*addr), "Wrong frame type");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   280
    return (same_frame_extended*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   281
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   282
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   283
  static same_frame_extended* create_at(address addr, u2 offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   284
    same_frame_extended* sm = (same_frame_extended*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   285
    sm->set_frame_type(_frame_id);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   286
    sm->set_offset_delta(offset_delta);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   287
    return sm;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   288
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   289
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   290
  static size_t calculate_size() { return sizeof(u1) + sizeof(u2); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   291
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   292
  size_t size() const { return calculate_size(); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   293
  int offset_delta() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   294
    return Bytes::get_Java_u2(offset_delta_addr()) + 1;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   295
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   296
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   297
  void set_offset_delta(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   298
    Bytes::put_Java_u2(offset_delta_addr(), offset_delta - 1);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   299
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   300
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   301
  int number_of_types() const { return 0; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   302
  verification_type_info* types() const { return NULL; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   303
  bool is_valid_offset(int offset) const { return true; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   304
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   305
  bool verify_subtype(address start, address end) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   306
    return frame_type_addr() + size() <= end;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   307
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   308
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   309
  void print_on(outputStream* st, int current_offset = -1) const {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   310
    st->print("same_frame_extended(@%d)", offset_delta() + current_offset);
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   311
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   312
};
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   313
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   314
class same_locals_1_stack_item_frame : public stack_map_frame {
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   315
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   316
  address type_addr() const { return frame_type_addr() + sizeof(u1); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   317
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   318
  static int frame_type_to_offset_delta(u1 frame_type) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   319
      return frame_type - 63; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   320
  static u1 offset_delta_to_frame_type(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   321
      return (u1)(offset_delta + 63); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   322
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   323
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   324
  static bool is_frame_type(u1 tag) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   325
    return tag >= 64 && tag < 128;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   326
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   327
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   328
  static same_locals_1_stack_item_frame* at(address addr) {
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   329
    assert(is_frame_type(*addr), "Wrong frame id");
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   330
    return (same_locals_1_stack_item_frame*)addr;
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   331
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   332
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   333
  static same_locals_1_stack_item_frame* create_at(
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   334
      address addr, int offset_delta, verification_type_info* vti) {
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   335
    same_locals_1_stack_item_frame* sm = (same_locals_1_stack_item_frame*)addr;
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   336
    sm->set_offset_delta(offset_delta);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   337
    if (vti != NULL) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   338
      sm->set_type(vti);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   339
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   340
    return sm;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   341
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   342
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   343
  static size_t calculate_size(verification_type_info* vti) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   344
    return sizeof(u1) + vti->size();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   345
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   346
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   347
  static size_t max_size() {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   348
    return sizeof(u1) + verification_type_info::max_size();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   349
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   350
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   351
  size_t size() const { return calculate_size(types()); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   352
  int offset_delta() const { return frame_type_to_offset_delta(frame_type()); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   353
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   354
  void set_offset_delta(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   355
    assert(offset_delta > 0 && offset_delta <= 64,
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   356
           "Offset too large for this frame type");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   357
    set_frame_type(offset_delta_to_frame_type(offset_delta));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   358
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   359
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   360
  void set_type(verification_type_info* vti) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   361
    verification_type_info* cur = types();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   362
    cur->copy_from(vti);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   363
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   364
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   365
  int number_of_types() const { return 1; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   366
  verification_type_info* types() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   367
    return verification_type_info::at(type_addr());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   368
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   369
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   370
  bool is_valid_offset(int offset_delta) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   371
    return is_frame_type(offset_delta_to_frame_type(offset_delta));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   372
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   373
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   374
  bool verify_subtype(address start, address end) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   375
    return types()->verify(start, end);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   376
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   377
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   378
  void print_on(outputStream* st, int current_offset = -1) const {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   379
    st->print("same_locals_1_stack_item_frame(@%d,",
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   380
        offset_delta() + current_offset);
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   381
    types()->print_on(st);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   382
    st->print(")");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   383
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   384
};
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   385
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   386
class same_locals_1_stack_item_extended : public stack_map_frame {
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   387
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   388
  address offset_delta_addr() const { return frame_type_addr() + sizeof(u1); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   389
  address type_addr() const { return offset_delta_addr() + sizeof(u2); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   390
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   391
  enum { _frame_id = 247 };
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   392
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   393
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   394
  static bool is_frame_type(u1 tag) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   395
    return tag == _frame_id;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   396
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   397
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   398
  static same_locals_1_stack_item_extended* at(address addr) {
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   399
    assert(is_frame_type(*addr), "Wrong frame id");
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   400
    return (same_locals_1_stack_item_extended*)addr;
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   401
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   402
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   403
  static same_locals_1_stack_item_extended* create_at(
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   404
      address addr, int offset_delta, verification_type_info* vti) {
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   405
    same_locals_1_stack_item_extended* sm =
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   406
       (same_locals_1_stack_item_extended*)addr;
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   407
    sm->set_frame_type(_frame_id);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   408
    sm->set_offset_delta(offset_delta);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   409
    if (vti != NULL) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   410
      sm->set_type(vti);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   411
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   412
    return sm;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   413
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   414
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   415
  static size_t calculate_size(verification_type_info* vti) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   416
    return sizeof(u1) + sizeof(u2) + vti->size();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   417
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   418
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   419
  size_t size() const { return calculate_size(types()); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   420
  int offset_delta() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   421
    return Bytes::get_Java_u2(offset_delta_addr()) + 1;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   422
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   423
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   424
  void set_offset_delta(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   425
    Bytes::put_Java_u2(offset_delta_addr(), offset_delta - 1);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   426
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   427
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   428
  void set_type(verification_type_info* vti) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   429
    verification_type_info* cur = types();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   430
    cur->copy_from(vti);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   431
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   432
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   433
  int number_of_types() const { return 1; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   434
  verification_type_info* types() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   435
    return verification_type_info::at(type_addr());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   436
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   437
  bool is_valid_offset(int offset) { return true; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   438
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   439
  bool verify_subtype(address start, address end) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   440
    return type_addr() < end && types()->verify(start, end);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   441
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   442
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   443
  void print_on(outputStream* st, int current_offset = -1) const {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   444
    st->print("same_locals_1_stack_item_extended(@%d,",
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   445
        offset_delta() + current_offset);
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   446
    types()->print_on(st);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   447
    st->print(")");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   448
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   449
};
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   450
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   451
class chop_frame : public stack_map_frame {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   452
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   453
  address offset_delta_addr() const { return frame_type_addr() + sizeof(u1); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   454
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   455
  static int frame_type_to_chops(u1 frame_type) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   456
    int chop = 251 - frame_type;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   457
    return chop;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   458
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   459
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   460
  static u1 chops_to_frame_type(int chop) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   461
    return 251 - chop;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   462
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   463
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   464
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   465
  static bool is_frame_type(u1 tag) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   466
    return frame_type_to_chops(tag) > 0 && frame_type_to_chops(tag) < 4;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   467
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   468
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   469
  static chop_frame* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   470
    assert(is_frame_type(*addr), "Wrong frame id");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   471
    return (chop_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   472
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   473
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   474
  static chop_frame* create_at(address addr, int offset_delta, int chops) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   475
    chop_frame* sm = (chop_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   476
    sm->set_chops(chops);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   477
    sm->set_offset_delta(offset_delta);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   478
    return sm;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   479
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   480
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   481
  static size_t calculate_size() {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   482
    return sizeof(u1) + sizeof(u2);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   483
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   484
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   485
  size_t size() const { return calculate_size(); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   486
  int offset_delta() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   487
    return Bytes::get_Java_u2(offset_delta_addr()) + 1;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   488
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   489
  void set_offset_delta(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   490
    Bytes::put_Java_u2(offset_delta_addr(), offset_delta - 1);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   491
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   492
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   493
  int chops() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   494
    int chops = frame_type_to_chops(frame_type());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   495
    assert(chops > 0 && chops < 4, "Invalid number of chops in frame");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   496
    return chops;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   497
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   498
  void set_chops(int chops) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   499
    assert(chops > 0 && chops <= 3, "Bad number of chops");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   500
    set_frame_type(chops_to_frame_type(chops));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   501
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   502
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   503
  int number_of_types() const { return 0; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   504
  verification_type_info* types() const { return NULL; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   505
  bool is_valid_offset(int offset) { return true; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   506
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   507
  bool verify_subtype(address start, address end) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   508
    return frame_type_addr() + size() <= end;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   509
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   510
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   511
  void print_on(outputStream* st, int current_offset = -1) const {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   512
    st->print("chop_frame(@%d,%d)", offset_delta() + current_offset, chops());
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   513
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   514
};
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   515
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   516
class append_frame : public stack_map_frame {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   517
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   518
  address offset_delta_addr() const { return frame_type_addr() + sizeof(u1); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   519
  address types_addr() const { return offset_delta_addr() + sizeof(u2); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   520
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   521
  static int frame_type_to_appends(u1 frame_type) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   522
    int append = frame_type - 251;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   523
    return append;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   524
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   525
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   526
  static u1 appends_to_frame_type(int appends) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   527
    assert(appends > 0 && appends < 4, "Invalid append amount");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   528
    return 251 + appends;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   529
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   530
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   531
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   532
  static bool is_frame_type(u1 tag) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   533
    return frame_type_to_appends(tag) > 0 && frame_type_to_appends(tag) < 4;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   534
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   535
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   536
  static append_frame* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   537
    assert(is_frame_type(*addr), "Wrong frame id");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   538
    return (append_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   539
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   540
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   541
  static append_frame* create_at(
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   542
      address addr, int offset_delta, int appends,
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   543
      verification_type_info* types) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   544
    append_frame* sm = (append_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   545
    sm->set_appends(appends);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   546
    sm->set_offset_delta(offset_delta);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   547
    if (types != NULL) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   548
      verification_type_info* cur = sm->types();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   549
      for (int i = 0; i < appends; ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   550
        cur->copy_from(types);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   551
        cur = cur->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   552
        types = types->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   553
      }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   554
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   555
    return sm;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   556
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   557
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   558
  static size_t calculate_size(int appends, verification_type_info* types) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   559
    size_t sz = sizeof(u1) + sizeof(u2);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   560
    for (int i = 0; i < appends; ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   561
      sz += types->size();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   562
      types = types->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   563
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   564
    return sz;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   565
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   566
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   567
  static size_t max_size() {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   568
    return sizeof(u1) + sizeof(u2) + 3 * verification_type_info::max_size();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   569
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   570
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   571
  size_t size() const { return calculate_size(number_of_types(), types()); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   572
  int offset_delta() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   573
    return Bytes::get_Java_u2(offset_delta_addr()) + 1;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   574
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   575
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   576
  void set_offset_delta(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   577
    Bytes::put_Java_u2(offset_delta_addr(), offset_delta - 1);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   578
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   579
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   580
  void set_appends(int appends) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   581
    assert(appends > 0 && appends < 4, "Bad number of appends");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   582
    set_frame_type(appends_to_frame_type(appends));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   583
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   584
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   585
  int number_of_types() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   586
    int appends = frame_type_to_appends(frame_type());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   587
    assert(appends > 0 && appends < 4, "Invalid number of appends in frame");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   588
    return appends;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   589
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   590
  verification_type_info* types() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   591
    return verification_type_info::at(types_addr());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   592
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   593
  bool is_valid_offset(int offset) const { return true; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   594
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   595
  bool verify_subtype(address start, address end) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   596
    verification_type_info* vti = types();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   597
    if ((address)vti < end && vti->verify(start, end)) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   598
      int nof = number_of_types();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   599
      vti = vti->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   600
      if (nof < 2 || vti->verify(start, end)) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   601
        vti = vti->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   602
        if (nof < 3 || vti->verify(start, end)) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   603
          return true;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   604
        }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   605
      }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   606
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   607
    return false;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   608
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   609
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   610
  void print_on(outputStream* st, int current_offset = -1) const {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   611
    st->print("append_frame(@%d,", offset_delta() + current_offset);
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   612
    verification_type_info* vti = types();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   613
    for (int i = 0; i < number_of_types(); ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   614
      vti->print_on(st);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   615
      if (i != number_of_types() - 1) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   616
        st->print(",");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   617
      }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   618
      vti = vti->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   619
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   620
    st->print(")");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   621
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   622
};
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   623
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   624
class full_frame : public stack_map_frame {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   625
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   626
  address offset_delta_addr() const { return frame_type_addr() + sizeof(u1); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   627
  address num_locals_addr() const { return offset_delta_addr() + sizeof(u2); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   628
  address locals_addr() const { return num_locals_addr() + sizeof(u2); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   629
  address stack_slots_addr(address end_of_locals) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   630
      return end_of_locals; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   631
  address stack_addr(address end_of_locals) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   632
      return stack_slots_addr(end_of_locals) + sizeof(u2); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   633
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   634
  enum { _frame_id = 255 };
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   635
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   636
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   637
  static bool is_frame_type(u1 tag) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   638
    return tag == _frame_id;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   639
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   640
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   641
  static full_frame* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   642
    assert(is_frame_type(*addr), "Wrong frame id");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   643
    return (full_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   644
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   645
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   646
  static full_frame* create_at(
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   647
      address addr, int offset_delta, int num_locals,
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   648
      verification_type_info* locals,
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   649
      int stack_slots, verification_type_info* stack) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   650
    full_frame* sm = (full_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   651
    sm->set_frame_type(_frame_id);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   652
    sm->set_offset_delta(offset_delta);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   653
    sm->set_num_locals(num_locals);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   654
    if (locals != NULL) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   655
      verification_type_info* cur = sm->locals();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   656
      for (int i = 0; i < num_locals; ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   657
        cur->copy_from(locals);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   658
        cur = cur->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   659
        locals = locals->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   660
      }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   661
      address end_of_locals = (address)cur;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   662
      sm->set_stack_slots(end_of_locals, stack_slots);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   663
      cur = sm->stack(end_of_locals);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   664
      for (int i = 0; i < stack_slots; ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   665
        cur->copy_from(stack);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   666
        cur = cur->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   667
        stack = stack->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   668
      }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   669
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   670
    return sm;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   671
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   672
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   673
  static size_t calculate_size(
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   674
      int num_locals, verification_type_info* locals,
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   675
      int stack_slots, verification_type_info* stack) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   676
    size_t sz = sizeof(u1) + sizeof(u2) + sizeof(u2) + sizeof(u2);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   677
    verification_type_info* vti = locals;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   678
    for (int i = 0; i < num_locals; ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   679
      sz += vti->size();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   680
      vti = vti->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   681
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   682
    vti = stack;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   683
    for (int i = 0; i < stack_slots; ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   684
      sz += vti->size();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   685
      vti = vti->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   686
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   687
    return sz;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   688
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   689
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   690
  static size_t max_size(int locals, int stack) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   691
    return sizeof(u1) + 3 * sizeof(u2) +
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   692
        (locals + stack) * verification_type_info::max_size();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   693
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   694
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   695
  size_t size() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   696
    address eol = end_of_locals();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   697
    return calculate_size(num_locals(), locals(), stack_slots(eol), stack(eol));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   698
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   699
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   700
  int offset_delta() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   701
    return Bytes::get_Java_u2(offset_delta_addr()) + 1;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   702
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   703
  int num_locals() const { return Bytes::get_Java_u2(num_locals_addr()); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   704
  verification_type_info* locals() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   705
    return verification_type_info::at(locals_addr());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   706
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   707
  address end_of_locals() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   708
    verification_type_info* vti = locals();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   709
    for (int i = 0; i < num_locals(); ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   710
      vti = vti->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   711
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   712
    return (address)vti;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   713
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   714
  int stack_slots(address end_of_locals) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   715
    return Bytes::get_Java_u2(stack_slots_addr(end_of_locals));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   716
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   717
  verification_type_info* stack(address end_of_locals) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   718
    return verification_type_info::at(stack_addr(end_of_locals));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   719
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   720
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   721
  void set_offset_delta(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   722
    Bytes::put_Java_u2(offset_delta_addr(), offset_delta - 1);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   723
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   724
  void set_num_locals(int num_locals) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   725
    Bytes::put_Java_u2(num_locals_addr(), num_locals);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   726
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   727
  void set_stack_slots(address end_of_locals, int stack_slots) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   728
    Bytes::put_Java_u2(stack_slots_addr(end_of_locals), stack_slots);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   729
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   730
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   731
  // These return only the locals.  Extra processing is required for stack
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   732
  // types of full frames.
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   733
  int number_of_types() const { return num_locals(); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   734
  verification_type_info* types() const { return locals(); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   735
  bool is_valid_offset(int offset) { return true; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   736
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   737
  bool verify_subtype(address start, address end) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   738
    verification_type_info* vti = types();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   739
    if ((address)vti >= end) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   740
      return false;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   741
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   742
    int count = number_of_types();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   743
    for (int i = 0; i < count; ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   744
      if (!vti->verify(start, end)) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   745
        return false;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   746
      }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   747
      vti = vti->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   748
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   749
    address eol = (address)vti;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   750
    if (eol + sizeof(u2) > end) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   751
      return false;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   752
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   753
    count = stack_slots(eol);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   754
    vti = stack(eol);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   755
    for (int i = 0; i < stack_slots(eol); ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   756
      if (!vti->verify(start, end)) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   757
        return false;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   758
      }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   759
      vti = vti->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   760
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   761
    return true;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   762
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   763
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   764
  void print_on(outputStream* st, int current_offset = -1) const {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   765
    st->print("full_frame(@%d,{", offset_delta() + current_offset);
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   766
    verification_type_info* vti = locals();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   767
    for (int i = 0; i < num_locals(); ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   768
      vti->print_on(st);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   769
      if (i != num_locals() - 1) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   770
        st->print(",");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   771
      }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   772
      vti = vti->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   773
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   774
    st->print("},{");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   775
    address end_of_locals = (address)vti;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   776
    vti = stack(end_of_locals);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   777
    int ss = stack_slots(end_of_locals);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   778
    for (int i = 0; i < ss; ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   779
      vti->print_on(st);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   780
      if (i != ss - 1) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   781
        st->print(",");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   782
      }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   783
      vti = vti->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   784
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   785
    st->print("})");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   786
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   787
};
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   788
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   789
#define VIRTUAL_DISPATCH(stack_frame_type, func_name, args) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   790
  stack_frame_type* item_##stack_frame_type = as_##stack_frame_type(); \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   791
  if (item_##stack_frame_type != NULL) { \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   792
    return item_##stack_frame_type->func_name args;  \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   793
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   794
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   795
#define VOID_VIRTUAL_DISPATCH(stack_frame_type, func_name, args) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   796
  stack_frame_type* item_##stack_frame_type = as_##stack_frame_type(); \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   797
  if (item_##stack_frame_type != NULL) { \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   798
    item_##stack_frame_type->func_name args;  \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   799
    return; \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   800
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   801
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   802
size_t stack_map_frame::size() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   803
  FOR_EACH_STACKMAP_FRAME_TYPE(VIRTUAL_DISPATCH, size, ());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   804
  return 0;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   805
}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   806
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   807
int stack_map_frame::offset_delta() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   808
  FOR_EACH_STACKMAP_FRAME_TYPE(VIRTUAL_DISPATCH, offset_delta, ());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   809
  return 0;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   810
}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   811
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   812
void stack_map_frame::set_offset_delta(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   813
  FOR_EACH_STACKMAP_FRAME_TYPE(
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   814
      VOID_VIRTUAL_DISPATCH, set_offset_delta, (offset_delta));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   815
}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   816
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   817
int stack_map_frame::number_of_types() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   818
  FOR_EACH_STACKMAP_FRAME_TYPE(VIRTUAL_DISPATCH, number_of_types, ());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   819
  return 0;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   820
}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   821
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   822
verification_type_info* stack_map_frame::types() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   823
  FOR_EACH_STACKMAP_FRAME_TYPE(VIRTUAL_DISPATCH, types, ());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   824
  return NULL;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   825
}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   826
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   827
bool stack_map_frame::is_valid_offset(int offset) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   828
  FOR_EACH_STACKMAP_FRAME_TYPE(VIRTUAL_DISPATCH, is_valid_offset, (offset));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   829
  return true;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   830
}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   831
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   832
bool stack_map_frame::verify(address start, address end) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   833
  if (frame_type_addr() >= start && frame_type_addr() < end) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   834
    FOR_EACH_STACKMAP_FRAME_TYPE(
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   835
       VIRTUAL_DISPATCH, verify_subtype, (start, end));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   836
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   837
  return false;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   838
}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   839
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   840
void stack_map_frame::print_on(outputStream* st, int offs = -1) const {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   841
  FOR_EACH_STACKMAP_FRAME_TYPE(VOID_VIRTUAL_DISPATCH, print_on, (st, offs));
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   842
}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   843
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   844
#undef VIRTUAL_DISPATCH
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   845
#undef VOID_VIRTUAL_DISPATCH
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   846
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   847
#define AS_SUBTYPE_DEF(stack_frame_type, arg1, arg2) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   848
stack_frame_type* stack_map_frame::as_##stack_frame_type() const { \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   849
  if (stack_frame_type::is_frame_type(frame_type())) { \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   850
    return (stack_frame_type*)this; \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   851
  } else { \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   852
    return NULL; \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   853
  } \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   854
}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   855
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   856
FOR_EACH_STACKMAP_FRAME_TYPE(AS_SUBTYPE_DEF, x, x)
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   857
#undef AS_SUBTYPE_DEF
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   858
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   859
class stack_map_table {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   860
 private:
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   861
  address number_of_entries_addr() const {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   862
    return (address)this;
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   863
  }
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   864
  address entries_addr() const {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   865
    return number_of_entries_addr() + sizeof(u2);
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   866
  }
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   867
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   868
 protected:
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   869
  // No constructors  - should be 'private', but GCC issues a warning if it is
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   870
  stack_map_table() {}
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   871
  stack_map_table(const stack_map_table&) {}
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   872
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   873
 public:
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   874
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   875
  static stack_map_table* at(address addr) {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   876
    return (stack_map_table*)addr;
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   877
  }
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   878
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   879
  u2 number_of_entries() const {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   880
    return Bytes::get_Java_u2(number_of_entries_addr());
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   881
  }
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   882
  stack_map_frame* entries() const {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   883
    return stack_map_frame::at(entries_addr());
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   884
  }
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   885
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   886
  void set_number_of_entries(u2 num) {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   887
    Bytes::put_Java_u2(number_of_entries_addr(), num);
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   888
  }
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   889
};
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   890
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   891
class stack_map_table_attribute {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   892
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   893
  address name_index_addr() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   894
      return (address)this; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   895
  address attribute_length_addr() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   896
      return name_index_addr() + sizeof(u2); }
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   897
  address stack_map_table_addr() const {
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   898
      return attribute_length_addr() + sizeof(u4); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   899
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   900
 protected:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   901
  // No constructors  - should be 'private', but GCC issues a warning if it is
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   902
  stack_map_table_attribute() {}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   903
  stack_map_table_attribute(const stack_map_table_attribute&) {}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   904
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   905
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   906
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   907
  static stack_map_table_attribute* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   908
    return (stack_map_table_attribute*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   909
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   910
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   911
  u2 name_index() const {
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   912
    return Bytes::get_Java_u2(name_index_addr()); }
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   913
  u4 attribute_length() const {
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   914
    return Bytes::get_Java_u4(attribute_length_addr()); }
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   915
  stack_map_table* table() const {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   916
    return stack_map_table::at(stack_map_table_addr());
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   917
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   918
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   919
  void set_name_index(u2 idx) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   920
    Bytes::put_Java_u2(name_index_addr(), idx);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   921
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   922
  void set_attribute_length(u4 len) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   923
    Bytes::put_Java_u4(attribute_length_addr(), len);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   924
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   925
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6974
diff changeset
   926
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   927
#undef FOR_EACH_STACKMAP_FRAME_TYPE
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 7397
diff changeset
   928
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6974
diff changeset
   929
#endif // SHARE_VM_CLASSFILE_STACKMAPTABLEFORMAT_HPP