1 /*
2 * Copyright (c) 1997, 2013, 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 *
121
122 JavaCallArguments(int max_size) {
123 if (max_size > _default_size) {
124 _value = NEW_RESOURCE_ARRAY(intptr_t, max_size + 1);
125 _is_oop = NEW_RESOURCE_ARRAY(bool, max_size + 1);
126
127 // Reserve room for potential receiver in value and is_oop
128 _value++; _is_oop++;
129
130 _max_size = max_size;
131 _size = 0;
132 _start_at_zero = false;
133 } else {
134 initialize();
135 }
136 }
137
138 inline void push_oop(Handle h) { _is_oop[_size] = true;
139 JNITypes::put_obj((oop)h.raw_value(), _value, _size); }
140
141 inline void push_int(int i) { _is_oop[_size] = false;
142 JNITypes::put_int(i, _value, _size); }
143
144 inline void push_double(double d) { _is_oop[_size] = false; _is_oop[_size + 1] = false;
145 JNITypes::put_double(d, _value, _size); }
146
147 inline void push_long(jlong l) { _is_oop[_size] = false; _is_oop[_size + 1] = false;
148 JNITypes::put_long(l, _value, _size); }
149
150 inline void push_float(float f) { _is_oop[_size] = false;
151 JNITypes::put_float(f, _value, _size); }
152
153 // receiver
154 Handle receiver() {
155 assert(_size > 0, "must at least be one argument");
156 assert(_is_oop[0], "first argument must be an oop");
157 assert(_value[0] != 0, "receiver must be not-null");
158 return Handle((oop*)_value[0], false);
159 }
160
|
1 /*
2 * Copyright (c) 1997, 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 *
121
122 JavaCallArguments(int max_size) {
123 if (max_size > _default_size) {
124 _value = NEW_RESOURCE_ARRAY(intptr_t, max_size + 1);
125 _is_oop = NEW_RESOURCE_ARRAY(bool, max_size + 1);
126
127 // Reserve room for potential receiver in value and is_oop
128 _value++; _is_oop++;
129
130 _max_size = max_size;
131 _size = 0;
132 _start_at_zero = false;
133 } else {
134 initialize();
135 }
136 }
137
138 inline void push_oop(Handle h) { _is_oop[_size] = true;
139 JNITypes::put_obj((oop)h.raw_value(), _value, _size); }
140
141 inline void push_jobject(jobject h) { _is_oop[_size] = true;
142 JNITypes::put_obj((oop)h, _value, _size); }
143
144 inline void push_int(int i) { _is_oop[_size] = false;
145 JNITypes::put_int(i, _value, _size); }
146
147 inline void push_double(double d) { _is_oop[_size] = false; _is_oop[_size + 1] = false;
148 JNITypes::put_double(d, _value, _size); }
149
150 inline void push_long(jlong l) { _is_oop[_size] = false; _is_oop[_size + 1] = false;
151 JNITypes::put_long(l, _value, _size); }
152
153 inline void push_float(float f) { _is_oop[_size] = false;
154 JNITypes::put_float(f, _value, _size); }
155
156 // receiver
157 Handle receiver() {
158 assert(_size > 0, "must at least be one argument");
159 assert(_is_oop[0], "first argument must be an oop");
160 assert(_value[0] != 0, "receiver must be not-null");
161 return Handle((oop*)_value[0], false);
162 }
163
|