Skip to content

Commit 3be826f

Browse files
committed
Add some documentation to java_object_factory
Add a high-level overview of the recursive algorithm in the file.
1 parent 2cf1931 commit 3be826f

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

jbmc/src/java_bytecode/java_object_factory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ void java_object_factoryt::gen_nondet_struct_init(
974974
// Should we write the whole object?
975975
// * Not if this is a sub-structure (a superclass object), as our caller will
976976
// have done this already
977-
// * Not if the object has already been initialised by our caller, in whic
977+
// * Not if the object has already been initialised by our caller, in which
978978
// case they will set `skip_classid`
979979
// * Not if we're re-initializing an existing object (i.e. update_in_place)
980980

@@ -1094,7 +1094,7 @@ void java_object_factoryt::gen_nondet_struct_init(
10941094
}
10951095
}
10961096

1097-
/// Initializes a primitive-typed or referece-typed object tree rooted at
1097+
/// Initializes a primitive-typed or reference-typed object tree rooted at
10981098
/// `expr`, allocating child objects as necessary and nondet-initializing their
10991099
/// members, or if MUST_UPDATE_IN_PLACE is set, re-initializing
11001100
/// already-allocated objects.

jbmc/src/java_bytecode/java_object_factory.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,19 @@ Author: Daniel Kroening, [email protected]
1919
/// that are called but for which we don't have a body (overapproximating the
2020
/// return value and possibly side effects).
2121
///
22-
/// The two main APIs are \ref gen_nondet_init() and \ref object_factory(), at
23-
/// the bottom of the file. Their purpose is very similar. A call to
22+
/// The two main APIs are \ref gen_nondet_init() and \ref object_factory()
23+
/// (which calls gen_nondet_init()), at the bottom of the file.
24+
/// A call to
2425
///
2526
/// gen_nondet_init(expr, code, ..., update_in_place)
2627
///
2728
/// appends to `code` (a code_blockt) a sequence of statements that
2829
/// non-deterministically initialize the `expr` (which is expected to be an
2930
/// l-value exprt) with a primitive or reference value of type equal to or
3031
/// compatible with `expr.type()` -- see documentation for the argument
31-
/// `pointer_type_selector` for additional details.
32+
/// `pointer_type_selector` for additional details. gen_nondet_init() is the
33+
/// starting point of a recursive algorithm, and most other functions in this
34+
/// file are different (recursive or base) cases depending on the type of expr.
3235
///
3336
/// The code generated mainly depends on the parameter `update_in_place`. Assume
3437
/// that `expr` is a reference to an object (in our IR, that means a pointer to

0 commit comments

Comments
 (0)