Re: Re: NOP ATHROW hack defeated !

Rémi Forax <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
On 06/07/2011 11:02 PM, Charles Oliver Nutter wrote:
> Ok, here's ASMifier output of a class that breaks. I turned off stack
> map calculation so it wouldn't do the rewriting. Hopefully modifying
> this to turn the stack map calculation back on will trigger the
> problem. I'll play with it more, but this is at least a start at it...
>
> - Charlie

After discussion with some friends from Cambridge,
I figure out why you generate unreachable code.
In your compiler, the instruction visitor should return if the next 
instruction
will be called or not.
By example, after these Java instructions break, continue, return or throw
the next instruction is dead. So if you have an if/else (it's the same 
with a loop),
if the block of the true branchends with one of these instruction,
you should not generate the goto to jump after the else block.

Rémi

> On Tue, Jun 7, 2011 at 3:24 PM, Charles Oliver Nutter
> <[email protected]>  wrote:
>> Trying to get you something right now; It will probably have JRuby
>> dependencies, but I can try to strip them out later if possible. At
>> least it will give you an example to go on.
>>
>> - Charlie
>>
>> On Sat, May 21, 2011 at 4:58 AM, Eric Bruneton<[email protected]>  wrote:
>>> 18/05/2011 22:28, Charles Oliver Nutter wrote:
>>>> Now I have a case where the ASM dead code rewriting breaks on Java 7
>>>> but not Java 6:
>>>> So it's a while loop with a break inside a rescued method body. The
>>>> code emitted for the while loop looks like this:
>>>>
>>>>     L5
>>>>      LINENUMBER 2 L5
>>>>      GOTO L6
>>>>     L7
>>>>     L8
>>>>      LINENUMBER 3 L8
>>>>      ALOAD 1
>>>>      GETFIELD org/jruby/runtime/ThreadContext.nil :
>>>> Lorg/jruby/runtime/builtin/IRubyObject;
>>>>      GOTO L9
>>>>     L10
>>>>      POP
>>>>     L6
>>>>      ALOAD 9
>>>>      INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.isTrue ()Z
>>>>      IFNE L7
>>> can you send us the corresponding ASMifier code (for the whole
>>> method/class), so that we can reproduce the bug?
>>>
>>> Eric
>>>
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.