From e75ce53f479919e6a98bd94e32ac834661a8796d Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Wed, 8 Mar 2017 14:06:41 +0300 Subject: [PATCH] Remove exception catching in main module --- mpc/structures/block.c | 75 +++--------------------------------------- 1 file changed, 4 insertions(+), 71 deletions(-) diff --git a/mpc/structures/block.c b/mpc/structures/block.c index 1b55eea..0922765 100644 --- a/mpc/structures/block.c +++ b/mpc/structures/block.c @@ -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); } -- 2.29.2