test/hotspot/gtest/code/test_vtableStub.cpp
author herrick
Mon, 17 Jun 2019 15:18:52 -0400
branchJDK-8200758-branch
changeset 57412 02034583f4dc
parent 49449 ef5d5d343e2a
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48557
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
     1
/*
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
     4
 *
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
     8
 *
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    13
 * accompanied this code).
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    14
 *
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    18
 *
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    21
 * questions.
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    22
 *
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    23
 */
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    24
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    25
#include "precompiled.hpp"
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    26
#include "code/vtableStubs.hpp"
49449
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 48557
diff changeset
    27
#include "runtime/interfaceSupport.inline.hpp"
48557
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    28
#include "unittest.hpp"
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    29
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    30
TEST_VM(code, vtableStubs) {
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    31
  // Should be in VM to use locks
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    32
  ThreadInVMfromNative ThreadInVMfromNative(JavaThread::current());
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    33
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    34
  VtableStubs::find_vtable_stub(0); // min vtable index
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    35
  for (int i = 0; i < 15; i++) {
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    36
    VtableStubs::find_vtable_stub((1 << i) - 1);
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    37
    VtableStubs::find_vtable_stub((1 << i));
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    38
  }
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    39
  VtableStubs::find_vtable_stub((1 << 15) - 1); // max vtable index
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    40
}
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    41
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    42
TEST_VM(code, itableStubs) {
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    43
  // Should be in VM to use locks
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    44
  ThreadInVMfromNative ThreadInVMfromNative(JavaThread::current());
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    45
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    46
  VtableStubs::find_itable_stub(0); // min itable index
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    47
  for (int i = 0; i < 15; i++) {
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    48
    VtableStubs::find_itable_stub((1 << i) - 1);
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    49
    VtableStubs::find_itable_stub((1 << i));
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    50
  }
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    51
  VtableStubs::find_itable_stub((1 << 15) - 1); // max itable index
2e867226b914 8174962: Better interface invocations
vlivanov
parents:
diff changeset
    52
}