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: 44% (9 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...
-
This case illustrates how the abnormal earnings valuation model described in Appendix 7A of this chapter can be combined with security analysts published earnings forecasts and used to spot...
-
The velocity ratio of third systemof pulleys is _____.
-
Gramado Company was created as a wholly owned subsidiary of Porto Alegre Corporation on January 1, Year 1. On that date, Porto Alegre invested $42,000 in Gramado's capital stock. Given the exchange...
-
Head-First Company plans to sell 5,120 bicycle helmets at $74 each in the coming year. Unit variable cost is $45 (includes direct materials, direct labor, variable factory overhead, and variable...
-
Jimmy owns a garden in which he has planted N trees in a row. After a few years, the trees have grown up and now they have different heights. Jimmy pays much attention to the aesthetics of his...
-
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...
-
You decide to set up a college fund for your 10-year-old child and plan to make annual deposits into the account each year on your child's birthday. Because "other things" consistently use more of...
-
In a basic credit-linked note, how does the maturity value differ compared to a standard bond structure?
-
Why can a fixed-rate payer in an interest rate swap be viewed as being short the bond market, and the floating-rate payer be viewed as being long the bond market?
-
Why is the holding of a claim on a financial intermediary by an investor considered an indirect investment in another entity?
-
a. How does a cash CDO differ from a synthetic CDO? b. What is the advantage of a synthetic \(\mathrm{CDO}\) over a cash CDO for a bank that wants to use this structure for balance sheet management?
-
What is the difference between a financial asset and a tangible asset?
-
The image behind a convex mirror (radius of curvature = 68 cm) is located 22 cm from the mirror. (a) Where is the object located and (b) What is the magnification of the mirror? Determine whether the...
-
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...
-
Discuss the merits of the each standard (2g, 3g & 4g), including the advantages and disadvantages of each with respect to planning , deployment and the services they are able to provide.
-
Consider a dataset with the following 7 data points: {(3, +1), (2,+1), (-1,-1), (0,-1), (+1,-1), (+2, +1), (+3, +1)} Consider mapping these points to 2 dimensions using the feature vector (x) = (x,...
-
You borrow $3,500 and will pay back the entire amount in 5 years. You are charged 9 percent interest per year. How much interest do you pay on this loan?
Study smarter with the SolutionInn App