Skip to content

Commit c8f2ed1

Browse files
davidpichardiefacebook-github-bot
authored andcommitted
[Java frontend] new Sawja 1.5.10 release
Reviewed By: ngorogiannis, jvillard Differential Revision: D31543918 fbshipit-source-id: dde0fc570
1 parent 4f05856 commit c8f2ed1

File tree

5 files changed

+60
-47
lines changed

5 files changed

+60
-47
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,11 @@ $ firefox infer-out/captured/hello.c.*.html
220220

221221
## Updating infer.opam and infer.opam.locked
222222

223-
tl; dr: Run `make opam/infer.opam.locked`.
224-
225-
infer.opam.locked records fixed versions of the opam dependencies known to work with infer and to respect
226-
the constraints in opam. This prevents unpredictable breakages of infer or its dependencies,
227-
especially for infer releases, for which it is more difficult to change their package constraints
228-
after the fact.
229-
230-
To add an opam package or update its version constraints, edit 'infer.opam' then run `make infer.opam.locked`.
223+
`opam/infer.opam.locked` records fixed versions of the opam
224+
dependencies known to work with infer and to respect the constraints
225+
in opam. This prevents unpredictable breakages of infer or its
226+
dependencies, especially for infer releases, for which it is more
227+
difficult to change their package constraints after the fact.
228+
229+
To add an opam package or update its version constraints, edit
230+
`opam/infer.opam` then run `opam lock .` in directory `opam/`.

Makefile

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -890,17 +890,6 @@ conf-clean: clean
890890
$(REMOVE_DIR) $(MODELS_DIR)/java/infer-out/
891891
$(REMOVE_DIR) $(MODELS_DIR)/objc/out/
892892

893-
894-
# phony because it depends on opam's internal state
895-
.PHONY: opam/infer.opam.locked
896-
opam/infer.opam.locked: opam/infer.opam
897-
# allow users to not force a run of opam update since it's very slow
898-
ifeq ($(NO_OPAM_UPDATE),)
899-
$(QUIET)$(call silent_on_success,opam update,$(OPAM) update)
900-
endif
901-
$(QUIET)$(call silent_on_success,generating opam/infer.opam.locked,\
902-
$(OPAM) lock opam/infer.opam)
903-
904893
OPAM_DEV_DEPS = ocp-indent merlin utop webbrowser
905894

906895
ifneq ($(EMACS),no)

infer/src/java/jTrans.ml

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,38 @@ let instruction (context : JContext.t) pc instr : translation =
946946
let procname_string = Procname.to_string procname in
947947
Procdesc.Node.Stmt_node (Call procname_string)
948948
in
949+
let build_alloc var cn constructor_opt =
950+
let builtin_new = Exp.Const (Const.Cfun BuiltinDecl.__new) in
951+
let class_type = JTransType.get_class_type program tenv cn in
952+
let class_type_np = JTransType.get_class_type_no_pointer program tenv cn in
953+
let sizeof_exp =
954+
Exp.Sizeof {typ= class_type_np; nbytes= None; dynamic_length= None; subtype= Subtype.exact}
955+
in
956+
let args = [(sizeof_exp, class_type)] in
957+
let ret_id = Ident.create_fresh Ident.knormal in
958+
let new_instr = Sil.Call ((ret_id, class_type), builtin_new, args, loc, CallFlags.default) in
959+
let pvar = JContext.set_pvar context var class_type in
960+
let set_instr =
961+
Sil.Store {e1= Exp.Lvar pvar; root_typ= class_type; typ= class_type; e2= Exp.Var ret_id; loc}
962+
in
963+
match constructor_opt with
964+
| Some (constr_type_list, constr_arg_list) ->
965+
let constr_ms = JBasics.make_ms JConfig.constructor_name constr_type_list None in
966+
let constr_procname, call_instrs =
967+
let ret_opt = Some (Exp.Var ret_id, class_type) in
968+
method_invocation context loc pc None cn constr_ms ret_opt constr_arg_list I_Special
969+
Procname.Java.Non_Static
970+
in
971+
let instrs = (new_instr :: call_instrs) @ [set_instr] in
972+
let node_kind = create_node_kind constr_procname in
973+
let node = create_node node_kind instrs in
974+
Instr node
975+
| None ->
976+
let instrs = [new_instr; set_instr] in
977+
let node_kind = Procdesc.Node.Stmt_node MethodBody in
978+
let node = create_node node_kind instrs in
979+
Instr node
980+
in
949981
try
950982
match (instr : JBir.instr) with
951983
| AffectVar (var, expr) ->
@@ -1063,33 +1095,11 @@ let instruction (context : JContext.t) pc instr : translation =
10631095
let node = create_node Procdesc.Node.throw_kind (instrs @ [sil_instr]) in
10641096
JContext.add_goto_jump context pc JContext.Exit ;
10651097
Instr node
1098+
| Alloc (var, cn) ->
1099+
(* since Sawja 1.5.10 some allocation sites come without constructor calls *)
1100+
build_alloc var cn None
10661101
| New (var, cn, constr_type_list, constr_arg_list) ->
1067-
let builtin_new = Exp.Const (Const.Cfun BuiltinDecl.__new) in
1068-
let class_type = JTransType.get_class_type program tenv cn in
1069-
let class_type_np = JTransType.get_class_type_no_pointer program tenv cn in
1070-
let sizeof_exp =
1071-
Exp.Sizeof {typ= class_type_np; nbytes= None; dynamic_length= None; subtype= Subtype.exact}
1072-
in
1073-
let args = [(sizeof_exp, class_type)] in
1074-
let ret_id = Ident.create_fresh Ident.knormal in
1075-
let new_instr =
1076-
Sil.Call ((ret_id, class_type), builtin_new, args, loc, CallFlags.default)
1077-
in
1078-
let constr_ms = JBasics.make_ms JConfig.constructor_name constr_type_list None in
1079-
let constr_procname, call_instrs =
1080-
let ret_opt = Some (Exp.Var ret_id, class_type) in
1081-
method_invocation context loc pc None cn constr_ms ret_opt constr_arg_list I_Special
1082-
Procname.Java.Non_Static
1083-
in
1084-
let pvar = JContext.set_pvar context var class_type in
1085-
let set_instr =
1086-
Sil.Store
1087-
{e1= Exp.Lvar pvar; root_typ= class_type; typ= class_type; e2= Exp.Var ret_id; loc}
1088-
in
1089-
let instrs = (new_instr :: call_instrs) @ [set_instr] in
1090-
let node_kind = create_node_kind constr_procname in
1091-
let node = create_node node_kind instrs in
1092-
Instr node
1102+
build_alloc var cn (Some (constr_type_list, constr_arg_list))
10931103
| NewArray (var, vt, expr_list) ->
10941104
let builtin_new_array = Exp.Const (Const.Cfun BuiltinDecl.__new_array) in
10951105
let content_type = JTransType.value_type program tenv vt in

