Пример #1
0
void StackMapFrame::set_local_2(
    int32_t index, VerificationType type1, VerificationType type2, TRAPS) {
  assert(type1.is_long() || type1.is_double(), "must be long/double");
  assert(type2.is_long2() || type2.is_double2(), "must be long/double_2");
  if (index >= _max_locals - 1) {
    verifier()->verify_error(
        ErrorContext::bad_local_index(_offset, index),
        "Local variable table overflow");
    return;
  }
  // If type at index+1 is double or long, set the next location to be unusable
  if (_locals[index+1].is_double() || _locals[index+1].is_long()) {
    assert((index + 2) < _locals_size, "Local variable table overflow");
    _locals[index + 2] = VerificationType::bogus_type();
  }
  // If type at index is double_2 or long_2, set the previous location to be unusable
  if (_locals[index].is_double2() || _locals[index].is_long2()) {
    assert(index >= 1, "Local variable table underflow");
    _locals[index - 1] = VerificationType::bogus_type();
  }
  _locals[index] = type1;
  _locals[index+1] = type2;
  if (index >= _locals_size - 1) {
#ifdef ASSERT
    for (int i=_locals_size; i<index; i++) {
      assert(_locals[i] == VerificationType::bogus_type(),
             "holes must be bogus type");
    }
#endif
    _locals_size = index + 2;
  }
}
Пример #2
0
void StackMapFrame::get_local_2(
    int32_t index, VerificationType type1, VerificationType type2, TRAPS) {
  assert(type1.is_long() || type1.is_double(), "must be long/double");
  assert(type2.is_long2() || type2.is_double2(), "must be long/double_2");
  if (index >= _locals_size - 1) {
    verifier()->verify_error(
        ErrorContext::bad_local_index(_offset, index),
        "get long/double overflows locals");
    return;
  }
  bool subtype = type1.is_assignable_from(_locals[index], verifier(), CHECK);
  if (!subtype) {
    verifier()->verify_error(
        ErrorContext::bad_type(_offset,
            TypeOrigin::local(index, this), TypeOrigin::implicit(type1)),
        "Bad local variable type");
  } else {
    subtype = type2.is_assignable_from(_locals[index + 1], verifier(), CHECK);
    if (!subtype) {
      /* Unreachable? All local store routines convert a split long or double
       * into a TOP during the store.  So we should never end up seeing an
       * orphaned half.  */
      verifier()->verify_error(
          ErrorContext::bad_type(_offset,
              TypeOrigin::local(index + 1, this), TypeOrigin::implicit(type2)),
          "Bad local variable type");
    }
  }
}
Пример #3
0
 inline void push_stack_2(
     VerificationType type1, VerificationType type2, TRAPS) {
   assert(type1.is_long() || type1.is_double(), "must be long/double");
   assert(type2.is_long2() || type2.is_double2(), "must be long/double_2");
   if (_stack_size >= _max_stack - 1) {
     verifier()->verify_error(
         ErrorContext::stack_overflow(_offset, this),
         "Operand stack overflow");
     return;
   }
   _stack[_stack_size++] = type1;
   _stack[_stack_size++] = type2;
 }
Пример #4
0
 inline void pop_stack_2(
     VerificationType type1, VerificationType type2, TRAPS) {
   assert(type1.is_long2() || type1.is_double2(), "must be long/double");
   assert(type2.is_long() || type2.is_double(), "must be long/double_2");
   if (_stack_size >= 2) {
     VerificationType top1 = _stack[_stack_size - 1];
     bool subtype1 = type1.is_assignable_from(top1, verifier(), CHECK);
     VerificationType top2 = _stack[_stack_size - 2];
     bool subtype2 = type2.is_assignable_from(top2, verifier(), CHECK);
     if (subtype1 && subtype2) {
       _stack_size -= 2;
       return;
     }
   }
   pop_stack_ex(type1, THREAD);
   pop_stack_ex(type2, THREAD);
 }