diff --git a/src/compiler/flx_bind/flx_bind_apply.ml b/src/compiler/flx_bind/flx_bind_apply.ml index 8ec7e3355..7c6ead539 100644 --- a/src/compiler/flx_bind/flx_bind_apply.ml +++ b/src/compiler/flx_bind/flx_bind_apply.ml @@ -30,43 +30,9 @@ let generic_function_dispatcher bsym_table counter sr f a = (* ---------------------------------------------------------- *) | "lrbrack" -> Some (Flx_bind_lrbrack.try_bind_lrbrack bsym_table counter a) - | "_deref" -> - (* FIXME: Move this codeto a separate file *) - begin - let t = snd a in - print_endline ("System function _deref"); - match t with - (* FIXME: more work needed here - This code only handles pointers to pointers, but has to apply - to tuples, arrays, records, abstract typesm, variants and everything! - to do this we have to rebuild every term, replacing R and RW pointers - universally with V pointers. This requires recursive remapping from - the bottom up and reconstructing the types of aggregate terms because - Felix attaches the type type every expression and subexpression. - *) - | BTYP_ptr (mode,base,_) -> - begin match base with - | BTYP_ptr (mode2, base2, kk) -> - let mode2 = - match mode2 with - | `N -> `N - | `R -> `V - | `RW -> `V - | `W -> `N - | `V -> `V - in - let base = Flx_btype.btyp_ptr mode2 base2 kk in - let a = match a with (x,t) -> x,base in (* should check the type of a is correct ... *) - Some (bexpr_deref base a) - | _ -> - Some (bexpr_deref base a) - end - | _ -> Flx_exceptions.clierr sr ("Dereferemce value of non pointer type " ^ Flx_btype.st t) - end | _ -> None - (* Note: the exception chaining machinery below is a superior HACK WHat happens is that it just tries each case in turn until diff --git a/src/compiler/flx_bind/flx_bind_expression.ml b/src/compiler/flx_bind/flx_bind_expression.ml index b4cbb5d16..646035603 100644 --- a/src/compiler/flx_bind/flx_bind_expression.ml +++ b/src/compiler/flx_bind/flx_bind_expression.ml @@ -1192,8 +1192,6 @@ print_endline ("LOOKUP 9A: varname " ^ si i); let x = Flx_strr.apl2 sr "lnot" [e] in be x - | `EXPR_ref (_,(`EXPR_deref (_,e))) -> be e - | `EXPR_ref (srr,e) -> (* Helper function to look up a property in a symbol. *) let has_property bid property = @@ -1219,7 +1217,6 @@ print_endline ("LOOKUP 9A: varname " ^ si i); let e = be e in begin match e with | _,t when Flx_btype.istriv t -> bexpr_address e - | BEXPR_deref e,_ -> e | BEXPR_varname (index,ts),_ -> (* Look up the type of the name, and make sure it's addressable. *) @@ -1340,15 +1337,6 @@ print_endline ("LOOKUP 9A: varname " ^ si i); | _ -> clierr sr ("Write pointer reference requires argument be variable") end - | `EXPR_deref (_,(`EXPR_ref (sr,e) as x)) -> - begin - try ignore (be x) - with err -> - print_endline ("WARNING: binding address of expression " ^ string_of_expr x ^ - " gave error: \n" ^ Printexc.to_string err ^ "\n" ^ Flx_srcref.long_string_of_src sr ) - end; - be e - | `EXPR_deref (sr,e') -> (* print_endline ("Binding _deref .. " ^ string_of_expr e); diff --git a/src/compiler/flx_core/flx_unify.ml b/src/compiler/flx_core/flx_unify.ml index db61753f0..00c584fc5 100644 --- a/src/compiler/flx_core/flx_unify.ml +++ b/src/compiler/flx_core/flx_unify.ml @@ -13,6 +13,7 @@ open Flx_btype_subst open Flx_bid let mode_supertype m1 m2 = match m1,m2 with + | `V, `R | `R, `RW | `W, `RW | `N, _ -> () diff --git a/src/packages/buildtools.fdoc b/src/packages/buildtools.fdoc index a62d9c8ed..6470c1289 100644 --- a/src/packages/buildtools.fdoc +++ b/src/packages/buildtools.fdoc @@ -245,6 +245,8 @@ println$ "-" * 20; "-w", "@8", /* bug out partial matches */ "-w", "@11", /* bug out unused cases */ "-w", "-21", /* shut up about non-returning statments like assert false */ + "-I", "+unix", + "-I", "+str", "-I",tmpdir, "-I",tmpdir/dir, "-I", entmp (Filename::dirname file)) + @@ -269,6 +271,7 @@ println$ "-" * 20; println$ "Linking library " + tmpdir/lib + ".cmxa"; sorted_libs = sorted_libs + (tmpdir/lib+ ".cmxa"); var result = Shell::system$ "ocamlopt.opt" + list( + "-I","+unix","-I","+str", "-a", '-o',tmpdir/lib + ".cmxa") + unbox (map diff --git a/src/packages/pointers.fdoc b/src/packages/pointers.fdoc index 249b8b0a6..2fb1071e4 100644 --- a/src/packages/pointers.fdoc +++ b/src/packages/pointers.fdoc @@ -32,7 +32,8 @@ open class MachinePointers proc storeat[T:LINEAR] ( p: &>T, v: T) = { _storeat (p,v); } //$ Dereference a Felx pointer. - //fun _deref[T:LINEAR]: & T = "*$t"; + fun _deref[T:LINEAR]: & T = "*$t"; + fun _deref[T:LINEAR]: &< T = "*$t"; fun deref[T:LINEAR] (p:& _deref p; fun deref[T:LINEAR] (p:&< _deref p; }