Using your local implementations of Java and C#, compile the code of Figures 16.2 and C 16.7
Question:
Using your local implementations of Java and C#, compile the code of Figures 16.2 and C 16.7 all the way to machine language. Disassemble and compare the results. Can all the differences be attributed to variations in the quality of the compilers, or are any reflective of more fundamental differences between the source languages or virtual machines?
Figure 16.2:
Transcribed Image Text:
Code: public void insert (int v) { Stack=3, Locals=4, Args size=2 // this # 4; //Field head:LLLset $node; node n = head; 0: aload_0 1: getfield astore_2 aload_2 4: while (n.next != null // n #5; //Field LLset $node.next:LLLset $node; // conditional branch 5: &k n.next.val < v) { 6: getfield 9: ifnull 31 12: aload_2 13: getfield 16: getfield #5; //Field LLset$node.next:LLLset $node; #6; //Field LLset$node.val:I // v 19: iload_1 20: if_icmpge 31 n = n.next; 23: aload_2 24: getfield #5; //Field LLset$node. next:LLLset$node; 27: astore_2 28: goto if (n.next == null Il n.next.val > v) { 31: aload_2 32: getfield #5; //Field LLset$node.next:LLLset$node; 35: ifnull 49 38: aload_2 #5; //Field LLset $node.next:LLLset$node; 39: getfield 42: getfield 45: iload_1 #6; //Field LLset$node.val:I 46: if_icmple 76 node t = new node (); 49: # 2; //class LLset$node new 52: dup 53: aload_0 54: invokespecial #3; //Method LLset$node."
Code: public void insert (int v) { Stack=3, Locals=4, Args size=2 // this # 4; //Field head:LLLset $node; node n = head; 0: aload_0 1: getfield astore_2 aload_2 4: while (n.next != null // n #5; //Field LLset $node.next:LLLset $node; // conditional branch 5: &k n.next.val < v) { 6: getfield 9: ifnull 31 12: aload_2 13: getfield 16: getfield #5; //Field LLset$node.next:LLLset $node; #6; //Field LLset$node.val:I // v 19: iload_1 20: if_icmpge 31 n = n.next; 23: aload_2 24: getfield #5; //Field LLset$node. next:LLLset$node; 27: astore_2 28: goto if (n.next == null Il n.next.val > v) { 31: aload_2 32: getfield #5; //Field LLset$node.next:LLLset$node; 35: ifnull 49 38: aload_2 #5; //Field LLset $node.next:LLLset$node; 39: getfield 42: getfield 45: iload_1 #6; //Field LLset$node.val:I 46: if_icmple 76 node t = new node (); 49: # 2; //class LLset$node new 52: dup 53: aload_0 54: invokespecial #3; //Method LLset$node."":(LLLset;) 57: astore_3 t.val = v; 58: aload_3 // t 59: iload_1 60: putfield #6; //Field LLset$node.val:I t.next = n.next; 63: aload_3 64: aload_2 65: getfield 68: putfield aload_2 #5; //Field LLset$node.next:LLLset$node; #5; //Field LLset$node.next:LLLset$node; n.next = t; 71: 72: aload_3 73: putfield #5; //Field LLset$node.next:LLLset$node; } // else v already in set 76: return
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 37% (8 reviews)
ANS WER The machine language code generated by the Java and C comp ilers will be differe...View the full answer
Answered By
Churchil Mino
I have been a tutor for 2 years and have experience working with students of all ages and abilities. I am comfortable working with students one-on-one or in small groups, and am able to adapt my teaching style to meet the needs of each individual. I am patient and supportive, and my goal is to help my students succeed.
I have a strong background in math and science, and have tutored students in these subjects at all levels, from elementary school to college. I have also helped students prepare for standardized tests such as the SAT and ACT. In addition to academic tutoring, I have also worked as a swim coach and a camp counselor, and have experience working with children with special needs.
0.00
0 Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
Are there fundamental differences between liberal arts colleges and universities? In this case, we have information on the top 25 liberal arts colleges and the top 25 universities in the United...
-
Are there fundamental differences between liberal arts colleges and universities? In this case, we have information on the top 25 liberal arts colleges and the top 25 universities in the Unites...
-
Virtual Machines are presented with storage in manners similar to physical machines via TCP/IP, Fibre-Channel, or iSCSI connections. There are features in virtualization that optimize memory and...
-
Suppose that a 20-year bond pays $4 coupon once a year, and its yield rate is 6%. The bond has write-down of $0.49 for the first year. Calculate the write-down amount for the third year. Round the...
-
A 0.8-m3 insulated rigid tank contains 1.54 kg of carbon dioxide at 100 kPa. Now paddle wheel work is done on the system until the pressure in the tank rises to 135 kPa. Determine (a) The actual...
-
At a large university, the Statistics Department has tried a different text during each of the last three quarters. During the fall quarter, 500 students used a book by Professor Mean; during the...
-
Suppose that a probability of \(\frac{1}{16}\) is assigned to each point of the sample space of part (a) of Exercise 3.1 on page 65 . Find the probability distribution of the total number of units of...
-
1. Which of the following items has the greatest GAAP authority under SAS 69? a. GASB implementation guides b. Consensus positions of GASBs Emerging Issues Task Force c. GASB statements and...
-
What approaches do adaptive leaders employ to promote organizational agility and responsiveness, fostering a culture of experimentation and iterative improvement ?
-
1. Describe the Club Med experience for the international consumer. What are the elements of Club Meds unique offering that cross cultural boundaries? 2. Do you think Club Med should perform a market...
-
Rewrite the list insertion method of Example C 16.40 in F# instead of C#. Compile to CIL and compare to the right side of Figure C 16.7. Discuss any differences you find. Figure 16.7 . method private...
-
Suppose we wish, as described at the end of Example 16.36, to accurately attribute sampled time to the various contexts in which a subroutine is called. Perhaps the most straightforward approach...
-
Selected financial information from Syntex Corporation is reproduced below: 1. NOA turnover (average NOA equals ending NOA) is 2. 2. NOPAT margin equals 5%. 3. Leverage ratio (average NFO/average...
-
John agrees to buy a second-hand fishing boat from Malcolm. They agree the price of $20,000 and John pays a deposit of $2,000. He arranges to collect the boat the next day when he has his ute with...
-
Client suffered serious injuries at work when she fell 30 feet off a conveyor designed to carry employees from one work level to another. She was injured when the conveyor malfunctioned and failed to...
-
What area may be searched at the time of the arrest? Explain When is a search permitted if a person is arrested in a car? Explain Properly give citation
-
Ethan makes an online order of an unassembled patio table from Shangri La Furniture Company (SL). SL confirms the order and ships to Ethan the unassembled table that Ethan ordered. Before accepting...
-
Universal Camera, a camera manufacturer, sold 50 single lens reflex cameras to Lens Master, a retail store that sells cameras. The purchase price was $200 per camera. The written contract between...
-
List the errors you find in the following balance sheet. Prepare a corrected balance sheet. Assets Liabilities Current assets: Current liabilities: Accounts payable Supplies 31,300 6,500 Accum....
-
In the circuit shown in Figure 4, a battery supplies a constant voltage of 40 V, the inductance is 2 H, the resistance is 10, and l(0) = 0. (a) Find l(t). (b) Find the current after 0.1s.
-
A beam of light moves from one medium to another medium with less density. The critical angle is 60. Do we have refraction or reflection for each of the following incident angles? Show the bending of...
-
What is the difference between omnidirectional waves and unidirectional waves?
-
Using Figure 7.16, tabulate the attenuation (in dB) of an optical fiber for the indicated wavelength and distances. Figure 7.16 100 50 10 0.5 0.1 0.05 0.01 800 1000 1200 1400 1600 1800 Wavelength...
-
A rhino is charging at you, so decide to sedate it with a tranquilizer gun angled at 40 as shown above. The tranquilizer gun can reach a horizontal distance of 49 m when angled at 45. (Assume ideal...
-
What is the definition of motivation and how can the chef foster an environment of motivation in the kitchen? What methods can a chef implement to motivate the kitchen team? What factors contribute...
-
Article Review Read the article. Link is given below: https://www.projecttimes.com/articles/avoid-the-top-three-real-causes-of-scope-creep.html Post your thoughts on this article, add references if...
Study smarter with the SolutionInn App