Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/cpu/zero/abstractInterpreter_zero.cpp
40931 views
1
/*
2
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
3
* Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
4
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
*
6
* This code is free software; you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License version 2 only, as
8
* published by the Free Software Foundation.
9
*
10
* This code is distributed in the hope that it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13
* version 2 for more details (a copy is included in the LICENSE file that
14
* accompanied this code).
15
*
16
* You should have received a copy of the GNU General Public License version
17
* 2 along with this work; if not, write to the Free Software Foundation,
18
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
*
20
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21
* or visit www.oracle.com if you need additional information or have any
22
* questions.
23
*
24
*/
25
26
#include "precompiled.hpp"
27
#include "interpreter/zero/bytecodeInterpreter.hpp"
28
#include "interpreter/zero/zeroInterpreter.hpp"
29
#include "runtime/frame.inline.hpp"
30
#include "utilities/globalDefinitions.hpp"
31
32
int AbstractInterpreter::BasicType_as_index(BasicType type) {
33
int i = 0;
34
switch (type) {
35
case T_BOOLEAN: i = 0; break;
36
case T_CHAR : i = 1; break;
37
case T_BYTE : i = 2; break;
38
case T_SHORT : i = 3; break;
39
case T_INT : i = 4; break;
40
case T_LONG : i = 5; break;
41
case T_VOID : i = 6; break;
42
case T_FLOAT : i = 7; break;
43
case T_DOUBLE : i = 8; break;
44
case T_OBJECT : i = 9; break;
45
case T_ARRAY : i = 9; break;
46
default : ShouldNotReachHere();
47
}
48
assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers,
49
"index out of bounds");
50
return i;
51
}
52
53
// Deoptimization helpers
54
55
int AbstractInterpreter::size_activation(int max_stack,
56
int tempcount,
57
int extra_args,
58
int moncount,
59
int callee_param_count,
60
int callee_locals,
61
bool is_top_frame) {
62
int header_words = InterpreterFrame::header_words;
63
int monitor_words = moncount * frame::interpreter_frame_monitor_size();
64
int stack_words = is_top_frame ? max_stack : tempcount;
65
int callee_extra_locals = callee_locals - callee_param_count;
66
67
return header_words + monitor_words + stack_words + callee_extra_locals;
68
}
69
70
void AbstractInterpreter::layout_activation(Method* method,
71
int tempcount,
72
int popframe_extra_args,
73
int moncount,
74
int caller_actual_parameters,
75
int callee_param_count,
76
int callee_locals,
77
frame* caller,
78
frame* interpreter_frame,
79
bool is_top_frame,
80
bool is_bottom_frame) {
81
assert(popframe_extra_args == 0, "what to do?");
82
assert(!is_top_frame || (!callee_locals && !callee_param_count),
83
"top frame should have no caller");
84
85
// This code must exactly match what InterpreterFrame::build
86
// does (the full InterpreterFrame::build, that is, not the
87
// one that creates empty frames for the deoptimizer).
88
//
89
// interpreter_frame will be filled in. It's size is determined by
90
// a previous call to the size_activation() method,
91
//
92
// Note that tempcount is the current size of the expression
93
// stack. For top most frames we will allocate a full sized
94
// expression stack and not the trimmed version that non-top
95
// frames have.
96
97
int monitor_words = moncount * frame::interpreter_frame_monitor_size();
98
intptr_t *locals = interpreter_frame->fp() + method->max_locals();
99
interpreterState istate = interpreter_frame->get_interpreterState();
100
intptr_t *monitor_base = (intptr_t*) istate;
101
intptr_t *stack_base = monitor_base - monitor_words;
102
intptr_t *stack = stack_base - tempcount - 1;
103
104
BytecodeInterpreter::layout_interpreterState(istate,
105
caller,
106
NULL,
107
method,
108
locals,
109
stack,
110
stack_base,
111
monitor_base,
112
NULL,
113
is_top_frame);
114
}
115
116
// Helper for (runtime) stack overflow checks
117
118
int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
119
return 0;
120
}
121
122