Parameter names

1 view
Skip to first unread message

Josh McDonald

unread,
May 25, 2009, 1:37:13 AM5/25/09
to loom...@googlegroups.com
Hey Max,

I don't suppose function parameter names are available for introspection at the .abc level? Apologies for the slightly off-topic question, but you're my AVM2 guru :)

Cheers,
-Josh

--
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

Josh 'G-Funk' McDonald
  -  jo...@joshmcdonald.info
  -  http://twitter.com/sophistifunk
  -  http://flex.joshmcdonald.info/

Maxim Porges

unread,
May 25, 2009, 11:16:48 AM5/25/09
to loom...@googlegroups.com
Nope, parameter names are not available unfortunately. The compiler throws them out, which is not an unusual thing for a compiler to do. Everything in the opcodes is based on local parameter index, so the name becomes irrelevant.

- max

Josh McDonald

unread,
May 25, 2009, 11:20:15 AM5/25/09
to loom...@googlegroups.com
Thought as much, but it was worth a shot ;-)

Cheers,
-Josh

2009/5/26 Maxim Porges <maxim....@gmail.com>

Drew Bourne

unread,
May 25, 2009, 6:09:41 PM5/25/09
to loom...@googlegroups.com
Max, Josh,

It is possible to include the parameter names, refer to the section of
the spec below relating to method_info. The info is optional though.

4.5.2 Parameter names
The param_names entry is available only when the HAS_PARAM_NAMES bit
is set in the flags. Each param_info
element of the array is an index into the constant pool’s string
array. The parameter name entry exists solely
for external tool use and is not used by the AVM2.
param_info
{
u30 param_name[param_count]
}

http://www.adobe.com/devnet/actionscript/articles/avm2overview.pdf

cheers,
Drew

Robert Penner

unread,
May 25, 2009, 7:27:25 PM5/25/09
to loom...@googlegroups.com
When I decompile AS3 SWFs, I see function parameter names.

Robert

Maxim Porges

unread,
May 26, 2009, 9:47:50 AM5/26/09
to loom...@googlegroups.com
You would think that, but this is not the case. Those are parameter names for external tools to pick up on, as it says in the spec: "The parameter name entry exists solely for external tool use and is not used by the AVM2."

I have yet to see a single example of a SWF or AVM2 block that has these entries present.

- max

Maxim Porges

unread,
May 26, 2009, 9:57:03 AM5/26/09
to loom...@googlegroups.com
Robert,

My guess is that the parameter names you are seeing are auto-generated by the decompiler, as is usually the case with decompilers for any platform. Are they the original parameter names or generated ones?

Looking at the AVM2 spec again, I'll take back my reply to Drew's message. The parameter name block in the method_info element does appear to be the place you'd expect method parameter names to show up, and they reference constant string pool entries which is the place that parameter names would end up. Again, I have not seen this block ever get filled with values, but I suspect they are present when using a compiler flag of some kind. The only flag I can see that might fill this block is the debug flag.

Thanks,

- max

Robert Penner

unread,
May 26, 2009, 1:51:18 PM5/26/09
to loom...@googlegroups.com
They are the original parameter names. You can see them in the Flex SDK, for example:

frameworks\libs\flex.swc

mx.core.BitmapAsset

public function BitmapAsset(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){
     super(bitmapData, pixelSnapping, smoothing);
}
 
Flash Authoring omits the parameters, though.

Robert
Reply all
Reply to author
Forward
0 new messages