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: 40% (10 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...
-
Bouie Company's beginning inventory and purchases during the fiscal year ended December 31, 20--, were as follows: There are 20 units of inventory on hand on December 31. 1. Calculate the total...
-
The school Spanish Club is sponsoring a trip to Mexico that will cost \($1,000\) per student. Your parents will contribute \($300\), but you need to save the remaining \($700\) over the next four...
-
On November 1, 2017, the account balances of Hamm Equipment Repair were as follows. During November, the following summary transactions were completed. Nov. 8 Paid $1,700 for salaries due employees,...
-
Frazier LLC placed in service on June 19, 2021 computer equipment (5-year property) with a basis of $2,740,000. Assume that Frazier has sufficient income to avoid any limitations. Calculate the...
-
Which of the graphs in Fig. Q25.12 best illustrates the current I in a real resistor as a function of the potential difference V across it? Explain. Figure Q25.12 (a) (b) (c) (d)
-
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...
-
Riveredge Manufacturing Company realized too late that it had made a mistake locating its controllers office and its electronic data processing system in the basement. Because of the spring thaw, the...
-
Two ice skaters, Daniel (mass 70.0 kg) and Rebecca (mass 45.0 kg), are practicing. Daniel stops to tie his shoelace and, while at rest, is struck by Rebecca, who is moving at 12.0 m/s before she...
-
Menlo Company distributes a single product. The company's sales and expenses for last month follow: 5 Sales Variable expenses Contribution margin Fixed expenses Net operating income Required: Total $...
-
1. What is Economic Order Quantity? What is its significance in inventory management? 2. What is Reorder Point? What is its significance in inventory management? 3. What is Materials Requirement...
-
For a "normal" $300m venture capital partnership: 1.How many portfolio companies would you expect? 2.How many of the portfolio companies do you expect to fail at a 100% loss to the VC partnership?...
-
you've probably heard the term "profit margin" at some point, but what does it mean? what exactly is a "profit margin" and how is it calculated? once we see it, what is it telling us? is it good? is...
-
In what ways can the power distance dimension of national culture become an important issue in management?
-
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...
-
Question 20 (1 point) A is the maximum sales available to all firms in an industry during a given period, under a given level of industry marketing effort and environmental conditions. A) market...
-
You work for a supplier that provides technology products to a variety of industries. One of your partners calls you and indicates they need to buy 10 computers that will run an application that...
-
"Ecommerce is the newest and most disruptive distribution channel wherein 1 po goods and services are represented virtually online and then distributed directly to the buyer" Agree Disagree
Study smarter with the SolutionInn App