1 /*
2 * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2007, 2008 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.
23 *
24 */
25
26 class SignatureHandler {
27 public:
28 static SignatureHandler *from_handlerAddr(address handlerAddr) {
29 return (SignatureHandler *) handlerAddr;
30 }
31
32 public:
33 ffi_cif* cif() const {
34 return (ffi_cif *) this;
35 }
36
37 int argument_count() const {
38 return cif()->nargs;
39 }
40
41 ffi_type** argument_types() const {
42 return (ffi_type**) (cif() + 1);
43 }
44
45 ffi_type* argument_type(int i) const {
108 class SlowSignatureHandlerGenerator : public SignatureHandlerGeneratorBase {
109 private:
110 intptr_t *_dst;
111
112 public:
113 SlowSignatureHandlerGenerator(methodHandle method, intptr_t* buf)
114 : SignatureHandlerGeneratorBase(method, (ffi_cif *) buf) {
115 _dst = (intptr_t *) (cif() + 1);
116 }
117
118 private:
119 void push(intptr_t value) {
120 *(_dst++) = value;
121 }
122
123 public:
124 SignatureHandler *handler() const {
125 return (SignatureHandler *) cif();
126 }
127 };
|
1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2007, 2008 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.
23 *
24 */
25
26 #ifndef CPU_ZERO_VM_INTERPRETERRT_ZERO_HPP
27 #define CPU_ZERO_VM_INTERPRETERRT_ZERO_HPP
28
29 #include "memory/allocation.hpp"
30
31 class SignatureHandler {
32 public:
33 static SignatureHandler *from_handlerAddr(address handlerAddr) {
34 return (SignatureHandler *) handlerAddr;
35 }
36
37 public:
38 ffi_cif* cif() const {
39 return (ffi_cif *) this;
40 }
41
42 int argument_count() const {
43 return cif()->nargs;
44 }
45
46 ffi_type** argument_types() const {
47 return (ffi_type**) (cif() + 1);
48 }
49
50 ffi_type* argument_type(int i) const {
113 class SlowSignatureHandlerGenerator : public SignatureHandlerGeneratorBase {
114 private:
115 intptr_t *_dst;
116
117 public:
118 SlowSignatureHandlerGenerator(methodHandle method, intptr_t* buf)
119 : SignatureHandlerGeneratorBase(method, (ffi_cif *) buf) {
120 _dst = (intptr_t *) (cif() + 1);
121 }
122
123 private:
124 void push(intptr_t value) {
125 *(_dst++) = value;
126 }
127
128 public:
129 SignatureHandler *handler() const {
130 return (SignatureHandler *) cif();
131 }
132 };
133
134 #endif // CPU_ZERO_VM_INTERPRETERRT_ZERO_HPP
|