Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/cpu/zero/vm/interpreterRT_zero.hpp
32285 views
/*1* Copyright (c) 2003, 2010, 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_VM_INTERPRETERRT_ZERO_HPP26#define CPU_ZERO_VM_INTERPRETERRT_ZERO_HPP2728#include "memory/allocation.hpp"2930class SignatureHandler {31public:32static SignatureHandler *from_handlerAddr(address handlerAddr) {33return (SignatureHandler *) handlerAddr;34}3536public:37ffi_cif* cif() const {38return (ffi_cif *) this;39}4041int argument_count() const {42return cif()->nargs;43}4445ffi_type** argument_types() const {46return (ffi_type**) (cif() + 1);47}4849ffi_type* argument_type(int i) const {50return argument_types()[i];51}5253ffi_type* result_type() const {54return *(argument_types() + argument_count());55}5657protected:58friend class InterpreterRuntime;59friend class SignatureHandlerLibrary;6061void finalize();62};6364class SignatureHandlerGeneratorBase : public NativeSignatureIterator {65private:66ffi_cif* _cif;6768protected:69SignatureHandlerGeneratorBase(methodHandle method, ffi_cif *cif)70: NativeSignatureIterator(method), _cif(cif) {71_cif->nargs = 0;72}7374ffi_cif *cif() const {75return _cif;76}7778public:79void generate(uint64_t fingerprint);8081private:82void pass_int();83void pass_long();84void pass_float();85void pass_double();86void pass_object();8788private:89void push(BasicType type);90virtual void push(intptr_t value) = 0;91};9293class SignatureHandlerGenerator : public SignatureHandlerGeneratorBase {94private:95CodeBuffer* _cb;9697public:98SignatureHandlerGenerator(methodHandle method, CodeBuffer* buffer)99: SignatureHandlerGeneratorBase(method, (ffi_cif *) buffer->insts_end()),100_cb(buffer) {101_cb->set_insts_end((address) (cif() + 1));102}103104private:105void push(intptr_t value) {106intptr_t *dst = (intptr_t *) _cb->insts_end();107_cb->set_insts_end((address) (dst + 1));108*dst = value;109}110};111112class SlowSignatureHandlerGenerator : public SignatureHandlerGeneratorBase {113private:114intptr_t *_dst;115116public:117SlowSignatureHandlerGenerator(methodHandle method, intptr_t* buf)118: SignatureHandlerGeneratorBase(method, (ffi_cif *) buf) {119_dst = (intptr_t *) (cif() + 1);120}121122private:123void push(intptr_t value) {124*(_dst++) = value;125}126127public:128SignatureHandler *handler() const {129return (SignatureHandler *) cif();130}131};132133#endif // CPU_ZERO_VM_INTERPRETERRT_ZERO_HPP134135136