summary refs log tree commit diff
path: root/src/rt
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2012-05-03 14:11:54 -0700
committerGraydon Hoare <graydon@mozilla.com>2012-05-03 14:11:54 -0700
commit6e5c8a7fb86aa38d47d70f7390035cc426f91159 (patch)
treee9b157de0a53e056ebd63db17557e4af1ac17ef1 /src/rt
parent11a5d10bf2958c642ae6a7c4afff8e181aa2167d (diff)
downloadrust-6e5c8a7fb86aa38d47d70f7390035cc426f91159.tar.gz
rust-6e5c8a7fb86aa38d47d70f7390035cc426f91159.zip
More shape fixes for evecs.
Diffstat (limited to 'src/rt')
-rw-r--r--src/rt/rust_box_annihilator.cpp4
-rw-r--r--src/rt/rust_cc.cpp8
-rw-r--r--src/rt/rust_shape.cpp4
-rw-r--r--src/rt/rust_shape.h41
4 files changed, 30 insertions, 27 deletions
diff --git a/src/rt/rust_box_annihilator.cpp b/src/rt/rust_box_annihilator.cpp
index bc5e0dfdda5..15ec71eeb05 100644
--- a/src/rt/rust_box_annihilator.cpp
+++ b/src/rt/rust_box_annihilator.cpp
@@ -49,8 +49,8 @@ class annihilator : public shape::data<annihilator,shape::ptr> {
         task->kernel->free(vec);
     }
 
