src/hotspot/share/classfile/stackMapTable.cpp
author lfoltan
Mon, 21 Oct 2019 13:13:16 -0400
changeset 58722 cba8afa5cfed
parent 53838 c8c9bd65c198
permissions -rw-r--r--
8231844: Enhance type signature characters in classfile_constants.h and improve the JVM to use type signature characters more consistently Summary: Increase the use of type signature constants instead of hard coded characters within the JVM. Reviewed-by: coleenp, dholmes, fparain Contributed-by: lois.foltan@oracle.com, john.r.rose@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
43179
06ccf3bfd0a3 8167104: Additional class construction refinements
hseigel
parents: 33162
diff changeset
     2
 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6439
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6439
diff changeset
    26
#include "classfile/stackMapTable.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6439
diff changeset
    27
#include "classfile/verifier.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6439
diff changeset
    28
#include "memory/resourceArea.hpp"
53838
c8c9bd65c198 8219229: Make ConstantPool::tag_at and release_tag_at_put inlineable
redestad
parents: 49449
diff changeset
    29
#include "oops/constantPool.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6439
diff changeset
    30
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6439
diff changeset
    31
#include "runtime/fieldType.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6439
diff changeset
    32
#include "runtime/handles.inline.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
StackMapTable::StackMapTable(StackMapReader* reader, StackMapFrame* init_frame,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
                             u2 max_locals, u2 max_stack,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
                             char* code_data, int code_len, TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  _code_length = code_len;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  _frame_count = reader->get_frame_count();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  if (_frame_count > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
    _frame_array = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
                                                StackMapFrame*, _frame_count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    StackMapFrame* pre_frame = init_frame;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    for (int32_t i = 0; i < _frame_count; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
      StackMapFrame* frame = reader->next(
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
        pre_frame, i == 0, max_locals, max_stack,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
        CHECK_VERIFY(pre_frame->verifier()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
      _frame_array[i] = frame;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
      int offset = frame->offset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
      if (offset >= code_len || code_data[offset] == 0) {
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
    50
        frame->verifier()->verify_error(
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
    51
            ErrorContext::bad_stackmap(i, frame),
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
    52
            "StackMapTable error: bad offset");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
        return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
      pre_frame = frame;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  reader->check_end(CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
// This method is only called by method in StackMapTable.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
int StackMapTable::get_index_from_offset(int32_t offset) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  int i = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  for (; i < _frame_count; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
    if (_frame_array[i]->offset() == offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
      return i;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  return i;  // frame with offset doesn't exist in the array
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
bool StackMapTable::match_stackmap(
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    StackMapFrame* frame, int32_t target,
43179
06ccf3bfd0a3 8167104: Additional class construction refinements
hseigel
parents: 33162
diff changeset
    74
    bool match, bool update, ErrorContext* ctx, TRAPS) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  int index = get_index_from_offset(target);
43179
06ccf3bfd0a3 8167104: Additional class construction refinements
hseigel
parents: 33162
diff changeset
    76
  return match_stackmap(frame, target, index, match, update, ctx, THREAD);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
// Match and/or update current_frame to the frame in stackmap table with
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
// specified offset and frame index. Return true if the two frames match.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
//
43179
06ccf3bfd0a3 8167104: Additional class construction refinements
hseigel
parents: 33162
diff changeset
    82
// The values of match and update are:                  _match__update
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
//
43179
06ccf3bfd0a3 8167104: Additional class construction refinements
hseigel
parents: 33162
diff changeset
    84
// checking a branch target:                             true   false
06ccf3bfd0a3 8167104: Additional class construction refinements
hseigel
parents: 33162
diff changeset
    85
// checking an exception handler:                        true   false
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
// linear bytecode verification following an
43179
06ccf3bfd0a3 8167104: Additional class construction refinements
hseigel
parents: 33162
diff changeset
    87
// unconditional branch:                                 false  true
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
// linear bytecode verification not following an
43179
06ccf3bfd0a3 8167104: Additional class construction refinements
hseigel
parents: 33162
diff changeset
    89
// unconditional branch:                                 true   true
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
bool StackMapTable::match_stackmap(
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    StackMapFrame* frame, int32_t target, int32_t frame_index,
43179
06ccf3bfd0a3 8167104: Additional class construction refinements
hseigel
parents: 33162
diff changeset
    92
    bool match, bool update, ErrorContext* ctx, TRAPS) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  if (frame_index < 0 || frame_index >= _frame_count) {
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
    94
    *ctx = ErrorContext::missing_stackmap(frame->offset());
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
    95
    frame->verifier()->verify_error(
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
    96
        *ctx, "Expecting a stackmap frame at branch target %d", target);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
   100
  StackMapFrame *stackmap_frame = _frame_array[frame_index];
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  bool result = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  if (match) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    // Has direct control flow from last instruction, need to match the two
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    // frames.
43179
06ccf3bfd0a3 8167104: Additional class construction refinements
hseigel
parents: 33162
diff changeset
   105
    result = frame->is_assignable_to(stackmap_frame,
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
   106
        ctx, CHECK_VERIFY_(frame->verifier(), result));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  if (update) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
    // Use the frame in stackmap table as current frame
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
    int lsize = stackmap_frame->locals_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
    int ssize = stackmap_frame->stack_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    if (frame->locals_size() > lsize || frame->stack_size() > ssize) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
      // Make sure unused type array items are all _bogus_type.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
      frame->reset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
    frame->set_locals_size(lsize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
    frame->copy_locals(stackmap_frame);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    frame->set_stack_size(ssize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    frame->copy_stack(stackmap_frame);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    frame->set_flags(stackmap_frame->flags());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
void StackMapTable::check_jump_target(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    StackMapFrame* frame, int32_t target, TRAPS) const {
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
   127
  ErrorContext ctx;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  bool match = match_stackmap(
43179
06ccf3bfd0a3 8167104: Additional class construction refinements
hseigel
parents: 33162
diff changeset
   129
    frame, target, true, false, &ctx, CHECK_VERIFY(frame->verifier()));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  if (!match || (target < 0 || target >= _code_length)) {
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
   131
    frame->verifier()->verify_error(ctx,
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
   132
        "Inconsistent stackmap frames at branch target %d", target);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
   136
void StackMapTable::print_on(outputStream* str) const {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
   137
  str->indent().print_cr("StackMapTable: frame_count = %d", _frame_count);
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
   138
  str->indent().print_cr("table = { ");
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
   139
  {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
   140
    streamIndentor si(str);
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
   141
    for (int32_t i = 0; i < _frame_count; ++i) {
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
   142
      _frame_array[i]->print_on(str);
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
   143
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  }
13476
471200fb94fd 7116786: RFE: Detailed information on VerifyErrors
kamg
parents: 9133
diff changeset
   145
  str->print_cr(" }");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
49449
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47216
diff changeset
   148
StackMapReader::StackMapReader(ClassVerifier* v, StackMapStream* stream, char* code_data,
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47216
diff changeset
   149
                               int32_t code_len, TRAPS) :
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47216
diff changeset
   150
                               _verifier(v), _stream(stream),
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47216
diff changeset
   151
                               _code_data(code_data), _code_length(code_len) {
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47216
diff changeset
   152
  methodHandle m = v->method();
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47216
diff changeset
   153
  if (m->has_stackmap_table()) {
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47216
diff changeset
   154
    _cp = constantPoolHandle(THREAD, m->constants());
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47216
diff changeset
   155
    _frame_count = _stream->get_u2(CHECK);
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47216
diff changeset
   156
  } else {
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47216
diff changeset
   157
    // There's no stackmap table present. Frame count and size are 0.
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47216
diff changeset
   158
    _frame_count = 0;
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47216
diff changeset
   159
  }
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47216
diff changeset
   160
}
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47216
diff changeset
   161
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
int32_t StackMapReader::chop(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
    VerificationType* locals, int32_t length, int32_t chops) {
6439
a9c5a6738be7 6870851: Bad frame_chop in StackMapTable crashes JVM
kamg
parents: 5547
diff changeset
   164
  if (locals == NULL) return -1;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  int32_t pos = length - 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  for (int32_t i=0; i<chops; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
    if (locals[pos].is_category2_2nd()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
      pos -= 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
      pos --;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
    if (pos<0 && i<(chops-1)) return -1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  return pos+1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
VerificationType StackMapReader::parse_verification_type(u1* flags, TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  u1 tag = _stream->get_u1(THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  if (tag < (u1)ITEM_UninitializedThis) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
    return VerificationType::from_tag(tag);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  if (tag == ITEM_Object) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
    u2 class_index = _stream->get_u2(THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
    int nconstants = _cp->length();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
    if ((class_index <= 0 || class_index >= nconstants) ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
        (!_cp->tag_at(class_index).is_klass() &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
         !_cp->tag_at(class_index).is_unresolved_klass())) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
      _stream->stackmap_format_error("bad class index", THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
      return VerificationType::bogus_type();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
    }
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   191
    return VerificationType::reference_type(_cp->klass_name_at(class_index));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  if (tag == ITEM_UninitializedThis) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
    if (flags != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
      *flags |= FLAG_THIS_UNINIT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    return VerificationType::uninitialized_this_type();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  if (tag == ITEM_Uninitialized) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
    u2 offset = _stream->get_u2(THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
    if (offset >= _code_length ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
        _code_data[offset] != ClassVerifier::NEW_OFFSET) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
      _verifier->class_format_error(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
        "StackMapTable format error: bad offset for Uninitialized");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
      return VerificationType::bogus_type();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
    return VerificationType::uninitialized_type(offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  _stream->stackmap_format_error("bad verification type", THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  return VerificationType::bogus_type();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
StackMapFrame* StackMapReader::next(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
    StackMapFrame* pre_frame, bool first, u2 max_locals, u2 max_stack, TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  StackMapFrame* frame;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  int offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  VerificationType* locals = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  u1 frame_type = _stream->get_u1(THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  if (frame_type < 64) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
    // same_frame
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
    if (first) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
      offset = frame_type;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
      // Can't share the locals array since that is updated by the verifier.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
      if (pre_frame->locals_size() > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
        locals = NEW_RESOURCE_ARRAY_IN_THREAD(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
          THREAD, VerificationType, pre_frame->locals_size());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
      offset = pre_frame->offset() + frame_type + 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
      locals = pre_frame->locals();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
    frame = new StackMapFrame(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
      offset, pre_frame->flags(), pre_frame->locals_size(), 0,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
      max_locals, max_stack, locals, NULL, _verifier);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
    if (first && locals != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
      frame->copy_locals(pre_frame);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
    return frame;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  if (frame_type < 128) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
    // same_locals_1_stack_item_frame
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
    if (first) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
      offset = frame_type - 64;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
      // Can't share the locals array since that is updated by the verifier.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
      if (pre_frame->locals_size() > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
        locals = NEW_RESOURCE_ARRAY_IN_THREAD(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
          THREAD, VerificationType, pre_frame->locals_size());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
      offset = pre_frame->offset() + frame_type - 63;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
      locals = pre_frame->locals();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
    VerificationType* stack = NEW_RESOURCE_ARRAY_IN_THREAD(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
      THREAD, VerificationType, 2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
    u2 stack_size = 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
    stack[0] = parse_verification_type(NULL, CHECK_VERIFY_(_verifier, NULL));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
    if (stack[0].is_category2()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
      stack[1] = stack[0].to_category2_2nd();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
      stack_size = 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
    check_verification_type_array_size(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
      stack_size, max_stack, CHECK_VERIFY_(_verifier, NULL));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
    frame = new StackMapFrame(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
      offset, pre_frame->flags(), pre_frame->locals_size(), stack_size,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
      max_locals, max_stack, locals, stack, _verifier);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
    if (first && locals != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
      frame->copy_locals(pre_frame);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
    return frame;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  u2 offset_delta = _stream->get_u2(THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  if (frame_type < SAME_LOCALS_1_STACK_ITEM_EXTENDED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
    // reserved frame types
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
    _stream->stackmap_format_error(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
      "reserved frame type", CHECK_VERIFY_(_verifier, NULL));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  if (frame_type == SAME_LOCALS_1_STACK_ITEM_EXTENDED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
    // same_locals_1_stack_item_frame_extended
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
    if (first) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
      offset = offset_delta;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
      // Can't share the locals array since that is updated by the verifier.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
      if (pre_frame->locals_size() > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
        locals = NEW_RESOURCE_ARRAY_IN_THREAD(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
          THREAD, VerificationType, pre_frame->locals_size());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
      offset = pre_frame->offset() + offset_delta + 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
      locals = pre_frame->locals();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
    VerificationType* stack = NEW_RESOURCE_ARRAY_IN_THREAD(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
      THREAD, VerificationType, 2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
    u2 stack_size = 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
    stack[0] = parse_verification_type(NULL, CHECK_VERIFY_(_verifier, NULL));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
    if (stack[0].is_category2()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
      stack[1] = stack[0].to_category2_2nd();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
      stack_size = 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
    check_verification_type_array_size(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
      stack_size, max_stack, CHECK_VERIFY_(_verifier, NULL));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
    frame = new StackMapFrame(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
      offset, pre_frame->flags(), pre_frame->locals_size(), stack_size,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
      max_locals, max_stack, locals, stack, _verifier);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
    if (first && locals != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
      frame->copy_locals(pre_frame);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
    return frame;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
  if (frame_type <= SAME_EXTENDED) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
    // chop_frame or same_frame_extended
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
    locals = pre_frame->locals();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
    int length = pre_frame->locals_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
    int chops = SAME_EXTENDED - frame_type;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
    int new_length = length;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
    u1 flags = pre_frame->flags();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
    if (chops != 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
      new_length = chop(locals, length, chops);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
      check_verification_type_array_size(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
        new_length, max_locals, CHECK_VERIFY_(_verifier, NULL));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
      // Recompute flags since uninitializedThis could have been chopped.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
      flags = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
      for (int i=0; i<new_length; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
        if (locals[i].is_uninitialized_this()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
          flags |= FLAG_THIS_UNINIT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
          break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
    if (first) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
      offset = offset_delta;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
      // Can't share the locals array since that is updated by the verifier.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
      if (new_length > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
        locals = NEW_RESOURCE_ARRAY_IN_THREAD(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
          THREAD, VerificationType, new_length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
      } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
        locals = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
      offset = pre_frame->offset() + offset_delta + 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
    frame = new StackMapFrame(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
      offset, flags, new_length, 0, max_locals, max_stack,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
      locals, NULL, _verifier);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
    if (first && locals != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
      frame->copy_locals(pre_frame);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
    return frame;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
  } else if (frame_type < SAME_EXTENDED + 4) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
    // append_frame
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
    int appends = frame_type - SAME_EXTENDED;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
    int real_length = pre_frame->locals_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
    int new_length = real_length + appends*2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
    locals = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, VerificationType, new_length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
    VerificationType* pre_locals = pre_frame->locals();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
    int i;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
    for (i=0; i<pre_frame->locals_size(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
      locals[i] = pre_locals[i];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
    u1 flags = pre_frame->flags();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
    for (i=0; i<appends; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
      locals[real_length] = parse_verification_type(&flags, THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
      if (locals[real_length].is_category2()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
        locals[real_length + 1] = locals[real_length].to_category2_2nd();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
        ++real_length;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
      ++real_length;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
    check_verification_type_array_size(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
      real_length, max_locals, CHECK_VERIFY_(_verifier, NULL));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
    if (first) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
      offset = offset_delta;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
      offset = pre_frame->offset() + offset_delta + 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
    frame = new StackMapFrame(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
      offset, flags, real_length, 0, max_locals,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
      max_stack, locals, NULL, _verifier);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
    return frame;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
  if (frame_type == FULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
    // full_frame
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
    u1 flags = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
    u2 locals_size = _stream->get_u2(THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
    int real_locals_size = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
    if (locals_size > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
      locals = NEW_RESOURCE_ARRAY_IN_THREAD(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
        THREAD, VerificationType, locals_size*2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
    int i;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
    for (i=0; i<locals_size; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
      locals[real_locals_size] = parse_verification_type(&flags, THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
      if (locals[real_locals_size].is_category2()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
        locals[real_locals_size + 1] =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
          locals[real_locals_size].to_category2_2nd();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
        ++real_locals_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
      ++real_locals_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
    check_verification_type_array_size(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
      real_locals_size, max_locals, CHECK_VERIFY_(_verifier, NULL));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
    u2 stack_size = _stream->get_u2(THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
    int real_stack_size = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
    VerificationType* stack = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
    if (stack_size > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
      stack = NEW_RESOURCE_ARRAY_IN_THREAD(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
        THREAD, VerificationType, stack_size*2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
    for (i=0; i<stack_size; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
      stack[real_stack_size] = parse_verification_type(NULL, THREAD);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
      if (stack[real_stack_size].is_category2()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
        stack[real_stack_size + 1] = stack[real_stack_size].to_category2_2nd();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
        ++real_stack_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
      ++real_stack_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
    check_verification_type_array_size(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
      real_stack_size, max_stack, CHECK_VERIFY_(_verifier, NULL));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
    if (first) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
      offset = offset_delta;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
      offset = pre_frame->offset() + offset_delta + 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
    frame = new StackMapFrame(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
      offset, flags, real_locals_size, real_stack_size,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
      max_locals, max_stack, locals, stack, _verifier);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
    return frame;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
  _stream->stackmap_format_error(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
    "reserved frame type", CHECK_VERIFY_(pre_frame->verifier(), NULL));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
}