CodeTools proposal: "AsmTools"

Brian Kurotsuchi brian.kurotsuchi at oracle.com
Wed Dec 10 22:56:33 UTC 2014


Thanks Jon!

I agree that the usefulness of this goes beyond what's described below, 
we hope people will find the library convenient for whatever they can 
imagine, in addition to the uses that we've both pointed out for testing 
purposes.

Brian


On 12/10/14 12:29, Jonathan Gibbons wrote:
> Yes, this seems a good thing to do;  please go ahead and make this 
> happen.
>
> -- Jon
>
>
>
> On 12/04/2014 01:02 PM, Brian Kurotsuchi wrote:
>> Name: AsmTools
>>
>> Summary: A set of (Java class file) assembler/disassemblers, in order 
>> to facilitate the practice of verifying VM class-loader rejection of
>> invalid classfiles - for the purpose of OpenJDK development.
>>
>> Proposed by: Brian Kurotsuchi, Oracle, Java Conformance Tools team
>>
>> Rationale:
>>
>> This proposal is to open the Java Assembler Tools (AsmTools) into the
>> CodeTools project of OpenJDK. The rationale for this is to provide
>> transparency to the process of testing Java Virtual machines. The
>> advantage to promoting standard and methodical negative testing of 
>> Java VM class-loading  allows JDK developers to test their own VM and 
>> other environmental changes.  Publishing negative tests may also 
>> allow external OpenJDK users to contribute new tests for class file 
>> rejection that are not currently covered by SQE nor JCK test suites.
>>
>> AsmTools consists of 2 sets of assembler/disassemblers:
>>
>> Jasm/JDis - an assembler language that provides a Java-like 
>> declaration of member signatures, while providing Java VM 
>> specification compliant mnemonics for byte-code instructions. Jasm 
>> also provides high-level syntax for constructs often found within 
>> classfile attributes.   Jasm encoded tests are useful for sequencing 
>> byte codes in a way that Javac compiled code might not normally 
>> sequence byte-codes.
>>
>> JCod/JDec - an assembler language that provides byte-code containers 
>> of class-file constructs. JCod encoded tests are useful for testing 
>> the well-formedness of class-files, as well as creating collections 
>> within a class-file construct that might be size-bounded by a normal 
>> Java compiler.   JCod can also be used to 'fuzz' class files in a 
>> methodical way that respects class-file constructs.
>>
>> AsmTools are completely reflexive - Java binary (.class) files may be
>> disassembled into textual representations, which in turn can be
>> assembled back to the same binary file.
>>
>> AsmTools are developed to support the latest class file formats, in
>> lock-step with JDK development.
>>
>> Other open source Java assembler tools and binary classfile 
>> frameworks exist.  They can be used for the purpose of synthesizing 
>> classfiles for VM testing, however:
>>
>> a.) they typically are designed to enforce the limits imposed by the 
>> VM specification of the class file format.  They are not designed to
>> produce classes that violate those limits.
>>
>> b.) other assembler tools may not necessarily follow strict Java
>> mnemonics as defined in the Java VM spec.
>>
>> c.) other assembler tools may not stay in lock-step with the current
>> generation of the JDK and VM specifications.
>>
>> d.) class file libraries are harder to use for simple manipulations 
>> of any given class file.  Typically, one has to create a program in 
>> that framework to parse and modify a class for a specific change to a 
>> given class.
>>
>



More information about the code-tools-dev mailing list