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

Unified Diff: src/assembler.h

Issue 930733002: Subzero: Add sandboxing for x86-32. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add a sandboxing test. Rebase. Created 5 years, 10 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
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | src/assembler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/assembler.h
diff --git a/src/assembler.h b/src/assembler.h
index dfd8cd123bfdc09418d095c80666b1be53c322f8..84955e547843facf8b07a042dc4f3289cdadd644 100644
--- a/src/assembler.h
+++ b/src/assembler.h
@@ -115,6 +115,11 @@ public:
const FixupRefList &fixups() const { return fixups_; }
+ void setSize(intptr_t NewSize) {
+ assert(NewSize <= Size());
+ cursor_ = contents_ + NewSize;
+ }
+
private:
// The limit is set to kMinimumGap bytes before the end of the data area.
// This leaves enough space for the longest possible instruction and allows
@@ -149,7 +154,9 @@ class Assembler {
Assembler &operator=(const Assembler &) = delete;
public:
- Assembler() : FunctionName(""), IsInternal(false), buffer_(*this) {}
+ Assembler()
+ : FunctionName(""), IsInternal(false), Preliminary(false),
+ buffer_(*this) {}
virtual ~Assembler() {}
// Allocate a chunk of bytes using the per-Assembler allocator.
@@ -170,6 +177,9 @@ public:
// Align the tail end of the function to the required target alignment.
virtual void alignFunction() = 0;
+ // Add nop padding of a particular width to the current bundle.
+ virtual void padWithNop(intptr_t Padding) = 0;
+
virtual SizeT getBundleAlignLog2Bytes() const = 0;
virtual llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const = 0;
@@ -194,6 +204,11 @@ public:
void setInternal(bool Internal) { IsInternal = Internal; }
const IceString &getFunctionName() { return FunctionName; }
void setFunctionName(const IceString &NewName) { FunctionName = NewName; }
+ intptr_t getBufferSize() const { return buffer_.Size(); }
+ // Roll back to a (smaller) size.
+ void setBufferSize(intptr_t NewSize) { buffer_.setSize(NewSize); }
+ void setPreliminary(bool Value) { Preliminary = Value; }
+ bool getPreliminary() const { return Preliminary; }
private:
ArenaAllocator<32 * 1024> Allocator;
@@ -202,6 +217,11 @@ private:
// assembler buffer is emitted.
IceString FunctionName;
bool IsInternal;
+ // Preliminary indicates whether a preliminary pass is being made
+ // for calculating bundle padding (Preliminary=true), versus the
+ // final pass where all changes to label bindings, label links, and
+ // relocation fixups are fully committed (Preliminary=false).
+ bool Preliminary;
protected:
AssemblerBuffer buffer_;
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | src/assembler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698