summaryrefslogtreecommitdiffstats
path: root/courgette/encoded_program.h
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-22 20:19:49 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-22 20:19:49 +0000
commitc8240b1c3519b35de243b0fb91af409d59a5808c (patch)
treed7f20f227779c4c32fdd2851037255f1d660673a /courgette/encoded_program.h
parentd64abe1c12dbe8dab68adee605fa143dc9020f86 (diff)
downloadchromium_src-c8240b1c3519b35de243b0fb91af409d59a5808c.zip
chromium_src-c8240b1c3519b35de243b0fb91af409d59a5808c.tar.gz
chromium_src-c8240b1c3519b35de243b0fb91af409d59a5808c.tar.bz2
Identifying call sites that need to handle out of memory situations in Courgette.
There's no functional change here, only interface changes: * Change methods that are known to fail out in the field to return bool instead of void. * Where those methods are called, check the return value and report errors * In debug builds use a specialized template class that forces callers to check return values (this is possible at compile time in gcc, but unfortunately not in VS). The next step will be to change the implementation to not use STL containers. TEST=Run courgette tests. BUG=74777 Review URL: http://codereview.chromium.org/6716006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79030 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette/encoded_program.h')
-rw-r--r--courgette/encoded_program.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/courgette/encoded_program.h b/courgette/encoded_program.h
index 5662f2e..6d2f440 100644
--- a/courgette/encoded_program.h
+++ b/courgette/encoded_program.h
@@ -32,27 +32,27 @@ class EncodedProgram {
void set_image_base(uint64 base) { image_base_ = base; }
// (2) Address tables and indexes defined first.
- void DefineRel32Label(int index, RVA address);
- void DefineAbs32Label(int index, RVA address);
+ CheckBool DefineRel32Label(int index, RVA address);
+ CheckBool DefineAbs32Label(int index, RVA address);
void EndLabels();
// (3) Add instructions in the order needed to generate bytes of file.
- void AddOrigin(RVA rva);
- void AddCopy(uint32 count, const void* bytes);
- void AddRel32(int label_index);
- void AddAbs32(int label_index);
- void AddMakeRelocs();
+ CheckBool AddOrigin(RVA rva);
+ CheckBool AddCopy(uint32 count, const void* bytes);
+ CheckBool AddRel32(int label_index);
+ CheckBool AddAbs32(int label_index);
+ CheckBool AddMakeRelocs();
// (3) Serialize binary assembly language tables to a set of streams.
- void WriteTo(SinkStreamSet *streams);
+ CheckBool WriteTo(SinkStreamSet* streams);
// Using an EncodedProgram to generate a byte stream:
//
// (4) Deserializes a fresh EncodedProgram from a set of streams.
- bool ReadFrom(SourceStreamSet *streams);
+ bool ReadFrom(SourceStreamSet* streams);
// (5) Assembles the 'binary assembly language' into final file.
- bool AssembleTo(SinkStream *buffer);
+ CheckBool AssembleTo(SinkStream* buffer);
private:
// Binary assembly language operations.
@@ -74,8 +74,8 @@ class EncodedProgram {
typedef std::vector<OP, MemoryAllocator<OP> > OPVector;
void DebuggingSummary();
- void GenerateBaseRelocations(SinkStream *buffer);
- void DefineLabelCommon(RvaVector*, int, RVA);
+ CheckBool GenerateBaseRelocations(SinkStream *buffer);
+ CheckBool DefineLabelCommon(RvaVector*, int, RVA);
void FinishLabelsCommon(RvaVector* addresses);
// Binary assembly language tables.