Ticket #375: const-freeze.patch
File const-freeze.patch, 4.7 KB (added by rurban, 13 years ago) |
---|
-
src/pmc_freeze.c
132 132 __attribute__nonnull__(1) 133 133 __attribute__nonnull__(2); 134 134 135 static void push_ascii_integer(PARROT_INTERP, ARGIN(IMAGE_IO *io), INTVAL v) 135 static void push_ascii_integer(PARROT_INTERP, 136 ARGIN(IMAGE_IO *io), 137 const INTVAL v) 136 138 __attribute__nonnull__(1) 137 139 __attribute__nonnull__(2); 138 140 139 141 static void push_ascii_number(PARROT_INTERP, 140 142 ARGIN(const IMAGE_IO *io), 141 FLOATVAL v)143 const FLOATVAL v) 142 144 __attribute__nonnull__(1) 143 145 __attribute__nonnull__(2); 144 146 … … 158 160 159 161 static void push_opcode_integer(PARROT_INTERP, 160 162 ARGIN(IMAGE_IO *io), 161 INTVAL v)163 const INTVAL v) 162 164 __attribute__nonnull__(1) 163 165 __attribute__nonnull__(2); 164 166 165 167 static void push_opcode_number(PARROT_INTERP, 166 168 ARGIN(IMAGE_IO *io), 167 FLOATVAL v)169 const FLOATVAL v) 168 170 __attribute__nonnull__(1) 169 171 __attribute__nonnull__(2); 170 172 171 173 static void push_opcode_pmc(PARROT_INTERP, 172 174 ARGIN(IMAGE_IO *io), 173 ARGIN( PMC* v))175 ARGIN(const PMC* v)) 174 176 __attribute__nonnull__(1) 175 177 __attribute__nonnull__(2) 176 178 __attribute__nonnull__(3); 177 179 178 180 static void push_opcode_string(PARROT_INTERP, 179 181 ARGIN(IMAGE_IO *io), 180 ARGIN( STRING *v))182 ARGIN(const STRING *v)) 181 183 __attribute__nonnull__(1) 182 184 __attribute__nonnull__(2) 183 185 __attribute__nonnull__(3); … … 436 438 /* HEADERIZER END: static */ 437 439 438 440 /* 439 * define this to 1 for testing. TODO : 1 is broken.441 * define this to 1 for testing. TODO TT #375: 1 is broken. 440 442 */ 441 443 #ifndef FREEZE_ASCII 442 444 # define FREEZE_ASCII 0 … … 510 512 */ 511 513 512 514 static void 513 push_ascii_integer(PARROT_INTERP, ARGIN(IMAGE_IO *io), INTVAL v)515 push_ascii_integer(PARROT_INTERP, ARGIN(IMAGE_IO *io), const INTVAL v) 514 516 { 515 517 ASSERT_ARGS(push_ascii_integer) 516 518 char buffer[20]; … … 530 532 */ 531 533 532 534 static void 533 push_ascii_number(PARROT_INTERP, ARGIN(const IMAGE_IO *io), FLOATVAL v)535 push_ascii_number(PARROT_INTERP, ARGIN(const IMAGE_IO *io), const FLOATVAL v) 534 536 { 535 537 ASSERT_ARGS(push_ascii_number) 536 538 char buffer[40]; … … 558 560 { 559 561 ASSERT_ARGS(push_ascii_string) 560 562 const UINTVAL length = Parrot_str_byte_length(interp, s); 561 char * const buffer = (char *)malloc( 4*length); /* XXX Why 4? What does that mean? */563 char * const buffer = (char *)malloc(OPCODE_T_SIZE*length); 562 564 char *cursor = buffer; 563 565 UINTVAL idx = 0; 564 566 … … 777 779 */ 778 780 779 781 static void 780 push_opcode_integer(PARROT_INTERP, ARGIN(IMAGE_IO *io), INTVAL v)782 push_opcode_integer(PARROT_INTERP, ARGIN(IMAGE_IO *io), const INTVAL v) 781 783 { 782 784 ASSERT_ARGS(push_opcode_integer) 783 785 PARROT_ASSERT(sizeof (opcode_t) == sizeof (INTVAL)); … … 795 797 */ 796 798 797 799 static void 798 push_opcode_number(PARROT_INTERP, ARGIN(IMAGE_IO *io), FLOATVAL v)800 push_opcode_number(PARROT_INTERP, ARGIN(IMAGE_IO *io), const FLOATVAL v) 799 801 { 800 802 ASSERT_ARGS(push_opcode_number) 801 803 const size_t len = PF_size_number() * sizeof (opcode_t); … … 822 824 */ 823 825 824 826 static void 825 push_opcode_string(PARROT_INTERP, ARGIN(IMAGE_IO *io), ARGIN( STRING *v))827 push_opcode_string(PARROT_INTERP, ARGIN(IMAGE_IO *io), ARGIN(const STRING *v)) 826 828 { 827 829 ASSERT_ARGS(push_opcode_string) 828 830 const size_t len = PF_size_string(v) * sizeof (opcode_t); … … 849 851 */ 850 852 851 853 static void 852 push_opcode_pmc(PARROT_INTERP, ARGIN(IMAGE_IO *io), ARGIN( PMC* v))854 push_opcode_pmc(PARROT_INTERP, ARGIN(IMAGE_IO *io), ARGIN(const PMC* v)) 853 855 { 854 856 ASSERT_ARGS(push_opcode_pmc) 855 857 op_append(interp, io->image, (opcode_t)v, sizeof (opcode_t)); -
include/parrot/pmc_freeze.h
28 28 29 29 struct _image_io; 30 30 #define IMAGE_IO struct _image_io 31 typedef void (*push_integer_f) (PARROT_INTERP, IMAGE_IO*, INTVAL);32 typedef void (*push_pmc_f) (PARROT_INTERP, IMAGE_IO*, PMC*);33 typedef void (*push_string_f) (PARROT_INTERP, IMAGE_IO*, STRING*);34 typedef void (*push_number_f) (PARROT_INTERP, IMAGE_IO*, FLOATVAL);31 typedef void (*push_integer_f) (PARROT_INTERP, IMAGE_IO*, const INTVAL); 32 typedef void (*push_pmc_f) (PARROT_INTERP, IMAGE_IO*, const PMC*); 33 typedef void (*push_string_f) (PARROT_INTERP, IMAGE_IO*, const STRING*); 34 typedef void (*push_number_f) (PARROT_INTERP, IMAGE_IO*, const FLOATVAL); 35 35 typedef INTVAL (*shift_integer_f) (PARROT_INTERP, IMAGE_IO*); 36 36 typedef PMC* (*shift_pmc_f) (PARROT_INTERP, IMAGE_IO*); 37 37 typedef STRING* (*shift_string_f) (PARROT_INTERP, IMAGE_IO*);