Generating a class file for a small programming language
hello
Im in the middle of writing code to generate a java class file containing the bytecode etc from the result of compiling a small programming language I created for a project, with the intent on getting the JVM to execute the generated class file. I've already created all the necessary data structures to store the data for the class file (constant pool etc).
My question is, when storing the op - code of a byte code instruction in the code[] array contained in a code attribute for a method, how / where do you also store the value of the operand(s)? E.G when loading an int value from some index (say 21), the byte code mnemonic is iload and the operand is 21, so I store the opcode hex value (15) in the code[] array (I think you store the instructions op code in the code array, if im wrong please tell me) but I'm not sure how I'd store the operand (21).
thanks in advance (also any other pointers on class file generation would be appreciated)
adam

