MCPcopy Create free account
hub / github.com/N64Recomp/N64Recomp / LiveGeneratorOutput

Class LiveGeneratorOutput

include/recompiler/live_recompiler.h:16–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14 uint32_t section_offset;
15 };
16 struct LiveGeneratorOutput {
17 LiveGeneratorOutput() = default;
18 LiveGeneratorOutput(const LiveGeneratorOutput& rhs) = delete;
19 LiveGeneratorOutput(LiveGeneratorOutput&& rhs) { *this = std::move(rhs); }
20 LiveGeneratorOutput& operator=(const LiveGeneratorOutput& rhs) = delete;
21 LiveGeneratorOutput& operator=(LiveGeneratorOutput&& rhs) {
22 good = rhs.good;
23 string_literals = std::move(rhs.string_literals);
24 jump_tables = std::move(rhs.jump_tables);
25 code = rhs.code;
26 code_size = rhs.code_size;
27 functions = std::move(rhs.functions);
28 reference_symbol_jumps = std::move(rhs.reference_symbol_jumps);
29 import_jumps_by_index = std::move(rhs.import_jumps_by_index);
30 executable_offset = rhs.executable_offset;
31
32 rhs.good = false;
33 rhs.code = nullptr;
34 rhs.code_size = 0;
35 rhs.reference_symbol_jumps.clear();
36 rhs.executable_offset = 0;
37
38 return *this;
39 }
40 ~LiveGeneratorOutput();
41 size_t num_reference_symbol_jumps() const;
42 void set_reference_symbol_jump(size_t jump_index, recomp_func_t* func);
43 ReferenceJumpDetails get_reference_symbol_jump_details(size_t jump_index);
44 void populate_import_symbol_jumps(size_t import_index, recomp_func_t* func);
45 bool good = false;
46 // Storage for string literals referenced by recompiled code. These are allocated as unique_ptr arrays
47 // to prevent them from moving, as the referenced address is baked into the recompiled code.
48 std::vector<std::unique_ptr<char[]>> string_literals;
49 // Storage for jump tables referenced by recompiled code (vector of arrays of pointers). These are also
50 // allocated as unique_ptr arrays for the same reason as strings.
51 std::vector<std::unique_ptr<void*[]>> jump_tables;
52 // Recompiled code.
53 void* code;
54 // Size of the recompiled code.
55 size_t code_size;
56 // Pointers to each individual function within the recompiled code.
57 std::vector<recomp_func_t*> functions;
58 private:
59 // List of jump details and the corresponding jump instruction address. These jumps get populated after recompilation is complete
60 // during dependency resolution.
61 std::vector<std::pair<ReferenceJumpDetails, void*>> reference_symbol_jumps;
62 // Mapping of import symbol index to any jumps to that import symbol.
63 std::unordered_multimap<size_t, void*> import_jumps_by_index;
64 // sljit executable offset.
65 int64_t executable_offset;
66
67 friend class LiveGenerator;
68 };
69 struct LiveGeneratorInputs {
70 uint32_t base_event_index;
71 void (*cop0_status_write)(recomp_context* ctx, gpr value);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected