Thanks,
-Mark
Juozas Baliuka wrote:
double and long use two registers.do you have problems with long and double type ?Thanks, Would the following stack trace be related to these indexes? I'm assuming that Registers are analogous to entries in the index? Whould this be correct? java.lang.VerifyError: (class: foo/bar/NewTestBean, method: testMethod signature: (DI)D) Register 2 contains wrong type at java.lang.Class.getDeclaredConstructors0(Native Method) atjava.lang.Class.privateGetDeclaredConstructors(Class.java:1576)at java.lang.Class.getConstructor0(Class.java:1748) at java.lang.Class.newInstance0(Class.java:266) at java.lang.Class.newInstance(Class.java:249) atorg.apache.commons.jelly.tags.bcel.BsfClassExtender.main(BsfClassExtender.java:194)Exception in thread "main" -Mark Bob Lee wrote:You are correct. I'm pretty sure the indexes work like this (I personally use Javassist): Static method: 0..n: arguments. n+1..m: local variables. Instance method: 0: this 1..n: arguments. n+1..m: local variables. "load" pushes the variable at that index on to the stack. "store" pops the top value off of the stack and stores it in the specified index. Thanks, Bob On Thursday, January 30, 2003, at 07:54 PM, Mark R. Diggory wrote:Hi, I currently have this code fragment * Integer xyz = new Integer(foo); manager.declareBean("foo", xyz, xyz.getClass()); * Which I use BCELLifier on to get the following section of BCEL code: InstructionHandle ih_14 = il.append(_factory.createNew("java.lang.Integer")); il.append(InstructionConstants.DUP); il.append(_factory.createLoad(Type.INT, 1)); il.append(_factory.createInvoke("java.lang.Integer", "<init>",Type.VOID,new Type[] { Type.INT },Constants.INVOKESPECIAL));il.append(_factory.createStore(Type.OBJECT, 3)); InstructionHandle ih_23 = il.append(_factory.createLoad(Type.OBJECT, 0));il.append(_factory.createFieldAccess("org.apache.commons.jelly.tags.bcel.Test","manager",new ObjectType("com.ibm.bsf.BSFManager"), Constants.GETFIELD)); il.append(new PUSH(_cp, "foo")); il.append(_factory.createLoad(Type.OBJECT, 3)); il.append(_factory.createLoad(Type.OBJECT, 3)); il.append(_factory.createInvoke("java.lang.Object", "getClass", new ObjectType("java.lang.Class"), Type.NO_ARGS, >Constants.INVOKEVIRTUAL));il.append(_factory.createInvoke("com.ibm.bsf.BSFManager", "declareBean",Type.VOID, new Type[] { Type.STRING, Type.OBJECT, new ObjectType("java.lang.Class") }, Constants.INVOKEVIRTUAL)); Specifically, I'm struggling with some issues where I don't quite understand what the indexes are for in situations like _factory.createStore(Type.OBJECT, 3) and _factory.createLoad(Type.OBJECT, 3) am I right in assuming that there are a set number of "indexes" representing positions in the InstructionList and that these above references represent the setting and getting of Object references in that list? I'm struggling because I'm trying to make the code more "iterative" where I might iterate over a "set" of handlers/append statements to append repeatedly to the instruction list (as an Example): for(int i = 0; i < argNames.length ; ){ InstructionHandle ih_14 =il.append(_factory.createNew(argClasses[i]));... il.append(_factory.createStore(Type.OBJECT, i)); ... il.append(new PUSH(_cp, argName[i])); il.append(_factory.createLoad(Type.OBJECT, i)); il.append(_factory.createLoad(Type.OBJECT, i)); ... } My problem is that I get actuall references that end up pointing to only the first argument. I'm hoping I understand what the indexes are for, but I'm hoping that you guy's can clarify this for me. Thanks, -Mark Diggory --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