-    void walk_fixedvec2(uint16_t sz, bool is_pod) {
-        walk_vec2(is_pod, get_fixedvec_data_range(sz, dp));
+    void walk_fixedvec2(uint16_t n_elts, size_t elt_sz, bool is_pod) {
+        walk_vec2(is_pod, get_fixedvec_data_range(n_elts, elt_sz, dp));
     }
 
     void walk_vec2(bool is_pod,
diff --git a/src/rt/rust_cc.cpp b/src/rt/rust_cc.cpp
index 4e3facd0413..66f044b8ce9 100644
--- a/src/rt/rust_cc.cpp
+++ b/src/rt/rust_cc.cpp
@@ -100,8 +100,8 @@ class irc : public shape::data<irc,shape::ptr> {
         walk_vec2(is_pod, get_slice_data_range(is_str, dp));
     }
 
-    void walk_fixedvec2(uint16_t sz, bool is_pod) {
-        walk_vec2(is_pod, get_fixedvec_data_range(sz, dp));
+    void walk_fixedvec2(uint16_t n_elts, size_t elt_sz, bool is_pod) {
+        walk_vec2(is_pod, get_fixedvec_data_range(n_elts, elt_sz, dp));
     }
 
     void walk_tag2(shape::tag_info &tinfo, uint32_t tag_variant) {
@@ -356,8 +356,8 @@ class mark : public shape::data<mark,shape::ptr> {
         walk_vec2(is_pod, get_slice_data_range(is_str, dp));
     }
 
-    void walk_fixedvec2(uint16_t sz, bool is_pod) {
-        walk_vec2(is_pod, get_fixedvec_data_range(sz, dp));
+    void walk_fixedvec2(uint16_t n_elts, size_t elt_sz, bool is_pod) {
+        walk_vec2(is_pod, get_fixedvec_data_range(n_elts, elt_sz, dp));
     }
 
     void walk_tag2(shape::tag_info &tinfo, uint32_t tag_variant) {
diff --git a/src/rt/rust_shape.cpp b/src/rt/rust_shape.cpp
index 9f3fbbed89e..c5f6a39b6c8 100644
--- a/src/rt/rust_shape.cpp
+++ b/src/rt/rust_shape.cpp
@@ -355,9 +355,9 @@ public:
         walk_vec2(is_pod, get_slice_data_range(is_str, dp));
     }
 
-    void walk_fixedvec2(uint16_t sz, bool is_pod) {
+    void walk_fixedvec2(uint16_t n_elts, size_t elt_sz, bool is_pod) {
         // Fixedvecs compare just like vecs.
-        walk_vec2(is_pod, get_fixedvec_data_range(sz, dp));
+        walk_vec2(is_pod, get_fixedvec_data_range(n_elts, elt_sz, dp));
     }
 
     void walk_box2() {
diff --git a/src/rt/rust_shape.h b/src/rt/rust_shape.h
index 112a61ee239..c6817b23a6e 100644
--- a/src/rt/rust_shape.h
+++ b/src/rt/rust_shape.h
@@ -524,12 +524,12 @@ ctxt<T>::walk_rptr0() {
 template<typename T>
 void
 ctxt<T>::walk_fixedvec0() {
-    uint16_t vec_size = get_u16_bump(sp);
+    uint16_t n_elts = get_u16_bump(sp);
     bool is_pod = *sp++;
     uint16_t sp_size = get_u16_bump(sp);
     const uint8_t *end_sp = sp + sp_size;
 
-    static_cast<T *>(this)->walk_fixedvec1(vec_size, is_pod);
+    static_cast<T *>(this)->walk_fixedvec1(n_elts, is_pod);
 
     sp = end_sp;
 }
@@ -629,8 +629,8 @@ public:
     void walk_rptr1() {
         DPRINT("&<"); walk(); DPRINT(">");
     }
-    void walk_fixedvec1(uint16_t sz, bool is_pod) {
-      DPRINT("fixedvec<%u, ", sz); walk(); DPRINT(">");
+    void walk_fixedvec1(uint16_t n_elts, bool is_pod) {
+      DPRINT("fixedvec<%u, ", n_elts); walk(); DPRINT(">");
     }
     void walk_slice1(bool is_pod, bool is_str) {
       DPRINT("slice<"); walk(); DPRINT(">");
@@ -721,10 +721,10 @@ public:
         abort();    // TODO
     }
 
-    void walk_fixedvec1(uint16_t sz, bool is_pod) {
+    void walk_fixedvec1(uint16_t n_elts, bool is_pod) {
         size_of sub(*this);
         sub.walk();
-        sa.set(sub.sa.size * sz, sub.sa.alignment);
+        sa.set(sub.sa.size * n_elts, sub.sa.alignment);
     }
 
     template<typename T>
@@ -959,9 +959,9 @@ protected:
                                                              ptr_pair &dp);
 
     static std::pair<uint8_t *,uint8_t *>
-        get_fixedvec_data_range(uint16_t sz, ptr dp);
+        get_fixedvec_data_range(uint16_t n_elts, size_t elt_sz, ptr dp);
     static std::pair<ptr_pair,ptr_pair>
-        get_fixedvec_data_range(uint16_t sz, ptr_pair &dp);
+        get_fixedvec_data_range(uint16_t n_elts, size_t elt_sz, ptr_pair &dp);
 
 public:
     data(rust_task *in_task,
@@ -989,10 +989,10 @@ public:
         DATA_SIMPLE(void *, walk_slice2(is_pod, is_str));
     }
 
-    void walk_fixedvec1(uint16_t sz, bool is_pod) {
+    void walk_fixedvec1(uint16_t n_elts, bool is_pod) {
         size_align sa = size_of::get(*this);
         ALIGN_TO(sa.alignment);
-        static_cast<T *>(this)->walk_fixedvec2(sz, is_pod);
+        static_cast<T *>(this)->walk_fixedvec2(n_elts, sa.size, is_pod);
     }
 
     void walk_box1() { DATA_SIMPLE(void *, walk_box2()); }
@@ -1132,16 +1132,19 @@ data<T,U>::get_slice_data_range(bool is_str, ptr_pair &dp) {
 
 template<typename T,typename U>
 std::pair<uint8_t *,uint8_t *>
-data<T,U>::get_fixedvec_data_range(uint16_t sz, ptr dp) {
+data<T,U>::get_fixedvec_data_range(uint16_t n_elts, size_t elt_sz, ptr dp) {
     uint8_t* ptr = (uint8_t*)(dp);
-    return std::make_pair(ptr, ptr + sz);
+    return std::make_pair(ptr, ptr + (((size_t)n_elts) * elt_sz));
 }
 
 template<typename T,typename U>
 std::pair<ptr_pair,ptr_pair>
-data<T,U>::get_fixedvec_data_range(uint16_t sz, ptr_pair &dp) {
-    std::pair<uint8_t *,uint8_t *> fst = get_fixedvec_data_range(sz, dp.fst);
-    std::pair<uint8_t *,uint8_t *> snd = get_fixedvec_data_range(sz, dp.snd);
+data<T,U>::get_fixedvec_data_range(uint16_t n_elts, size_t elt_sz,
+                                   ptr_pair &dp) {
+    std::pair<uint8_t *,uint8_t *> fst =
+        get_fixedvec_data_range(n_elts, elt_sz, dp.fst);
+    std::pair<uint8_t *,uint8_t *> snd =
+        get_fixedvec_data_range(n_elts, elt_sz, dp.snd);
     ptr_pair start(fst.first, snd.first);
     ptr_pair end(fst.second, snd.second);
     return std::make_pair(start, end);
@@ -1248,13 +1251,13 @@ private:
     }
 
     void walk_slice2(bool is_pod, bool is_str) {
-        walk_vec2(is_pod, get_slice_data_range(dp, is_str));
+        walk_vec2(is_pod, get_slice_data_range(is_str, dp));
         out << "/&";
     }
 
-    void walk_fixedvec2(uint16_t sz, bool is_pod) {
-        walk_vec2(is_pod, get_fixedvec_data_range(sz, dp));
-        out << "/" << sz;
+    void walk_fixedvec2(uint16_t n_elts, size_t elt_sz, bool is_pod) {
+        walk_vec2(is_pod, get_fixedvec_data_range(n_elts, elt_sz, dp));
+        out << "/" << n_elts;
     }
 
     void walk_tag2(tag_info &tinfo, tag_variant_t tag_variant) {