Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/jfr/jni/jfrJavaCall.hpp
41149 views
1
/*
2
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*
23
*/
24
25
#ifndef SHARE_JFR_JNI_JFRJAVACALL_HPP
26
#define SHARE_JFR_JNI_JFRJAVACALL_HPP
27
28
#include "jni.h"
29
#include "jfr/utilities/jfrAllocation.hpp"
30
#include "utilities/exceptions.hpp"
31
#include "utilities/globalDefinitions.hpp"
32
33
class JavaCallArguments;
34
class JavaThread;
35
class JavaValue;
36
class Klass;
37
class Symbol;
38
39
class JfrJavaArguments : public StackObj {
40
friend class JfrJavaCall;
41
public:
42
JfrJavaArguments(JavaValue* result);
43
JfrJavaArguments(JavaValue* result, const char* klass_name, const char* name, const char* signature, TRAPS);
44
JfrJavaArguments(JavaValue* result, const Klass* klass, const Symbol* name, const Symbol* signature);
45
46
Klass* klass() const;
47
void set_klass(const char* klass_name, TRAPS);
48
void set_klass(const Klass* klass);
49
50
Symbol* name() const;
51
void set_name(const char* name);
52
void set_name(const Symbol* name);
53
54
Symbol* signature() const;
55
void set_signature(const char* signature);
56
void set_signature(const Symbol* signature);
57
58
int array_length() const;
59
void set_array_length(int length);
60
61
JavaValue* result() const;
62
63
bool has_receiver() const;
64
void set_receiver(const oop receiver);
65
void set_receiver(Handle receiver);
66
oop receiver() const;
67
68
// parameters
69
void push_oop(const oop obj);
70
void push_oop(Handle h_obj);
71
void push_jobject(jobject h);
72
void push_int(jint i);
73
void push_double(jdouble d);
74
void push_long(jlong l);
75
void push_float(jfloat f);
76
77
int length() const;
78
const JavaValue& param(int idx) const;
79
80
private:
81
class Parameters {
82
friend class JfrJavaArguments;
83
private:
84
enum { SIZE = 16};
85
JavaValue _storage[SIZE];
86
int _storage_index;
87
int _java_stack_slots;
88
89
Parameters();
90
NONCOPYABLE(Parameters);
91
92
void push(const JavaValue& value);
93
void push_large(const JavaValue& value);
94
95
void push_oop(const oop obj);
96
void push_oop(Handle h_obj);
97
void push_jobject(jobject h);
98
void push_jint(jint i);
99
void push_jdouble(jdouble d);
100
void push_jlong(jlong l);
101
void push_jfloat(jfloat f);
102
103
bool has_receiver() const;
104
void set_receiver(const oop receiver);
105
void set_receiver(Handle receiver);
106
oop receiver() const;
107
108
int length() const;
109
int java_stack_slots() const;
110
111
void copy(JavaCallArguments& args, TRAPS) const;
112
const JavaValue& values(int idx) const;
113
};
114
115
Parameters _params;
116
const JavaValue* const _result;
117
const Klass* _klass;
118
const Symbol* _name;
119
const Symbol* _signature;
120
int _array_length;
121
122
int java_call_arg_slots() const;
123
void copy(JavaCallArguments& args, TRAPS);
124
};
125
126
class JfrJavaCall : public AllStatic {
127
friend class JfrJavaSupport;
128
private:
129
static void call_static(JfrJavaArguments* args, TRAPS);
130
static void call_special(JfrJavaArguments* args, TRAPS);
131
static void call_virtual(JfrJavaArguments* args, TRAPS);
132
};
133
134
#endif // SHARE_JFR_JNI_JFRJAVACALL_HPP
135
136