Skip to content

Commit 5a349f0

Browse files
committed
Make string literal tables global
The string literal uniqueing tables only work if they can see every string in the program, and if multiple .class files are specified on the command-line, multiple java_bytecode_typecheckt instances are created. Literal symbol creation would then fail if the two classes used matching literals. Note this does not apply to classes loaded on demand or from a JAR file, which *do* share a typecheckt instance with their parent.
1 parent b5a205a commit 5a349f0

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/java_bytecode/java_bytecode_typecheck.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,9 @@ bool java_bytecode_typecheck(
184184
// fail for now
185185
return true;
186186
}
187+
188+
// Static members of java_bytecode_typecheckt:
189+
std::map<irep_idt, irep_idt>
190+
java_bytecode_typecheckt::string_literal_to_symbol_name;
191+
std::map<irep_idt, size_t>
192+
java_bytecode_typecheckt::escaped_string_literal_count;

src/java_bytecode/java_bytecode_typecheck.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ class java_bytecode_typecheckt:public typecheckt
6464
virtual std::string to_string(const typet &type);
6565

6666
std::set<irep_idt> already_typechecked;
67-
std::map<irep_idt, irep_idt> string_literal_to_symbol_name;
68-
std::map<irep_idt, size_t> escaped_string_literal_count;
67+
static std::map<irep_idt, irep_idt> string_literal_to_symbol_name;
68+
static std::map<irep_idt, size_t> escaped_string_literal_count;
6969
};
7070

7171
#endif // CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_TYPECHECK_H

0 commit comments

Comments
 (0)