aboutsummaryrefslogtreecommitdiff
path: root/src/boot/me/semant.ml
diff options
context:
space:
mode:
authorRoy Frostig <[email protected]>2010-09-03 16:18:32 -0700
committerRoy Frostig <[email protected]>2010-09-03 16:18:32 -0700
commit4e355aebf7c0987c3d6f66ca0013e7023aa501dd (patch)
treea1d1490532468b04d76f06a0e3351f869427de48 /src/boot/me/semant.ml
parentAssert to insure that the worst-case glue-call arg count is not exceeded unle... (diff)
downloadrust-4e355aebf7c0987c3d6f66ca0013e7023aa501dd.tar.xz
rust-4e355aebf7c0987c3d6f66ca0013e7023aa501dd.zip
When vec growth results in a newly allocated (extended) buffer, copy existing elements over via element-wise copy, not flat memcpy. Introduce new vec growth glue to achieve this.
Diffstat (limited to 'src/boot/me/semant.ml')
-rw-r--r--src/boot/me/semant.ml9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/boot/me/semant.ml b/src/boot/me/semant.ml
index 3f98488c..ef262647 100644
--- a/src/boot/me/semant.ml
+++ b/src/boot/me/semant.ml
@@ -40,6 +40,7 @@ type glue =
| GLUE_obj_drop of node_id (* Node is the obj. *)
| GLUE_loop_body of node_id (* Node is the 'for each' body block. *)
| GLUE_forward of (Ast.ident * Ast.ty_obj * Ast.ty_obj)
+ | GLUE_vec_grow
;;
type data =
@@ -1939,6 +1940,11 @@ and fn_rty (opaque_box_body:bool) (word_bits:Il.bits) : Il.referent_ty =
r [| code_ptr; box_ptr |]
+and vec_sty (word_bits:Il.bits) : Il.scalar_ty =
+ let word = word_rty word_bits in
+ let ptr = Il.ScalarTy (Il.AddrTy Il.OpaqueTy) in
+ Il.AddrTy (Il.StructTy [| word; word; word; ptr |])
+
and referent_type (word_bits:Il.bits) (t:Ast.ty) : Il.referent_ty =
let s t = Il.ScalarTy t in
let v b = Il.ValTy b in
@@ -1985,7 +1991,7 @@ and referent_type (word_bits:Il.bits) (t:Ast.ty) : Il.referent_ty =
| Ast.TY_mach (TY_f64) -> sv Il.Bits64
| Ast.TY_str -> sp (Il.StructTy [| word; word; word; ptr |])
- | Ast.TY_vec _ -> sp (Il.StructTy [| word; word; word; ptr |])
+ | Ast.TY_vec _ -> s (vec_sty word_bits)
| Ast.TY_tup tt -> tup tt
| Ast.TY_rec tr -> tup (Array.map snd tr)
@@ -2344,6 +2350,7 @@ let glue_str (cx:ctxt) (g:glue) : string =
^ id
^ "$" ^ (ty_str (Ast.TY_obj oty1))
^ "$" ^ (ty_str (Ast.TY_obj oty2))
+ | GLUE_vec_grow -> "glue$vec_grow"
;;