src/hotspot/share/prims/whitebox.hpp
author coleenp
Thu, 10 Jan 2019 15:13:51 -0500
changeset 53244 9807daeb47c4
parent 49449 ef5d5d343e2a
permissions -rw-r--r--
8216167: Update include guards to reflect correct directories Summary: Use script and some manual fixup to fix directores names in include guards. Reviewed-by: lfoltan, eosterlund, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12095
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49449
diff changeset
     2
 * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
12095
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
     4
 *
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
     8
 *
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    13
 * accompanied this code).
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    14
 *
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    18
 *
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    21
 * questions.
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    22
 *
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    23
 */
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49449
diff changeset
    25
#ifndef SHARE_PRIMS_WHITEBOX_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49449
diff changeset
    26
#define SHARE_PRIMS_WHITEBOX_HPP
12095
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    27
47659
a8e9aff89f7b 8189608: Remove duplicated jni.h
ihse
parents: 47216
diff changeset
    28
#include "jni.h"
12262
fb3b9fede660 7148488: Whitebox tests for the Diagnostic Framework Parser
nloodin
parents: 12095
diff changeset
    29
27917
c5937f7b4e8b 8064669: compiler/whitebox/AllocationCodeBlobTest.java crashes / asserts
iignatyev
parents: 27642
diff changeset
    30
#include "utilities/exceptions.hpp"
12262
fb3b9fede660 7148488: Whitebox tests for the Diagnostic Framework Parser
nloodin
parents: 12095
diff changeset
    31
#include "memory/allocation.hpp"
fb3b9fede660 7148488: Whitebox tests for the Diagnostic Framework Parser
nloodin
parents: 12095
diff changeset
    32
#include "oops/oopsHierarchy.hpp"
26844
80398753ed99 8057752: WhiteBox extension support for testing
sjohanss
parents: 25492
diff changeset
    33
#include "oops/symbol.hpp"
49449
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47659
diff changeset
    34
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47659
diff changeset
    35
#define WB_METHOD_DECLARE(result_type) extern "C" result_type JNICALL
12262
fb3b9fede660 7148488: Whitebox tests for the Diagnostic Framework Parser
nloodin
parents: 12095
diff changeset
    36
41084
fc5db29fa08e 8164086: Checked JNI pending exception check should be cleared when returning to Java frame
dsimms
parents: 38024
diff changeset
    37
// Unconditionally clear pedantic pending JNI checks
fc5db29fa08e 8164086: Checked JNI pending exception check should be cleared when returning to Java frame
dsimms
parents: 38024
diff changeset
    38
class ClearPendingJniExcCheck : public StackObj {
fc5db29fa08e 8164086: Checked JNI pending exception check should be cleared when returning to Java frame
dsimms
parents: 38024
diff changeset
    39
private:
fc5db29fa08e 8164086: Checked JNI pending exception check should be cleared when returning to Java frame
dsimms
parents: 38024
diff changeset
    40
  JavaThread* _thread;
fc5db29fa08e 8164086: Checked JNI pending exception check should be cleared when returning to Java frame
dsimms
parents: 38024
diff changeset
    41
public:
fc5db29fa08e 8164086: Checked JNI pending exception check should be cleared when returning to Java frame
dsimms
parents: 38024
diff changeset
    42
  ClearPendingJniExcCheck(JNIEnv* env) : _thread(JavaThread::thread_from_jni_environment(env)) {}
fc5db29fa08e 8164086: Checked JNI pending exception check should be cleared when returning to Java frame
dsimms
parents: 38024
diff changeset
    43
  ~ClearPendingJniExcCheck() {
fc5db29fa08e 8164086: Checked JNI pending exception check should be cleared when returning to Java frame
dsimms
parents: 38024
diff changeset
    44
    _thread->clear_pending_jni_exception_check();
fc5db29fa08e 8164086: Checked JNI pending exception check should be cleared when returning to Java frame
dsimms
parents: 38024
diff changeset
    45
  }
fc5db29fa08e 8164086: Checked JNI pending exception check should be cleared when returning to Java frame
dsimms
parents: 38024
diff changeset
    46
};
fc5db29fa08e 8164086: Checked JNI pending exception check should be cleared when returning to Java frame
dsimms
parents: 38024
diff changeset
    47
