Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/ci/ciNativeEntryPoint.cpp
40931 views
1
/*
2
* Copyright (c) 2020, 2021, 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
#include "precompiled.hpp"
26
#include "ci/ciClassList.hpp"
27
#include "ci/ciNativeEntryPoint.hpp"
28
#include "ci/ciUtilities.inline.hpp"
29
#include "ci/ciArray.hpp"
30
#include "classfile/javaClasses.hpp"
31
#include "oops/oop.inline.hpp"
32
#include "memory/allocation.hpp"
33
34
VMReg* getVMRegArray(ciArray* array) {
35
assert(array->element_basic_type() == T_LONG, "Unexpected type");
36
37
VMReg* out = NEW_ARENA_ARRAY(CURRENT_ENV->arena(), VMReg, array->length());
38
39
for (int i = 0; i < array->length(); i++) {
40
ciConstant con = array->element_value(i);
41
VMReg reg = VMRegImpl::as_VMReg(con.as_long());
42
out[i] = reg;
43
}
44
45
return out;
46
}
47
48
ciNativeEntryPoint::ciNativeEntryPoint(instanceHandle h_i) : ciInstance(h_i), _name(NULL) {
49
// Copy name
50
oop name_str = jdk_internal_invoke_NativeEntryPoint::name(get_oop());
51
if (name_str != NULL) {
52
char* temp_name = java_lang_String::as_quoted_ascii(name_str);
53
size_t len = strlen(temp_name) + 1;
54
char* name = (char*)CURRENT_ENV->arena()->Amalloc(len);
55
strncpy(name, temp_name, len);
56
_name = name;
57
}
58
59
_arg_moves = getVMRegArray(CURRENT_ENV->get_object(jdk_internal_invoke_NativeEntryPoint::argMoves(get_oop()))->as_array());
60
_ret_moves = getVMRegArray(CURRENT_ENV->get_object(jdk_internal_invoke_NativeEntryPoint::returnMoves(get_oop()))->as_array());
61
}
62
63
jint ciNativeEntryPoint::shadow_space() const {
64
VM_ENTRY_MARK;
65
return jdk_internal_invoke_NativeEntryPoint::shadow_space(get_oop());
66
}
67
68
VMReg* ciNativeEntryPoint::argMoves() const {
69
return _arg_moves;
70
}
71
72
VMReg* ciNativeEntryPoint::returnMoves() const {
73
return _ret_moves;
74
}
75
76
jboolean ciNativeEntryPoint::need_transition() const {
77
VM_ENTRY_MARK;
78
return jdk_internal_invoke_NativeEntryPoint::need_transition(get_oop());
79
}
80
81
ciMethodType* ciNativeEntryPoint::method_type() const {
82
VM_ENTRY_MARK;
83
return CURRENT_ENV->get_object(jdk_internal_invoke_NativeEntryPoint::method_type(get_oop()))->as_method_type();
84
}
85
86
const char* ciNativeEntryPoint::name() {
87
return _name;
88
}
89
90