Path: blob/master/src/hotspot/cpu/zero/interpreterRT_zero.hpp
40931 views
/*1* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.2* Copyright 2007, 2008 Red Hat, Inc.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 it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 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 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#ifndef CPU_ZERO_INTERPRETERRT_ZERO_HPP26#define CPU_ZERO_INTERPRETERRT_ZERO_HPP2728// This is included in the middle of class Interpreter.29// Do not include files here.303132class SignatureHandler {33public:34static SignatureHandler *from_handlerAddr(address handlerAddr) {35return (SignatureHandler *) handlerAddr;36}3738public:39ffi_cif* cif() const {40return (ffi_cif *) this;41}4243int argument_count() const {44return cif()->nargs;45}4647ffi_type** argument_types() const {48return (ffi_type**) (cif() + 1);49}5051ffi_type* argument_type(int i) const {52return argument_types()[i];53}5455ffi_type* result_type() const {56return *(argument_types() + argument_count());57}5859protected:60friend class InterpreterRuntime;61friend class SignatureHandlerLibrary;6263void finalize();64};6566class SignatureHandlerGeneratorBase : public NativeSignatureIterator {67private:68ffi_cif* _cif;6970protected:71SignatureHandlerGeneratorBase(const methodHandle& method, ffi_cif *cif)72: NativeSignatureIterator(method), _cif(cif) {73_cif->nargs = 0;74}7576ffi_cif *cif() const {77return _cif;78}7980public:81void generate(uint64_t fingerprint);8283private:84void pass_int();85void pass_long();86void pass_float();87void pass_double();88void pass_object();8990private:91void push(BasicType type);92virtual void push(intptr_t value) = 0;93};9495class SignatureHandlerGenerator : public SignatureHandlerGeneratorBase {96private:97CodeBuffer* _cb;9899public:100SignatureHandlerGenerator(const methodHandle& method, CodeBuffer* buffer);101102private:103void push(intptr_t value);104};105106class SlowSignatureHandlerGenerator : public SignatureHandlerGeneratorBase {107private:108intptr_t *_dst;109110public:111SlowSignatureHandlerGenerator(const methodHandle& method, intptr_t* buf)112: SignatureHandlerGeneratorBase(method, (ffi_cif *) buf) {113_dst = (intptr_t *) (cif() + 1);114}115116private:117void push(intptr_t value) {118*(_dst++) = value;119}120121public:122SignatureHandler *handler() const {123return (SignatureHandler *) cif();124}125};126127#endif // CPU_ZERO_INTERPRETERRT_ZERO_HPP128129130