sort bytecode_info table by bytecode#4670
Conversation
allredj
left a comment
There was a problem hiding this comment.
✔️
Passed Diffblue compatibility checks (cbmc commit: 5d8125e).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/112355616
04c83d3 to
ccab473
Compare
| i_it->statement!="jsr" && | ||
| i_it->statement!="jsr_w" && | ||
| i_it->statement!="ret") | ||
| const std::string statement = bytecode_info[i_it->bytecode].mnemonic; |
There was a problem hiding this comment.
No, this is turning a const char * into a string, for comparison.
Won't fix now, since this will be replaced by bytecode comparisons.
| const std::string statement = bytecode_info[i_it->bytecode].mnemonic; | ||
|
|
||
| if( | ||
| statement != "goto" && statement != "return" && |
There was a problem hiding this comment.
Suggested followup -- create symbolic constants for these JAVA_BYTECODE_NOP and so on, and compare those instead of the mnemonics
There was a problem hiding this comment.
Yes, that's the plan.
| instruction.statement == "ldc2" || | ||
| instruction.statement == "ldc_w" || | ||
| instruction.statement == "ldc2_w") | ||
| const std::string statement = |
| { | ||
| if(instruction.statement == "getfield" || | ||
| instruction.statement == "putfield") | ||
| const std::string statement = |
| { | ||
| if(instruction.statement == "getstatic" || | ||
| instruction.statement == "putstatic") | ||
| const std::string statement = |
| { | ||
| { "aaload", 0x32, ' ', 2, 1, ' ' }, // arrayref, index → value; load onto the stack a reference from an array NOLINT(*) | ||
| { "aastore", 0x53, ' ', 3, 0, ' ' }, // arrayref, index, value →; store into a reference in an array NOLINT(*) | ||
| { "nop", 0x00, ' ', 0, 0, ' ' }, // [No change]; perform no operation NOLINT(*) |
There was a problem hiding this comment.
Given anyone using this table already has a bytecode, the second field is useless now
There was a problem hiding this comment.
Keeping for audit!
| { "impdep1", 0xfe, ' ', 0, 0, ' ' }, // ; reserved for implementation-dependent operations within debuggers; should not appear in any class file NOLINT(*) | ||
| { "impdep2", 0xff, ' ', 0, 0, ' ' }, // ; reserved for implementation-dependent operations within debuggers; should not appear in any class file NOLINT(*) | ||
| { "wide", 0xc4, ' ', 0, 0, ' ' }, // modifier for others NOLINT(*) | ||
| { nullptr, 0x00, '\0',0, 0, '\0'}, // zero-initialized NOLINT (*) |
There was a problem hiding this comment.
This looks like a magic terminator, but nothing about it is unique (0x00 is also nop, and a nullptr mnemonic is shared by the missing entries)-- suggest removing it
allredj
left a comment
There was a problem hiding this comment.
This PR failed Diffblue compatibility checks (cbmc commit: ccab473).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/112420225
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
ccab473 to
3b70661
Compare
allredj
left a comment
There was a problem hiding this comment.
This PR failed Diffblue compatibility checks (cbmc commit: 3b70661).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/112439621
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
3b70661 to
46daf81
Compare
allredj
left a comment
There was a problem hiding this comment.
This PR failed Diffblue compatibility checks (cbmc commit: 46daf81).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/112482347
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.
46daf81 to
c60a918
Compare
allredj
left a comment
There was a problem hiding this comment.
✔️
Passed Diffblue compatibility checks (cbmc commit: c60a918).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/113236477
smowton
left a comment
There was a problem hiding this comment.
Formatting grumbles only, otherwise lgtm
| i_it->statement=="invokeinterface" || | ||
| (threading_support && (i_it->statement=="monitorenter" || | ||
| i_it->statement=="monitorexit"))) | ||
| if( |
There was a problem hiding this comment.
Suggest killing clang-format here to keep the nicer one-cndition-per-line format
| i_it->statement=="ifnull" || | ||
| i_it->statement=="jsr" || | ||
| i_it->statement=="jsr_w") | ||
| if( |
| const std::string statement = | ||
| bytecode_info[instruction.bytecode].mnemonic; | ||
| if( | ||
| statement == "ldc" || statement == "ldc2" || statement == "ldc_w" || |
thk123
left a comment
There was a problem hiding this comment.
🚫 This will need a manual bump - I'll take care of this but please wait before merging
💡 I would add a unit test that verifies the table has the correct structure (e.g. that the position matches the bytecode, that there are no gaps etc)
|
I will do the bump once rebased - please let me know when |
c60a918 to
7822fac
Compare
|
@thk123 done! |
|
Sorry could I have one more rebase as I think #4705 is required for TG compatibility and this is just before it. |
allredj
left a comment
There was a problem hiding this comment.
✔️
Passed Diffblue compatibility checks (cbmc commit: 7822fac).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/113427828
|
@kroening sorry didn't tag you - can I have one more rebase as #4705 has been merged into TG submodule |
5023dd0 to
7cca038
Compare
The bytecode_info table is now sorted by bytecode, instead of alphabetically. This is enables direct lookup of bytecodes, and can replace the table that is currently built at runtime. We do not have any use for the alphabetic ordering. Obtained from previous file with sort -t, -k2 bytecode_info.cpp -b
The run-time generated bytecode table is replaced by bytecode_info. The linear search for the mnemonic is replaced by an array access.
7cca038 to
b149012
Compare
allredj
left a comment
There was a problem hiding this comment.
✔️
Passed Diffblue compatibility checks (cbmc commit: b149012).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/113731628
The bytecode_info table is now sorted by bytecode, instead of
alphabetically. This is enables direct lookup of bytecodes, and can replace
the table that is currently built at runtime. We do not have any use for
the alphabetic ordering.
Obtained from previous file with
sort -t, -k2 bytecode_info.cpp -b