Re: How to push a Custom Type Object on Stack
Martin von Gagern <[email protected]> Fri, 10 Jun 2011 08:24:59 +0200
| Newsgroups | gmane.comp.jakarta.bcel.user |
|---|---|
| Message-ID | <[email protected]> |
--------------enig5D8AFDC5B898AF29AD328639
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On 09.06.2011 08:38, Zaree Faryal wrote:
> What i want to do is i have a class=20
> class Automobile {
> public void getEngine(int carNo,EngineClass engineClassObj){
> System.out.println("EngineNo=3D"+engineClassObj.sisNo);
> }
> }
>=20
> /Now when i load "Automobile" class in memory./
> ilist =3D new InstructionList();
> ilist.append(InstructionConstants.ALOAD_0);
> ilist.append(new PUSH(pgen,345));
> ////Hear Now i have to also push the Object on Stack/
> ilist.append(ifact.createInvoke(_invoking_ClassName,
> _invoking_MethodName, Type.INT,
> new Type[] { Type.INT,Type.OBJECT }, Constants.INVOKEVIRTUAL=
));
> ilist.append(InstructionConstants.IRETURN);
>=20
> 1-if i use createNew() method and generate new object then how i am
> going to fill its fields value?
> 2-or if i firstly push all fields values of Engine type Obj on Stack
> using PUSH then i can some how construct object on memory & then push=
it
> on Stack.
I suggest you formulate how you'd create the object in Java, and then
simply run the resulting class through BCELifier to get an idea of how
the corresponding BCEL code would look like.
http://jakarta.apache.org/bcel/apidocs/org/apache/bcel/util/BCELifier.htm=
l
Martin
--------------enig5D8AFDC5B898AF29AD328639
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk3xuMAACgkQRhp6o4m9dFu45wCfWxCaxTTYVW2R7jwccFWdm2gB
UXgAnidGahWQwK1cV3QQNKcCXGev0chu
=ze07
-----END PGP SIGNATURE-----
--------------enig5D8AFDC5B898AF29AD328639--