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...
-
1. Depreciation for the current year includes Equipment $3,900 and Trucks, 51 800 Propor a compound entry to record depreciation on both the end the trucks ) Date Accounts and Explanation Debit...
-
Discuss the strengths and weaknesses of consumer-oriented and trade-oriented sales promotions.
-
What are Etsys three core competencies and how do these help the firm in its efforts to be successful?
-
How PPP predicts movement in the foreign exchange rate: a) short-term (3 months) b) long-term (6 years)
-
The Campbell Company is evaluating the proposed acquisition of a new milling machine. The machines base price is $108,000, and it would cost another $12,500 to modify it for special use by your firm....
-
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...
-
The mythical Owen Distributors has an annual demand of 2,000 units for its handheld security wands. The average cost of the handheld security wand is US$140. Carrying cost is 18% of the unit cost of...
-
Suppose a small flashlight bulb is on the bottom of the bathtub of Problem 19, directly under the toy boat. When this bulb is lit and the ceiling light is turned off, how does the size of the shadow...
-
Draw a scatter diagram and find \(r\) for the data shown in each table in Problems 25-30. X 85 90 y 80 40 100 30 102 28 105 25
-
Rothera Point Utilities (RPU) provides customers with 7 million megawatt-hours (MWh) of electricity each year. RPU operates three different generation facilities to meet this demand: the Rothera...
-
Explain the components of the path evaluation function f(node) used by A*. Do you think it is the best evaluation function that could be used? To what kinds of problems might it be best suited? And...
-
Celvin FoodStuff operates a chain of mini conve- nience stores in downtown city settings, offering beverages, snack food, and some fresh food items to passing pedestrian traffic. A typical Celvin...
-
What is the name of the element represented by each of the following atomic symbols? a. He b. H c. Pd d. Sr
-
A parking lot charges $3 for the first hour (or part of an hour) and $2 for each succeeding hour (or part), up to a daily maximum of $10. (a) Sketch a graph of the cost of parking at this lot as a...
-
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 company sells two products. Assuming the same sales mix as shown below, how many units of Product A must be sold to breakeven? Product A Product B Total Units 100,000 150,000 250,000 Sales $300,000...
-
South Sea Baubles has the following (incomplete) balance sheet and income statement. BALANCE SHEET AT END OF YEAR (Figures in $ millions) Assets 2015 2016 Liabilities and Shareholders' Equity 2015...
-
When the investor pays $100,000 to acquire 40% of a company's outstanding voting shares at a time when the fair value of the company's net assets are $175,000, the resulting goodwill amount is...
Study smarter with the SolutionInn App