1.1 --- a/jitcraft/BytecodeEmitter.h Sat Jul 07 21:01:39 2012 -0700
1.2 +++ b/jitcraft/BytecodeEmitter.h Sat Jul 07 21:08:47 2012 -0700
1.3 @@ -21,7 +21,6 @@
1.4
1.5 #include <assert.h>
1.6 #include <limits.h>
1.7 -#include <vector>
1.8 #include "Opcodes.h"
1.9 #include "NameBinding.h"
1.10 #include "Handles.h"
1.11 @@ -31,7 +30,7 @@
1.12 class Type;
1.13 class Map;
1.14
1.15 -typedef std::vector<ScopedRoot<Object> *> ObjectList;
1.16 +typedef PoolList<ScopedRoot<Object> *> ObjectList;
1.17
1.18 struct OopRecord : public PoolObject
1.19 {
1.20 @@ -59,8 +58,8 @@
1.21 bool oom_;
1.22 unsigned maxStackDepth_;
1.23 ObjectList objects_;
1.24 - std::vector<bool> oopMap_;
1.25 - std::vector<OopRecord *> oopRecords_;
1.26 + PoolList<bool> oopMap_;
1.27 + PoolList<OopRecord *> oopRecords_;
1.28
1.29 private:
1.30 // The maximum size of a code object must be such that the distance between
1.31 @@ -103,18 +102,18 @@
1.32
1.33 writeUint8(op);
1.34 for (int i = 0; i < OpcodeInfo[op].nuses; i++)
1.35 - oopMap_.pop_back();
1.36 + oopMap_.pop();
1.37 for (int i = 0; i < OpcodeInfo[op].ndefs; i++)
1.38 - oopMap_.push_back(false);
1.39 - if (oopMap_.size() > maxStackDepth_)
1.40 - maxStackDepth_ = oopMap_.size();
1.41 + oopMap_.append(false);
1.42 + if (oopMap_.length() > maxStackDepth_)
1.43 + maxStackDepth_ = oopMap_.length();
1.44 }
1.45 void writeObject(Object *obj) {
1.46 - writeUint32(objects_.size());
1.47 + writeUint32(objects_.length());
1.48 ScopedRoot<Object> *root = new ScopedRoot<Object>(obj);
1.49 if (!root)
1.50 oom_ = true;
1.51 - objects_.push_back(root);
1.52 + oom_ &= objects_.append(root);
1.53 }
1.54
1.55 int position() const {
1.56 @@ -135,7 +134,7 @@
1.57 return oom_;
1.58 }
1.59 unsigned stackDepth() const {
1.60 - return oopMap_.size();
1.61 + return oopMap_.length();
1.62 }
1.63 unsigned maxStackDepth() const {
1.64 return maxStackDepth_;
1.65 @@ -143,14 +142,14 @@
1.66 const ObjectList *objects() const {
1.67 return &objects_;
1.68 }
1.69 - std::vector<OopRecord *> *oopRecords() {
1.70 + PoolList<OopRecord *> *oopRecords() {
1.71 return &oopRecords_;
1.72 }
1.73
1.74 void drop(unsigned amt) {
1.75 assert(amt <= stackDepth());
1.76 for (unsigned i = 0; i < amt; i++)
1.77 - oopMap_.pop_back();
1.78 + oopMap_.pop();
1.79 }
1.80
1.81 public:
1.82 @@ -229,12 +228,12 @@
1.83 void markOop(unsigned depth, bool oop = true) {
1.84 if (oom_)
1.85 return;
1.86 - oopMap_[oopMap_.size() - depth] = oop;
1.87 + oopMap_[oopMap_.length() - depth] = oop;
1.88 }
1.89 bool getOop(unsigned depth) {
1.90 if (oom_)
1.91 return false;
1.92 - return oopMap_[oopMap_.size() - depth];
1.93 + return oopMap_[oopMap_.length() - depth];
1.94 }
1.95
1.96 // Mark the current bytecode position as either re-entrant (meaning, it