1 /*
2 * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2012, 2014 SAP AG. 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 *
173 BasicType frame::interpreter_frame_result(oop* oop_result, jvalue* value_result) {
174 assert(is_interpreted_frame(), "interpreted frame expected");
175 Method* method = interpreter_frame_method();
176 BasicType type = method->result_type();
177
178 if (method->is_native()) {
179 // Prior to calling into the runtime to notify the method exit the possible
180 // result value is saved into the interpreter frame.
181 #ifdef CC_INTERP
182 interpreterState istate = get_interpreterState();
183 address lresult = (address)istate + in_bytes(BytecodeInterpreter::native_lresult_offset());
184 address fresult = (address)istate + in_bytes(BytecodeInterpreter::native_fresult_offset());
185 #else
186 address lresult = (address)&(get_ijava_state()->lresult);
187 address fresult = (address)&(get_ijava_state()->fresult);
188 #endif
189
190 switch (method->result_type()) {
191 case T_OBJECT:
192 case T_ARRAY: {
193 oop* obj_p = *(oop**)lresult;
194 oop obj = (obj_p == NULL) ? (oop)NULL : *obj_p;
195 assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check");
196 *oop_result = obj;
197 break;
198 }
199 // We use std/stfd to store the values.
200 case T_BOOLEAN : value_result->z = (jboolean) *(unsigned long*)lresult; break;
201 case T_INT : value_result->i = (jint) *(long*)lresult; break;
202 case T_CHAR : value_result->c = (jchar) *(unsigned long*)lresult; break;
203 case T_SHORT : value_result->s = (jshort) *(long*)lresult; break;
204 case T_BYTE : value_result->z = (jbyte) *(long*)lresult; break;
205 case T_LONG : value_result->j = (jlong) *(long*)lresult; break;
206 case T_FLOAT : value_result->f = (jfloat) *(double*)fresult; break;
207 case T_DOUBLE : value_result->d = (jdouble) *(double*)fresult; break;
208 case T_VOID : /* Nothing to do */ break;
209 default : ShouldNotReachHere();
210 }
211 } else {
212 intptr_t* tos_addr = interpreter_frame_tos_address();
213 switch (method->result_type()) {
214 case T_OBJECT:
215 case T_ARRAY: {
216 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 AG. 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 *
173 BasicType frame::interpreter_frame_result(oop* oop_result, jvalue* value_result) {
174 assert(is_interpreted_frame(), "interpreted frame expected");
175 Method* method = interpreter_frame_method();
176 BasicType type = method->result_type();
177
178 if (method->is_native()) {
179 // Prior to calling into the runtime to notify the method exit the possible
180 // result value is saved into the interpreter frame.
181 #ifdef CC_INTERP
182 interpreterState istate = get_interpreterState();
183 address lresult = (address)istate + in_bytes(BytecodeInterpreter::native_lresult_offset());
184 address fresult = (address)istate + in_bytes(BytecodeInterpreter::native_fresult_offset());
185 #else
186 address lresult = (address)&(get_ijava_state()->lresult);
187 address fresult = (address)&(get_ijava_state()->fresult);
188 #endif
189
190 switch (method->result_type()) {
191 case T_OBJECT:
192 case T_ARRAY: {
193 *oop_result = JNIHandles::resolve(*(jobject*)lresult);
194 break;
195 }
196 // We use std/stfd to store the values.
197 case T_BOOLEAN : value_result->z = (jboolean) *(unsigned long*)lresult; break;
198 case T_INT : value_result->i = (jint) *(long*)lresult; break;
199 case T_CHAR : value_result->c = (jchar) *(unsigned long*)lresult; break;
200 case T_SHORT : value_result->s = (jshort) *(long*)lresult; break;
201 case T_BYTE : value_result->z = (jbyte) *(long*)lresult; break;
202 case T_LONG : value_result->j = (jlong) *(long*)lresult; break;
203 case T_FLOAT : value_result->f = (jfloat) *(double*)fresult; break;
204 case T_DOUBLE : value_result->d = (jdouble) *(double*)fresult; break;
205 case T_VOID : /* Nothing to do */ break;
206 default : ShouldNotReachHere();
207 }
208 } else {
209 intptr_t* tos_addr = interpreter_frame_tos_address();
210 switch (method->result_type()) {
211 case T_OBJECT:
212 case T_ARRAY: {
213 oop obj = *(oop*)tos_addr;
|