27642
8c9eff693145 8059624: Test task: WhiteBox API for testing segmented codecache feature
iignatyev
parents: 26844
diff changeset
    48
class CodeBlob;
8c9eff693145 8059624: Test task: WhiteBox API for testing segmented codecache feature
iignatyev
parents: 26844
diff changeset
    49
class CodeHeap;
27917
c5937f7b4e8b 8064669: compiler/whitebox/AllocationCodeBlobTest.java crashes / asserts
iignatyev
parents: 27642
diff changeset
    50
class JavaThread;
27642
8c9eff693145 8059624: Test task: WhiteBox API for testing segmented codecache feature
iignatyev
parents: 26844
diff changeset
    51
12095
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    52
class WhiteBox : public AllStatic {
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    53
 private:
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    54
  static bool _used;
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    55
 public:
27642
8c9eff693145 8059624: Test task: WhiteBox API for testing segmented codecache feature
iignatyev
parents: 26844
diff changeset
    56
  static volatile bool compilation_locked;
12095
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    57
  static bool used()     { return _used; }
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    58
  static void set_used() { _used = true; }
12262
fb3b9fede660 7148488: Whitebox tests for the Diagnostic Framework Parser
nloodin
parents: 12095
diff changeset
    59
  static int offset_for_field(const char* field_name, oop object,
fb3b9fede660 7148488: Whitebox tests for the Diagnostic Framework Parser
nloodin
parents: 12095
diff changeset
    60
    Symbol* signature_symbol);
fb3b9fede660 7148488: Whitebox tests for the Diagnostic Framework Parser
nloodin
parents: 12095
diff changeset
    61
  static const char* lookup_jstring(const char* field_name, oop object);
fb3b9fede660 7148488: Whitebox tests for the Diagnostic Framework Parser
nloodin
parents: 12095
diff changeset
    62
  static bool lookup_bool(const char* field_name, oop object);
27642
8c9eff693145 8059624: Test task: WhiteBox API for testing segmented codecache feature
iignatyev
parents: 26844
diff changeset
    63
  static int get_blob_type(const CodeBlob* code);
8c9eff693145 8059624: Test task: WhiteBox API for testing segmented codecache feature
iignatyev
parents: 26844
diff changeset
    64
  static CodeHeap* get_code_heap(int blob_type);
28042
40ce95bcdc78 8065134: Need WhiteBox::allocateCodeBlob(long, int) method to be implemented
iignatyev
parents: 27917
diff changeset
    65
  static CodeBlob* allocate_code_blob(int size, int blob_type);
25492
d27050bdfb04 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 25491
diff changeset
    66
  static int array_bytes_to_length(size_t bytes);
26844
80398753ed99 8057752: WhiteBox extension support for testing
sjohanss
parents: 25492
diff changeset
    67
  static void register_methods(JNIEnv* env, jclass wbclass, JavaThread* thread,
80398753ed99 8057752: WhiteBox extension support for testing
sjohanss
parents: 25492
diff changeset
    68
    JNINativeMethod* method_array, int method_count);
80398753ed99 8057752: WhiteBox extension support for testing
sjohanss
parents: 25492
diff changeset
    69
  static void register_extended(JNIEnv* env, jclass wbclass, JavaThread* thread);
38024
84095353e30f 8153514: Whitebox API should allow compilation of <clinit>
thartmann
parents: 30205
diff changeset
    70
  static bool compile_method(Method* method, int comp_level, int bci, Thread* THREAD);
12095
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    71
};
cc3d6f08a4c4 7148152: Add whitebox testing API to HotSpot
mgerdin
parents:
diff changeset
    72
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49449
diff changeset
    73
#endif // SHARE_PRIMS_WHITEBOX_HPP