1 /*
2  * Copyright (C) 2016 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package benchmarks;
18 
19 public class CloneBenchmark {
20     static class CloneableObject implements Cloneable {
clone()21         public Object clone() throws CloneNotSupportedException {
22             return super.clone();
23         }
24     }
25 
26     static class CloneableManyFieldObject implements Cloneable {
clone()27         public Object clone() throws CloneNotSupportedException {
28             return super.clone();
29         }
30 
31         Object o1 = new Object();
32         Object o2 = new Object();
33         Object o3 = new Object();
34         Object o4 = new Object();
35         Object o5 = new Object();
36         Object o6 = new Object();
37         Object o7 = new Object();
38         Object o8 = new Object();
39         Object o9 = new Object();
40         Object o10 = new Object();
41         Object o11 = new Object();
42         Object o12 = new Object();
43         Object o13 = new Object();
44         Object o14 = new Object();
45         Object o15 = new Object();
46         Object o16 = new Object();
47         Object o17 = new Object();
48         Object o18 = new Object();
49         Object o19 = new Object();
50         Object o20 = new Object();
51         Object o21 = new Object();
52         Object o22 = new Object();
53         Object o23 = new Object();
54         Object o24 = new Object();
55         Object o25 = new Object();
56         Object o26 = new Object();
57         Object o27 = new Object();
58         Object o28 = new Object();
59         Object o29 = new Object();
60         Object o30 = new Object();
61         Object o31 = new Object();
62         Object o32 = new Object();
63         Object o33 = new Object();
64         Object o34 = new Object();
65         Object o35 = new Object();
66         Object o36 = new Object();
67         Object o37 = new Object();
68         Object o38 = new Object();
69         Object o39 = new Object();
70         Object o40 = new Object();
71         Object o41 = new Object();
72         Object o42 = new Object();
73         Object o43 = new Object();
74         Object o44 = new Object();
75         Object o45 = new Object();
76         Object o46 = new Object();
77         Object o47 = new Object();
78         Object o48 = new Object();
79         Object o49 = new Object();
80         Object o50 = new Object();
81         Object o51 = new Object();
82         Object o52 = new Object();
83         Object o53 = new Object();
84         Object o54 = new Object();
85         Object o55 = new Object();
86         Object o56 = new Object();
87         Object o57 = new Object();
88         Object o58 = new Object();
89         Object o59 = new Object();
90         Object o60 = new Object();
91         Object o61 = new Object();
92         Object o62 = new Object();
93         Object o63 = new Object();
94         Object o64 = new Object();
95         Object o65 = new Object();
96         Object o66 = new Object();
97         Object o67 = new Object();
98         Object o68 = new Object();
99         Object o69 = new Object();
100         Object o70 = new Object();
101         Object o71 = new Object();
102         Object o72 = new Object();
103         Object o73 = new Object();
104         Object o74 = new Object();
105         Object o75 = new Object();
106         Object o76 = new Object();
107         Object o77 = new Object();
108         Object o78 = new Object();
109         Object o79 = new Object();
110         Object o80 = new Object();
111         Object o81 = new Object();
112         Object o82 = new Object();
113         Object o83 = new Object();
114         Object o84 = new Object();
115         Object o85 = new Object();
116         Object o86 = new Object();
117         Object o87 = new Object();
118         Object o88 = new Object();
119         Object o89 = new Object();
120         Object o90 = new Object();
121         Object o91 = new Object();
122         Object o92 = new Object();
123         Object o93 = new Object();
124         Object o94 = new Object();
125         Object o95 = new Object();
126         Object o96 = new Object();
127         Object o97 = new Object();
128         Object o98 = new Object();
129         Object o99 = new Object();
130         Object o100 = new Object();
131         Object o101 = new Object();
132         Object o102 = new Object();
133         Object o103 = new Object();
134         Object o104 = new Object();
135         Object o105 = new Object();
136         Object o106 = new Object();
137         Object o107 = new Object();
138         Object o108 = new Object();
139         Object o109 = new Object();
140         Object o110 = new Object();
141         Object o111 = new Object();
142         Object o112 = new Object();
143         Object o113 = new Object();
144         Object o114 = new Object();
145         Object o115 = new Object();
146         Object o116 = new Object();
147         Object o117 = new Object();
148         Object o118 = new Object();
149         Object o119 = new Object();
150         Object o120 = new Object();
151         Object o121 = new Object();
152         Object o122 = new Object();
153         Object o123 = new Object();
154         Object o124 = new Object();
155         Object o125 = new Object();
156         Object o126 = new Object();
157         Object o127 = new Object();
158         Object o128 = new Object();
159         Object o129 = new Object();
160         Object o130 = new Object();
161         Object o131 = new Object();
162         Object o132 = new Object();
163         Object o133 = new Object();
164         Object o134 = new Object();
165         Object o135 = new Object();
166         Object o136 = new Object();
167         Object o137 = new Object();
168         Object o138 = new Object();
169         Object o139 = new Object();
170         Object o140 = new Object();
171         Object o141 = new Object();
172         Object o142 = new Object();
173         Object o143 = new Object();
174         Object o144 = new Object();
175         Object o145 = new Object();
176         Object o146 = new Object();
177         Object o147 = new Object();
178         Object o148 = new Object();
179         Object o149 = new Object();
180         Object o150 = new Object();
181         Object o151 = new Object();
182         Object o152 = new Object();
183         Object o153 = new Object();
184         Object o154 = new Object();
185         Object o155 = new Object();
186         Object o156 = new Object();
187         Object o157 = new Object();
188         Object o158 = new Object();
189         Object o159 = new Object();
190         Object o160 = new Object();
191         Object o161 = new Object();
192         Object o162 = new Object();
193         Object o163 = new Object();
194         Object o164 = new Object();
195         Object o165 = new Object();
196         Object o166 = new Object();
197         Object o167 = new Object();
198         Object o168 = new Object();
199         Object o169 = new Object();
200         Object o170 = new Object();
201         Object o171 = new Object();
202         Object o172 = new Object();
203         Object o173 = new Object();
204         Object o174 = new Object();
205         Object o175 = new Object();
206         Object o176 = new Object();
207         Object o177 = new Object();
208         Object o178 = new Object();
209         Object o179 = new Object();
210         Object o180 = new Object();
211         Object o181 = new Object();
212         Object o182 = new Object();
213         Object o183 = new Object();
214         Object o184 = new Object();
215         Object o185 = new Object();
216         Object o186 = new Object();
217         Object o187 = new Object();
218         Object o188 = new Object();
219         Object o189 = new Object();
220         Object o190 = new Object();
221         Object o191 = new Object();
222         Object o192 = new Object();
223         Object o193 = new Object();
224         Object o194 = new Object();
225         Object o195 = new Object();
226         Object o196 = new Object();
227         Object o197 = new Object();
228         Object o198 = new Object();
229         Object o199 = new Object();
230         Object o200 = new Object();
231         Object o201 = new Object();
232         Object o202 = new Object();
233         Object o203 = new Object();
234         Object o204 = new Object();
235         Object o205 = new Object();
236         Object o206 = new Object();
237         Object o207 = new Object();
238         Object o208 = new Object();
239         Object o209 = new Object();
240         Object o210 = new Object();
241         Object o211 = new Object();
242         Object o212 = new Object();
243         Object o213 = new Object();
244         Object o214 = new Object();
245         Object o215 = new Object();
246         Object o216 = new Object();
247         Object o217 = new Object();
248         Object o218 = new Object();
249         Object o219 = new Object();
250         Object o220 = new Object();
251         Object o221 = new Object();
252         Object o222 = new Object();
253         Object o223 = new Object();
254         Object o224 = new Object();
255         Object o225 = new Object();
256         Object o226 = new Object();
257         Object o227 = new Object();
258         Object o228 = new Object();
259         Object o229 = new Object();
260         Object o230 = new Object();
261         Object o231 = new Object();
262         Object o232 = new Object();
263         Object o233 = new Object();
264         Object o234 = new Object();
265         Object o235 = new Object();
266         Object o236 = new Object();
267         Object o237 = new Object();
268         Object o238 = new Object();
269         Object o239 = new Object();
270         Object o240 = new Object();
271         Object o241 = new Object();
272         Object o242 = new Object();
273         Object o243 = new Object();
274         Object o244 = new Object();
275         Object o245 = new Object();
276         Object o246 = new Object();
277         Object o247 = new Object();
278         Object o248 = new Object();
279         Object o249 = new Object();
280         Object o250 = new Object();
281         Object o251 = new Object();
282         Object o252 = new Object();
283         Object o253 = new Object();
284         Object o254 = new Object();
285         Object o255 = new Object();
286         Object o256 = new Object();
287         Object o257 = new Object();
288         Object o258 = new Object();
289         Object o259 = new Object();
290         Object o260 = new Object();
291         Object o261 = new Object();
292         Object o262 = new Object();
293         Object o263 = new Object();
294         Object o264 = new Object();
295         Object o265 = new Object();
296         Object o266 = new Object();
297         Object o267 = new Object();
298         Object o268 = new Object();
299         Object o269 = new Object();
300         Object o270 = new Object();
301         Object o271 = new Object();
302         Object o272 = new Object();
303         Object o273 = new Object();
304         Object o274 = new Object();
305         Object o275 = new Object();
306         Object o276 = new Object();
307         Object o277 = new Object();
308         Object o278 = new Object();
309         Object o279 = new Object();
310         Object o280 = new Object();
311         Object o281 = new Object();
312         Object o282 = new Object();
313         Object o283 = new Object();
314         Object o284 = new Object();
315         Object o285 = new Object();
316         Object o286 = new Object();
317         Object o287 = new Object();
318         Object o288 = new Object();
319         Object o289 = new Object();
320         Object o290 = new Object();
321         Object o291 = new Object();
322         Object o292 = new Object();
323         Object o293 = new Object();
324         Object o294 = new Object();
325         Object o295 = new Object();
326         Object o296 = new Object();
327         Object o297 = new Object();
328         Object o298 = new Object();
329         Object o299 = new Object();
330         Object o300 = new Object();
331         Object o301 = new Object();
332         Object o302 = new Object();
333         Object o303 = new Object();
334         Object o304 = new Object();
335         Object o305 = new Object();
336         Object o306 = new Object();
337         Object o307 = new Object();
338         Object o308 = new Object();
339         Object o309 = new Object();
340         Object o310 = new Object();
341         Object o311 = new Object();
342         Object o312 = new Object();
343         Object o313 = new Object();
344         Object o314 = new Object();
345         Object o315 = new Object();
346         Object o316 = new Object();
347         Object o317 = new Object();
348         Object o318 = new Object();
349         Object o319 = new Object();
350         Object o320 = new Object();
351         Object o321 = new Object();
352         Object o322 = new Object();
353         Object o323 = new Object();
354         Object o324 = new Object();
355         Object o325 = new Object();
356         Object o326 = new Object();
357         Object o327 = new Object();
358         Object o328 = new Object();
359         Object o329 = new Object();
360         Object o330 = new Object();
361         Object o331 = new Object();
362         Object o332 = new Object();
363         Object o333 = new Object();
364         Object o334 = new Object();
365         Object o335 = new Object();
366         Object o336 = new Object();
367         Object o337 = new Object();
368         Object o338 = new Object();
369         Object o339 = new Object();
370         Object o340 = new Object();
371         Object o341 = new Object();
372         Object o342 = new Object();
373         Object o343 = new Object();
374         Object o344 = new Object();
375         Object o345 = new Object();
376         Object o346 = new Object();
377         Object o347 = new Object();
378         Object o348 = new Object();
379         Object o349 = new Object();
380         Object o350 = new Object();
381         Object o351 = new Object();
382         Object o352 = new Object();
383         Object o353 = new Object();
384         Object o354 = new Object();
385         Object o355 = new Object();
386         Object o356 = new Object();
387         Object o357 = new Object();
388         Object o358 = new Object();
389         Object o359 = new Object();
390         Object o360 = new Object();
391         Object o361 = new Object();
392         Object o362 = new Object();
393         Object o363 = new Object();
394         Object o364 = new Object();
395         Object o365 = new Object();
396         Object o366 = new Object();
397         Object o367 = new Object();
398         Object o368 = new Object();
399         Object o369 = new Object();
400         Object o370 = new Object();
401         Object o371 = new Object();
402         Object o372 = new Object();
403         Object o373 = new Object();
404         Object o374 = new Object();
405         Object o375 = new Object();
406         Object o376 = new Object();
407         Object o377 = new Object();
408         Object o378 = new Object();
409         Object o379 = new Object();
410         Object o380 = new Object();
411         Object o381 = new Object();
412         Object o382 = new Object();
413         Object o383 = new Object();
414         Object o384 = new Object();
415         Object o385 = new Object();
416         Object o386 = new Object();
417         Object o387 = new Object();
418         Object o388 = new Object();
419         Object o389 = new Object();
420         Object o390 = new Object();
421         Object o391 = new Object();
422         Object o392 = new Object();
423         Object o393 = new Object();
424         Object o394 = new Object();
425         Object o395 = new Object();
426         Object o396 = new Object();
427         Object o397 = new Object();
428         Object o398 = new Object();
429         Object o399 = new Object();
430         Object o400 = new Object();
431         Object o401 = new Object();
432         Object o402 = new Object();
433         Object o403 = new Object();
434         Object o404 = new Object();
435         Object o405 = new Object();
436         Object o406 = new Object();
437         Object o407 = new Object();
438         Object o408 = new Object();
439         Object o409 = new Object();
440         Object o410 = new Object();
441         Object o411 = new Object();
442         Object o412 = new Object();
443         Object o413 = new Object();
444         Object o414 = new Object();
445         Object o415 = new Object();
446         Object o416 = new Object();
447         Object o417 = new Object();
448         Object o418 = new Object();
449         Object o419 = new Object();
450         Object o420 = new Object();
451         Object o421 = new Object();
452         Object o422 = new Object();
453         Object o423 = new Object();
454         Object o424 = new Object();
455         Object o425 = new Object();
456         Object o426 = new Object();
457         Object o427 = new Object();
458         Object o428 = new Object();
459         Object o429 = new Object();
460         Object o430 = new Object();
461         Object o431 = new Object();
462         Object o432 = new Object();
463         Object o433 = new Object();
464         Object o434 = new Object();
465         Object o435 = new Object();
466         Object o436 = new Object();
467         Object o437 = new Object();
468         Object o438 = new Object();
469         Object o439 = new Object();
470         Object o440 = new Object();
471         Object o441 = new Object();
472         Object o442 = new Object();
473         Object o460 = new Object();
474         Object o461 = new Object();
475         Object o462 = new Object();
476         Object o463 = new Object();
477         Object o464 = new Object();
478         Object o465 = new Object();
479         Object o466 = new Object();
480         Object o467 = new Object();
481         Object o468 = new Object();
482         Object o469 = new Object();
483         Object o470 = new Object();
484         Object o471 = new Object();
485         Object o472 = new Object();
486         Object o473 = new Object();
487         Object o474 = new Object();
488         Object o475 = new Object();
489         Object o476 = new Object();
490         Object o477 = new Object();
491         Object o478 = new Object();
492         Object o479 = new Object();
493         Object o480 = new Object();
494         Object o481 = new Object();
495         Object o482 = new Object();
496         Object o483 = new Object();
497         Object o484 = new Object();
498         Object o485 = new Object();
499         Object o486 = new Object();
500         Object o487 = new Object();
501         Object o488 = new Object();
502         Object o489 = new Object();
503         Object o490 = new Object();
504         Object o491 = new Object();
505         Object o492 = new Object();
506         Object o493 = new Object();
507         Object o494 = new Object();
508         Object o495 = new Object();
509         Object o496 = new Object();
510         Object o497 = new Object();
511         Object o498 = new Object();
512         Object o499 = new Object();
513         Object o500 = new Object();
514         Object o501 = new Object();
515         Object o502 = new Object();
516         Object o503 = new Object();
517         Object o504 = new Object();
518         Object o505 = new Object();
519         Object o506 = new Object();
520         Object o507 = new Object();
521         Object o508 = new Object();
522         Object o509 = new Object();
523         Object o510 = new Object();
524         Object o511 = new Object();
525         Object o512 = new Object();
526         Object o513 = new Object();
527         Object o514 = new Object();
528         Object o515 = new Object();
529         Object o516 = new Object();
530         Object o517 = new Object();
531         Object o518 = new Object();
532         Object o519 = new Object();
533         Object o520 = new Object();
534         Object o521 = new Object();
535         Object o522 = new Object();
536         Object o523 = new Object();
537         Object o556 = new Object();
538         Object o557 = new Object();
539         Object o558 = new Object();
540         Object o559 = new Object();
541         Object o560 = new Object();
542         Object o561 = new Object();
543         Object o562 = new Object();
544         Object o563 = new Object();
545         Object o564 = new Object();
546         Object o565 = new Object();
547         Object o566 = new Object();
548         Object o567 = new Object();
549         Object o568 = new Object();
550         Object o569 = new Object();
551         Object o570 = new Object();
552         Object o571 = new Object();
553         Object o572 = new Object();
554         Object o573 = new Object();
555         Object o574 = new Object();
556         Object o575 = new Object();
557         Object o576 = new Object();
558         Object o577 = new Object();
559         Object o578 = new Object();
560         Object o579 = new Object();
561         Object o580 = new Object();
562         Object o581 = new Object();
563         Object o582 = new Object();
564         Object o583 = new Object();
565         Object o584 = new Object();
566         Object o585 = new Object();
567         Object o586 = new Object();
568         Object o587 = new Object();
569         Object o588 = new Object();
570         Object o589 = new Object();
571         Object o590 = new Object();
572         Object o591 = new Object();
573         Object o592 = new Object();
574         Object o593 = new Object();
575         Object o594 = new Object();
576         Object o595 = new Object();
577         Object o596 = new Object();
578         Object o597 = new Object();
579         Object o598 = new Object();
580         Object o599 = new Object();
581         Object o600 = new Object();
582         Object o601 = new Object();
583         Object o602 = new Object();
584         Object o603 = new Object();
585         Object o604 = new Object();
586         Object o605 = new Object();
587         Object o606 = new Object();
588         Object o607 = new Object();
589         Object o608 = new Object();
590         Object o609 = new Object();
591         Object o610 = new Object();
592         Object o611 = new Object();
593         Object o612 = new Object();
594         Object o613 = new Object();
595         Object o614 = new Object();
596         Object o615 = new Object();
597         Object o616 = new Object();
598         Object o617 = new Object();
599         Object o618 = new Object();
600         Object o619 = new Object();
601         Object o620 = new Object();
602         Object o621 = new Object();
603         Object o622 = new Object();
604         Object o623 = new Object();
605         Object o624 = new Object();
606         Object o625 = new Object();
607         Object o626 = new Object();
608         Object o627 = new Object();
609         Object o628 = new Object();
610         Object o629 = new Object();
611         Object o630 = new Object();
612         Object o631 = new Object();
613         Object o632 = new Object();
614         Object o633 = new Object();
615         Object o634 = new Object();
616         Object o635 = new Object();
617         Object o636 = new Object();
618         Object o637 = new Object();
619         Object o638 = new Object();
620         Object o639 = new Object();
621         Object o640 = new Object();
622         Object o641 = new Object();
623         Object o642 = new Object();
624         Object o643 = new Object();
625         Object o644 = new Object();
626         Object o645 = new Object();
627         Object o646 = new Object();
628         Object o647 = new Object();
629         Object o648 = new Object();
630         Object o649 = new Object();
631         Object o650 = new Object();
632         Object o651 = new Object();
633         Object o652 = new Object();
634         Object o653 = new Object();
635         Object o654 = new Object();
636         Object o655 = new Object();
637         Object o656 = new Object();
638         Object o657 = new Object();
639         Object o658 = new Object();
640         Object o659 = new Object();
641         Object o660 = new Object();
642         Object o661 = new Object();
643         Object o662 = new Object();
644         Object o663 = new Object();
645         Object o664 = new Object();
646         Object o665 = new Object();
647         Object o666 = new Object();
648         Object o667 = new Object();
649         Object o668 = new Object();
650         Object o669 = new Object();
651         Object o670 = new Object();
652         Object o671 = new Object();
653         Object o672 = new Object();
654         Object o673 = new Object();
655         Object o674 = new Object();
656         Object o675 = new Object();
657         Object o676 = new Object();
658         Object o677 = new Object();
659         Object o678 = new Object();
660         Object o679 = new Object();
661         Object o680 = new Object();
662         Object o681 = new Object();
663         Object o682 = new Object();
664         Object o683 = new Object();
665         Object o684 = new Object();
666         Object o685 = new Object();
667         Object o686 = new Object();
668         Object o687 = new Object();
669         Object o688 = new Object();
670         Object o734 = new Object();
671         Object o735 = new Object();
672         Object o736 = new Object();
673         Object o737 = new Object();
674         Object o738 = new Object();
675         Object o739 = new Object();
676         Object o740 = new Object();
677         Object o741 = new Object();
678         Object o742 = new Object();
679         Object o743 = new Object();
680         Object o744 = new Object();
681         Object o745 = new Object();
682         Object o746 = new Object();
683         Object o747 = new Object();
684         Object o748 = new Object();
685         Object o749 = new Object();
686         Object o750 = new Object();
687         Object o751 = new Object();
688         Object o752 = new Object();
689         Object o753 = new Object();
690         Object o754 = new Object();
691         Object o755 = new Object();
692         Object o756 = new Object();
693         Object o757 = new Object();
694         Object o758 = new Object();
695         Object o759 = new Object();
696         Object o760 = new Object();
697         Object o761 = new Object();
698         Object o762 = new Object();
699         Object o763 = new Object();
700         Object o764 = new Object();
701         Object o765 = new Object();
702         Object o766 = new Object();
703         Object o767 = new Object();
704         Object o768 = new Object();
705         Object o769 = new Object();
706         Object o770 = new Object();
707         Object o771 = new Object();
708         Object o772 = new Object();
709         Object o773 = new Object();
710         Object o774 = new Object();
711         Object o775 = new Object();
712         Object o776 = new Object();
713         Object o777 = new Object();
714         Object o778 = new Object();
715         Object o779 = new Object();
716         Object o780 = new Object();
717         Object o781 = new Object();
718         Object o782 = new Object();
719         Object o783 = new Object();
720         Object o784 = new Object();
721         Object o785 = new Object();
722         Object o786 = new Object();
723         Object o787 = new Object();
724         Object o788 = new Object();
725         Object o789 = new Object();
726         Object o790 = new Object();
727         Object o791 = new Object();
728         Object o792 = new Object();
729         Object o793 = new Object();
730         Object o794 = new Object();
731         Object o795 = new Object();
732         Object o796 = new Object();
733         Object o797 = new Object();
734         Object o798 = new Object();
735         Object o799 = new Object();
736         Object o800 = new Object();
737         Object o801 = new Object();
738         Object o802 = new Object();
739         Object o803 = new Object();
740         Object o804 = new Object();
741         Object o805 = new Object();
742         Object o806 = new Object();
743         Object o807 = new Object();
744         Object o808 = new Object();
745         Object o809 = new Object();
746         Object o810 = new Object();
747         Object o811 = new Object();
748         Object o812 = new Object();
749         Object o813 = new Object();
750         Object o848 = new Object();
751         Object o849 = new Object();
752         Object o850 = new Object();
753         Object o851 = new Object();
754         Object o852 = new Object();
755         Object o853 = new Object();
756         Object o854 = new Object();
757         Object o855 = new Object();
758         Object o856 = new Object();
759         Object o857 = new Object();
760         Object o858 = new Object();
761         Object o859 = new Object();
762         Object o860 = new Object();
763         Object o861 = new Object();
764         Object o862 = new Object();
765         Object o863 = new Object();
766         Object o864 = new Object();
767         Object o865 = new Object();
768         Object o866 = new Object();
769         Object o867 = new Object();
770         Object o868 = new Object();
771         Object o869 = new Object();
772         Object o870 = new Object();
773         Object o871 = new Object();
774         Object o872 = new Object();
775         Object o873 = new Object();
776         Object o874 = new Object();
777         Object o875 = new Object();
778         Object o876 = new Object();
779         Object o877 = new Object();
780         Object o878 = new Object();
781         Object o879 = new Object();
782         Object o880 = new Object();
783         Object o881 = new Object();
784         Object o882 = new Object();
785         Object o883 = new Object();
786         Object o884 = new Object();
787         Object o885 = new Object();
788         Object o886 = new Object();
789         Object o887 = new Object();
790         Object o888 = new Object();
791         Object o889 = new Object();
792         Object o890 = new Object();
793         Object o891 = new Object();
794         Object o892 = new Object();
795         Object o893 = new Object();
796         Object o894 = new Object();
797         Object o895 = new Object();
798         Object o896 = new Object();
799         Object o897 = new Object();
800         Object o898 = new Object();
801         Object o899 = new Object();
802         Object o900 = new Object();
803         Object o901 = new Object();
804         Object o902 = new Object();
805         Object o903 = new Object();
806         Object o904 = new Object();
807         Object o905 = new Object();
808         Object o906 = new Object();
809         Object o907 = new Object();
810         Object o908 = new Object();
811         Object o909 = new Object();
812         Object o910 = new Object();
813         Object o911 = new Object();
814         Object o912 = new Object();
815         Object o913 = new Object();
816         Object o914 = new Object();
817         Object o915 = new Object();
818         Object o916 = new Object();
819         Object o917 = new Object();
820         Object o918 = new Object();
821         Object o919 = new Object();
822         Object o920 = new Object();
823         Object o921 = new Object();
824         Object o922 = new Object();
825         Object o923 = new Object();
826         Object o924 = new Object();
827         Object o925 = new Object();
828         Object o926 = new Object();
829         Object o927 = new Object();
830         Object o928 = new Object();
831         Object o929 = new Object();
832         Object o930 = new Object();
833         Object o931 = new Object();
834         Object o932 = new Object();
835         Object o933 = new Object();
836         Object o934 = new Object();
837         Object o935 = new Object();
838         Object o936 = new Object();
839         Object o937 = new Object();
840         Object o938 = new Object();
841         Object o939 = new Object();
842         Object o940 = new Object();
843         Object o941 = new Object();
844         Object o942 = new Object();
845         Object o943 = new Object();
846         Object o944 = new Object();
847         Object o945 = new Object();
848         Object o946 = new Object();
849         Object o947 = new Object();
850         Object o948 = new Object();
851         Object o949 = new Object();
852         Object o950 = new Object();
853         Object o951 = new Object();
854         Object o952 = new Object();
855         Object o953 = new Object();
856         Object o954 = new Object();
857         Object o955 = new Object();
858         Object o956 = new Object();
859         Object o957 = new Object();
860         Object o958 = new Object();
861         Object o959 = new Object();
862         Object o960 = new Object();
863         Object o961 = new Object();
864         Object o962 = new Object();
865         Object o963 = new Object();
866         Object o964 = new Object();
867         Object o965 = new Object();
868         Object o966 = new Object();
869         Object o967 = new Object();
870         Object o968 = new Object();
871         Object o969 = new Object();
872         Object o970 = new Object();
873         Object o971 = new Object();
874         Object o972 = new Object();
875         Object o973 = new Object();
876         Object o974 = new Object();
877         Object o975 = new Object();
878         Object o976 = new Object();
879         Object o977 = new Object();
880         Object o978 = new Object();
881         Object o979 = new Object();
882         Object o980 = new Object();
883         Object o981 = new Object();
884         Object o982 = new Object();
885         Object o983 = new Object();
886         Object o984 = new Object();
887         Object o985 = new Object();
888         Object o986 = new Object();
889         Object o987 = new Object();
890         Object o988 = new Object();
891         Object o989 = new Object();
892         Object o990 = new Object();
893         Object o991 = new Object();
894         Object o992 = new Object();
895         Object o993 = new Object();
896         Object o994 = new Object();
897         Object o995 = new Object();
898         Object o996 = new Object();
899         Object o997 = new Object();
900         Object o998 = new Object();
901         Object o999 = new Object();
902     }
903 
904     static class Deep0 {}
905     static class Deep1 extends Deep0 {}
906     static class Deep2 extends Deep1 {}
907     static class Deep3 extends Deep2 {}
908     static class Deep4 extends Deep3 {}
909     static class Deep5 extends Deep4 {}
910     static class Deep6 extends Deep5 {}
911     static class Deep7 extends Deep6 {}
912     static class Deep8 extends Deep7 {}
913     static class Deep9 extends Deep8 {}
914     static class Deep10 extends Deep9 {}
915     static class Deep11 extends Deep10 {}
916     static class Deep12 extends Deep11 {}
917     static class Deep13 extends Deep12 {}
918     static class Deep14 extends Deep13 {}
919     static class Deep15 extends Deep14 {}
920     static class Deep16 extends Deep15 {}
921     static class Deep17 extends Deep16 {}
922     static class Deep18 extends Deep17 {}
923     static class Deep19 extends Deep18 {}
924     static class Deep20 extends Deep19 {}
925     static class Deep21 extends Deep20 {}
926     static class Deep22 extends Deep21 {}
927     static class Deep23 extends Deep22 {}
928     static class Deep24 extends Deep23 {}
929     static class Deep25 extends Deep24 {}
930     static class Deep26 extends Deep25 {}
931     static class Deep27 extends Deep26 {}
932     static class Deep28 extends Deep27 {}
933     static class Deep29 extends Deep28 {}
934     static class Deep30 extends Deep29 {}
935     static class Deep31 extends Deep30 {}
936     static class Deep32 extends Deep31 {}
937     static class Deep33 extends Deep32 {}
938     static class Deep34 extends Deep33 {}
939     static class Deep35 extends Deep34 {}
940     static class Deep36 extends Deep35 {}
941     static class Deep37 extends Deep36 {}
942     static class Deep38 extends Deep37 {}
943     static class Deep39 extends Deep38 {}
944     static class Deep40 extends Deep39 {}
945     static class Deep41 extends Deep40 {}
946     static class Deep42 extends Deep41 {}
947     static class Deep43 extends Deep42 {}
948     static class Deep44 extends Deep43 {}
949     static class Deep45 extends Deep44 {}
950     static class Deep46 extends Deep45 {}
951     static class Deep47 extends Deep46 {}
952     static class Deep48 extends Deep47 {}
953     static class Deep49 extends Deep48 {}
954     static class Deep50 extends Deep49 {}
955     static class Deep51 extends Deep50 {}
956     static class Deep52 extends Deep51 {}
957     static class Deep53 extends Deep52 {}
958     static class Deep54 extends Deep53 {}
959     static class Deep55 extends Deep54 {}
960     static class Deep56 extends Deep55 {}
961     static class Deep57 extends Deep56 {}
962     static class Deep58 extends Deep57 {}
963     static class Deep59 extends Deep58 {}
964     static class Deep60 extends Deep59 {}
965     static class Deep61 extends Deep60 {}
966     static class Deep62 extends Deep61 {}
967     static class Deep63 extends Deep62 {}
968     static class Deep64 extends Deep63 {}
969     static class Deep65 extends Deep64 {}
970     static class Deep66 extends Deep65 {}
971     static class Deep67 extends Deep66 {}
972     static class Deep68 extends Deep67 {}
973     static class Deep69 extends Deep68 {}
974     static class Deep70 extends Deep69 {}
975     static class Deep71 extends Deep70 {}
976     static class Deep72 extends Deep71 {}
977     static class Deep73 extends Deep72 {}
978     static class Deep74 extends Deep73 {}
979     static class Deep75 extends Deep74 {}
980     static class Deep76 extends Deep75 {}
981     static class Deep77 extends Deep76 {}
982     static class Deep78 extends Deep77 {}
983     static class Deep79 extends Deep78 {}
984     static class Deep80 extends Deep79 {}
985     static class Deep81 extends Deep80 {}
986     static class Deep82 extends Deep81 {}
987     static class Deep83 extends Deep82 {}
988     static class Deep84 extends Deep83 {}
989     static class Deep85 extends Deep84 {}
990     static class Deep86 extends Deep85 {}
991     static class Deep87 extends Deep86 {}
992     static class Deep88 extends Deep87 {}
993     static class Deep89 extends Deep88 {}
994     static class Deep90 extends Deep89 {}
995     static class Deep91 extends Deep90 {}
996     static class Deep92 extends Deep91 {}
997     static class Deep93 extends Deep92 {}
998     static class Deep94 extends Deep93 {}
999     static class Deep95 extends Deep94 {}
1000     static class Deep96 extends Deep95 {}
1001     static class Deep97 extends Deep96 {}
1002     static class Deep98 extends Deep97 {}
1003     static class Deep99 extends Deep98 {}
1004     static class Deep100 extends Deep99 {}
1005 
1006     static class DeepCloneable extends Deep100 implements Cloneable {
clone()1007         public Object clone() throws CloneNotSupportedException {
1008             return super.clone();
1009         }
1010     }
1011 
time_Object_clone(int reps)1012     public void time_Object_clone(int reps) {
1013         try {
1014             CloneableObject o = new CloneableObject();
1015             for (int rep = 0; rep < reps; ++rep) {
1016                 o.clone();
1017             }
1018         } catch (Exception e) {
1019             throw new AssertionError(e.getMessage());
1020         }
1021     }
1022 
time_Object_manyFieldClone(int reps)1023     public void time_Object_manyFieldClone(int reps) {
1024         try {
1025             CloneableManyFieldObject o = new CloneableManyFieldObject();
1026             for (int rep = 0; rep < reps; ++rep) {
1027                 o.clone();
1028             }
1029         } catch (Exception e) {
1030             throw new AssertionError(e.getMessage());
1031         }
1032     }
1033 
time_Object_deepClone(int reps)1034     public void time_Object_deepClone(int reps) {
1035         try {
1036             DeepCloneable o = new DeepCloneable();
1037             for (int rep = 0; rep < reps; ++rep) {
1038                 o.clone();
1039             }
1040         } catch (Exception e) {
1041             throw new AssertionError(e.getMessage());
1042         }
1043     }
1044 
time_Array_clone(int reps)1045     public void time_Array_clone(int reps) {
1046         int[] o = new int[32];
1047         for (int rep = 0; rep < reps; ++rep) {
1048             o.clone();
1049         }
1050     }
1051 
time_ObjectArray_smallClone(int reps)1052     public void time_ObjectArray_smallClone(int reps) {
1053         Object[] o = new Object[32];
1054         for (int i = 0; i < o.length / 2; ++i) {
1055             o[i] = new Object();
1056         }
1057         for (int rep = 0; rep < reps; ++rep) {
1058             o.clone();
1059         }
1060     }
1061 
time_ObjectArray_largeClone(int reps)1062     public void time_ObjectArray_largeClone(int reps) {
1063         Object[] o = new Object[2048];
1064         for (int i = 0; i < o.length / 2; ++i) {
1065             o[i] = new Object();
1066         }
1067         for (int rep = 0; rep < reps; ++rep) {
1068             o.clone();
1069         }
1070     }
1071 }
1072