Commit 4d91aa5
JBMC: Modified the instrumentation of monitorexit/enter instructions
The monitorenter and monitorexit instructions are used by the JVM to
coordinate access to an object in the context of multiple threads.
We have previously added two methods to the object model that use a
counter to implement a reentrant lock. Calls to
'org.cprover.CProver.atomicBegin:()V"' and
'org.cprover.CProver.atomicEnd:()V' ensure that multiple threads do
not race in the access/modification of this counter.
In-order to support synchronization blocks, when the
monitorexit/moniitorenter bytecode instruction is executed JBMC must
call the aforementioned object model. To this end, this commit makes
the following changes:
1. Transforms the monitorenter and monitorexit bytecode instructions
into function-calls to the object model. Specifically,
'java.lang.Object.monitorenter:(Ljava/lang/Object;)V' and
'java.lang.Object.monitorexit:(Ljava/lang/Object;)V'.
2. Transforms 'org.cprover.CProver.atomicBegin:()V"' and
'org.cprover.CProver.atomicEnd:()V' into the appropriate
codet instructions.
Added the appropriate target-handlers if monitorenter or monitorexit
are in the context of a try-catch block.1 parent 0691f03 commit 4d91aa5
File tree
4 files changed
+59
-50
lines changed- jbmc/src/java_bytecode
- src/goto-programs
4 files changed
+59
-50
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1021 | 1021 | | |
1022 | 1022 | | |
1023 | 1023 | | |
| 1024 | + | |
| 1025 | + | |
1024 | 1026 | | |
1025 | 1027 | | |
1026 | 1028 | | |
| |||
1246 | 1248 | | |
1247 | 1249 | | |
1248 | 1250 | | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
1249 | 1265 | | |
1250 | 1266 | | |
1251 | 1267 | | |
| |||
1634 | 1650 | | |
1635 | 1651 | | |
1636 | 1652 | | |
1637 | | - | |
| 1653 | + | |
1638 | 1654 | | |
1639 | | - | |
1640 | | - | |
1641 | | - | |
1642 | | - | |
1643 | | - | |
| 1655 | + | |
1644 | 1656 | | |
1645 | 1657 | | |
1646 | 1658 | | |
| |||
1960 | 1972 | | |
1961 | 1973 | | |
1962 | 1974 | | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
1963 | 1998 | | |
1964 | 1999 | | |
1965 | 2000 | | |
| |||
2399 | 2434 | | |
2400 | 2435 | | |
2401 | 2436 | | |
2402 | | - | |
2403 | | - | |
2404 | | - | |
2405 | | - | |
2406 | | - | |
2407 | | - | |
2408 | | - | |
2409 | | - | |
2410 | | - | |
2411 | | - | |
2412 | | - | |
2413 | | - | |
2414 | | - | |
2415 | | - | |
2416 | | - | |
2417 | | - | |
2418 | | - | |
2419 | | - | |
2420 | | - | |
2421 | | - | |
2422 | | - | |
2423 | | - | |
2424 | | - | |
2425 | | - | |
2426 | | - | |
2427 | | - | |
2428 | | - | |
2429 | | - | |
2430 | | - | |
2431 | | - | |
2432 | | - | |
2433 | | - | |
2434 | 2437 | | |
2435 | 2438 | | |
2436 | 2439 | | |
| |||
Lines changed: 5 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
420 | 420 | | |
421 | 421 | | |
422 | 422 | | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | 423 | | |
432 | 424 | | |
433 | 425 | | |
| |||
446 | 438 | | |
447 | 439 | | |
448 | 440 | | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
449 | 446 | | |
450 | 447 | | |
451 | 448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
240 | 247 | | |
241 | 248 | | |
242 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
855 | 855 | | |
856 | 856 | | |
857 | 857 | | |
| 858 | + | |
858 | 859 | | |
859 | 860 | | |
860 | 861 | | |
861 | 862 | | |
862 | 863 | | |
863 | 864 | | |
| 865 | + | |
864 | 866 | | |
865 | 867 | | |
866 | 868 | | |
| |||
0 commit comments