1 /* 2 * Copyright (C) 2010 The Android Open Source Project 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 import other.Mutant; 18 19 /* 20 * Entry point and tests that are expected to succeed. 21 */ 22 public class Main { 23 24 /** 25 * Drives tests. 26 */ 27 public static void main(String[] args) { 28 29 // Test static put/get 30 testStaticInt(); 31 testStaticVolatileInt(); 32 testStaticWide(); 33 testStaticVolatileWide(); 34 testStaticObject(); 35 testStaticVolatileObject(); 36 testStaticBoolean(); 37 testStaticByte(); 38 testStaticChar(); 39 testStaticShort(); 40 41 // Test field put/get 42 JumboField fieldTest = new JumboField(); 43 testFieldInt(fieldTest); 44 testFieldVolatileInt(fieldTest); 45 testFieldWide(fieldTest); 46 testFieldVolatileWide(fieldTest); 47 testFieldObject(fieldTest); 48 testFieldVolatileObject(fieldTest); 49 testFieldBoolean(fieldTest); 50 testFieldByte(fieldTest); 51 testFieldChar(fieldTest); 52 testFieldShort(fieldTest); 53 54 // Test method invokes 55 JumboMethod methodTest = new JumboMethod(); 56 methodTest.testMethods(); 57 58 // Test remaining jumbo instructions 59 // const-class/jumbo, check-cast/jumbo, instance-of/jumbo, 60 // new-instance/jumbo, new-array/jumbo, filled-new-array/jumbo 61 // throw-verification-error/jumbo 62 JumboRegister registerTest = new JumboRegister(); 63 registerTest.testRegisters(); 64 } 65 66 // Test sput/jumbo & sget/jumbo 67 public static void testStaticInt() { 68 int putInt = 0x12345678; 69 JumboStatic.testInt = putInt; 70 int getInt = JumboStatic.testInt; 71 if (putInt != getInt) { 72 System.out.println("Static put int: " + putInt + 73 " does not match static get int: " + getInt); 74 } 75 } 76 77 // Test sput-wide/jumbo & sget-wide/jumbo 78 public static void testStaticWide() { 79 long putWide = 0xfedcba9876543210l; 80 JumboStatic.testWide = putWide; 81 long getWide = JumboStatic.testWide; 82 if (putWide != getWide) { 83 System.out.println("Static put wide: " + putWide + 84 " does not match static get wide: " + getWide); 85 } 86 } 87 88 // Test sput-object/jumbo & sget-object/jumbo 89 public static void testStaticObject() { 90 Object putObject = new Object(); 91 JumboStatic.testObject = putObject; 92 Object getObject = JumboStatic.testObject; 93 if (putObject != getObject) { 94 System.out.println("Static put object: " + putObject + 95 " does not match static get object: " + getObject); 96 } 97 } 98 99 // Test sput-volatile/jumbo & sget-volatile/jumbo 100 public static void testStaticVolatileInt() { 101 int putInt = 0x12345678; 102 JumboStatic.testVolatileInt = putInt; 103 int getInt = JumboStatic.testVolatileInt; 104 if (putInt != getInt) { 105 System.out.println("Static put int: " + putInt + 106 " does not match static get int: " + getInt); 107 } 108 } 109 110 // Test sput-wide-volatile/jumbo & sget-wide-volatile/jumbo 111 public static void testStaticVolatileWide() { 112 long putWide = 0xfedcba9876543210l; 113 JumboStatic.testVolatileWide = putWide; 114 long getWide = JumboStatic.testVolatileWide; 115 if (putWide != getWide) { 116 System.out.println("Static put wide: " + putWide + 117 " does not match static get wide: " + getWide); 118 } 119 } 120 121 // Test sput-object-volatile/jumbo & sget-object-volatile/jumbo 122 public static void testStaticVolatileObject() { 123 Object putObject = new Object(); 124 JumboStatic.testVolatileObject = putObject; 125 Object getObject = JumboStatic.testVolatileObject; 126 if (putObject != getObject) { 127 System.out.println("Static put object: " + putObject + 128 " does not match static get object: " + getObject); 129 } 130 } 131 132 // Test sput-boolean/jumbo & sget-boolean/jumbo 133 public static void testStaticBoolean() { 134 boolean putBoolean = true; 135 JumboStatic.testBoolean = putBoolean; 136 boolean getBoolean = JumboStatic.testBoolean; 137 if (putBoolean != getBoolean) { 138 System.out.println("Static put boolean: " + putBoolean + 139 " does not match static get boolean: " + getBoolean); 140 } 141 } 142 143 // Test sput-byte/jumbo & sget-byte/jumbo 144 public static void testStaticByte() { 145 byte putByte = 0x6D; 146 JumboStatic.testByte = putByte; 147 byte getByte = JumboStatic.testByte; 148 if (putByte != getByte) { 149 System.out.println("Static put byte: " + putByte + 150 " does not match static get byte: " + getByte); 151 } 152 } 153 154 // Test sput-char/jumbo & sget-char/jumbo 155 public static void testStaticChar() { 156 char putChar = 0xE5; 157 JumboStatic.testChar = putChar; 158 char getChar = JumboStatic.testChar; 159 if (putChar != getChar) { 160 System.out.println("Static put char: " + putChar + 161 " does not match static get char: " + getChar); 162 } 163 } 164 165 // Test sput-short/jumbo & sget-short/jumbo 166 public static void testStaticShort() { 167 short putShort = 0x7A3B; 168 JumboStatic.testShort = putShort; 169 short getShort = JumboStatic.testShort; 170 if (putShort != getShort) { 171 System.out.println("Static put short: " + putShort + 172 " does not match static get short: " + getShort); 173 } 174 } 175 176 // Test iput/jumbo & iget/jumbo 177 public static void testFieldInt(JumboField fieldTest) { 178 int putInt = 0x12345678; 179 fieldTest.testInt = putInt; 180 int getInt = fieldTest.testInt; 181 if (putInt != getInt) { 182 System.out.println("Field put int: " + putInt + 183 " does not match field get int: " + getInt); 184 } 185 } 186 187 // Test iput-wide/jumbo & iget-wide/jumbo 188 public static void testFieldWide(JumboField fieldTest) { 189 long putWide = 0xfedcba9876543210l; 190 fieldTest.testWide = putWide; 191 long getWide = fieldTest.testWide; 192 if (putWide != getWide) { 193 System.out.println("Field put wide: " + putWide + 194 " does not match field get wide: " + getWide); 195 } 196 } 197 198 // Test iput-object/jumbo & iget-object/jumbo 199 public static void testFieldObject(JumboField fieldTest) { 200 Object putObject = new Object(); 201 fieldTest.testObject = putObject; 202 Object getObject = fieldTest.testObject; 203 if (putObject != getObject) { 204 System.out.println("Field put object: " + putObject + 205 " does not match field get object: " + getObject); 206 } 207 } 208 209 // Test iput-volatile/jumbo & iget-volatile/jumbo 210 public static void testFieldVolatileInt(JumboField fieldTest) { 211 int putInt = 0x12345678; 212 fieldTest.testVolatileInt = putInt; 213 int getInt = fieldTest.testVolatileInt; 214 if (putInt != getInt) { 215 System.out.println("Field put int: " + putInt + 216 " does not match field get int: " + getInt); 217 } 218 } 219 220 // Test iput-wide-volatile/jumbo & iget-wide-volatile/jumbo 221 public static void testFieldVolatileWide(JumboField fieldTest) { 222 long putWide = 0xfedcba9876543210l; 223 fieldTest.testVolatileWide = putWide; 224 long getWide = fieldTest.testVolatileWide; 225 if (putWide != getWide) { 226 System.out.println("Field put wide: " + putWide + 227 " does not match field get wide: " + getWide); 228 } 229 } 230 231 // Test iput-object-volatile/jumbo & iget-object-volatile/jumbo 232 public static void testFieldVolatileObject(JumboField fieldTest) { 233 Object putObject = new Object(); 234 fieldTest.testVolatileObject = putObject; 235 Object getObject = fieldTest.testVolatileObject; 236 if (putObject != getObject) { 237 System.out.println("Field put object: " + putObject + 238 " does not match field get object: " + getObject); 239 } 240 } 241 242 // Test iput-boolean/jumbo & iget-boolean/jumbo 243 public static void testFieldBoolean(JumboField fieldTest) { 244 boolean putBoolean = true; 245 fieldTest.testBoolean = putBoolean; 246 boolean getBoolean = fieldTest.testBoolean; 247 if (putBoolean != getBoolean) { 248 System.out.println("Field put boolean: " + putBoolean + 249 " does not match field get boolean: " + getBoolean); 250 } 251 } 252 253 // Test iput-byte/jumbo & iget-byte/jumbo 254 public static void testFieldByte(JumboField fieldTest) { 255 byte putByte = 0x6D; 256 fieldTest.testByte = putByte; 257 byte getByte = fieldTest.testByte; 258 if (putByte != getByte) { 259 System.out.println("Field put byte: " + putByte + 260 " does not match field get byte: " + getByte); 261 } 262 } 263 264 // Test iput-char/jumbo & iget-char/jumbo 265 public static void testFieldChar(JumboField fieldTest) { 266 char putChar = 0xE5; 267 fieldTest.testChar = putChar; 268 char getChar = fieldTest.testChar; 269 if (putChar != getChar) { 270 System.out.println("Field put char: " + putChar + 271 " does not match field get char: " + getChar); 272 } 273 } 274 275 // Test iput-short/jumbo & iget-short/jumbo 276 public static void testFieldShort(JumboField fieldTest) { 277 short putShort = 0x7A3B; 278 fieldTest.testShort = putShort; 279 short getShort = fieldTest.testShort; 280 if (putShort != getShort) { 281 System.out.println("Field put short: " + putShort + 282 " does not match field get short: " + getShort); 283 } 284 } 285 } 286 287 class JumboStatic { 288 static int staticInt1; 289 static int staticInt2; 290 static int staticInt3; 291 static int staticInt4; 292 static int staticInt5; 293 static int staticInt6; 294 static int staticInt7; 295 static int staticInt8; 296 static int staticInt9; 297 static int staticInt10; 298 static int staticInt11; 299 static int staticInt12; 300 static int staticInt13; 301 static int staticInt14; 302 static int staticInt15; 303 static int staticInt16; 304 static int staticInt17; 305 static int staticInt18; 306 static int staticInt19; 307 static int staticInt20; 308 static int staticInt21; 309 static int staticInt22; 310 static int staticInt23; 311 static int staticInt24; 312 static int staticInt25; 313 static int staticInt26; 314 static int staticInt27; 315 static int staticInt28; 316 static int staticInt29; 317 static int staticInt30; 318 static int staticInt31; 319 static int staticInt32; 320 static int staticInt33; 321 static int staticInt34; 322 static int staticInt35; 323 static int staticInt36; 324 static int staticInt37; 325 static int staticInt38; 326 static int staticInt39; 327 static int staticInt40; 328 static int staticInt41; 329 static int staticInt42; 330 static int staticInt43; 331 static int staticInt44; 332 static int staticInt45; 333 static int staticInt46; 334 static int staticInt47; 335 static int staticInt48; 336 static int staticInt49; 337 static int staticInt50; 338 339 static int testInt; 340 static long testWide; 341 static Object testObject; 342 static boolean testBoolean; 343 static byte testByte; 344 static char testChar; 345 static short testShort; 346 static volatile int testVolatileInt; 347 static volatile long testVolatileWide; 348 static volatile Object testVolatileObject; 349 } 350 351 class JumboField { 352 int fieldInt1; 353 int fieldInt2; 354 int fieldInt3; 355 int fieldInt4; 356 int fieldInt5; 357 int fieldInt6; 358 int fieldInt7; 359 int fieldInt8; 360 int fieldInt9; 361 int fieldInt10; 362 int fieldInt11; 363 int fieldInt12; 364 int fieldInt13; 365 int fieldInt14; 366 int fieldInt15; 367 int fieldInt16; 368 int fieldInt17; 369 int fieldInt18; 370 int fieldInt19; 371 int fieldInt20; 372 int fieldInt21; 373 int fieldInt22; 374 int fieldInt23; 375 int fieldInt24; 376 int fieldInt25; 377 int fieldInt26; 378 int fieldInt27; 379 int fieldInt28; 380 int fieldInt29; 381 int fieldInt30; 382 int fieldInt31; 383 int fieldInt32; 384 int fieldInt33; 385 int fieldInt34; 386 int fieldInt35; 387 int fieldInt36; 388 int fieldInt37; 389 int fieldInt38; 390 int fieldInt39; 391 int fieldInt40; 392 int fieldInt41; 393 int fieldInt42; 394 int fieldInt43; 395 int fieldInt44; 396 int fieldInt45; 397 int fieldInt46; 398 int fieldInt47; 399 int fieldInt48; 400 int fieldInt49; 401 int fieldInt50; 402 403 int testInt; 404 long testWide; 405 Object testObject; 406 boolean testBoolean; 407 byte testByte; 408 char testChar; 409 short testShort; 410 volatile int testVolatileInt; 411 volatile long testVolatileWide; 412 volatile Object testVolatileObject; 413 } 414 415 class JumboMethodSuper { 416 void testSuper() { 417 System.out.println("Invoked super"); 418 } 419 } 420 421 interface JumboMethodInterface { 422 void testInterface(); 423 } 424 425 class JumboMethod extends JumboMethodSuper implements JumboMethodInterface { 426 void meth1() { } 427 void meth2() { } 428 void meth3() { } 429 void meth4() { } 430 void meth5() { } 431 void meth6() { } 432 void meth7() { } 433 void meth8() { } 434 void meth9() { } 435 void meth10() { } 436 void meth11() { } 437 void meth12() { } 438 void meth13() { } 439 void meth14() { } 440 void meth15() { } 441 void meth16() { } 442 void meth17() { } 443 void meth18() { } 444 void meth19() { } 445 void meth20() { } 446 void meth21() { } 447 void meth22() { } 448 void meth23() { } 449 void meth24() { } 450 void meth25() { } 451 void meth26() { } 452 void meth27() { } 453 void meth28() { } 454 void meth29() { } 455 void meth30() { } 456 void meth31() { } 457 void meth32() { } 458 void meth33() { } 459 void meth34() { } 460 void meth35() { } 461 void meth36() { } 462 void meth37() { } 463 void meth38() { } 464 void meth39() { } 465 void meth40() { } 466 void meth41() { } 467 void meth42() { } 468 void meth43() { } 469 void meth44() { } 470 void meth45() { } 471 void meth46() { } 472 void meth47() { } 473 void meth48() { } 474 void meth49() { } 475 void meth50() { } 476 477 void testMethods() { 478 testVirtual(); 479 super.testSuper(); 480 testDirect(); 481 testStatic(); 482 ((JumboMethodInterface) this).testInterface(); 483 } 484 485 void testVirtual() { 486 System.out.println("Invoked virtual"); 487 } 488 489 void testSuper() { 490 System.out.println("Invoked base"); 491 } 492 493 private void testDirect() { 494 System.out.println("Invoked direct"); 495 } 496 497 static void testStatic() { 498 System.out.println("Invoked static"); 499 } 500 501 public void testInterface() { 502 System.out.println("Invoked interface"); 503 } 504 } 505 506 class JumboRegister { 507 void testRegisters() { 508 // Create a bunch of registers 509 Class c1 = Thread.class; 510 Class c2 = Thread.class; 511 Class c3 = Thread.class; 512 Class c4 = Thread.class; 513 Class c5 = Thread.class; 514 Class c6 = Thread.class; 515 Class c7 = Thread.class; 516 Class c8 = Thread.class; 517 Class c9 = Thread.class; 518 Class c10 = Thread.class; 519 Class c11 = Thread.class; 520 Class c12 = Thread.class; 521 Class c13 = Thread.class; 522 Class c14 = Thread.class; 523 Class c15 = Thread.class; 524 Class c16 = Thread.class; 525 Class c17 = Thread.class; 526 Class c18 = Thread.class; 527 Class c19 = Thread.class; 528 Class c20 = Thread.class; 529 Class c21 = Thread.class; 530 Class c22 = Thread.class; 531 Class c23 = Thread.class; 532 Class c24 = Thread.class; 533 Class c25 = Thread.class; 534 Class c26 = Thread.class; 535 Class c27 = Thread.class; 536 Class c28 = Thread.class; 537 Class c29 = Thread.class; 538 Class c30 = Thread.class; 539 Class c31 = Thread.class; 540 Class c32 = Thread.class; 541 Class c33 = Thread.class; 542 Class c34 = Thread.class; 543 Class c35 = Thread.class; 544 Class c36 = Thread.class; 545 Class c37 = Thread.class; 546 Class c38 = Thread.class; 547 Class c39 = Thread.class; 548 Class c40 = Thread.class; 549 Class c41 = Thread.class; 550 Class c42 = Thread.class; 551 Class c43 = Thread.class; 552 Class c44 = Thread.class; 553 Class c45 = Thread.class; 554 Class c46 = Thread.class; 555 Class c47 = Thread.class; 556 Class c48 = Thread.class; 557 Class c49 = Thread.class; 558 Class c50 = Thread.class; 559 Class c51 = Thread.class; 560 Class c52 = Thread.class; 561 Class c53 = Thread.class; 562 Class c54 = Thread.class; 563 Class c55 = Thread.class; 564 Class c56 = Thread.class; 565 Class c57 = Thread.class; 566 Class c58 = Thread.class; 567 Class c59 = Thread.class; 568 Class c60 = Thread.class; 569 Class c61 = Thread.class; 570 Class c62 = Thread.class; 571 Class c63 = Thread.class; 572 Class c64 = Thread.class; 573 Class c65 = Thread.class; 574 Class c66 = Thread.class; 575 Class c67 = Thread.class; 576 Class c68 = Thread.class; 577 Class c69 = Thread.class; 578 Class c70 = Thread.class; 579 Class c71 = Thread.class; 580 Class c72 = Thread.class; 581 Class c73 = Thread.class; 582 Class c74 = Thread.class; 583 Class c75 = Thread.class; 584 Class c76 = Thread.class; 585 Class c77 = Thread.class; 586 Class c78 = Thread.class; 587 Class c79 = Thread.class; 588 Class c80 = Thread.class; 589 Class c81 = Thread.class; 590 Class c82 = Thread.class; 591 Class c83 = Thread.class; 592 Class c84 = Thread.class; 593 Class c85 = Thread.class; 594 Class c86 = Thread.class; 595 Class c87 = Thread.class; 596 Class c88 = Thread.class; 597 Class c89 = Thread.class; 598 Class c90 = Thread.class; 599 Class c91 = Thread.class; 600 Class c92 = Thread.class; 601 Class c93 = Thread.class; 602 Class c94 = Thread.class; 603 Class c95 = Thread.class; 604 Class c96 = Thread.class; 605 Class c97 = Thread.class; 606 Class c98 = Thread.class; 607 Class c99 = Thread.class; 608 Class c100 = Thread.class; 609 Class c101 = Thread.class; 610 Class c102 = Thread.class; 611 Class c103 = Thread.class; 612 Class c104 = Thread.class; 613 Class c105 = Thread.class; 614 Class c106 = Thread.class; 615 Class c107 = Thread.class; 616 Class c108 = Thread.class; 617 Class c109 = Thread.class; 618 Class c110 = Thread.class; 619 Class c111 = Thread.class; 620 Class c112 = Thread.class; 621 Class c113 = Thread.class; 622 Class c114 = Thread.class; 623 Class c115 = Thread.class; 624 Class c116 = Thread.class; 625 Class c117 = Thread.class; 626 Class c118 = Thread.class; 627 Class c119 = Thread.class; 628 Class c120 = Thread.class; 629 Class c121 = Thread.class; 630 Class c122 = Thread.class; 631 Class c123 = Thread.class; 632 Class c124 = Thread.class; 633 Class c125 = Thread.class; 634 Class c126 = Thread.class; 635 Class c127 = Thread.class; 636 Class c128 = Thread.class; 637 Class c129 = Thread.class; 638 Class c130 = Thread.class; 639 Class c131 = Thread.class; 640 Class c132 = Thread.class; 641 Class c133 = Thread.class; 642 Class c134 = Thread.class; 643 Class c135 = Thread.class; 644 Class c136 = Thread.class; 645 Class c137 = Thread.class; 646 Class c138 = Thread.class; 647 Class c139 = Thread.class; 648 Class c140 = Thread.class; 649 Class c141 = Thread.class; 650 Class c142 = Thread.class; 651 Class c143 = Thread.class; 652 Class c144 = Thread.class; 653 Class c145 = Thread.class; 654 Class c146 = Thread.class; 655 Class c147 = Thread.class; 656 Class c148 = Thread.class; 657 Class c149 = Thread.class; 658 Class c150 = Thread.class; 659 Class c151 = Thread.class; 660 Class c152 = Thread.class; 661 Class c153 = Thread.class; 662 Class c154 = Thread.class; 663 Class c155 = Thread.class; 664 Class c156 = Thread.class; 665 Class c157 = Thread.class; 666 Class c158 = Thread.class; 667 Class c159 = Thread.class; 668 Class c160 = Thread.class; 669 Class c161 = Thread.class; 670 Class c162 = Thread.class; 671 Class c163 = Thread.class; 672 Class c164 = Thread.class; 673 Class c165 = Thread.class; 674 Class c166 = Thread.class; 675 Class c167 = Thread.class; 676 Class c168 = Thread.class; 677 Class c169 = Thread.class; 678 Class c170 = Thread.class; 679 Class c171 = Thread.class; 680 Class c172 = Thread.class; 681 Class c173 = Thread.class; 682 Class c174 = Thread.class; 683 Class c175 = Thread.class; 684 Class c176 = Thread.class; 685 Class c177 = Thread.class; 686 Class c178 = Thread.class; 687 Class c179 = Thread.class; 688 Class c180 = Thread.class; 689 Class c181 = Thread.class; 690 Class c182 = Thread.class; 691 Class c183 = Thread.class; 692 Class c184 = Thread.class; 693 Class c185 = Thread.class; 694 Class c186 = Thread.class; 695 Class c187 = Thread.class; 696 Class c188 = Thread.class; 697 Class c189 = Thread.class; 698 Class c190 = Thread.class; 699 Class c191 = Thread.class; 700 Class c192 = Thread.class; 701 Class c193 = Thread.class; 702 Class c194 = Thread.class; 703 Class c195 = Thread.class; 704 Class c196 = Thread.class; 705 Class c197 = Thread.class; 706 Class c198 = Thread.class; 707 Class c199 = Thread.class; 708 Class c200 = Thread.class; 709 Class c201 = Thread.class; 710 Class c202 = Thread.class; 711 Class c203 = Thread.class; 712 Class c204 = Thread.class; 713 Class c205 = Thread.class; 714 Class c206 = Thread.class; 715 Class c207 = Thread.class; 716 Class c208 = Thread.class; 717 Class c209 = Thread.class; 718 Class c210 = Thread.class; 719 Class c211 = Thread.class; 720 Class c212 = Thread.class; 721 Class c213 = Thread.class; 722 Class c214 = Thread.class; 723 Class c215 = Thread.class; 724 Class c216 = Thread.class; 725 Class c217 = Thread.class; 726 Class c218 = Thread.class; 727 Class c219 = Thread.class; 728 Class c220 = Thread.class; 729 Class c221 = Thread.class; 730 Class c222 = Thread.class; 731 Class c223 = Thread.class; 732 Class c224 = Thread.class; 733 Class c225 = Thread.class; 734 Class c226 = Thread.class; 735 Class c227 = Thread.class; 736 Class c228 = Thread.class; 737 Class c229 = Thread.class; 738 Class c230 = Thread.class; 739 Class c231 = Thread.class; 740 Class c232 = Thread.class; 741 Class c233 = Thread.class; 742 Class c234 = Thread.class; 743 Class c235 = Thread.class; 744 Class c236 = Thread.class; 745 Class c237 = Thread.class; 746 Class c238 = Thread.class; 747 Class c239 = Thread.class; 748 Class c240 = Thread.class; 749 Class c241 = Thread.class; 750 Class c242 = Thread.class; 751 Class c243 = Thread.class; 752 Class c244 = Thread.class; 753 Class c245 = Thread.class; 754 Class c246 = Thread.class; 755 Class c247 = Thread.class; 756 Class c248 = Thread.class; 757 Class c249 = Thread.class; 758 Class c250 = Thread.class; 759 Class c251 = Thread.class; 760 Class c252 = Thread.class; 761 Class c253 = Thread.class; 762 Class c254 = Thread.class; 763 Class c255 = Thread.class; 764 765 // Test const-class/jumbo 766 Class c256 = Thread.class; 767 768 // Test check-cast/jumbo 769 770 // Test instance-of/jumbo 771 boolean b1 = c1 instanceof Object; 772 if (!b1) System.out.println("instance-of/jumbo returned wrong result"); 773 774 // Test new-instance/jumbo 775 Object o1 = new Object(); 776 777 // Test new-array/jumbo 778 int[] a1 = new int[10]; 779 a1[0] = 1; 780 a1[1] = 2; 781 a1[2] = 3; 782 a1[3] = 4; 783 a1[4] = 5; 784 a1[5] = 6; 785 a1[6] = 7; 786 a1[7] = 8; 787 a1[8] = 9; 788 a1[9] = 10; 789 790 // Test filled-new-array/jumbo 791 792 // Test throw-verification-error/jumbo 793 try { 794 MaybeAbstract ma = new MaybeAbstract(); 795 System.err.println("ERROR: MaybeAbstract succeeded unexpectedly"); 796 } catch (InstantiationError ie) { 797 System.out.println("Got expected InstantationError"); 798 } catch (Exception ex) { 799 System.err.println("Got unexpected MaybeAbstract failure"); 800 } 801 testMissingStuff(); 802 803 // Do something with those registers to force other ops to be jumbo 804 useRegs(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10); 805 useRegs(c11, c12, c13, c14, c15, c16, c17, c18, c19, c20); 806 useRegs(c21, c22, c23, c24, c25, c26, c27, c28, c29, c30); 807 useRegs(c31, c32, c33, c34, c35, c36, c37, c38, c39, c40); 808 useRegs(c41, c42, c43, c44, c45, c46, c47, c48, c49, c50); 809 useRegs(c51, c52, c53, c54, c55, c56, c57, c58, c59, c60); 810 useRegs(c61, c62, c63, c64, c65, c66, c67, c68, c69, c70); 811 useRegs(c71, c72, c73, c74, c75, c76, c77, c78, c79, c80); 812 useRegs(c81, c82, c83, c84, c85, c86, c87, c88, c89, c90); 813 useRegs(c91, c92, c93, c94, c95, c96, c97, c98, c99, c100); 814 useRegs(c101, c102, c103, c104, c105, c106, c107, c108, c109, c110); 815 useRegs(c111, c112, c113, c114, c115, c116, c117, c118, c119, c120); 816 useRegs(c121, c122, c123, c124, c125, c126, c127, c128, c129, c130); 817 useRegs(c131, c132, c133, c134, c135, c136, c137, c138, c139, c140); 818 useRegs(c141, c142, c143, c144, c145, c146, c147, c148, c149, c150); 819 useRegs(c151, c152, c153, c154, c155, c156, c157, c158, c159, c160); 820 useRegs(c161, c162, c163, c164, c165, c166, c167, c168, c169, c170); 821 useRegs(c171, c172, c173, c174, c175, c176, c177, c178, c179, c180); 822 useRegs(c181, c182, c183, c184, c185, c186, c187, c188, c189, c190); 823 useRegs(c191, c192, c193, c194, c195, c196, c197, c198, c199, c200); 824 useRegs(c201, c202, c203, c204, c205, c206, c207, c208, c209, c210); 825 useRegs(c211, c212, c213, c214, c215, c216, c217, c218, c219, c220); 826 useRegs(c221, c222, c223, c224, c225, c226, c227, c228, c229, c230); 827 useRegs(c231, c232, c233, c234, c235, c236, c237, c238, c239, c240); 828 useRegs(c241, c242, c243, c244, c245, c246, c247, c248, c249, c250); 829 useRegs(c251, c252, c253, c254, c255, c256, c256, c256, c256, c256); 830 831 useRegs(b1); 832 useRegs(o1); 833 useRegs(a1); 834 } 835 836 // Trigger more jumbo verification errors 837 static void testMissingStuff() { 838 Mutant mutant = new Mutant(); 839 840 try { 841 int x = mutant.disappearingField; 842 } catch (NoSuchFieldError nsfe) { 843 System.out.println("Got expected NoSuchFieldError"); 844 } 845 846 try { 847 int y = Mutant.disappearingStaticField; 848 } catch (NoSuchFieldError nsfe) { 849 System.out.println("Got expected NoSuchFieldError"); 850 } 851 852 try { 853 mutant.disappearingMethod(); 854 } catch (NoSuchMethodError nsme) { 855 System.out.println("Got expected NoSuchMethodError"); 856 } 857 858 try { 859 Mutant.disappearingStaticMethod(); 860 } catch (NoSuchMethodError nsme) { 861 System.out.println("Got expected NoSuchMethodError"); 862 } 863 } 864 865 void useRegs(Object o1, Object o2, Object o3, Object o4, Object o5, 866 Object o6, Object o7, Object o8, Object o9, Object o10) { 867 } 868 869 void useRegs(Object o1) { } 870 void useRegs(boolean b1) { } 871 } 872