< prev index next >

src/cpu/arm/vm/sharedRuntime_arm.cpp

Print this page


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


1715   __ str_32(ZR, Address(LR, JNIHandleBlock::top_offset_in_bytes()));
1716   if (CheckJNICalls) {
1717     __ str(ZR, Address(Rthread, JavaThread::pending_jni_exception_check_fn_offset()));
1718   }
1719 
1720 
1721   switch (ret_type) {
1722   case T_BOOLEAN:
1723     __ tst(R0, 0xff);
1724     __ cset(R0, ne);
1725     break;
1726   case T_CHAR   : __ zero_extend(R0, R0, 16);  break;
1727   case T_BYTE   : __ sign_extend(R0, R0,  8);  break;
1728   case T_SHORT  : __ sign_extend(R0, R0, 16);  break;
1729   case T_INT    : // fall through
1730   case T_LONG   : // fall through
1731   case T_VOID   : // fall through
1732   case T_FLOAT  : // fall through
1733   case T_DOUBLE : /* nothing to do */          break;
1734   case T_OBJECT : // fall through
1735   case T_ARRAY  : break; // See JNIHandles::resolve below







1736   default:
1737     ShouldNotReachHere();
1738   }
1739 #else
1740   __ str_32(Rtemp, Address(LR, JNIHandleBlock::top_offset_in_bytes()));
1741   if (CheckJNICalls) {
1742     __ str(__ zero_register(Rtemp), Address(Rthread, JavaThread::pending_jni_exception_check_fn_offset()));
1743   }
1744 #endif // AARCH64
1745 
1746   // Unbox oop result, e.g. JNIHandles::resolve value in R0.
1747   if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
1748     __ resolve_jobject(R0,      // value
1749                        Rtemp,   // tmp1
1750                        R1_tmp); // tmp2
1751   }

1752 
1753   // Any exception pending?
1754   __ ldr(Rtemp, Address(Rthread, Thread::pending_exception_offset()));
1755   __ mov(SP, FP);
1756 
1757 #ifdef AARCH64
1758   Label except;
1759   __ cbnz(Rtemp, except);
1760   __ raw_pop(FP, LR);
1761   __ ret();
1762 
1763   __ bind(except);
1764   // Pop the frame and forward the exception. Rexception_pc contains return address.
1765   __ raw_pop(FP, Rexception_pc);
1766 #else
1767   __ cmp(Rtemp, 0);
1768   // Pop the frame and return if no exception pending
1769   __ pop(RegisterSet(FP) | RegisterSet(PC), eq);
1770   // Pop the frame and forward the exception. Rexception_pc contains return address.
1771   __ ldr(FP, Address(SP, wordSize, post_indexed), ne);


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


1715   __ str_32(ZR, Address(LR, JNIHandleBlock::top_offset_in_bytes()));
1716   if (CheckJNICalls) {
1717     __ str(ZR, Address(Rthread, JavaThread::pending_jni_exception_check_fn_offset()));
1718   }
1719 
1720 
1721   switch (ret_type) {
1722   case T_BOOLEAN:
1723     __ tst(R0, 0xff);
1724     __ cset(R0, ne);
1725     break;
1726   case T_CHAR   : __ zero_extend(R0, R0, 16);  break;
1727   case T_BYTE   : __ sign_extend(R0, R0,  8);  break;
1728   case T_SHORT  : __ sign_extend(R0, R0, 16);  break;
1729   case T_INT    : // fall through
1730   case T_LONG   : // fall through
1731   case T_VOID   : // fall through
1732   case T_FLOAT  : // fall through
1733   case T_DOUBLE : /* nothing to do */          break;
1734   case T_OBJECT : // fall through
1735   case T_ARRAY  : {
1736     Label L;
1737     __ cbz(R0, L);
1738     __ ldr(R0, Address(R0));
1739     __ verify_oop(R0);
1740     __ bind(L);
1741     break;
1742   }
1743   default:
1744     ShouldNotReachHere();
1745   }
1746 #else
1747   __ str_32(Rtemp, Address(LR, JNIHandleBlock::top_offset_in_bytes()));
1748   if (CheckJNICalls) {
1749     __ str(__ zero_register(Rtemp), Address(Rthread, JavaThread::pending_jni_exception_check_fn_offset()));
1750   }

1751 
1752   // Unhandle the result
1753   if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
1754     __ cmp(R0, 0);
1755     __ ldr(R0, Address(R0), ne);

1756   }
1757 #endif // AARCH64
1758 
1759   // Any exception pending?
1760   __ ldr(Rtemp, Address(Rthread, Thread::pending_exception_offset()));
1761   __ mov(SP, FP);
1762 
1763 #ifdef AARCH64
1764   Label except;
1765   __ cbnz(Rtemp, except);
1766   __ raw_pop(FP, LR);
1767   __ ret();
1768 
1769   __ bind(except);
1770   // Pop the frame and forward the exception. Rexception_pc contains return address.
1771   __ raw_pop(FP, Rexception_pc);
1772 #else
1773   __ cmp(Rtemp, 0);
1774   // Pop the frame and return if no exception pending
1775   __ pop(RegisterSet(FP) | RegisterSet(PC), eq);
1776   // Pop the frame and forward the exception. Rexception_pc contains return address.
1777   __ ldr(FP, Address(SP, wordSize, post_indexed), ne);


< prev index next >