Skip to content

Commit

Permalink
Set status of all JVM classes to "initialized" in the simulation state.
Browse files Browse the repository at this point in the history
This makes it possible to verify JVM specs that specify initial
values of static fields; previously the static initializers would
always run upon the first field access and overwrite the assumed
initial values.

Eventually the addition of explicit JVMSetup commands for class
initialization status preconditions will make this unnecessary (#916).
  • Loading branch information
Brian Huffman committed Dec 16, 2020
1 parent 8255da2 commit af4cbdb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/SAWScript/Crucible/JVM/Builtins.hs
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,11 @@ setupDynamicClassTable sym jc = foldM addClass Map.empty (Map.assocs (CJ.classTa
setupClass cls =
do let cname = J.className cls
name <- W4.stringLit sym (W4S.UnicodeLiteral $ CJ.classNameText (J.className cls))
status <- W4.bvLit sym knownRepr (BV.zero knownRepr)
-- Set every class to status 2 (initialized). In the absence
-- of JVMSetup commands for specifying initialization status,
-- this will allow verifications to proceed without the
-- interference of any static initializers.
status <- W4.bvLit sym knownRepr (BV.mkBV knownRepr 2)
super <-
case J.superClass cls of
Nothing -> return W4.Unassigned
Expand Down

0 comments on commit af4cbdb

Please sign in to comment.