Ian Rogers | b033c75 | 2011-07-20 12:22:35 -0700 | [diff] [blame^] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | // Author: irogers@google.com (Ian Rogers) |
| 3 | #ifndef ART_SRC_JNI_COMPILER_H_ |
| 4 | #define ART_SRC_JNI_COMPILER_H_ |
| 5 | |
| 6 | #include "globals.h" |
| 7 | #include "macros.h" |
| 8 | |
| 9 | namespace art { |
| 10 | |
| 11 | class Assembler; |
| 12 | class Method; |
| 13 | |
| 14 | // A JNI compiler generates code that acts as the bridge between managed code |
| 15 | // and native code. |
| 16 | // TODO: move the responsibility of managing memory to somewhere else |
| 17 | class JniCompiler { |
| 18 | public: |
| 19 | JniCompiler(); |
| 20 | ~JniCompiler(); |
| 21 | void Compile(Assembler* jni_asm, Method* method); |
| 22 | private: |
| 23 | // A poor man's code cache |
| 24 | void* AllocateCode(size_t size); |
| 25 | |
| 26 | // Base of memory region for allocated code |
| 27 | byte* jni_code_; |
| 28 | |
| 29 | // Allocated code size |
| 30 | size_t jni_code_size_; |
| 31 | |
| 32 | // Pointer to the free space |
| 33 | byte* jni_code_top_; |
| 34 | |
| 35 | DISALLOW_COPY_AND_ASSIGN(JniCompiler); |
| 36 | }; |
| 37 | |
| 38 | } // namespace art |
| 39 | |
| 40 | #endif // ART_SRC_JNI_COMPILER_H_ |