< prev index next >

src/cpu/x86/vm/templateInterpreter_x86_64.cpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 2016, 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  *


1255     __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans)));
1256     __ mov(rsp, r12); // restore sp
1257     __ reinit_heapbase();
1258     __ bind(Continue);
1259   }
1260 
1261   // change thread state
1262   __ movl(Address(r15_thread, JavaThread::thread_state_offset()), _thread_in_Java);
1263 
1264   // reset_last_Java_frame
1265   __ reset_last_Java_frame(r15_thread, true);
1266 
1267   // reset handle block
1268   __ movptr(t, Address(r15_thread, JavaThread::active_handles_offset()));
1269   __ movl(Address(t, JNIHandleBlock::top_offset_in_bytes()), (int32_t)NULL_WORD);
1270 
1271   // If result is an oop unbox and store it in frame where gc will see it
1272   // and result handler will pick it up
1273 
1274   {
1275     Label no_oop, store_result;
1276     __ lea(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT)));
1277     __ cmpptr(t, Address(rbp, frame::interpreter_frame_result_handler_offset*wordSize));
1278     __ jcc(Assembler::notEqual, no_oop);
1279     // retrieve result
1280     __ pop(ltos);
1281     __ testptr(rax, rax);
1282     __ jcc(Assembler::zero, store_result);
1283     __ movptr(rax, Address(rax, 0));
1284     __ bind(store_result);
1285     __ movptr(Address(rbp, frame::interpreter_frame_oop_temp_offset*wordSize), rax);
1286     // keep stack depth as expected by pushing oop which will eventually be discarde
1287     __ push(ltos);
1288     __ bind(no_oop);
1289   }
1290 
1291 
1292   {
1293     Label no_reguard;
1294     __ cmpl(Address(r15_thread, JavaThread::stack_guard_state_offset()),
1295             JavaThread::stack_guard_yellow_disabled);
1296     __ jcc(Assembler::notEqual, no_reguard);
1297 
1298     __ pusha(); // XXX only save smashed registers
1299     __ mov(r12, rsp); // remember sp (can only use r12 if not using call_VM)
1300     __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
1301     __ andptr(rsp, -16); // align stack as required by ABI
1302     __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages)));
1303     __ mov(rsp, r12); // restore sp
1304     __ popa(); // XXX only restore smashed registers


   1 /*
   2  * Copyright (c) 2003, 2017, 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  *


1255     __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans)));
1256     __ mov(rsp, r12); // restore sp
1257     __ reinit_heapbase();
1258     __ bind(Continue);
1259   }
1260 
1261   // change thread state
1262   __ movl(Address(r15_thread, JavaThread::thread_state_offset()), _thread_in_Java);
1263 
1264   // reset_last_Java_frame
1265   __ reset_last_Java_frame(r15_thread, true);
1266 
1267   // reset handle block
1268   __ movptr(t, Address(r15_thread, JavaThread::active_handles_offset()));
1269   __ movl(Address(t, JNIHandleBlock::top_offset_in_bytes()), (int32_t)NULL_WORD);
1270 
1271   // If result is an oop unbox and store it in frame where gc will see it
1272   // and result handler will pick it up
1273 
1274   {
1275     Label no_oop;
1276     __ lea(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT)));
1277     __ cmpptr(t, Address(rbp, frame::interpreter_frame_result_handler_offset*wordSize));
1278     __ jcc(Assembler::notEqual, no_oop);
1279     // retrieve result
1280     __ pop(ltos);
1281     // Unbox oop result, e.g. JNIHandles::resolve value.
1282     __ resolve_jobject(rax /* value */,
1283                        r15_thread /* thread */,
1284                        t /* tmp */);
1285     __ movptr(Address(rbp, frame::interpreter_frame_oop_temp_offset*wordSize), rax);
1286     // keep stack depth as expected by pushing oop which will eventually be discarde
1287     __ push(ltos);
1288     __ bind(no_oop);
1289   }
1290 
1291 
1292   {
1293     Label no_reguard;
1294     __ cmpl(Address(r15_thread, JavaThread::stack_guard_state_offset()),
1295             JavaThread::stack_guard_yellow_disabled);
1296     __ jcc(Assembler::notEqual, no_reguard);
1297 
1298     __ pusha(); // XXX only save smashed registers
1299     __ mov(r12, rsp); // remember sp (can only use r12 if not using call_VM)
1300     __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
1301     __ andptr(rsp, -16); // align stack as required by ABI
1302     __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages)));
1303     __ mov(rsp, r12); // restore sp
1304     __ popa(); // XXX only restore smashed registers


< prev index next >