You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-user@jakarta.apache.org by Sapan Shah <sa...@patni.com> on 2003/04/24 15:42:16 UTC

Use Of DUP?

What is the Use of DUP??..what exactly does it do.

Thanks and Regards,
Sapan.

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org


Re: Use Of DUP?

Posted by Stephen Kolaroff <ch...@riflexo.com>.
Yes, dup duplicates the stack's top element.

You may see a compiling indiom:
java code:
new Something()

java bytecode:
new #<something_class_constant>// put new (uninitialized) instance of 
class Something
dup // now we have 2 such instances
invokespecial #Something::<init>() (noarg constructor)

since invokespecial requires object instance on the stack (and 
arguments, but in our case we have noarg constructor), and <init>() 
returns nothing, we
need two identical instances on the stack: the second is lost in the 
constructor invokation. The first is left on the stack for the code that 
follows.

Bob Lee wrote:

> I believe it duplicates the top item on the stack.
>
> Bob
>
> On Thursday, April 24, 2003, at 08:42 AM, Sapan Shah wrote:
>
>> What is the Use of DUP??..what exactly does it do.
>>
>> Thanks and Regards,
>> Sapan.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>>
>>
> http://crazybob.org/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: bcel-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org


Re: Use Of DUP?

Posted by Bob Lee <cr...@crazybob.org>.
Efficiency. Write some code, compile and disassemble it. I'm sure 
you'll see a few good examples.

Bob

On Thursday, April 24, 2003, at 08:49 AM, Sapan Shah wrote:

> But what could be the usage of duplicating it?.
>
> -----Original Message-----
> From: Bob Lee [mailto:crazybob@crazybob.org]
> Sent: Thursday, April 24, 2003 7:14 PM
> To: BCEL Users List
> Subject: Re: Use Of DUP?
>
>
> I believe it duplicates the top item on the stack.
>
> Bob
>
> On Thursday, April 24, 2003, at 08:42 AM, Sapan Shah wrote:
>
>> What is the Use of DUP??..what exactly does it do.
>>
>> Thanks and Regards,
>> Sapan.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>>
>>
> http://crazybob.org/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>
>
http://crazybob.org/


---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org


RE: Use Of DUP?

Posted by Sapan Shah <sa...@patni.com>.
But what could be the usage of duplicating it?.

-----Original Message-----
From: Bob Lee [mailto:crazybob@crazybob.org]
Sent: Thursday, April 24, 2003 7:14 PM
To: BCEL Users List
Subject: Re: Use Of DUP?


I believe it duplicates the top item on the stack.

Bob

On Thursday, April 24, 2003, at 08:42 AM, Sapan Shah wrote:

> What is the Use of DUP??..what exactly does it do.
>
> Thanks and Regards,
> Sapan.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>
>
http://crazybob.org/


---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org


Re: Use Of DUP?

Posted by Bob Lee <cr...@crazybob.org>.
I believe it duplicates the top item on the stack.

Bob

On Thursday, April 24, 2003, at 08:42 AM, Sapan Shah wrote:

> What is the Use of DUP??..what exactly does it do.
>
> Thanks and Regards,
> Sapan.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>
>
http://crazybob.org/


---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org