1 16 17 package org.cojen.classfile; 18 19 import java.lang.reflect.Constructor ; 20 import java.lang.reflect.Method ; 21 import java.util.MissingResourceException ; 22 23 29 public interface CodeAssembler { 30 31 public final static int CONVERT_FP_NORMAL = 0; 32 33 public final static int CONVERT_FP_BITS = 1; 34 35 public final static int CONVERT_FP_RAW_BITS = 2; 36 37 41 int getParameterCount(); 42 43 49 LocalVariable getParameter(int index) throws IndexOutOfBoundsException ; 50 51 60 LocalVariable createLocalVariable(String name, TypeDesc type); 61 62 75 Label createLabel(); 76 77 88 void exceptionHandler(Location startLocation, 89 Location endLocation, 90 String catchClassName); 91 92 97 void mapLineNumber(int lineNumber); 98 99 110 void inline(Object code) throws IllegalArgumentException , MissingResourceException ; 111 112 114 117 void loadNull(); 118 119 126 void loadConstant(String value); 127 128 136 void loadConstant(TypeDesc type) throws IllegalStateException ; 137 138 141 void loadConstant(boolean value); 142 143 147 void loadConstant(int value); 148 149 152 void loadConstant(long value); 153 154 157 void loadConstant(float value); 158 159 162 void loadConstant(double value); 163 164 166 173 void loadLocal(LocalVariable local); 174 175 180 void loadThis(); 181 182 184 193 void storeLocal(LocalVariable local); 194 195 197 209 void loadFromArray(TypeDesc type); 210 211 213 225 void storeToArray(TypeDesc type); 226 227 229 235 void loadField(String fieldName, 236 TypeDesc type); 237 238 244 void loadField(String className, 245 String fieldName, 246 TypeDesc type); 247 248 257 void loadField(TypeDesc classDesc, 258 String fieldName, 259 TypeDesc type); 260 261 266 void loadStaticField(String fieldName, 267 TypeDesc type); 268 269 274 void loadStaticField(String className, 275 String fieldName, 276 TypeDesc type); 277 278 286 void loadStaticField(TypeDesc classDesc, 287 String fieldName, 288 TypeDesc type); 289 290 292 298 void storeField(String fieldName, 299 TypeDesc type); 300 301 307 void storeField(String className, 308 String fieldName, 309 TypeDesc type); 310 311 320 void storeField(TypeDesc classDesc, 321 String fieldName, 322 TypeDesc type); 323 324 329 void storeStaticField(String fieldName, 330 TypeDesc type); 331 332 337 void storeStaticField(String className, 338 String fieldName, 339 TypeDesc type); 340 341 349 void storeStaticField(TypeDesc classDesc, 350 String fieldName, 351 TypeDesc type); 352 353 355 358 void returnVoid(); 359 360 368 void returnValue(TypeDesc type); 369 370 372 390 void convert(TypeDesc fromType, TypeDesc toType); 391 392 412 void convert(TypeDesc fromType, TypeDesc toType, int fpConvertMode); 413 414 416 421 void invoke(Method method); 422 423 430 void invokeVirtual(String methodName, 431 TypeDesc ret, 432 TypeDesc[] params); 433 434 441 void invokeVirtual(String className, 442 String methodName, 443 TypeDesc ret, 444 TypeDesc[] params); 445 446 455 void invokeVirtual(TypeDesc classDesc, 456 String methodName, 457 TypeDesc ret, 458 TypeDesc[] params); 459 460 467 void invokeStatic(String methodName, 468 TypeDesc ret, 469 TypeDesc[] params); 470 471 478 void invokeStatic(String className, 479 String methodName, 480 TypeDesc ret, 481 TypeDesc[] params); 482 483 492 void invokeStatic(TypeDesc classDesc, 493 String methodName, 494 TypeDesc ret, 495 TypeDesc[] params); 496 497 504 void invokeInterface(String className, 505 String methodName, 506 TypeDesc ret, 507 TypeDesc[] params); 508 509 518 void invokeInterface(TypeDesc classDesc, 519 String methodName, 520 TypeDesc ret, 521 TypeDesc[] params); 522 523 530 void invokePrivate(String methodName, 531 TypeDesc ret, 532 TypeDesc[] params); 533 534 538 void invokeSuper(Method method); 539 540 547 void invokeSuper(String superClassName, 548 String methodName, 549 TypeDesc ret, 550 TypeDesc[] params); 551 552 561 void invokeSuper(TypeDesc superClassDesc, 562 String methodName, 563 TypeDesc ret, 564 TypeDesc[] params); 565 566 570 void invoke(Constructor constructor); 571 572 578 void invokeConstructor(TypeDesc[] params); 579 580 586 void invokeConstructor(String className, TypeDesc[] params); 587 588 596 void invokeConstructor(TypeDesc classDesc, TypeDesc[] params); 597 598 604 void invokeSuperConstructor(TypeDesc[] params); 605 606 608 619 void newObject(TypeDesc type); 620 621 631 void newObject(TypeDesc type, int dimensions); 632 633 635 638 void dup(); 639 640 643 void dupX1(); 644 645 648 void dupX2(); 649 650 653 void dup2(); 654 655 658 void dup2X1(); 659 660 663 void dup2X2(); 664 665 668 void pop(); 669 670 673 void pop2(); 674 675 678 void swap(); 679 680 683 void swap2(); 684 685 687 693 void branch(Location location); 694 695 705 void ifNullBranch(Location location, boolean choice); 706 707 717 void ifEqualBranch(Location location, boolean choice); 718 719 730 void ifZeroComparisonBranch(Location location, String choice) 731 throws IllegalArgumentException ; 732 733 744 void ifComparisonBranch(Location location, String choice) 745 throws IllegalArgumentException ; 746 747 771 void ifComparisonBranch(Location location, String choice, TypeDesc type) 772 throws IllegalArgumentException ; 773 774 790 void switchBranch(int[] cases, 791 Location[] locations, Location defaultLocation); 792 793 800 void jsr(Location location); 801 802 808 void ret(LocalVariable local); 809 810 812 838 void math(byte opcode); 839 840 842 846 void arrayLength(); 847 848 852 void throwObject(); 853 854 858 void checkCast(TypeDesc type); 859 860 864 void instanceOf(TypeDesc type); 865 866 870 void integerIncrement(LocalVariable local, int amount); 871 872 875 void monitorEnter(); 876 877 880 void monitorExit(); 881 882 885 void nop(); 886 887 890 void breakpoint(); 891 } 892 | Popular Tags |