Take a look at the JVM instruction set under Resources.
| || 1 ||Sep
|| 6 ||Sep
Write down as many sequences of JVM instructions that have the cummulative effect of leaving a single 0 on the top of the JVM arithmetic stack.
- After your sequence, the stack should be the same as before except
for the extra 0 on top.
- You cannot assume a register has any specific contents a priori.
- Use at most 3 instructions.
- Two sequences that differ only in their register (local) number or
immediate values are
not considered distinct. List only one such sequence! The bottom
line is to use a single idea just once in your answer.
- You can work with others on this assignment. Turn in just one
solution with all participants' names on that solution.
- The person or group with the largest number of acceptable sequences
will win an edible prize.
- Show all single JVM instructions that can push the value 4 on top of stack.
Each instruction could be of any length (1, 2, 3, or 4 bytes).
Discuss why there are so many.
Last modified 15:04:33 CDT 30 August 2007
by Ron K. Cytron