[inferbo] Add a model: Object.clone

Reviewed By: ezgicicek

Differential Revision: D18272339

fbshipit-source-id: 6a84a1ac7
master
Sungkeun Cho 5 years ago committed by Facebook Github Bot
parent 752b8ab56a
commit 0a8919166f

@ -1155,6 +1155,15 @@ module ByteBuffer = struct
{exec; check= no_check} {exec; check= no_check}
end end
module Object = struct
let clone exp =
let exec {integer_type_widths} ~ret:(ret_id, _) mem =
let v = Sem.eval integer_type_widths exp mem in
model_by_value v ret_id mem
in
{exec; check= no_check}
end
module Call = struct module Call = struct
let dispatch : (Tenv.t, model) ProcnameDispatcher.Call.dispatcher = let dispatch : (Tenv.t, model) ProcnameDispatcher.Call.dispatcher =
let open ProcnameDispatcher.Call in let open ProcnameDispatcher.Call in
@ -1394,5 +1403,6 @@ module Call = struct
&:: "getShort" <>$ capt_exp $--> ByteBuffer.get_int &:: "getShort" <>$ capt_exp $--> ByteBuffer.get_int
; +PatternMatch.implements_nio "ByteBuffer" &:: "getInt" <>$ capt_exp $--> ByteBuffer.get_int ; +PatternMatch.implements_nio "ByteBuffer" &:: "getInt" <>$ capt_exp $--> ByteBuffer.get_int
; +PatternMatch.implements_nio "ByteBuffer" ; +PatternMatch.implements_nio "ByteBuffer"
&:: "getLong" <>$ capt_exp $--> ByteBuffer.get_int ] &:: "getLong" <>$ capt_exp $--> ByteBuffer.get_int
; -"java.lang.Object" &:: "clone" <>$ capt_exp $--> Object.clone ]
end end

@ -203,3 +203,13 @@ public class Cost_test {
for (int i = 0; i < get_global(); i++) {} for (int i = 0; i < get_global(); i++) {}
} }
} }
class CloneTest {
int i;
void clone_test_constant() throws CloneNotSupportedException {
this.i = 10;
CloneTest o = (CloneTest) this.clone();
for (int i = 0; i < o.i; i++) {}
}
}

Loading…
Cancel
Save