-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'rewrite' of github.com:PLSysSec/FaCT into rewrite
- Loading branch information
Showing
74 changed files
with
8,759 additions
and
3,935 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
ANSITerminal 0.8 root | ||
base v0.11.1 installed | ||
base-bigarray base root | ||
base-bytes base installed | ||
base-threads base root | ||
base-unix base root | ||
bin_prot v0.11.0 installed | ||
biniou 1.2.0 installed | ||
conf-cmake 1 installed | ||
conf-gmp 1 installed | ||
conf-llvm 6.0.0 installed | ||
conf-m4 1 installed | ||
conf-pkg-config 1.1 installed | ||
conf-python-2-7 1.0 installed | ||
conf-which 1 installed | ||
configurator v0.11.0 installed | ||
core v0.11.2 root | ||
core_kernel v0.11.1 installed | ||
cppo 1.6.4 installed | ||
cppo_ocamlbuild 1.6.0 installed | ||
ctypes 0.14.0 root | ||
ctypes-foreign 0.4.0 root | ||
dolog 3.0 root | ||
dune 1.0.0 installed | ||
easy-format 1.3.1 installed | ||
fieldslib v0.11.0 installed | ||
integers 0.2.2 installed | ||
jane-street-headers v0.11.0 installed | ||
jbuilder transition installed | ||
llvm 6.0.0 root | ||
lwt 4.1.0 root | ||
lwt_ppx 1.2.1 root | ||
menhir 20180703 root | ||
merlin 3.1.0 root | ||
num 1.1 installed | ||
oasis 0.4.11 root | ||
ocaml-compiler-libs v0.11.0 installed | ||
ocaml-migrate-parsetree 1.0.11 installed | ||
ocamlbuild 0.12.0 installed | ||
ocamlfind 1.8.0 installed | ||
ocamlify 0.0.1 installed | ||
ocamlmod 0.0.9 installed | ||
octavius 1.2.0 installed | ||
parsexp v0.11.0 installed | ||
ppx_assert v0.11.0 installed | ||
ppx_base v0.11.0 installed | ||
ppx_bench v0.11.0 installed | ||
ppx_bin_prot v0.11.1 installed | ||
ppx_compare v0.11.1 installed | ||
ppx_custom_printf v0.11.0 installed | ||
ppx_derivers 1.0 installed | ||
ppx_deriving 4.2.1 root | ||
ppx_enumerate v0.11.1 installed | ||
ppx_expect v0.11.0 installed | ||
ppx_fail v0.11.0 installed | ||
ppx_fields_conv v0.11.0 installed | ||
ppx_hash v0.11.1 installed | ||
ppx_here v0.11.0 installed | ||
ppx_inline_test v0.11.0 installed | ||
ppx_jane v0.11.0 installed | ||
ppx_js_style v0.11.0 installed | ||
ppx_let v0.11.0 installed | ||
ppx_optcomp v0.11.0 installed | ||
ppx_optional v0.11.0 installed | ||
ppx_pipebang v0.11.0 installed | ||
ppx_sexp_conv v0.11.2 installed | ||
ppx_sexp_message v0.11.0 installed | ||
ppx_sexp_value v0.11.0 installed | ||
ppx_tools 5.1+4.06.0 installed | ||
ppx_tools_versioned 5.2 installed | ||
ppx_typerep_conv v0.11.1 installed | ||
ppx_variants_conv v0.11.1 installed | ||
ppxlib 0.3.0 installed | ||
re 1.7.3 installed | ||
result 1.3 installed | ||
sexplib v0.11.0 installed | ||
sexplib0 v0.11.0 installed | ||
spawn v0.12.0 installed | ||
splittable_random v0.11.0 installed | ||
stdio v0.11.0 installed | ||
topkg 0.9.1 installed | ||
typerep v0.11.0 installed | ||
variantslib v0.11.0 installed | ||
yojson 1.4.1 installed | ||
z3 4.7.1 root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
open Util | ||
open Pos | ||
open Err | ||
open Ast | ||
open Ast_util | ||
open Astmap | ||
|
||
let findfn fmap fname = | ||
Core.List.Assoc.find fmap fname ~equal:vequal | ||
|
||
class array_spec_fncall = | ||
object (visit) | ||
inherit Astmap.ast_visitor as super | ||
val mutable _fmap : (fun_name * params) list = [] | ||
|
||
method fact_module m = | ||
let Module(_,fdecs) = m in | ||
List.iter | ||
(fun fdec -> | ||
match fdec.data with | ||
| FunDec(fn,_,_,params,_) -> | ||
_fmap <- (fn,params) :: _fmap | ||
| _ -> ()) | ||
fdecs; | ||
super#fact_module m | ||
|
||
method _fncall fn args = | ||
match findfn _fmap fn with | ||
| Some params -> | ||
let args' = | ||
try List.map2 | ||
(fun arg param -> | ||
let Param (x,bty) = param.data in | ||
match is_unspec_arr bty with | ||
| Some _ -> | ||
[arg ; arg.pos @> ArrayLen arg] | ||
| None -> [arg]) | ||
args | ||
params | ||
with Invalid_argument _ -> | ||
raise @@ cerr fn.pos "arity mismatch on call to '%s'" fn.data | ||
in | ||
List.flatten args' | ||
| None -> args | ||
|
||
method stm_post ({pos=p;data} as stm_) = | ||
match data with | ||
| FnCall (x,bty,fn,args) -> | ||
p @> FnCall (x,bty,fn,visit#_fncall fn args) | ||
| VoidFnCall (fn,args) -> | ||
p @> VoidFnCall (fn,visit#_fncall fn args) | ||
| _ -> super#stm_post stm_ | ||
|
||
end | ||
|
||
class array_spec_fdec = | ||
object (visit) | ||
inherit Astmap.ast_visitor as super | ||
|
||
method fdec_post = | ||
wrap @@ fun p -> function | ||
| FunDec (fn,ft,rt,params,body) -> | ||
let params' = | ||
List.map | ||
(fun param -> | ||
match param.data with | ||
| Param (x,{pos;data=Arr (bty,{data=LUnspecified},vattr)}) -> | ||
let x_len = p @> make_fresh (x.data ^ "_len") in | ||
let var_expr = p@>Variable x_len in | ||
[p@>Param (x,{pos;data=Arr (bty,{pos;data=LExpression var_expr},vattr)}); | ||
p@>Param (x_len,{pos;data=UInt (64,p@>Public)})] | ||
| _ -> [param]) | ||
params | ||
in | ||
FunDec(fn,ft,rt,List.flatten params',body) | ||
| CExtern (fn,ft,rt,params) as fdec -> | ||
List.iter | ||
(fun param -> | ||
match param.data with | ||
| _ -> ()) | ||
params; | ||
fdec | ||
|
||
end | ||
|
||
let transform m = | ||
let visit_fncall = new array_spec_fncall in | ||
let m' = visit_fncall#fact_module m in | ||
let visit_fdec = new array_spec_fdec in | ||
visit_fdec#fact_module m' |
Oops, something went wrong.