< prev index next >

src/hotspot/cpu/zero/interpreterRT_zero.cpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 2007, 2008, 2010 Red Hat, Inc.
   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.


 124   pass_object();
 125   if (method()->is_static())
 126     pass_object();
 127   iterate(fingerprint);
 128 
 129   // Tack on the result type
 130   push(method()->result_type());
 131 }
 132 
 133 void InterpreterRuntime::SignatureHandler::finalize() {
 134   ffi_status status =
 135     ffi_prep_cif(cif(),
 136                  FFI_DEFAULT_ABI,
 137                  argument_count(),
 138                  result_type(),
 139                  argument_types());
 140 
 141   assert(status == FFI_OK, "should be");
 142 }
 143 
 144 JRT_ENTRY(address,
 145           InterpreterRuntime::slow_signature_handler(JavaThread* thread,
 146                                                      Method*     method,
 147                                                      intptr_t*   unused1,
 148                                                      intptr_t*   unused2))
 149   ZeroStack *stack = thread->zero_stack();
 150 
 151   int required_words =
 152     (align_up(sizeof(ffi_cif), wordSize) >> LogBytesPerWord) +
 153     (method->is_static() ? 2 : 1) + method->size_of_parameters() + 1;
 154 
 155   stack->overflow_check(required_words, CHECK_NULL);
 156 
 157   intptr_t *buf = (intptr_t *) stack->alloc(required_words * wordSize);
 158   SlowSignatureHandlerGenerator sshg(methodHandle(thread, method), buf);
 159   sshg.generate((uint64_t)CONST64(-1));
 160 
 161   SignatureHandler *handler = sshg.handler();
 162   handler->finalize();
 163 
 164   return (address) handler;
 165 JRT_END
 166 
 167 void SignatureHandlerLibrary::pd_set_handler(address handlerAddr) {
 168   InterpreterRuntime::SignatureHandler *handler =
 169     InterpreterRuntime::SignatureHandler::from_handlerAddr(handlerAddr);
 170 
 171   handler->finalize();
 172 }
   1 /*
   2  * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 2007, 2008, 2010 Red Hat, Inc.
   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.


 124   pass_object();
 125   if (method()->is_static())
 126     pass_object();
 127   iterate(fingerprint);
 128 
 129   // Tack on the result type
 130   push(method()->result_type());
 131 }
 132 
 133 void InterpreterRuntime::SignatureHandler::finalize() {
 134   ffi_status status =
 135     ffi_prep_cif(cif(),
 136                  FFI_DEFAULT_ABI,
 137                  argument_count(),
 138                  result_type(),
 139                  argument_types());
 140 
 141   assert(status == FFI_OK, "should be");
 142 }
 143 
 144 IRT_ENTRY(address,
 145           InterpreterRuntime::slow_signature_handler(JavaThread* thread,
 146                                                      Method*     method,
 147                                                      intptr_t*   unused1,
 148                                                      intptr_t*   unused2))
 149   ZeroStack *stack = thread->zero_stack();
 150 
 151   int required_words =
 152     (align_up(sizeof(ffi_cif), wordSize) >> LogBytesPerWord) +
 153     (method->is_static() ? 2 : 1) + method->size_of_parameters() + 1;
 154 
 155   stack->overflow_check(required_words, CHECK_NULL);
 156 
 157   intptr_t *buf = (intptr_t *) stack->alloc(required_words * wordSize);
 158   SlowSignatureHandlerGenerator sshg(methodHandle(thread, method), buf);
 159   sshg.generate((uint64_t)CONST64(-1));
 160 
 161   SignatureHandler *handler = sshg.handler();
 162   handler->finalize();
 163 
 164   return (address) handler;
 165 IRT_END
 166 
 167 void SignatureHandlerLibrary::pd_set_handler(address handlerAddr) {
 168   InterpreterRuntime::SignatureHandler *handler =
 169     InterpreterRuntime::SignatureHandler::from_handlerAddr(handlerAddr);
 170 
 171   handler->finalize();
 172 }
< prev index next >