blob: 4a6b1ba9d291b6e008e744dc5e71170896456be8 [file] [log] [blame]
Ian Rogersb033c752011-07-20 12:22:35 -07001// 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
9namespace art {
10
11class Assembler;
12class 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
17class 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_