X-Git-Url: http://deadsoftware.ru/gitweb?p=mp3cc.git;a=blobdiff_plain;f=mpc%2Fstructures%2Fblock.c;h=0922765234cdd4ea50d81deb0b5c99e33bff40c4;hp=1b55eeae2479366bf16c2474d8e1981b4ad7c303;hb=e75ce53f479919e6a98bd94e32ac834661a8796d;hpb=d0793351bd1e7cdd18f93d6a5851053fea807ce5 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); }