If you're in the modding and theming community, your work is about to get a bit faster, because Smali v2.0 is now in beta and firing on all cylinders. The new version brings multithreaded processing and a few tweaks to the language that should result in cleaner-looking code.

Smali and baksmali are tools for assembling and disassembling the dex format used in Android apks. It's true that tools like this can be used for less than honorable endeavors, but they are also incredibly important to activities like deodexing apps for custom themes, tweaking functionality (like forcing portrait or landscape mode), and even digging around to learn more about various apps.

Multithreading

The biggest change to come with this update is multithreading, which splits processing of classes across as many as 6 cores. The developers recommend increasing available memory via a command line option to account for running several threads simultaneously. Concurrent processing is enabled by default, but the maximum number of cores can also be adjusted. The speed increase should be pretty noticeable, especially on larger and very complicated apps.

Command line call with option to boost memory usage:

smali -JXmx512m out -o classes.dex

Language Changes

The developer also took the opportunity to make a few changes to Smali code syntax to improve readability and function. A very welcome modification comes to the .parameter directive, which is now called .param and no longer requires ordered sequential lines for each parameter slot.

[gist id='c457ff5b019f1e4c4504']

Similarly, .array-data has been tweaked so that numbers can be written in simple little-endian order without breaking them into a series bytes.

[gist id='c76fda022801611797b1']

Rounding out the list of changes, const/high16 and const-wide/high16 no longer accept just 16 bits for the instruction, but require the full value to be loaded into the register.

[gist id='4b4c260bd6a7662d176f']

If you can't wait to give all of your processor cores a workout, hurry over to the Smali repository to pick up the latest version. Remember, this is still in beta, so check back frequently as updates and bug fixes will probably be uploaded often.

Source: Smali 2.0 on Google Code