hotspot/src/share/vm/classfile/stackMapTableFormat.hpp
author ikrylov
Wed, 01 Dec 2010 18:26:32 -0500
changeset 7405 e6fc8d3926f8
parent 7397 5b173b4ca846
child 13476 471200fb94fd
permissions -rw-r--r--
6348631: remove the use of the HPI library from Hotspot Summary: move functions from hpi library to hotspot, communicate with licensees and open source community, check jdk for dependency, file CCC request Reviewed-by: coleenp, acorn, dsamersoff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6974
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
     1
/*
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
     2
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
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
#ifdef ASSERT
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   139
  void print_on(outputStream* st) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   140
    switch (tag()) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   141
      case ITEM_Top: st->print("Top"); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   142
      case ITEM_Integer: st->print("Integer"); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   143
      case ITEM_Float: st->print("Float"); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   144
      case ITEM_Double: st->print("Double"); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   145
      case ITEM_Long: st->print("Long"); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   146
      case ITEM_Null: st->print("Null"); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   147
      case ITEM_UninitializedThis:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   148
        st->print("UninitializedThis"); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   149
      case ITEM_Uninitialized:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   150
        st->print("Uninitialized[#%d]", bci()); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   151
      case ITEM_Object:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   152
        st->print("Object[#%d]", cpool_index()); break;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   153
      default:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   154
        assert(false, "Bad verification_type_info");
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
#endif
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   158
};
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   159
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   160
#define FOR_EACH_STACKMAP_FRAME_TYPE(macro, arg1, arg2) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   161
  macro(same_frame, arg1, arg2) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   162
  macro(same_frame_extended, arg1, arg2) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   163
  macro(same_frame_1_stack_item_frame, arg1, arg2) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   164
  macro(same_frame_1_stack_item_extended, arg1, arg2) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   165
  macro(chop_frame, arg1, arg2) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   166
  macro(append_frame, arg1, arg2) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   167
  macro(full_frame, arg1, arg2)
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   168
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   169
#define SM_FORWARD_DECL(type, arg1, arg2) class type;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   170
FOR_EACH_STACKMAP_FRAME_TYPE(SM_FORWARD_DECL, x, x)
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   171
#undef SM_FORWARD_DECL
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   172
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   173
class stack_map_frame {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   174
 protected:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   175
  address frame_type_addr() const { return (address)this; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   176
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   177
  // 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
   178
  stack_map_frame() {}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   179
  stack_map_frame(const stack_map_frame&) {}
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
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   182
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   183
  static stack_map_frame* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   184
    return (stack_map_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   185
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   186
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   187
  stack_map_frame* next() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   188
    return at((address)this + size());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   189
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   190
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   191
  u1 frame_type() const { return *(u1*)frame_type_addr(); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   192
  void set_frame_type(u1 type) { *((u1*)frame_type_addr()) = type; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   193
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   194
  // pseudo-virtual methods
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   195
  inline size_t size() const;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   196
  inline int offset_delta() const;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   197
  inline void set_offset_delta(int offset_delta);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   198
  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
   199
  inline verification_type_info* types() const; // pointer to first type
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   200
  inline bool is_valid_offset(int offset_delta) const;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   201
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   202
  // 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
   203
  // 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
   204
  // 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
   205
  inline bool verify(address start, address end) const;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   206
#ifdef ASSERT
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   207
  inline void print_on(outputStream* st) const;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   208
#endif
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   209
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   210
  // Create as_xxx and is_xxx methods for the subtypes
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   211
#define FRAME_TYPE_DECL(stackmap_frame_type, arg1, arg2) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   212
  inline stackmap_frame_type* as_##stackmap_frame_type() const; \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   213
  bool is_##stackmap_frame_type() { \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   214
    return as_##stackmap_frame_type() != NULL; \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   215
  }
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
  FOR_EACH_STACKMAP_FRAME_TYPE(FRAME_TYPE_DECL, x, x)
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   218
#undef FRAME_TYPE_DECL
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   219
};
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   220
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   221
class same_frame : public stack_map_frame {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   222
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   223
  static int frame_type_to_offset_delta(u1 frame_type) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   224
      return frame_type + 1; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   225
  static u1 offset_delta_to_frame_type(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   226
      return (u1)(offset_delta - 1); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   227
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   228
 public:
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
  static bool is_frame_type(u1 tag) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   231
    return tag < 64;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   232
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   233
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   234
  static same_frame* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   235
    assert(is_frame_type(*addr), "Wrong frame id");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   236
    return (same_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   237
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   238
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   239
  static same_frame* create_at(address addr, int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   240
    same_frame* sm = (same_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   241
    sm->set_offset_delta(offset_delta);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   242
    return sm;
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   245
  static size_t calculate_size() { return sizeof(u1); }
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
  size_t size() const { return calculate_size(); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   248
  int offset_delta() const { return frame_type_to_offset_delta(frame_type()); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   249
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   250
  void set_offset_delta(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   251
    assert(offset_delta <= 64, "Offset too large for same_frame");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   252
    set_frame_type(offset_delta_to_frame_type(offset_delta));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   253
  }
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
  int number_of_types() const { return 0; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   256
  verification_type_info* types() const { return NULL; }
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
  bool is_valid_offset(int offset_delta) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   259
    return is_frame_type(offset_delta_to_frame_type(offset_delta));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   260
  }
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
  bool verify_subtype(address start, address end) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   263
    return true;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   264
  }
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
#ifdef ASSERT
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   267
  void print_on(outputStream* st) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   268
    st->print("same_frame(%d)", offset_delta());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   269
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   270
#endif
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   271
};
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
class same_frame_extended : public stack_map_frame {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   274
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   275
  enum { _frame_id = 251 };
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   276
  address offset_delta_addr() const { return frame_type_addr() + sizeof(u1); }
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
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   279
  static bool is_frame_type(u1 tag) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   280
    return tag == _frame_id;
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* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   284
    assert(is_frame_type(*addr), "Wrong frame type");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   285
    return (same_frame_extended*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   286
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   287
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   288
  static same_frame_extended* create_at(address addr, u2 offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   289
    same_frame_extended* sm = (same_frame_extended*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   290
    sm->set_frame_type(_frame_id);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   291
    sm->set_offset_delta(offset_delta);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   292
    return sm;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   293
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   294
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   295
  static size_t calculate_size() { return sizeof(u1) + sizeof(u2); }
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
  size_t size() const { return calculate_size(); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   298
  int offset_delta() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   299
    return Bytes::get_Java_u2(offset_delta_addr()) + 1;
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   302
  void set_offset_delta(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   303
    Bytes::put_Java_u2(offset_delta_addr(), offset_delta - 1);
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   306
  int number_of_types() const { return 0; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   307
  verification_type_info* types() const { return NULL; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   308
  bool is_valid_offset(int offset) const { return true; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   309
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   310
  bool verify_subtype(address start, address end) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   311
    return frame_type_addr() + size() <= end;
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   314
#ifdef ASSERT
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   315
  void print_on(outputStream* st) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   316
    st->print("same_frame_extended(%d)", offset_delta());
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
#endif
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   319
};
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   320
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   321
class same_frame_1_stack_item_frame : public stack_map_frame {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   322
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   323
  address type_addr() const { return frame_type_addr() + sizeof(u1); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   324
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   325
  static int frame_type_to_offset_delta(u1 frame_type) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   326
      return frame_type - 63; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   327
  static u1 offset_delta_to_frame_type(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   328
      return (u1)(offset_delta + 63); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   329
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   330
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   331
  static bool is_frame_type(u1 tag) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   332
    return tag >= 64 && tag < 128;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   333
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   334
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   335
  static same_frame_1_stack_item_frame* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   336
    assert(is_frame_type(*addr), "Wrong frame id");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   337
    return (same_frame_1_stack_item_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   338
  }
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
  static same_frame_1_stack_item_frame* create_at(
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   341
      address addr, int offset_delta, verification_type_info* vti) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   342
    same_frame_1_stack_item_frame* sm = (same_frame_1_stack_item_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   343
    sm->set_offset_delta(offset_delta);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   344
    if (vti != NULL) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   345
      sm->set_type(vti);
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
    return sm;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   348
  }
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
  static size_t calculate_size(verification_type_info* vti) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   351
    return sizeof(u1) + vti->size();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   352
  }
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
  static size_t max_size() {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   355
    return sizeof(u1) + verification_type_info::max_size();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   356
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   357
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   358
  size_t size() const { return calculate_size(types()); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   359
  int offset_delta() const { return frame_type_to_offset_delta(frame_type()); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   360
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   361
  void set_offset_delta(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   362
    assert(offset_delta > 0 && offset_delta <= 64,
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   363
           "Offset too large for this frame type");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   364
    set_frame_type(offset_delta_to_frame_type(offset_delta));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   365
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   366
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   367
  void set_type(verification_type_info* vti) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   368
    verification_type_info* cur = types();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   369
    cur->copy_from(vti);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   370
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   371
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   372
  int number_of_types() const { return 1; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   373
  verification_type_info* types() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   374
    return verification_type_info::at(type_addr());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   375
  }
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
  bool is_valid_offset(int offset_delta) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   378
    return is_frame_type(offset_delta_to_frame_type(offset_delta));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   379
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   380
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   381
  bool verify_subtype(address start, address end) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   382
    return types()->verify(start, end);
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
#ifdef ASSERT
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   386
  void print_on(outputStream* st) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   387
    st->print("same_frame_1_stack_item_frame(%d,", offset_delta());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   388
    types()->print_on(st);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   389
    st->print(")");
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
#endif
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   394
class same_frame_1_stack_item_extended : public stack_map_frame {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   395
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   396
  address offset_delta_addr() const { return frame_type_addr() + sizeof(u1); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   397
  address type_addr() const { return offset_delta_addr() + sizeof(u2); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   398
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   399
  enum { _frame_id = 247 };
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   400
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   401
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   402
  static bool is_frame_type(u1 tag) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   403
    return tag == _frame_id;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   404
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   405
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   406
  static same_frame_1_stack_item_extended* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   407
    assert(is_frame_type(*addr), "Wrong frame id");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   408
    return (same_frame_1_stack_item_extended*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   409
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   410
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   411
  static same_frame_1_stack_item_extended* create_at(
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   412
      address addr, int offset_delta, verification_type_info* vti) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   413
    same_frame_1_stack_item_extended* sm =
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   414
       (same_frame_1_stack_item_extended*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   415
    sm->set_frame_type(_frame_id);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   416
    sm->set_offset_delta(offset_delta);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   417
    if (vti != NULL) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   418
      sm->set_type(vti);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   419
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   420
    return sm;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   421
  }
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
  static size_t calculate_size(verification_type_info* vti) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   424
    return sizeof(u1) + sizeof(u2) + vti->size();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   425
  }
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
  size_t size() const { return calculate_size(types()); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   428
  int offset_delta() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   429
    return Bytes::get_Java_u2(offset_delta_addr()) + 1;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   430
  }
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
  void set_offset_delta(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   433
    Bytes::put_Java_u2(offset_delta_addr(), offset_delta - 1);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   434
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   435
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   436
  void set_type(verification_type_info* vti) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   437
    verification_type_info* cur = types();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   438
    cur->copy_from(vti);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   439
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   440
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   441
  int number_of_types() const { return 1; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   442
  verification_type_info* types() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   443
    return verification_type_info::at(type_addr());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   444
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   445
  bool is_valid_offset(int offset) { return true; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   446
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   447
  bool verify_subtype(address start, address end) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   448
    return type_addr() < end && types()->verify(start, end);
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
#ifdef ASSERT
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   452
  void print_on(outputStream* st) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   453
    st->print("same_frame_1_stack_item_extended(%d,", offset_delta());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   454
    types()->print_on(st);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   455
    st->print(")");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   456
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   457
#endif
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
class chop_frame : public stack_map_frame {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   461
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   462
  address offset_delta_addr() const { return frame_type_addr() + sizeof(u1); }
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
  static int frame_type_to_chops(u1 frame_type) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   465
    int chop = 251 - frame_type;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   466
    return chop;
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 u1 chops_to_frame_type(int chop) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   470
    return 251 - chop;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   471
  }
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
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   474
  static bool is_frame_type(u1 tag) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   475
    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
   476
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   477
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   478
  static chop_frame* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   479
    assert(is_frame_type(*addr), "Wrong frame id");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   480
    return (chop_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   481
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   482
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   483
  static chop_frame* create_at(address addr, int offset_delta, int chops) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   484
    chop_frame* sm = (chop_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   485
    sm->set_chops(chops);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   486
    sm->set_offset_delta(offset_delta);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   487
    return sm;
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   490
  static size_t calculate_size() {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   491
    return sizeof(u1) + sizeof(u2);
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   494
  size_t size() const { return calculate_size(); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   495
  int offset_delta() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   496
    return Bytes::get_Java_u2(offset_delta_addr()) + 1;
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_offset_delta(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   499
    Bytes::put_Java_u2(offset_delta_addr(), offset_delta - 1);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   500
  }
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
  int chops() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   503
    int chops = frame_type_to_chops(frame_type());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   504
    assert(chops > 0 && chops < 4, "Invalid number of chops in frame");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   505
    return chops;
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
  void set_chops(int chops) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   508
    assert(chops > 0 && chops <= 3, "Bad number of chops");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   509
    set_frame_type(chops_to_frame_type(chops));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   510
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   511
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   512
  int number_of_types() const { return 0; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   513
  verification_type_info* types() const { return NULL; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   514
  bool is_valid_offset(int offset) { return true; }
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
  bool verify_subtype(address start, address end) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   517
    return frame_type_addr() + size() <= end;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   518
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   519
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   520
#ifdef ASSERT
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   521
  void print_on(outputStream* st) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   522
    st->print("chop_frame(%d,%d)", offset_delta(), chops());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   523
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   524
#endif
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   527
class append_frame : public stack_map_frame {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   528
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   529
  address offset_delta_addr() const { return frame_type_addr() + sizeof(u1); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   530
  address types_addr() const { return offset_delta_addr() + sizeof(u2); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   531
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   532
  static int frame_type_to_appends(u1 frame_type) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   533
    int append = frame_type - 251;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   534
    return append;
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   537
  static u1 appends_to_frame_type(int appends) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   538
    assert(appends > 0 && appends < 4, "Invalid append amount");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   539
    return 251 + appends;
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   542
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   543
  static bool is_frame_type(u1 tag) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   544
    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
   545
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   546
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   547
  static append_frame* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   548
    assert(is_frame_type(*addr), "Wrong frame id");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   549
    return (append_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   550
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   551
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   552
  static append_frame* create_at(
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   553
      address addr, int offset_delta, int appends,
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   554
      verification_type_info* types) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   555
    append_frame* sm = (append_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   556
    sm->set_appends(appends);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   557
    sm->set_offset_delta(offset_delta);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   558
    if (types != NULL) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   559
      verification_type_info* cur = sm->types();
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
        cur->copy_from(types);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   562
        cur = cur->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   563
        types = types->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   564
      }
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
    return sm;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   567
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   568
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   569
  static size_t calculate_size(int appends, verification_type_info* types) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   570
    size_t sz = sizeof(u1) + sizeof(u2);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   571
    for (int i = 0; i < appends; ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   572
      sz += types->size();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   573
      types = types->next();
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
    return sz;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   576
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   577
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   578
  static size_t max_size() {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   579
    return sizeof(u1) + sizeof(u2) + 3 * verification_type_info::max_size();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   580
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   581
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   582
  size_t size() const { return calculate_size(number_of_types(), types()); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   583
  int offset_delta() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   584
    return Bytes::get_Java_u2(offset_delta_addr()) + 1;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   585
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   586
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   587
  void set_offset_delta(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   588
    Bytes::put_Java_u2(offset_delta_addr(), offset_delta - 1);
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   591
  void set_appends(int appends) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   592
    assert(appends > 0 && appends < 4, "Bad number of appends");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   593
    set_frame_type(appends_to_frame_type(appends));
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   596
  int number_of_types() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   597
    int appends = frame_type_to_appends(frame_type());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   598
    assert(appends > 0 && appends < 4, "Invalid number of appends in frame");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   599
    return appends;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   600
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   601
  verification_type_info* types() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   602
    return verification_type_info::at(types_addr());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   603
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   604
  bool is_valid_offset(int offset) const { return true; }
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
  bool verify_subtype(address start, address end) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   607
    verification_type_info* vti = types();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   608
    if ((address)vti < end && vti->verify(start, end)) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   609
      int nof = number_of_types();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   610
      vti = vti->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   611
      if (nof < 2 || vti->verify(start, end)) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   612
        vti = vti->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   613
        if (nof < 3 || vti->verify(start, end)) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   614
          return true;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   615
        }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   616
      }
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
    return false;
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   621
#ifdef ASSERT
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   622
  void print_on(outputStream* st) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   623
    st->print("append_frame(%d,", offset_delta());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   624
    verification_type_info* vti = types();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   625
    for (int i = 0; i < number_of_types(); ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   626
      vti->print_on(st);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   627
      if (i != number_of_types() - 1) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   628
        st->print(",");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   629
      }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   630
      vti = vti->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   631
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   632
    st->print(")");
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
#endif
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   637
class full_frame : public stack_map_frame {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   638
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   639
  address offset_delta_addr() const { return frame_type_addr() + sizeof(u1); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   640
  address num_locals_addr() const { return offset_delta_addr() + sizeof(u2); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   641
  address locals_addr() const { return num_locals_addr() + sizeof(u2); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   642
  address stack_slots_addr(address end_of_locals) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   643
      return end_of_locals; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   644
  address stack_addr(address end_of_locals) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   645
      return stack_slots_addr(end_of_locals) + sizeof(u2); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   646
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   647
  enum { _frame_id = 255 };
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   648
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   649
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   650
  static bool is_frame_type(u1 tag) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   651
    return tag == _frame_id;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   652
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   653
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   654
  static full_frame* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   655
    assert(is_frame_type(*addr), "Wrong frame id");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   656
    return (full_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   657
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   658
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   659
  static full_frame* create_at(
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   660
      address addr, int offset_delta, int num_locals,
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   661
      verification_type_info* locals,
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   662
      int stack_slots, verification_type_info* stack) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   663
    full_frame* sm = (full_frame*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   664
    sm->set_frame_type(_frame_id);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   665
    sm->set_offset_delta(offset_delta);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   666
    sm->set_num_locals(num_locals);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   667
    if (locals != NULL) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   668
      verification_type_info* cur = sm->locals();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   669
      for (int i = 0; i < num_locals; ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   670
        cur->copy_from(locals);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   671
        cur = cur->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   672
        locals = locals->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   673
      }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   674
      address end_of_locals = (address)cur;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   675
      sm->set_stack_slots(end_of_locals, stack_slots);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   676
      cur = sm->stack(end_of_locals);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   677
      for (int i = 0; i < stack_slots; ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   678
        cur->copy_from(stack);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   679
        cur = cur->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   680
        stack = stack->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
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   683
    return sm;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   684
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   685
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   686
  static size_t calculate_size(
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   687
      int num_locals, verification_type_info* locals,
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   688
      int stack_slots, verification_type_info* stack) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   689
    size_t sz = sizeof(u1) + sizeof(u2) + sizeof(u2) + sizeof(u2);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   690
    verification_type_info* vti = locals;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   691
    for (int i = 0; i < num_locals; ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   692
      sz += vti->size();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   693
      vti = vti->next();
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
    vti = stack;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   696
    for (int i = 0; i < stack_slots; ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   697
      sz += vti->size();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   698
      vti = vti->next();
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
    return sz;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   701
  }
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
  static size_t max_size(int locals, int stack) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   704
    return sizeof(u1) + 3 * sizeof(u2) +
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   705
        (locals + stack) * verification_type_info::max_size();
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   708
  size_t size() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   709
    address eol = end_of_locals();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   710
    return calculate_size(num_locals(), locals(), stack_slots(eol), stack(eol));
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   713
  int offset_delta() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   714
    return Bytes::get_Java_u2(offset_delta_addr()) + 1;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   715
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   716
  int num_locals() const { return Bytes::get_Java_u2(num_locals_addr()); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   717
  verification_type_info* locals() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   718
    return verification_type_info::at(locals_addr());
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
  address end_of_locals() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   721
    verification_type_info* vti = locals();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   722
    for (int i = 0; i < num_locals(); ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   723
      vti = vti->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   724
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   725
    return (address)vti;
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
  int stack_slots(address end_of_locals) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   728
    return Bytes::get_Java_u2(stack_slots_addr(end_of_locals));
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
  verification_type_info* stack(address end_of_locals) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   731
    return verification_type_info::at(stack_addr(end_of_locals));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   732
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   733
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   734
  void set_offset_delta(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   735
    Bytes::put_Java_u2(offset_delta_addr(), offset_delta - 1);
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
  void set_num_locals(int num_locals) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   738
    Bytes::put_Java_u2(num_locals_addr(), num_locals);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   739
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   740
  void set_stack_slots(address end_of_locals, int stack_slots) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   741
    Bytes::put_Java_u2(stack_slots_addr(end_of_locals), stack_slots);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   742
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   743
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   744
  // These return only the locals.  Extra processing is required for stack
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   745
  // types of full frames.
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   746
  int number_of_types() const { return num_locals(); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   747
  verification_type_info* types() const { return locals(); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   748
  bool is_valid_offset(int offset) { return true; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   749
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   750
  bool verify_subtype(address start, address end) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   751
    verification_type_info* vti = types();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   752
    if ((address)vti >= end) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   753
      return false;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   754
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   755
    int count = number_of_types();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   756
    for (int i = 0; i < count; ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   757
      if (!vti->verify(start, end)) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   758
        return false;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   759
      }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   760
      vti = vti->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   761
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   762
    address eol = (address)vti;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   763
    if (eol + sizeof(u2) > end) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   764
      return false;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   765
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   766
    count = stack_slots(eol);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   767
    vti = stack(eol);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   768
    for (int i = 0; i < stack_slots(eol); ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   769
      if (!vti->verify(start, end)) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   770
        return false;
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
    return true;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   775
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   776
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   777
#ifdef ASSERT
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   778
  void print_on(outputStream* st) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   779
    st->print("full_frame(%d,{", offset_delta());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   780
    verification_type_info* vti = locals();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   781
    for (int i = 0; i < num_locals(); ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   782
      vti->print_on(st);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   783
      if (i != num_locals() - 1) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   784
        st->print(",");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   785
      }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   786
      vti = vti->next();
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
    st->print("},{");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   789
    address end_of_locals = (address)vti;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   790
    vti = stack(end_of_locals);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   791
    int ss = stack_slots(end_of_locals);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   792
    for (int i = 0; i < ss; ++i) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   793
      vti->print_on(st);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   794
      if (i != ss - 1) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   795
        st->print(",");
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   796
      }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   797
      vti = vti->next();
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   798
    }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   799
    st->print("})");
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
#endif
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   802
};
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   803
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   804
#define VIRTUAL_DISPATCH(stack_frame_type, func_name, args) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   805
  stack_frame_type* item_##stack_frame_type = as_##stack_frame_type(); \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   806
  if (item_##stack_frame_type != NULL) { \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   807
    return item_##stack_frame_type->func_name args;  \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   808
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   809
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   810
#define VOID_VIRTUAL_DISPATCH(stack_frame_type, func_name, args) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   811
  stack_frame_type* item_##stack_frame_type = as_##stack_frame_type(); \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   812
  if (item_##stack_frame_type != NULL) { \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   813
    item_##stack_frame_type->func_name args;  \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   814
    return; \
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
size_t stack_map_frame::size() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   818
  FOR_EACH_STACKMAP_FRAME_TYPE(VIRTUAL_DISPATCH, size, ());
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
int stack_map_frame::offset_delta() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   823
  FOR_EACH_STACKMAP_FRAME_TYPE(VIRTUAL_DISPATCH, offset_delta, ());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   824
  return 0;
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
void stack_map_frame::set_offset_delta(int offset_delta) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   828
  FOR_EACH_STACKMAP_FRAME_TYPE(
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   829
      VOID_VIRTUAL_DISPATCH, set_offset_delta, (offset_delta));
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
int stack_map_frame::number_of_types() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   833
  FOR_EACH_STACKMAP_FRAME_TYPE(VIRTUAL_DISPATCH, number_of_types, ());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   834
  return 0;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   835
}
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
verification_type_info* stack_map_frame::types() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   838
  FOR_EACH_STACKMAP_FRAME_TYPE(VIRTUAL_DISPATCH, types, ());
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   839
  return NULL;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   840
}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   841
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   842
bool stack_map_frame::is_valid_offset(int offset) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   843
  FOR_EACH_STACKMAP_FRAME_TYPE(VIRTUAL_DISPATCH, is_valid_offset, (offset));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   844
  return true;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   845
}
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
bool stack_map_frame::verify(address start, address end) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   848
  if (frame_type_addr() >= start && frame_type_addr() < end) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   849
    FOR_EACH_STACKMAP_FRAME_TYPE(
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   850
       VIRTUAL_DISPATCH, verify_subtype, (start, end));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   851
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   852
  return false;
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
#ifdef ASSERT
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   856
void stack_map_frame::print_on(outputStream* st) const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   857
  FOR_EACH_STACKMAP_FRAME_TYPE(VOID_VIRTUAL_DISPATCH, print_on, (st));
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   858
}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   859
#endif
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   860
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   861
#undef VIRTUAL_DISPATCH
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   862
#undef VOID_VIRTUAL_DISPATCH
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   863
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   864
#define AS_SUBTYPE_DEF(stack_frame_type, arg1, arg2) \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   865
stack_frame_type* stack_map_frame::as_##stack_frame_type() const { \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   866
  if (stack_frame_type::is_frame_type(frame_type())) { \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   867
    return (stack_frame_type*)this; \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   868
  } else { \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   869
    return NULL; \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   870
  } \
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   871
}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   872
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   873
FOR_EACH_STACKMAP_FRAME_TYPE(AS_SUBTYPE_DEF, x, x)
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   874
#undef AS_SUBTYPE_DEF
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   875
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   876
class stack_map_table_attribute {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   877
 private:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   878
  address name_index_addr() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   879
      return (address)this; }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   880
  address attribute_length_addr() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   881
      return name_index_addr() + sizeof(u2); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   882
  address number_of_entries_addr() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   883
      return attribute_length_addr() + sizeof(u4); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   884
  address entries_addr() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   885
      return number_of_entries_addr() + sizeof(u2); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   886
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   887
 protected:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   888
  // 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
   889
  stack_map_table_attribute() {}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   890
  stack_map_table_attribute(const stack_map_table_attribute&) {}
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   891
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   892
 public:
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   893
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   894
  static stack_map_table_attribute* at(address addr) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   895
    return (stack_map_table_attribute*)addr;
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   896
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   897
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   898
  u2 name_index() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   899
       return Bytes::get_Java_u2(name_index_addr()); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   900
  u4 attribute_length() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   901
      return Bytes::get_Java_u4(attribute_length_addr()); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   902
  u2 number_of_entries() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   903
      return Bytes::get_Java_u2(number_of_entries_addr()); }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   904
  stack_map_frame* entries() const {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   905
    return stack_map_frame::at(entries_addr());
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   908
  static size_t header_size() {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   909
      return sizeof(u2) + sizeof(u4);
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
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   912
  void set_name_index(u2 idx) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   913
    Bytes::put_Java_u2(name_index_addr(), idx);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   914
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   915
  void set_attribute_length(u4 len) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   916
    Bytes::put_Java_u4(attribute_length_addr(), len);
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
  void set_number_of_entries(u2 num) {
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   919
    Bytes::put_Java_u2(number_of_entries_addr(), num);
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   920
  }
a013f1c533a5 6991315: RedefineClasses fails with java.lang.VerifyError
kamg
parents:
diff changeset
   921
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6974
diff changeset
   922
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6974
diff changeset
   923
#endif // SHARE_VM_CLASSFILE_STACKMAPTABLEFORMAT_HPP