blob: ec2e23cf0bec5e1b3deee0b4103c2e21a4d7bf57 [file] [log] [blame]
Ian Rogersb033c752011-07-20 12:22:35 -07001// Copyright 2011 Google Inc. All Rights Reserved.
Carl Shapiroad107ab2011-08-14 15:54:24 -07002
Ian Rogersb033c752011-07-20 12:22:35 -07003#ifndef ART_SRC_JNI_COMPILER_H_
4#define ART_SRC_JNI_COMPILER_H_
5
Ian Rogers2c8f6532011-09-02 17:16:34 -07006#include "constants.h"
Brian Carlstromf3eb61f2011-07-23 20:22:26 -07007#include "macros.h"
Ian Rogersb033c752011-07-20 12:22:35 -07008
9namespace art {
10
11class Assembler;
Ian Rogers2c8f6532011-09-02 17:16:34 -070012class JniCallingConvention;
13class ManagedRegister;
14class ManagedRuntimeCallingConvention;
Ian Rogersb033c752011-07-20 12:22:35 -070015class Method;
16
17// A JNI compiler generates code that acts as the bridge between managed code
18// and native code.
19// TODO: move the responsibility of managing memory to somewhere else
20class JniCompiler {
21 public:
Ian Rogers2c8f6532011-09-02 17:16:34 -070022 explicit JniCompiler(InstructionSet insns);
Ian Rogersb033c752011-07-20 12:22:35 -070023 ~JniCompiler();
Ian Rogers2c8f6532011-09-02 17:16:34 -070024
25 void Compile(Method* method);
Ian Rogersdf20fe02011-07-20 20:34:16 -070026
Ian Rogersb033c752011-07-20 12:22:35 -070027 private:
Ian Rogersdf20fe02011-07-20 20:34:16 -070028 // Copy a single parameter from the managed to the JNI calling convention
29 void CopyParameter(Assembler* jni_asm,
30 ManagedRuntimeCallingConvention* mr_conv,
31 JniCallingConvention* jni_conv,
32 size_t frame_size, size_t out_arg_size);
33
Ian Rogers2c8f6532011-09-02 17:16:34 -070034 void SetNativeParameter(Assembler* jni_asm,
35 JniCallingConvention* jni_conv,
Shih-wei Liao668512a2011-09-01 14:18:34 -070036 ManagedRegister in_reg);
37
Ian Rogers2c8f6532011-09-02 17:16:34 -070038 InstructionSet instruction_set_;
39
Ian Rogersb033c752011-07-20 12:22:35 -070040 DISALLOW_COPY_AND_ASSIGN(JniCompiler);
41};
42
43} // namespace art
44
45#endif // ART_SRC_JNI_COMPILER_H_