I found this question that answered it for C++:
How do you get assembler output from C/C++ source in gcc?
How do I check assembly output of Java code?
11.9k views Asked by Archishman Archi MAN Sravan Ku AtThere are 2 answers
Stephan Rauh
On
Java uses both bytecode and assembly language machine code. It's a two-step process. The first step is to compile the Java source code to bytecode, as @elliott-frisch pointed out. At runtime, the JVM watches which parts of the program are used a lot. If a method "runs hot", it's compiled to machine code. That, in turn, is a multi-step process itself, including many optimizations and replacing fast code with even faster code. I've described this in BeyondJava.net several years ago.
If you can spare 45 minutes, I also recommend watching the talk of Charles Nutter. "Down the rabbit hole" is a great introduction to how Java compiles to assembly language.
As for your question: you have to add some parameters to the command starting the application:
javaw.exe -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly Adder
You also have to download a special DLL and store it in the jre folder. Also see Chris Newlands article on how to compile this file for OS X.
Related Questions in JAVA
- I need the BIRT.war that is compatible with Java 17 and Tomcat 10
- Creating global Class holder
- No method found for class java.lang.String in Kafka
- Issue edit a jtable with a pictures
- getting error when trying to launch kotlin jar file that use supabase "java.lang.NoClassDefFoundError"
- Does the && (logical AND) operator have a higher precedence than || (logical OR) operator in Java?
- Mixed color rendering in a JTable
- HTTPS configuration in Spring Boot, server returning timeout
- How to use Layout to create textfields which dont increase in size?
- Function for making the code wait in javafx
- How to create beans of the same class for multiple template parameters in Spring
- How could you print a specific String from an array with the values of an array from a double array on the same line, using iteration to print all?
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Accessing Secret Variables in Classic Pipelines through Java app in Azure DevOps
- Postgres && statement Error in Mybatis Mapper?
Related Questions in ASSEMBLY
- Is there some way to use printf to print a horizontal list of decrementing hex digits in NASM assembly on Linux
- How to call a C language function from x86 assembly code?
- Binary Bomb Phase 2 - Decoding Assembly
- AVR Assembly Clock Cycle
- Understanding the differences between mov and lea instructions in x86 assembly
- ARM Assembly code is not executing in Vitis IDE
- Which version of ARM does the M1 chip run on?
- Why would %rbp not be equal to the value of %rsp, which is 0x28?
- Move immediate 8-bit value into RSI, RDI, RSP or RBP
- Unable to run get .exe file from assembly NASM
- DOSbox automatically freezes and crashes without any prompt warnings
- Load function written in amd64 assembly into memory and call it
- link.exe unresolved external symbol _mainCRTStartup
- x86 Wrote a boot loader that prints a message to the screen but the characters are completely different to what I expected
- running an imf file using dosbox in parallel to a game
Related Questions in JVM
- How to check what objects are created and where?
- why does Java’s JIT compilation happen within user threads?
- The way Elasticsearch deals with control heap memory when indexing documents
- Within a Clojure project using deps.edn, where is the package name and version tracked?
- spark - How is it even possible to get an OOM?
- files in /tmp/hsperfdata_<user>/ were deleted
- Does an Stackoverflow occur in the JVM if the Activation Record is too small but there is still space left in the general stack?
- android art genertate verification errors,how to
- Understanding Invokedynamic Instruction in Java Bytecode and Its Impact on the Operand Stack
- A compatibility issue between jaydebeapi and jpype
- Java native access violation is not triggering the windows jit debugger
- java flight recorder(jfr) consumes 100% cpu when its supposed to have only 1-2% overhead
- Java reflection returning base type for Scala classes
- What is the exactly time that JNI release the LocalReference automatically?
- jvm exits for unknown reason
Related Questions in JIT
- Can not load scripted model using torch::jit::load
- Load function written in amd64 assembly into memory and call it
- Cannot trace my own model using torch.jit.trace
- why does Java’s JIT compilation happen within user threads?
- Why doesn't Hotspot JIT optimize-out code that has no external effects?
- How does the JIT compiler Maglev in chrome v8 perform?
- Is this python function to calculate ZLEMA correct (and optimised)?
- Is there a way to work around the donet jit compile inliner time budget?
- Provide symbols to the VisualStudio debugger for custom code
- jit - "Failed in nopython mode pipeline" error, despite not using nopython in numba
- Export Detectron2 Model
- Equivalent of `jax.lax.cond` for multiple boolean conditions
- V8 unsigned int operations
- Allowed data types in torch.jit.trace()
- suspiciously large mmap in C2Compiler::compile_method/PhaseCFG::insert_anti_dependences
Related Questions in JVM-HOTSPOT
- Why doesn't Hotspot JIT optimize-out code that has no external effects?
- Java native access violation is not triggering the windows jit debugger
- OpenJDK Tracking ReentrantLock lock and unlock
- Why are there extra logs in /tmp under -XX:+LogCompilation?
- Why do we need Thread.sleep after calling System.gc in JDK native memory usage scenario?
- Interpreter resolve get/put method only resolves the first access to a field
- How does java.c determine which to call since there are three function implementations for different systems in Jdk8?
- Is there any good examples of jvm reuse LocalVariableTable slot?
- Why is the code cache not flushed even if code cache gets full?
- Will sending `kill -11` to java process raises a NullPointerException?
- JVM option --XX MaxJavaStackTraceDepth when I decrease any value below 10, It is not working
- JVM stack depth: JVM internal vs C++ calling through JNI
- How to print generated assembly code for intrinsic functions in the "java.lang.Math"?
- Impact of heap space / non heap space memory on number of possible threads for a jvm process
- How does the hotspot VM handle the CMF(concurrent mode failure)?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Java uses bytecode. The most similar would be
javap, per the linked Oracle documentation, the javap command disassembles one or more class files. Its output depends on the options used.If I compile that to
Main.classand then runjavap -v Main.classI get