opam/infer.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ depends: [
4747
"ppx_expect" {>= "v0.14.0" & < "v0.15"}
4848
"ppx_fields_conv" {>= "v0.14.0" & < "v0.15"}
4949
"ppx_yojson_conv" {>= "v0.14.0" & < "v0.15"}
50-
"sawja" {>="1.5.8"}
50+
"sawja" {>="1.5.10"}
5151
"sqlite3"
5252
"utop" {with-test}
5353
"xmlm" {>="1.2.0"}

opam/infer.opam.locked

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ depends: [
4040
"biniou" {= "1.2.1"}
4141
"camlidl" {= "1.09"}
4242
"camlzip" {= "1.10"}
43+
"camomile" {= "1.0.2" & with-test}
44+
"charInfo_width" {= "1.1.0" & with-test}
4345
"cmdliner" {= "1.0.4"}
4446
"conf-autoconf" {= "0.1"}
4547
"conf-gmp" {= "3"}
@@ -64,11 +66,18 @@ depends: [
6466
"jane-street-headers" {= "v0.14.0"}
6567
"javalib" {= "3.2.1"}
6668
"jst-config" {= "v0.14.0"}
69+
"lambda-term" {= "3.1.0" & with-test}
70+
"lwt" {= "5.4.2" & with-test}
71+
"lwt_log" {= "1.1.1" & with-test}
72+
"lwt_react" {= "1.1.4" & with-test}
6773
"memtrace" {= "0.2.1.2"}
6874
"menhir" {= "20210419"}
6975
"menhirLib" {= "20210419"}
7076
"menhirSdk" {= "20210419"}
77+
"mew" {= "0.1.0" & with-test}
78+
"mew_vi" {= "0.5.0" & with-test}
7179
"mlgmpidl" {= "1.2.13"}
80+
"mmap" {= "1.1.0" & with-test}
7281
"mtime" {= "1.2.0"}
7382
"num" {= "1.4"}
7483
"ocaml" {= "4.12.0"}
@@ -80,6 +89,7 @@ depends: [
8089
"ocamlbuild" {= "0.14.0"}
8190
"ocamlfind" {= "1.9.1"}
8291
"ocamlgraph" {= "2.0.0"}
92+
"ocplib-endian" {= "1.1" & with-test}
8393
"octavius" {= "1.2.2"}
8494
"ounit" {= "2.2.4"}
8595
"ounit2" {= "2.2.4"}
@@ -121,8 +131,9 @@ depends: [
121131
"ppxlib" {= "0.22.0"}
122132
"protocol_version_header" {= "v0.14.0"}
123133
"re" {= "1.9.0"}
134+
"react" {= "1.2.1" & with-test}
124135
"result" {= "1.5"}
125-
"sawja" {= "1.5.8"}
136+
"sawja" {= "1.5.10"}
126137
"seq" {= "base"}
127138
"sexplib" {= "v0.14.0"}
128139
"sexplib0" {= "v0.14.0"}
@@ -135,11 +146,14 @@ depends: [
135146
"time_now" {= "v0.14.0"}
136147
"timezone" {= "v0.14.0"}
137148
"topkg" {= "1.0.3"}
149+
"trie" {= "1.0.0" & with-test}
138150
"typerep" {= "v0.14.0"}
151+
"utop" {= "2.8.0" & with-test}
139152
"variantslib" {= "v0.14.0"}
140153
"xmlm" {= "1.3.0"}
141154
"yojson" {= "1.7.0"}
142155
"zarith" {= "1.12"}
156+
"zed" {= "3.1.0" & with-test}
143157
]
144158
depexts: [
145159
[ ["ubuntu"] ["default-jdk"] ]

0 commit comments

Comments
 (0)