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/25 15:53:45 UTC

Would createFieldAccess load local variable?

Hi,
I want to access the local variable in my code, to return the same.

	LocalVariableGen lg = mg.addLocalVariable("retValue",Type.BOOLEAN,
null,null);
	int retValue = lg.getIndex();

	lg.setStart(il.append(new ASTORE(retValue)));
	/**********
		at this point i need to get the access to the variable for creating the
further 			return instruction, if i m not wrong. how do i do the same?
	*********/
	il.append(fac.createReturn(Type.BOOLEAN));

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: Would createFieldAccess load local variable?

Posted by Sapan Shah <sa...@patni.com>.
Thanks a lot for this suggestion!..had never tried this.

-----Original Message-----
From: Juozas Baliuka [mailto:baliuka@mwm.lt]
Sent: Friday, April 25, 2003 8:57 PM
To: BCEL Users List; sapan.shah@patni.com
Subject: Re: Would createFieldAccess load local variable?



BTW  try to write JAVA code, compile it with javac and decomple it with
javap, it takes a few minutes to learn generate stuff like this using
iteratyve method.


> Hi,
> I want to access the local variable in my code, to return the same.
>
> LocalVariableGen lg = mg.addLocalVariable("retValue",Type.BOOLEAN,
> null,null);
> int retValue = lg.getIndex();
>
> lg.setStart(il.append(new ASTORE(retValue)));
> /**********
> at this point i need to get the access to the variable for creating the
> further return instruction, if i m not wrong. how do i do the same?
> *********/
> il.append(fac.createReturn(Type.BOOLEAN));
>
> 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
>
>


---------------------------------------------------------------------
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: Would createFieldAccess load local variable?

Posted by Juozas Baliuka <ba...@mwm.lt>.
BTW  try to write JAVA code, compile it with javac and decomple it with
javap, it takes a few minutes to learn generate stuff like this using
iteratyve method.


> Hi,
> I want to access the local variable in my code, to return the same.
>
> LocalVariableGen lg = mg.addLocalVariable("retValue",Type.BOOLEAN,
> null,null);
> int retValue = lg.getIndex();
>
> lg.setStart(il.append(new ASTORE(retValue)));
> /**********
> at this point i need to get the access to the variable for creating the
> further return instruction, if i m not wrong. how do i do the same?
> *********/
> il.append(fac.createReturn(Type.BOOLEAN));
>
> 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
>
>


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


Re: Would createFieldAccess load local variable?

Posted by Juozas Baliuka <ba...@mwm.lt>.

Load it on the top of stack by index before to return.

> Hi,
> I want to access the local variable in my code, to return the same.
> 
> LocalVariableGen lg = mg.addLocalVariable("retValue",Type.BOOLEAN,
> null,null);
> int retValue = lg.getIndex();
> 
> lg.setStart(il.append(new ASTORE(retValue)));
> /**********
> at this point i need to get the access to the variable for creating the
> further return instruction, if i m not wrong. how do i do the same?
> *********/
> il.append(fac.createReturn(Type.BOOLEAN));
> 
> 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
> 
> 


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