1 (* ============================================================ *)
2 (* JVMcodes is the module which defines jasmin name ordinals. *)
3 (* Name spelling is defined by the lexical rules of Jasmin. *)
4 (* Copyright (c) John Gough 1999, 2000. *)
5 (* ============================================================ *)
10 (* ============================================================ *)
35 att_synchronized
*= {5};
40 att_interface
* = {10};
42 (* Constants for java class files *)
49 acc_protected
* = 0004H
;
52 acc_synchronized
* = 0020H
;
53 acc_volatile
* = 0040H
;
54 acc_transient
* = 0080H
;
57 acc_interface
* = 0200H
;
58 acc_abstract
* = 0400H
;
60 (* constant pool tags *)
69 const_methodref
* = 10;
70 const_interfacemethodref
* = 11;
71 const_nameandtype
* = 12;
73 (* ============================================================ *)
235 opc_if_icmpeq
* = 159;
236 opc_if_icmpne
* = 160;
237 opc_if_icmplt
* = 161;
238 opc_if_icmpge
* = 162;
239 opc_if_icmpgt
* = 163;
240 opc_if_icmple
* = 164;
241 opc_if_acmpeq
* = 165;
242 opc_if_acmpne
* = 166;
246 opc_tableswitch
* = 170;
247 opc_lookupswitch
* = 171;
254 opc_getstatic
* = 178;
255 opc_putstatic
* = 179;
258 opc_invokevirtual
* = 182;
259 opc_invokespecial
* = 183;
260 opc_invokestatic
* = 184;
261 opc_invokeinterface
* = 185;
262 opc_xxxunusedxxx
= 186;
265 opc_anewarray
* = 189;
266 opc_arraylength
* = 190;
268 opc_checkcast
* = 192;
269 opc_instanceof
* = 193;
270 opc_monitorenter
* = 194;
271 opc_monitorexit
* = 195;
273 opc_multianewarray
* = 197;
275 opc_ifnonnull
* = 199;
278 opc_breakpoint
* = 202;
280 (* ============================================================ *)
283 OpName
* = ARRAY 24 OF CHAR;
285 (* ============================================================ *)
287 VAR op
* : ARRAY 203 OF OpName
;
288 dl
* : ARRAY 203 OF INTEGER;
290 VAR dirStr
* : ARRAY 14 OF OpName
;
291 access
* : ARRAY 12 OF OpName
;
293 (* ============================================================ *)
296 dirStr
[dot_error
] := ".ERROR";
297 dirStr
[dot_catch
] := ".catch";
298 dirStr
[dot_class
] := ".class";
299 dirStr
[dot_end
] := ".end method";
300 dirStr
[dot_field
] := ".field";
301 dirStr
[dot_implements
] := ".implements";
302 dirStr
[dot_interface
] := ".interface";
303 dirStr
[dot_limit
] := ".limit";
304 dirStr
[dot_line
] := ".line";
305 dirStr
[dot_method
] := ".method";
306 dirStr
[dot_source
] := ".source";
307 dirStr
[dot_super
] := ".super";
308 dirStr
[dot_throws
] := ".throws";
309 dirStr
[dot_var
] := ".var";
311 access
[ 0] := "public";
312 access
[ 1] := "private";
313 access
[ 2] := "protected";
314 access
[ 3] := "static";
315 access
[ 4] := "final";
316 access
[ 5] := "synchronized";
317 access
[ 6] := "native";
318 access
[ 7] := "volatile";
319 access
[ 8] := "abstract";
320 access
[ 9] := "transient";
321 access
[10] := "interface";
323 op
[opc_nop
] := "nop";
324 op
[opc_aconst_null
] := "aconst_null";
325 op
[opc_iconst_m1
] := "iconst_m1";
326 op
[opc_iconst_0
] := "iconst_0";
327 op
[opc_iconst_1
] := "iconst_1";
328 op
[opc_iconst_2
] := "iconst_2";
329 op
[opc_iconst_3
] := "iconst_3";
330 op
[opc_iconst_4
] := "iconst_4";
331 op
[opc_iconst_5
] := "iconst_5";
332 op
[opc_lconst_0
] := "lconst_0";
333 op
[opc_lconst_1
] := "lconst_1";
334 op
[opc_fconst_0
] := "fconst_0";
335 op
[opc_fconst_1
] := "fconst_1";
336 op
[opc_fconst_2
] := "fconst_2";
337 op
[opc_dconst_0
] := "dconst_0";
338 op
[opc_dconst_1
] := "dconst_1";
339 op
[opc_bipush
] := "bipush";
340 op
[opc_sipush
] := "sipush";
341 op
[opc_ldc
] := "ldc";
342 op
[opc_ldc_w
] := "ldc_w";
343 op
[opc_ldc2_w
] := "ldc2_w";
344 op
[opc_iload
] := "iload";
345 op
[opc_lload
] := "lload";
346 op
[opc_fload
] := "fload";
347 op
[opc_dload
] := "dload";
348 op
[opc_aload
] := "aload";
349 op
[opc_iload_0
] := "iload_0";
350 op
[opc_iload_1
] := "iload_1";
351 op
[opc_iload_2
] := "iload_2";
352 op
[opc_iload_3
] := "iload_3";
353 op
[opc_lload_0
] := "lload_0";
354 op
[opc_lload_1
] := "lload_1";
355 op
[opc_lload_2
] := "lload_2";
356 op
[opc_lload_3
] := "lload_3";
357 op
[opc_fload_0
] := "fload_0";
358 op
[opc_fload_1
] := "fload_1";
359 op
[opc_fload_2
] := "fload_2";
360 op
[opc_fload_3
] := "fload_3";
361 op
[opc_dload_0
] := "dload_0";
362 op
[opc_dload_1
] := "dload_1";
363 op
[opc_dload_2
] := "dload_2";
364 op
[opc_dload_3
] := "dload_3";
365 op
[opc_aload_0
] := "aload_0";
366 op
[opc_aload_1
] := "aload_1";
367 op
[opc_aload_2
] := "aload_2";
368 op
[opc_aload_3
] := "aload_3";
369 op
[opc_iaload
] := "iaload";
370 op
[opc_laload
] := "laload";
371 op
[opc_faload
] := "faload";
372 op
[opc_daload
] := "daload";
373 op
[opc_aaload
] := "aaload";
374 op
[opc_baload
] := "baload";
375 op
[opc_caload
] := "caload";
376 op
[opc_saload
] := "saload";
377 op
[opc_istore
] := "istore";
378 op
[opc_lstore
] := "lstore";
379 op
[opc_fstore
] := "fstore";
380 op
[opc_dstore
] := "dstore";
381 op
[opc_astore
] := "astore";
382 op
[opc_istore_0
] := "istore_0";
383 op
[opc_istore_1
] := "istore_1";
384 op
[opc_istore_2
] := "istore_2";
385 op
[opc_istore_3
] := "istore_3";
386 op
[opc_lstore_0
] := "lstore_0";
387 op
[opc_lstore_1
] := "lstore_1";
388 op
[opc_lstore_2
] := "lstore_2";
389 op
[opc_lstore_3
] := "lstore_3";
390 op
[opc_fstore_0
] := "fstore_0";
391 op
[opc_fstore_1
] := "fstore_1";
392 op
[opc_fstore_2
] := "fstore_2";
393 op
[opc_fstore_3
] := "fstore_3";
394 op
[opc_dstore_0
] := "dstore_0";
395 op
[opc_dstore_1
] := "dstore_1";
396 op
[opc_dstore_2
] := "dstore_2";
397 op
[opc_dstore_3
] := "dstore_3";
398 op
[opc_astore_0
] := "astore_0";
399 op
[opc_astore_1
] := "astore_1";
400 op
[opc_astore_2
] := "astore_2";
401 op
[opc_astore_3
] := "astore_3";
402 op
[opc_iastore
] := "iastore";
403 op
[opc_lastore
] := "lastore";
404 op
[opc_fastore
] := "fastore";
405 op
[opc_dastore
] := "dastore";
406 op
[opc_aastore
] := "aastore";
407 op
[opc_bastore
] := "bastore";
408 op
[opc_castore
] := "castore";
409 op
[opc_sastore
] := "sastore";
410 op
[opc_pop
] := "pop";
411 op
[opc_pop2
] := "pop2";
412 op
[opc_dup
] := "dup";
413 op
[opc_dup_x1
] := "dup_x1";
414 op
[opc_dup_x2
] := "dup_x2";
415 op
[opc_dup2
] := "dup2";
416 op
[opc_dup2_x1
] := "dup2_x1";
417 op
[opc_dup2_x2
] := "dup2_x2";
418 op
[opc_swap
] := "swap";
419 op
[opc_iadd
] := "iadd";
420 op
[opc_ladd
] := "ladd";
421 op
[opc_fadd
] := "fadd";
422 op
[opc_dadd
] := "dadd";
423 op
[opc_isub
] := "isub";
424 op
[opc_lsub
] := "lsub";
425 op
[opc_fsub
] := "fsub";
426 op
[opc_dsub
] := "dsub";
427 op
[opc_imul
] := "imul";
428 op
[opc_lmul
] := "lmul";
429 op
[opc_fmul
] := "fmul";
430 op
[opc_dmul
] := "dmul";
431 op
[opc_idiv
] := "idiv";
432 op
[opc_ldiv
] := "ldiv";
433 op
[opc_fdiv
] := "fdiv";
434 op
[opc_ddiv
] := "ddiv";
435 op
[opc_irem
] := "irem";
436 op
[opc_lrem
] := "lrem";
437 op
[opc_frem
] := "frem";
438 op
[opc_drem
] := "drem";
439 op
[opc_ineg
] := "ineg";
440 op
[opc_lneg
] := "lneg";
441 op
[opc_fneg
] := "fneg";
442 op
[opc_dneg
] := "dneg";
443 op
[opc_ishl
] := "ishl";
444 op
[opc_lshl
] := "lshl";
445 op
[opc_ishr
] := "ishr";
446 op
[opc_lshr
] := "lshr";
447 op
[opc_iushr
] := "iushr";
448 op
[opc_lushr
] := "lushr";
449 op
[opc_iand
] := "iand";
450 op
[opc_land
] := "land";
451 op
[opc_ior
] := "ior";
452 op
[opc_lor
] := "lor";
453 op
[opc_ixor
] := "ixor";
454 op
[opc_lxor
] := "lxor";
455 op
[opc_iinc
] := "iinc";
456 op
[opc_i2l
] := "i2l";
457 op
[opc_i2f
] := "i2f";
458 op
[opc_i2d
] := "i2d";
459 op
[opc_l2i
] := "l2i";
460 op
[opc_l2f
] := "l2f";
461 op
[opc_l2d
] := "l2d";
462 op
[opc_f2i
] := "f2i";
463 op
[opc_f2l
] := "f2l";
464 op
[opc_f2d
] := "f2d";
465 op
[opc_d2i
] := "d2i";
466 op
[opc_d2l
] := "d2l";
467 op
[opc_d2f
] := "d2f";
468 op
[opc_i2b
] := "i2b";
469 op
[opc_i2c
] := "i2c";
470 op
[opc_i2s
] := "i2s";
471 op
[opc_lcmp
] := "lcmp";
472 op
[opc_fcmpl
] := "fcmpl";
473 op
[opc_fcmpg
] := "fcmpg";
474 op
[opc_dcmpl
] := "dcmpl";
475 op
[opc_dcmpg
] := "dcmpg";
476 op
[opc_ifeq
] := "ifeq";
477 op
[opc_ifne
] := "ifne";
478 op
[opc_iflt
] := "iflt";
479 op
[opc_ifge
] := "ifge";
480 op
[opc_ifgt
] := "ifgt";
481 op
[opc_ifle
] := "ifle";
482 op
[opc_if_icmpeq
] := "if_icmpeq";
483 op
[opc_if_icmpne
] := "if_icmpne";
484 op
[opc_if_icmplt
] := "if_icmplt";
485 op
[opc_if_icmpge
] := "if_icmpge";
486 op
[opc_if_icmpgt
] := "if_icmpgt";
487 op
[opc_if_icmple
] := "if_icmple";
488 op
[opc_if_acmpeq
] := "if_acmpeq";
489 op
[opc_if_acmpne
] := "if_acmpne";
490 op
[opc_goto
] := "goto";
491 op
[opc_jsr
] := "jsr";
492 op
[opc_ret
] := "ret";
493 op
[opc_tableswitch
] := "tableswitch";
494 op
[opc_lookupswitch
] := "lookupswitch";
495 op
[opc_ireturn
] := "ireturn";
496 op
[opc_lreturn
] := "lreturn";
497 op
[opc_freturn
] := "freturn";
498 op
[opc_dreturn
] := "dreturn";
499 op
[opc_areturn
] := "areturn";
500 op
[opc_return
] := "return";
501 op
[opc_getstatic
] := "getstatic";
502 op
[opc_putstatic
] := "putstatic";
503 op
[opc_getfield
] := "getfield";
504 op
[opc_putfield
] := "putfield";
505 op
[opc_invokevirtual
] := "invokevirtual";
506 op
[opc_invokespecial
] := "invokespecial";
507 op
[opc_invokestatic
] := "invokestatic";
508 op
[opc_invokeinterface
] := "invokeinterface";
509 op
[opc_xxxunusedxxx
] := "xxxunusedxxx";
510 op
[opc_new
] := "new";
511 op
[opc_newarray
] := "newarray";
512 op
[opc_anewarray
] := "anewarray";
513 op
[opc_arraylength
] := "arraylength";
514 op
[opc_athrow
] := "athrow";
515 op
[opc_checkcast
] := "checkcast";
516 op
[opc_instanceof
] := "instanceof";
517 op
[opc_monitorenter
] := "monitorenter";
518 op
[opc_monitorexit
] := "monitorexit";
519 op
[opc_wide
] := "wide";
520 op
[opc_multianewarray
] := "multianewarray";
521 op
[opc_ifnull
] := "ifnull";
522 op
[opc_ifnonnull
] := "ifnonnull";
523 op
[opc_goto_w
] := "goto_w";
524 op
[opc_jsr_w
] := "jsr_w";
525 op
[opc_breakpoint
] := "breakpoint";
528 dl
[opc_aconst_null
] := 1;
529 dl
[opc_iconst_m1
] := 1;
530 dl
[opc_iconst_0
] := 1;
531 dl
[opc_iconst_1
] := 1;
532 dl
[opc_iconst_2
] := 1;
533 dl
[opc_iconst_3
] := 1;
534 dl
[opc_iconst_4
] := 1;
535 dl
[opc_iconst_5
] := 1;
536 dl
[opc_lconst_0
] := 2;
537 dl
[opc_lconst_1
] := 2;
538 dl
[opc_fconst_0
] := 1;
539 dl
[opc_fconst_1
] := 1;
540 dl
[opc_fconst_2
] := 1;
541 dl
[opc_dconst_0
] := 2;
542 dl
[opc_dconst_1
] := 2;
553 dl
[opc_iload_0
] := 1;
554 dl
[opc_iload_1
] := 1;
555 dl
[opc_iload_2
] := 1;
556 dl
[opc_iload_3
] := 1;
557 dl
[opc_lload_0
] := 2;
558 dl
[opc_lload_1
] := 2;
559 dl
[opc_lload_2
] := 2;
560 dl
[opc_lload_3
] := 2;
561 dl
[opc_fload_0
] := 1;
562 dl
[opc_fload_1
] := 1;
563 dl
[opc_fload_2
] := 1;
564 dl
[opc_fload_3
] := 1;
565 dl
[opc_dload_0
] := 2;
566 dl
[opc_dload_1
] := 2;
567 dl
[opc_dload_2
] := 2;
568 dl
[opc_dload_3
] := 2;
569 dl
[opc_aload_0
] := 1;
570 dl
[opc_aload_1
] := 1;
571 dl
[opc_aload_2
] := 1;
572 dl
[opc_aload_3
] := 1;
573 dl
[opc_iaload
] := -1; (* pop 2, push 1 *)
574 dl
[opc_laload
] := 0; (* pop 2, push 2 *)
575 dl
[opc_faload
] := -1; (* pop 2, push 1 *)
576 dl
[opc_daload
] := 0; (* pop 2, push 2 *)
577 dl
[opc_aaload
] := -1; (* pop 2, push 1 *)
578 dl
[opc_baload
] := -1; (* pop 2, push 1 *)
579 dl
[opc_caload
] := -1; (* pop 2, push 1 *)
580 dl
[opc_saload
] := -1; (* pop 2, push 1 *)
581 dl
[opc_istore
] := -1;
582 dl
[opc_lstore
] := -2;
583 dl
[opc_fstore
] := -1;
584 dl
[opc_dstore
] := -2;
585 dl
[opc_astore
] := -1;
586 dl
[opc_istore_0
] := -1;
587 dl
[opc_istore_1
] := -1;
588 dl
[opc_istore_2
] := -1;
589 dl
[opc_istore_3
] := -1;
590 dl
[opc_lstore_0
] := -2;
591 dl
[opc_lstore_1
] := -2;
592 dl
[opc_lstore_2
] := -2;
593 dl
[opc_lstore_3
] := -2;
594 dl
[opc_fstore_0
] := -1;
595 dl
[opc_fstore_1
] := -1;
596 dl
[opc_fstore_2
] := -1;
597 dl
[opc_fstore_3
] := -1;
598 dl
[opc_dstore_0
] := -2;
599 dl
[opc_dstore_1
] := -2;
600 dl
[opc_dstore_2
] := -2;
601 dl
[opc_dstore_3
] := -2;
602 dl
[opc_astore_0
] := -1;
603 dl
[opc_astore_1
] := -1;
604 dl
[opc_astore_2
] := -1;
605 dl
[opc_astore_3
] := -1;
606 dl
[opc_iastore
] := -3;
607 dl
[opc_lastore
] := -4;
608 dl
[opc_fastore
] := -3;
609 dl
[opc_dastore
] := -4;
610 dl
[opc_aastore
] := -3;
611 dl
[opc_bastore
] := -3;
612 dl
[opc_castore
] := -3;
613 dl
[opc_sastore
] := -3;
620 dl
[opc_dup2_x1
] := 2;
621 dl
[opc_dup2_x2
] := 2;
686 dl
[opc_if_icmpeq
] := -2;
687 dl
[opc_if_icmpne
] := -2;
688 dl
[opc_if_icmplt
] := -2;
689 dl
[opc_if_icmpge
] := -2;
690 dl
[opc_if_icmpgt
] := -2;
691 dl
[opc_if_icmple
] := -2;
692 dl
[opc_if_acmpeq
] := -2;
693 dl
[opc_if_acmpne
] := -2;
697 dl
[opc_tableswitch
] := -1;
698 dl
[opc_lookupswitch
] := -1;
699 dl
[opc_ireturn
] := -1; (* don't care ? *)
700 dl
[opc_lreturn
] := -2; (* don't care ? *)
701 dl
[opc_freturn
] := -1; (* don't care ? *)
702 dl
[opc_dreturn
] := -2; (* don't care ? *)
703 dl
[opc_areturn
] := -1; (* don't care ? *)
704 dl
[opc_return
] := 0; (* don't care ? *)
706 (* Defaults for single word load/store short Vs long *)
707 dl
[opc_getstatic
] := 1; (* Special case 1 or 2 *)
708 dl
[opc_putstatic
] := -1; (* Special case -1 or -2 *)
709 dl
[opc_getfield
] := 0; (* Special case 0 or 1 *)
710 dl
[opc_putfield
] := -2; (* Special case -2 or -3 *)
712 dl
[opc_invokevirtual
] := 0; (* Special case *)
713 dl
[opc_invokespecial
] := -1; (* Special case *)
714 dl
[opc_invokestatic
] := 0; (* Special case *)
715 dl
[opc_invokeinterface
] := 0; (* Special case *)
716 dl
[opc_xxxunusedxxx
] := 0;
718 dl
[opc_newarray
] := 0;
719 dl
[opc_anewarray
] := 0;
720 dl
[opc_arraylength
] := 0;
721 dl
[opc_athrow
] := -1; (* don't care *)
722 dl
[opc_checkcast
] := 0;
723 dl
[opc_instanceof
] := 0;
724 dl
[opc_monitorenter
] := -1;
725 dl
[opc_monitorexit
] := -1;
727 dl
[opc_multianewarray
] := 0; (* Special case (1-dim#) *)
728 dl
[opc_ifnull
] := -1;
729 dl
[opc_ifnonnull
] := -1;
732 dl
[opc_breakpoint
] := 0;
734 (* ============================================================ *)