1 /*
2 * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2009 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 SharkNativeWrapper : public SharkCompileInvariants {
27 friend class SharkStackWithNativeFrame;
28
29 public:
30 static SharkNativeWrapper* build(SharkBuilder* builder,
31 methodHandle target,
32 const char* name,
33 BasicType* arg_types,
34 BasicType return_type) {
35 return new SharkNativeWrapper(builder,
36 target,
37 name,
38 arg_types,
39 return_type);
40 }
41
42 private:
43 SharkNativeWrapper(SharkBuilder* builder,
44 methodHandle target,
45 const char* name,
163 }
164 void CreateResetHandleBlock() const {
165 llvm::Value *active_handles = builder()->CreateValueOfStructEntry(
166 thread(),
167 JavaThread::active_handles_offset(),
168 SharkType::jniHandleBlock_type(),
169 "active_handles");
170 builder()->CreateStore(
171 LLVMValue::intptr_constant(0),
172 builder()->CreateAddressOfStructEntry(
173 active_handles,
174 in_ByteSize(JNIHandleBlock::top_offset_in_bytes()),
175 llvm::PointerType::getUnqual(SharkType::intptr_type()),
176 "top"));
177 }
178 llvm::LoadInst* CreateLoadPendingException() const {
179 return builder()->CreateLoad(
180 pending_exception_address(), "pending_exception");
181 }
182 };
|
1 /*
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2009 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 SHARE_VM_SHARK_SHARKNATIVEWRAPPER_HPP
27 #define SHARE_VM_SHARK_SHARKNATIVEWRAPPER_HPP
28
29 #include "runtime/handles.hpp"
30 #include "shark/llvmHeaders.hpp"
31 #include "shark/sharkBuilder.hpp"
32 #include "shark/sharkContext.hpp"
33 #include "shark/sharkInvariants.hpp"
34 #include "shark/sharkStack.hpp"
35
36 class SharkNativeWrapper : public SharkCompileInvariants {
37 friend class SharkStackWithNativeFrame;
38
39 public:
40 static SharkNativeWrapper* build(SharkBuilder* builder,
41 methodHandle target,
42 const char* name,
43 BasicType* arg_types,
44 BasicType return_type) {
45 return new SharkNativeWrapper(builder,
46 target,
47 name,
48 arg_types,
49 return_type);
50 }
51
52 private:
53 SharkNativeWrapper(SharkBuilder* builder,
54 methodHandle target,
55 const char* name,
173 }
174 void CreateResetHandleBlock() const {
175 llvm::Value *active_handles = builder()->CreateValueOfStructEntry(
176 thread(),
177 JavaThread::active_handles_offset(),
178 SharkType::jniHandleBlock_type(),
179 "active_handles");
180 builder()->CreateStore(
181 LLVMValue::intptr_constant(0),
182 builder()->CreateAddressOfStructEntry(
183 active_handles,
184 in_ByteSize(JNIHandleBlock::top_offset_in_bytes()),
185 llvm::PointerType::getUnqual(SharkType::intptr_type()),
186 "top"));
187 }
188 llvm::LoadInst* CreateLoadPendingException() const {
189 return builder()->CreateLoad(
190 pending_exception_address(), "pending_exception");
191 }
192 };
193
194 #endif // SHARE_VM_SHARK_SHARKNATIVEWRAPPER_HPP
|