Local Variable table missing from generated static lambda methods.

Frost, Gary Gary.Frost at amd.com
Thu Oct 18 14:55:32 PDT 2012


I am new to this discussion list, hope this the correct place to note this.

I am trying to 'lamdafy' the Aparapi GPU offload project (http://aparapi.googlecode.com) which converts bytecode to OpenCL at runtime.

So essentially given

      Aparapi.forEach(in.length,
            (gid)->{ int square=in[gid]*in[gid]; squares[gid]=square;}  // I know the temp store to square is werid/verbose
            );

I need parse the bytecode of the lambda to convert to OpenCL and I need access to the local variable table for variable names and scope information.

Even though I compiled with
    javac -g  -XDlambdaToMethod

I don't see a local variable table for the 'synthetic' lambda$0(int[], int[], int) method. I do get LocalVariableTables for all other methods

>From javap -v -c -p I get

 private static void lambda$0(int[], int[], int);
    flags: ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
    Code:
      stack=3, locals=4, args_size=3
         0: aload_0
         1: iload_2
         2: iaload
         3: aload_0
         4: iload_2
         5: iaload
         6: imul
         7: istore_3
         8: aload_1
         9: iload_2
        10: iload_3
        11: iastore
        12: return
      LineNumberTable:
        line 1: 0
        line 7: 8

Is there a reason for this?  Is this by design?  Or possibly just an oversight?

I suspect that debuggers may also want access to these tables going forward.

Gary


More information about the lambda-dev mailing list