Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: courgette/assembly_program.h

Issue 2583373002: [Courgette] Simple AssemblyProgram and Disassembler cleanups. (Closed)
Patch Set: Sync. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: courgette/assembly_program.h
diff --git a/courgette/assembly_program.h b/courgette/assembly_program.h
index 86bd0449e670acb95e0a8316f026a316ea2677dc..9e9e34812034b12a4a4b5b4c2d29e1ad4da115f2 100644
--- a/courgette/assembly_program.h
+++ b/courgette/assembly_program.h
@@ -132,13 +132,11 @@ class AssemblyProgram {
using InstructionGenerator =
base::Callback<CheckBool(AssemblyProgram*, InstructionReceptor*)>;
- explicit AssemblyProgram(ExecutableType kind);
+ AssemblyProgram(ExecutableType kind, uint64_t image_base);
~AssemblyProgram();
ExecutableType kind() const { return kind_; }
- void set_image_base(uint64_t image_base) { image_base_ = image_base; }
-
// Traverses RVAs in |abs32_visitor| and |rel32_visitor| to precompute Labels.
void PrecomputeLabels(RvaVisitor* abs32_visitor, RvaVisitor* rel32_visitor);
@@ -212,7 +210,8 @@ class AssemblyProgram {
using ScopedInstruction =
std::unique_ptr<Instruction, UncheckedDeleter<Instruction>>;
- ExecutableType kind_;
+ const ExecutableType kind_;
grt (UTC plus 2) 2017/01/12 11:56:41 nit: these two data members (although const) belon
huangs 2017/01/12 19:54:41 Done.
+ const uint64_t image_base_; // Desired or mandated base address of image.
CheckBool Emit(ScopedInstruction instruction) WARN_UNUSED_RESULT;
CheckBool EmitShared(Instruction* instruction) WARN_UNUSED_RESULT;
@@ -222,17 +221,10 @@ class AssemblyProgram {
// Looks up a label or creates a new one. Might return NULL.
Label* FindLabel(RVA rva, RVAToLabel* labels);
- // Helper methods for the public versions.
- static void UnassignIndexes(RVAToLabel* labels);
- static void DefaultAssignIndexes(RVAToLabel* labels);
- static void AssignRemainingIndexes(RVAToLabel* labels);
-
// Sharing instructions that emit a single byte saves a lot of space.
Instruction* GetByteInstruction(uint8_t byte);
std::unique_ptr<Instruction* [], base::FreeDeleter> byte_instruction_cache_;
- uint64_t image_base_; // Desired or mandated base address of image.
-
InstructionVector instructions_; // All the instructions in program.
// Storage and lookup of Labels associated with target addresses. We use

Powered by Google App Engine
This is Rietveld 408576698