Skip to content

Fix dup2, pop2 et al operating on pointers #329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/java_bytecode/java_bytecode_convert_method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,13 @@ Function: java_bytecode_convert_methodt::convert_instructions

\*******************************************************************/

static unsigned get_bytecode_type_width(const typet& ty)
{
if(ty.id()==ID_pointer)
return 32;
return ty.get_unsigned_int(ID_width);
}

codet java_bytecode_convert_methodt::convert_instructions(
const instructionst &instructions,
const code_typet &method_type)
Expand Down Expand Up @@ -1158,7 +1165,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
{
assert(!stack.empty() && results.empty());

if(stack.back().type().get_unsigned_int(ID_width)==32)
if(get_bytecode_type_width(stack.back().type())==32)
op=pop(2);
else
op=pop(1);
Expand All @@ -1170,7 +1177,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
{
assert(!stack.empty() && results.empty());

if(stack.back().type().get_unsigned_int(ID_width)==32)
if(get_bytecode_type_width(stack.back().type())==32)
op=pop(3);
else
op=pop(2);
Expand All @@ -1182,15 +1189,15 @@ codet java_bytecode_convert_methodt::convert_instructions(
{
assert(!stack.empty() && results.empty());

if(stack.back().type().get_unsigned_int(ID_width)==32)
if(get_bytecode_type_width(stack.back().type())==32)
op=pop(2);
else
op=pop(1);

assert(!stack.empty());
exprt::operandst op2;

if(stack.back().type().get_unsigned_int(ID_width)==32)
if(get_bytecode_type_width(stack.back().type())==32)
op2=pop(2);
else
op2=pop(1);
Expand Down Expand Up @@ -1387,7 +1394,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
// two-word item (i.e. a double or a long).
// http://cs.au.dk/~mis/dOvs/jvmspec/ref-pop2.html
if(statement=="pop2" &&
op[0].type().get_unsigned_int(ID_width)==32)
get_bytecode_type_width(op[0].type())==32)
pop(1);
}
else if(statement=="instanceof")
Expand Down