1 /*
2 * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 2015 SAP SE. All rights reserved.
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 *
154 bool frame::is_interpreted_frame_valid(JavaThread* thread) const {
155 // Is there anything to do?
156 assert(is_interpreted_frame(), "Not an interpreted frame");
157 return true;
158 }
159
160 BasicType frame::interpreter_frame_result(oop* oop_result, jvalue* value_result) {
161 assert(is_interpreted_frame(), "interpreted frame expected");
162 Method* method = interpreter_frame_method();
163 BasicType type = method->result_type();
164
165 if (method->is_native()) {
166 // Prior to calling into the runtime to notify the method exit the possible
167 // result value is saved into the interpreter frame.
168 address lresult = (address)&(get_ijava_state()->lresult);
169 address fresult = (address)&(get_ijava_state()->fresult);
170
171 switch (method->result_type()) {
172 case T_OBJECT:
173 case T_ARRAY: {
174 oop* obj_p = *(oop**)lresult;
175 oop obj = (obj_p == NULL) ? (oop)NULL : *obj_p;
176 assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check");
177 *oop_result = obj;
178 break;
179 }
180 // We use std/stfd to store the values.
181 case T_BOOLEAN : value_result->z = (jboolean) *(unsigned long*)lresult; break;
182 case T_INT : value_result->i = (jint) *(long*)lresult; break;
183 case T_CHAR : value_result->c = (jchar) *(unsigned long*)lresult; break;
184 case T_SHORT : value_result->s = (jshort) *(long*)lresult; break;
185 case T_BYTE : value_result->z = (jbyte) *(long*)lresult; break;
186 case T_LONG : value_result->j = (jlong) *(long*)lresult; break;
187 case T_FLOAT : value_result->f = (jfloat) *(double*)fresult; break;
188 case T_DOUBLE : value_result->d = (jdouble) *(double*)fresult; break;
189 case T_VOID : /* Nothing to do */ break;
190 default : ShouldNotReachHere();
191 }
192 } else {
193 intptr_t* tos_addr = interpreter_frame_tos_address();
194 switch (method->result_type()) {
195 case T_OBJECT:
196 case T_ARRAY: {
197 oop obj = *(oop*)tos_addr;
|
1 /*
2 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 2017 SAP SE. All rights reserved.
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 *
154 bool frame::is_interpreted_frame_valid(JavaThread* thread) const {
155 // Is there anything to do?
156 assert(is_interpreted_frame(), "Not an interpreted frame");
157 return true;
158 }
159
160 BasicType frame::interpreter_frame_result(oop* oop_result, jvalue* value_result) {
161 assert(is_interpreted_frame(), "interpreted frame expected");
162 Method* method = interpreter_frame_method();
163 BasicType type = method->result_type();
164
165 if (method->is_native()) {
166 // Prior to calling into the runtime to notify the method exit the possible
167 // result value is saved into the interpreter frame.
168 address lresult = (address)&(get_ijava_state()->lresult);
169 address fresult = (address)&(get_ijava_state()->fresult);
170
171 switch (method->result_type()) {
172 case T_OBJECT:
173 case T_ARRAY: {
174 *oop_result = JNIHandles::resolve(*(jobject*)lresult);
175 break;
176 }
177 // We use std/stfd to store the values.
178 case T_BOOLEAN : value_result->z = (jboolean) *(unsigned long*)lresult; break;
179 case T_INT : value_result->i = (jint) *(long*)lresult; break;
180 case T_CHAR : value_result->c = (jchar) *(unsigned long*)lresult; break;
181 case T_SHORT : value_result->s = (jshort) *(long*)lresult; break;
182 case T_BYTE : value_result->z = (jbyte) *(long*)lresult; break;
183 case T_LONG : value_result->j = (jlong) *(long*)lresult; break;
184 case T_FLOAT : value_result->f = (jfloat) *(double*)fresult; break;
185 case T_DOUBLE : value_result->d = (jdouble) *(double*)fresult; break;
186 case T_VOID : /* Nothing to do */ break;
187 default : ShouldNotReachHere();
188 }
189 } else {
190 intptr_t* tos_addr = interpreter_frame_tos_address();
191 switch (method->result_type()) {
192 case T_OBJECT:
193 case T_ARRAY: {
194 oop obj = *(oop*)tos_addr;
|