DEADSOFTWARE

Remove exception catching in main module
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Wed, 8 Mar 2017 11:06:41 +0000 (14:06 +0300)
committerDeaDDooMER <deaddoomer@deadsoftware.ru>
Wed, 8 Mar 2017 11:06:41 +0000 (14:06 +0300)
mpc/structures/block.c

index 1b55eeae2479366bf16c2474d8e1981b4ad7c303..0922765234cdd4ea50d81deb0b5c99e33bff40c4 100644 (file)
@@ -2534,12 +2534,6 @@ void write_run_method(FILE *fp)
        /* create the code */
        bytecode_append(code, invokestatic$);
        bytecode_append_short_int(code, cp_add_methodref("M", "R", "()V"));
-
-       bytecode_append(code, goto$);
-       bytecode_append_short_int(code, 4);
-
-       bytecode_append(code, pop$);    /* the exception handler */
-
        bytecode_append(code, return$);
 
        /* write the method headers */
@@ -2558,13 +2552,14 @@ void write_run_method(FILE *fp)
 
        /* write the Code attribute */
        write_short_int(fp, cp_add_utf8("Code"));
-       write_long_int(fp, code->bytecode_pos + 20 + 38); /* 38 = stackmap size */
+       write_long_int(fp, code->bytecode_pos + 12);
 
        /* write the max stack */
        write_short_int(fp, 2);
 
        /* max locals for program block */
-       write_short_int(fp, 1);
+       write_short_int(fp, 2);
+
 
        /* code length */
        write_long_int(fp, code->bytecode_pos);
@@ -2575,70 +2570,8 @@ void write_run_method(FILE *fp)
 
        bytecode_destroy(code);
 
-       /* write exception table length*/
-       write_short_int(fp, 1);
-
-       /* write the exception table */
        write_short_int(fp, 0);
-       write_short_int(fp, 3);
-       write_short_int(fp, 6);
-       write_short_int(fp, cp_add_class("java/lang/Exception"));
-
-
-       /* StackMap attribute */
-       write_short_int(fp, 1);
-
-               write_short_int(fp, cp_add_utf8("StackMap"));
-               write_long_int(fp, 32);
-
-               /* 2 frames*/
-               write_short_int(fp, 3);
-
-               /* write the frame 0 */
-                       write_short_int(fp, 0);
-
-                       /* write the locals */
-                       write_short_int(fp, 1);
-                       tag = 7;
-                       if (fp != NULL)
-                               fwrite(&tag, 1, 1, fp);
-                       write_short_int(fp, cp_add_class("M"));
-
-
-                       /* 0 stack entries */
-                       write_short_int(fp, 0);
-
-               /* write the frame 1 */
-                       write_short_int(fp, 6);
-
-                       /* write the locals*/
-                       write_short_int(fp, 1);
-                       tag = 7;
-                       if (fp != NULL)
-                               fwrite(&tag, 1, 1, fp);
-                       write_short_int(fp, cp_add_class("M"));
-
-                       /* 1 stack entry */
-                       write_short_int(fp, 1);
-                       tag = 7;
-                       if (fp != NULL)
-                               fwrite(&tag, 1, 1, fp);
-                       write_short_int(fp, cp_add_class("java/lang/Exception"));
-
-
-               /* write the frame 2 */
-                       write_short_int(fp, 7);
-
-                       /* write the locals */
-                       write_short_int(fp, 1);
-                       tag = 7;
-                       if (fp != NULL)
-                               fwrite(&tag, 1, 1, fp);
-                       write_short_int(fp, cp_add_class("M"));
-
-                       /* 0 stack entries */
-                       write_short_int(fp, 0);
-
+       write_short_int(fp, 0);
 }