summaryrefslogtreecommitdiff
path: root/tools/lli/RPCChannel.h
blob: d04c8c25b491bb90772d2a4e2700ddefa7ce69f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//===---------- RPCChannel.h - LLVM out-of-process JIT execution ----------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Definition of the RemoteTargetExternal class which executes JITed code in a
// separate process from where it was built.
//
//===----------------------------------------------------------------------===//

#ifndef LLI_RPCCHANNEL_H
#define LLI_RPCCHANNEL_H

#include <stdlib.h>
#include <string>

namespace llvm {

class RPCChannel {
public:
  std::string ChildName;

  RPCChannel() {}
  ~RPCChannel();

  static void ReportError(int rc, size_t Size, std::string &ErrorMsg);

  /// Start the remote process.
  ///
  /// @returns True on success. On failure, ErrorMsg is updated with
  ///          descriptive text of the encountered error.
  bool createServer();

  bool createClient();

  // This will get filled in as a point to an OS-specific structure.
  void *ConnectionData;

  int WriteBytes(const void *Data, size_t Size);
  int ReadBytes(void *Data, size_t Size);

  void Wait();
};

} // end namespace llvm

#endif // LLI_RPCCHANNEL_H