[svn:parrot] r44398 - branches/boehm_gc_2/compilers/imcc
bacek at svn.parrot.org
bacek at svn.parrot.org
Tue Feb 23 19:48:29 UTC 2010
Author: bacek
Date: Tue Feb 23 19:48:28 2010
New Revision: 44398
URL: https://trac.parrot.org/parrot/changeset/44398
Log:
Switch IMCC to gc_strdup
Modified:
branches/boehm_gc_2/compilers/imcc/imcc.l
branches/boehm_gc_2/compilers/imcc/imcc.y
branches/boehm_gc_2/compilers/imcc/imclexer.c
branches/boehm_gc_2/compilers/imcc/imcparser.c
branches/boehm_gc_2/compilers/imcc/instructions.c
branches/boehm_gc_2/compilers/imcc/instructions.h
branches/boehm_gc_2/compilers/imcc/main.c
branches/boehm_gc_2/compilers/imcc/optimizer.c
branches/boehm_gc_2/compilers/imcc/parser_util.c
branches/boehm_gc_2/compilers/imcc/pbc.c
branches/boehm_gc_2/compilers/imcc/symreg.c
Modified: branches/boehm_gc_2/compilers/imcc/imcc.l
==============================================================================
--- branches/boehm_gc_2/compilers/imcc/imcc.l Tue Feb 23 19:47:58 2010 (r44397)
+++ branches/boehm_gc_2/compilers/imcc/imcc.l Tue Feb 23 19:48:28 2010 (r44398)
@@ -93,7 +93,7 @@
#define DUP_AND_RET(valp, token) \
do { \
- if (valp) (valp)->s = mem_sys_strdup(yytext); \
+ if (valp) (valp)->s = Parrot_gc_strdup(interp, yytext); \
return (token); \
} while (0)
@@ -101,7 +101,7 @@
do { \
if (valp) { \
mem_sys_free((valp)->s); \
- (valp)->s = mem_sys_strdup(yytext); \
+ (valp)->s = Parrot_gc_strdup(interp, yytext); \
return (token); \
} \
} while (0)
@@ -168,7 +168,7 @@
}
<heredoc1>.*{EOL} {
- IMCC_INFO(interp)->frames->heredoc_rest = mem_sys_strdup(yytext);
+ IMCC_INFO(interp)->frames->heredoc_rest = Parrot_gc_strdup(interp, yytext);
BEGIN(heredoc2);
}
@@ -228,8 +228,8 @@
yy_pop_state(yyscanner);
yy_push_state(cmt3, yyscanner);
- IMCC_INFO(interp)->frames->s.file = mem_sys_strdup(yytext);
- IMCC_INFO(interp)->cur_unit->file = mem_sys_strdup(yytext);
+ IMCC_INFO(interp)->frames->s.file = Parrot_gc_strdup(interp, yytext);
+ IMCC_INFO(interp)->cur_unit->file = Parrot_gc_strdup(interp, yytext);
return FILECOMMENT;
}
@@ -457,7 +457,7 @@
return c;
/* STRINGCs have a mem_sys_strdup()ed valp->s */
- mem_sys_free(valp->s);
+ mem_gc_free(interp, valp->s);
YYCHOP();
include_file(interp, yytext + 1, yyscanner);
}
@@ -512,13 +512,13 @@
YYCHOP();
if (valp)
- valp->s = mem_sys_strdup(yytext);
+ valp->s = Parrot_gc_strdup(interp, yytext);
return LABEL;
}
<emit,INITIAL>{DOT}{LETTER}{LETTERDIGIT}* {
- char * const macro_name = mem_sys_strdup(yytext + 1);
+ char * const macro_name = Parrot_gc_strdup(interp, yytext + 1);
int failed = expand_macro(interp, macro_name, yyscanner);
mem_sys_free(macro_name);
if (!failed) {
@@ -536,7 +536,7 @@
<*>{OCT} DUP_AND_RET(valp, INTC);
<*>{BIGINT} {
- valp->s = mem_sys_strdup(yytext);
+ valp->s = Parrot_gc_strdup(interp, yytext);
/* trailing 'L' */
valp->s[strlen(valp->s) - 1] = '\0';
@@ -546,7 +546,7 @@
}
<*>{STRINGCONSTANT} {
- valp->s = mem_sys_strdup(yytext);
+ valp->s = Parrot_gc_strdup(interp, yytext);
return STRINGC;
}
@@ -558,7 +558,7 @@
off newline and quote. */
if (IMCC_INFO(interp)->frames->heredoc_rest)
IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR, "nested heredoc not supported");
- IMCC_INFO(interp)->heredoc_end = mem_sys_strdup(yytext + 3);
+ IMCC_INFO(interp)->heredoc_end = Parrot_gc_strdup(interp, yytext + 3);
IMCC_INFO(interp)->heredoc_end[strlen(IMCC_INFO(interp)->heredoc_end) - 1] = 0;
if (!strlen(IMCC_INFO(interp)->heredoc_end))
@@ -581,7 +581,7 @@
<*>{UNICODE} {
/* charset:"..." */
- valp->s = mem_sys_strdup(yytext);
+ valp->s = Parrot_gc_strdup(interp, yytext);
/* this is actually not unicode but a string with a charset */
return USTRINGC;
@@ -630,7 +630,7 @@
"'%s' is only a valid register name in PASM mode", yytext);
if (valp)
- valp->s = mem_sys_strdup(yytext);
+ valp->s = Parrot_gc_strdup(interp, yytext);
return REG;
}
@@ -659,7 +659,7 @@
}
}
- valp->s = mem_sys_strdup(yytext);
+ valp->s = Parrot_gc_strdup(interp, yytext);
return (!IMCC_INFO(interp)->is_def && is_op(interp, valp->s) ? PARROT_OP : IDENTIFIER);
}
@@ -796,7 +796,7 @@
if (IMCC_INFO(interp)->frames) {
tmp->s.pasm_file = IMCC_INFO(interp)->frames->s.pasm_file;
if (IMCC_INFO(interp)->frames->s.file)
- tmp->s.file = mem_sys_strdup(IMCC_INFO(interp)->frames->s.file);
+ tmp->s.file = Parrot_gc_strdup(interp, IMCC_INFO(interp)->frames->s.file);
}
tmp->s.interp = interp;
@@ -864,7 +864,7 @@
/* free any mem_sys_strdup()ed strings */
if (yytext)
- mem_sys_free(valp->s);
+ mem_gc_free(interp, valp->s);
} while (*p != '\0');
if (c)
@@ -920,7 +920,7 @@
{
YYSTYPE val;
size_t len = 0;
- char *current = mem_sys_strdup("");
+ char *current = Parrot_gc_strdup(interp, "");
yyguts_t *yyg = (yyguts_t *)yyscanner;
int c = yylex_skip(&val, interp, " \n", yyscanner);
@@ -942,7 +942,7 @@
MAX_PARAM, macro_name);
params->name[params->num_param++] = current;
- current = mem_sys_strdup("");
+ current = Parrot_gc_strdup(interp, "");
len = 0;
if (val.s)
@@ -1120,7 +1120,7 @@
else
memset(&m->params, 0, sizeof (params_t));
- m->expansion = mem_sys_strdup(expansion);
+ m->expansion = Parrot_gc_strdup(interp, expansion);
m->line = start_line;
}
@@ -1164,7 +1164,7 @@
if (frame->s.file)
mem_sys_free(frame->s.file);
- frame->s.file = mem_sys_strdup(name);
+ frame->s.file = Parrot_gc_strdup(interp, name);
/* whitespace can be safely ignored */
do {
@@ -1193,7 +1193,7 @@
BEGIN(start_cond);
if (frame->expansion.num_param == 0 && m->params.num_param == 1) {
- frame->expansion.name[0] = mem_sys_strdup("");
+ frame->expansion.name[0] = Parrot_gc_strdup(interp, "");
frame->expansion.num_param = 1;
}
@@ -1212,7 +1212,7 @@
const char * const s = find_macro_param(interp, current + 1);
if (s) {
- frame->expansion.name[i] = mem_sys_strdup(s);
+ frame->expansion.name[i] = Parrot_gc_strdup(interp, s);
mem_sys_free(current);
}
@@ -1262,7 +1262,7 @@
if (frame->s.file)
mem_sys_free(frame->s.file);
mem_sys_free(s);
- frame->s.file = mem_sys_strdup(file_name);
+ frame->s.file = Parrot_gc_strdup(interp, file_name);
frame->s.handle = file;
ext = strrchr(file_name, '.');
@@ -1444,7 +1444,7 @@
* During the parse, the STRINGC is already mem_sys_strdup()ed once.
*/
if (IMCC_INFO(interp)->cur_unit)
- IMCC_INFO(interp)->cur_unit->file = mem_sys_strdup(filename);
+ IMCC_INFO(interp)->cur_unit->file = Parrot_gc_strdup(interp, filename);
}
/* Functions to set and get yyin, as we can't decorate it for export
Modified: branches/boehm_gc_2/compilers/imcc/imcc.y
==============================================================================
--- branches/boehm_gc_2/compilers/imcc/imcc.y Tue Feb 23 19:47:58 2010 (r44397)
+++ branches/boehm_gc_2/compilers/imcc/imcc.y Tue Feb 23 19:48:28 2010 (r44398)
@@ -454,11 +454,11 @@
r[0] = left;
if (ascii) {
/* strip delimiters */
- name = mem_sys_strdup(constant + 1);
+ name = Parrot_gc_strdup(interp,constant + 1);
name[strlen(name) - 1] = 0;
}
else {
- name = mem_sys_strdup(constant);
+ name = Parrot_gc_strdup(interp,constant);
}
switch (type_enum) {
@@ -504,7 +504,7 @@
SymReg *r[3];
char *const_name;
const int ascii = (*constant == '\'' || *constant == '"');
- char *unquoted_name = mem_sys_strdup(name + 1);
+ char *unquoted_name = Parrot_gc_strdup(interp,name + 1);
size_t name_length = strlen(unquoted_name) - 1;
unquoted_name[name_length] = 0;
@@ -521,11 +521,11 @@
r[0] = left;
if (ascii) {
/* strip delimiters */
- const_name = mem_sys_strdup(constant + 1);
+ const_name = Parrot_gc_strdup(interp,constant + 1);
const_name[strlen(const_name) - 1] = 0;
}
else {
- const_name = mem_sys_strdup(constant);
+ const_name = Parrot_gc_strdup(interp,constant);
}
if ((strncmp(unquoted_name, "Sub", name_length) == 0)
@@ -609,7 +609,7 @@
{
ASSERT_ARGS(INS_LABEL)
- Instruction * const ins = _mk_instruction("", "%s:", 1, &r0, 0);
+ Instruction * const ins = _mk_instruction(interp, "", "%s:", 1, &r0, 0);
ins->type = ITLABEL;
r0->first_ins = ins;
@@ -790,7 +790,7 @@
name_copy = Parrot_str_to_cstring(interp, unescaped);
}
else {
- name_copy = mem_sys_strdup(name);
+ name_copy = Parrot_gc_strdup(interp,name);
name_copy[ strlen(name) - 1 ] = 0;
}
@@ -1317,7 +1317,7 @@
}
| LEXICAL STRINGC COMMA REG
{
- char *name = mem_sys_strdup($2 + 1);
+ char *name = Parrot_gc_strdup(interp,$2 + 1);
SymReg *r = mk_pasm_reg(interp, $4);
SymReg *n;
name[strlen(name) - 1] = 0;
@@ -1389,7 +1389,7 @@
{
IMCC_INFO(interp)->cur_call->pcc_sub->pragma = $5;
if (!IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->subid) {
- IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->subid = mem_sys_strdup(
+ IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->subid = Parrot_gc_strdup(interp,
IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->name);
}
}
@@ -1965,7 +1965,7 @@
}
else {
SymReg *n;
- char *name = mem_sys_strdup($2 + 1);
+ char *name = Parrot_gc_strdup(interp,$2 + 1);
name[strlen(name) - 1] = 0;
n = mk_const(interp, name, 'S');
set_lexical(interp, $4, n); $$ = 0;
Modified: branches/boehm_gc_2/compilers/imcc/imclexer.c
==============================================================================
--- branches/boehm_gc_2/compilers/imcc/imclexer.c Tue Feb 23 19:47:58 2010 (r44397)
+++ branches/boehm_gc_2/compilers/imcc/imclexer.c Tue Feb 23 19:48:28 2010 (r44398)
@@ -2466,7 +2466,7 @@
#define DUP_AND_RET(valp, token) \
do { \
- if (valp) (valp)->s = mem_sys_strdup(yytext); \
+ if (valp) (valp)->s = Parrot_gc_strdup(interp, yytext); \
return (token); \
} while (0)
@@ -2474,7 +2474,7 @@
do { \
if (valp) { \
mem_sys_free((valp)->s); \
- (valp)->s = mem_sys_strdup(yytext); \
+ (valp)->s = Parrot_gc_strdup(interp, yytext); \
return (token); \
} \
} while (0)
@@ -2838,7 +2838,7 @@
YY_RULE_SETUP
#line 170 "compilers/imcc/imcc.l"
{
- IMCC_INFO(interp)->frames->heredoc_rest = mem_sys_strdup(yytext);
+ IMCC_INFO(interp)->frames->heredoc_rest = Parrot_gc_strdup(interp, yytext);
BEGIN(heredoc2);
}
YY_BREAK
@@ -2909,8 +2909,8 @@
yy_pop_state(yyscanner);
yy_push_state(cmt3, yyscanner);
- IMCC_INFO(interp)->frames->s.file = mem_sys_strdup(yytext);
- IMCC_INFO(interp)->cur_unit->file = mem_sys_strdup(yytext);
+ IMCC_INFO(interp)->frames->s.file = Parrot_gc_strdup(interp, yytext);
+ IMCC_INFO(interp)->cur_unit->file = Parrot_gc_strdup(interp, yytext);
return FILECOMMENT;
}
@@ -3550,7 +3550,7 @@
return c;
/* STRINGCs have a mem_sys_strdup()ed valp->s */
- mem_sys_free(valp->s);
+ mem_gc_free(interp, valp->s);
YYCHOP();
include_file(interp, yytext + 1, yyscanner);
}
@@ -3617,7 +3617,7 @@
YYCHOP();
if (valp)
- valp->s = mem_sys_strdup(yytext);
+ valp->s = Parrot_gc_strdup(interp, yytext);
return LABEL;
}
@@ -3626,7 +3626,7 @@
YY_RULE_SETUP
#line 520 "compilers/imcc/imcc.l"
{
- char * const macro_name = mem_sys_strdup(yytext + 1);
+ char * const macro_name = Parrot_gc_strdup(interp, yytext + 1);
int failed = expand_macro(interp, macro_name, yyscanner);
mem_sys_free(macro_name);
if (!failed) {
@@ -3664,7 +3664,7 @@
YY_RULE_SETUP
#line 538 "compilers/imcc/imcc.l"
{
- valp->s = mem_sys_strdup(yytext);
+ valp->s = Parrot_gc_strdup(interp, yytext);
/* trailing 'L' */
valp->s[strlen(valp->s) - 1] = '\0';
@@ -3677,7 +3677,7 @@
YY_RULE_SETUP
#line 548 "compilers/imcc/imcc.l"
{
- valp->s = mem_sys_strdup(yytext);
+ valp->s = Parrot_gc_strdup(interp, yytext);
return STRINGC;
}
@@ -3692,7 +3692,7 @@
off newline and quote. */
if (IMCC_INFO(interp)->frames->heredoc_rest)
IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR, "nested heredoc not supported");
- IMCC_INFO(interp)->heredoc_end = mem_sys_strdup(yytext + 3);
+ IMCC_INFO(interp)->heredoc_end = Parrot_gc_strdup(interp, yytext + 3);
IMCC_INFO(interp)->heredoc_end[strlen(IMCC_INFO(interp)->heredoc_end) - 1] = 0;
if (!strlen(IMCC_INFO(interp)->heredoc_end))
@@ -3718,7 +3718,7 @@
#line 582 "compilers/imcc/imcc.l"
{
/* charset:"..." */
- valp->s = mem_sys_strdup(yytext);
+ valp->s = Parrot_gc_strdup(interp, yytext);
/* this is actually not unicode but a string with a charset */
return USTRINGC;
@@ -3785,7 +3785,7 @@
"'%s' is only a valid register name in PASM mode", yytext);
if (valp)
- valp->s = mem_sys_strdup(yytext);
+ valp->s = Parrot_gc_strdup(interp, yytext);
return REG;
}
@@ -3817,7 +3817,7 @@
}
}
- valp->s = mem_sys_strdup(yytext);
+ valp->s = Parrot_gc_strdup(interp, yytext);
return (!IMCC_INFO(interp)->is_def && is_op(interp, valp->s) ? PARROT_OP : IDENTIFIER);
}
YY_BREAK
@@ -5218,7 +5218,7 @@
if (IMCC_INFO(interp)->frames) {
tmp->s.pasm_file = IMCC_INFO(interp)->frames->s.pasm_file;
if (IMCC_INFO(interp)->frames->s.file)
- tmp->s.file = mem_sys_strdup(IMCC_INFO(interp)->frames->s.file);
+ tmp->s.file = Parrot_gc_strdup(interp, IMCC_INFO(interp)->frames->s.file);
}
tmp->s.interp = interp;
@@ -5286,7 +5286,7 @@
/* free any mem_sys_strdup()ed strings */
if (yytext)
- mem_sys_free(valp->s);
+ mem_gc_free(interp, valp->s);
} while (*p != '\0');
if (c)
@@ -5342,7 +5342,7 @@
{
YYSTYPE val;
size_t len = 0;
- char *current = mem_sys_strdup("");
+ char *current = Parrot_gc_strdup(interp, "");
yyguts_t *yyg = (yyguts_t *)yyscanner;
int c = yylex_skip(&val, interp, " \n", yyscanner);
@@ -5364,7 +5364,7 @@
MAX_PARAM, macro_name);
params->name[params->num_param++] = current;
- current = mem_sys_strdup("");
+ current = Parrot_gc_strdup(interp, "");
len = 0;
if (val.s)
@@ -5542,7 +5542,7 @@
else
memset(&m->params, 0, sizeof (params_t));
- m->expansion = mem_sys_strdup(expansion);
+ m->expansion = Parrot_gc_strdup(interp, expansion);
m->line = start_line;
}
@@ -5586,7 +5586,7 @@
if (frame->s.file)
mem_sys_free(frame->s.file);
- frame->s.file = mem_sys_strdup(name);
+ frame->s.file = Parrot_gc_strdup(interp, name);
/* whitespace can be safely ignored */
do {
@@ -5615,7 +5615,7 @@
BEGIN(start_cond);
if (frame->expansion.num_param == 0 && m->params.num_param == 1) {
- frame->expansion.name[0] = mem_sys_strdup("");
+ frame->expansion.name[0] = Parrot_gc_strdup(interp, "");
frame->expansion.num_param = 1;
}
@@ -5634,7 +5634,7 @@
const char * const s = find_macro_param(interp, current + 1);
if (s) {
- frame->expansion.name[i] = mem_sys_strdup(s);
+ frame->expansion.name[i] = Parrot_gc_strdup(interp, s);
mem_sys_free(current);
}
@@ -5684,7 +5684,7 @@
if (frame->s.file)
mem_sys_free(frame->s.file);
mem_sys_free(s);
- frame->s.file = mem_sys_strdup(file_name);
+ frame->s.file = Parrot_gc_strdup(interp, file_name);
frame->s.handle = file;
ext = strrchr(file_name, '.');
@@ -5864,7 +5864,7 @@
* During the parse, the STRINGC is already mem_sys_strdup()ed once.
*/
if (IMCC_INFO(interp)->cur_unit)
- IMCC_INFO(interp)->cur_unit->file = mem_sys_strdup(filename);
+ IMCC_INFO(interp)->cur_unit->file = Parrot_gc_strdup(interp, filename);
}
/* Functions to set and get yyin, as we can't decorate it for export
Modified: branches/boehm_gc_2/compilers/imcc/imcparser.c
==============================================================================
--- branches/boehm_gc_2/compilers/imcc/imcparser.c Tue Feb 23 19:47:58 2010 (r44397)
+++ branches/boehm_gc_2/compilers/imcc/imcparser.c Tue Feb 23 19:48:28 2010 (r44398)
@@ -780,11 +780,11 @@
r[0] = left;
if (ascii) {
/* strip delimiters */
- name = mem_sys_strdup(constant + 1);
+ name = Parrot_gc_strdup(interp,constant + 1);
name[strlen(name) - 1] = 0;
}
else {
- name = mem_sys_strdup(constant);
+ name = Parrot_gc_strdup(interp,constant);
}
switch (type_enum) {
@@ -830,7 +830,7 @@
SymReg *r[3];
char *const_name;
const int ascii = (*constant == '\'' || *constant == '"');
- char *unquoted_name = mem_sys_strdup(name + 1);
+ char *unquoted_name = Parrot_gc_strdup(interp,name + 1);
size_t name_length = strlen(unquoted_name) - 1;
unquoted_name[name_length] = 0;
@@ -847,11 +847,11 @@
r[0] = left;
if (ascii) {
/* strip delimiters */
- const_name = mem_sys_strdup(constant + 1);
+ const_name = Parrot_gc_strdup(interp,constant + 1);
const_name[strlen(const_name) - 1] = 0;
}
else {
- const_name = mem_sys_strdup(constant);
+ const_name = Parrot_gc_strdup(interp,constant);
}
if ((strncmp(unquoted_name, "Sub", name_length) == 0)
@@ -935,7 +935,7 @@
{
ASSERT_ARGS(INS_LABEL)
- Instruction * const ins = _mk_instruction("", "%s:", 1, &r0, 0);
+ Instruction * const ins = _mk_instruction(interp, "", "%s:", 1, &r0, 0);
ins->type = ITLABEL;
r0->first_ins = ins;
@@ -1116,7 +1116,7 @@
name_copy = Parrot_str_to_cstring(interp, unescaped);
}
else {
- name_copy = mem_sys_strdup(name);
+ name_copy = Parrot_gc_strdup(interp,name);
name_copy[ strlen(name) - 1 ] = 0;
}
@@ -3461,7 +3461,7 @@
case 41:
#line 1319 "compilers/imcc/imcc.y"
{
- char *name = mem_sys_strdup((yyvsp[(2) - (4)].s) + 1);
+ char *name = Parrot_gc_strdup(interp,(yyvsp[(2) - (4)].s) + 1);
SymReg *r = mk_pasm_reg(interp, (yyvsp[(4) - (4)].s));
SymReg *n;
name[strlen(name) - 1] = 0;
@@ -3541,7 +3541,7 @@
{
IMCC_INFO(interp)->cur_call->pcc_sub->pragma = (yyvsp[(5) - (6)].t);
if (!IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->subid) {
- IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->subid = mem_sys_strdup(
+ IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->subid = Parrot_gc_strdup(interp,
IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->name);
}
}
@@ -4336,7 +4336,7 @@
}
else {
SymReg *n;
- char *name = mem_sys_strdup((yyvsp[(2) - (4)].s) + 1);
+ char *name = Parrot_gc_strdup(interp,(yyvsp[(2) - (4)].s) + 1);
name[strlen(name) - 1] = 0;
n = mk_const(interp, name, 'S');
set_lexical(interp, (yyvsp[(4) - (4)].sr), n); (yyval.i) = 0;
Modified: branches/boehm_gc_2/compilers/imcc/instructions.c
==============================================================================
--- branches/boehm_gc_2/compilers/imcc/instructions.c Tue Feb 23 19:47:58 2010 (r44397)
+++ branches/boehm_gc_2/compilers/imcc/instructions.c Tue Feb 23 19:48:28 2010 (r44398)
@@ -83,8 +83,8 @@
/*
-=item C<Instruction * _mk_instruction(const char *op, const char *fmt, int n,
-SymReg * const *r, int flags)>
+=item C<Instruction * _mk_instruction(PARROT_INTERP, const char *op, const char
+*fmt, int n, SymReg * const *r, int flags)>
Creates a new instruction
@@ -95,7 +95,8 @@
PARROT_MALLOC
PARROT_CANNOT_RETURN_NULL
Instruction *
-_mk_instruction(ARGIN(const char *op), ARGIN(const char *fmt), int n,
+_mk_instruction(PARROT_INTERP, ARGIN(const char *op),
+ ARGIN(const char *fmt), int n,
ARGIN(SymReg * const *r), int flags)
{
ASSERT_ARGS(_mk_instruction)
@@ -104,8 +105,8 @@
(Instruction*)mem_sys_allocate_zeroed(sizeof (Instruction) + reg_space);
int i;
- ins->opname = mem_sys_strdup(op);
- ins->format = mem_sys_strdup(fmt);
+ ins->opname = Parrot_gc_strdup(interp, op);
+ ins->format = Parrot_gc_strdup(interp, fmt);
ins->symreg_count = n;
for (i = 0; i < n; i++)
Modified: branches/boehm_gc_2/compilers/imcc/instructions.h
==============================================================================
--- branches/boehm_gc_2/compilers/imcc/instructions.h Tue Feb 23 19:47:58 2010 (r44397)
+++ branches/boehm_gc_2/compilers/imcc/instructions.h Tue Feb 23 19:48:28 2010 (r44398)
@@ -115,7 +115,7 @@
PARROT_MALLOC
PARROT_CANNOT_RETURN_NULL
-Instruction * _mk_instruction(
+Instruction * _mk_instruction(PARROT_INTERP,
ARGIN(const char *op),
ARGIN(const char *fmt),
int n,
@@ -123,7 +123,8 @@
int flags)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
- __attribute__nonnull__(4);
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(5);
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
@@ -232,7 +233,8 @@
PARROT_ASSERT_ARG(unit) \
, PARROT_ASSERT_ARG(ins))
#define ASSERT_ARGS__mk_instruction __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(op) \
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(op) \
, PARROT_ASSERT_ARG(fmt) \
, PARROT_ASSERT_ARG(r))
#define ASSERT_ARGS_delete_ins __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
Modified: branches/boehm_gc_2/compilers/imcc/main.c
==============================================================================
--- branches/boehm_gc_2/compilers/imcc/main.c Tue Feb 23 19:47:58 2010 (r44397)
+++ branches/boehm_gc_2/compilers/imcc/main.c Tue Feb 23 19:48:28 2010 (r44398)
@@ -644,7 +644,7 @@
Parrot_pbc_load(interp, pf);
IMCC_push_parser_state(interp);
- IMCC_INFO(interp)->state->file = mem_sys_strdup(sourcefile);
+ IMCC_INFO(interp)->state->file = Parrot_gc_strdup(interp, sourcefile);
emit_open(interp, per_pbc, per_pbc ? NULL : (void*)output_file);
Modified: branches/boehm_gc_2/compilers/imcc/optimizer.c
==============================================================================
--- branches/boehm_gc_2/compilers/imcc/optimizer.c Tue Feb 23 19:47:58 2010 (r44397)
+++ branches/boehm_gc_2/compilers/imcc/optimizer.c Tue Feb 23 19:48:28 2010 (r44398)
@@ -367,7 +367,7 @@
last->opnum = tmp->opnum;
last->opsize = tmp->opsize;
mem_sys_free(last->opname);
- last->opname = mem_sys_strdup(tmp->opname);
+ last->opname = Parrot_gc_strdup(interp, tmp->opname);
free_ins(tmp);
/* delete branch */
Modified: branches/boehm_gc_2/compilers/imcc/parser_util.c
==============================================================================
--- branches/boehm_gc_2/compilers/imcc/parser_util.c Tue Feb 23 19:47:58 2010 (r44397)
+++ branches/boehm_gc_2/compilers/imcc/parser_util.c Tue Feb 23 19:48:28 2010 (r44398)
@@ -345,7 +345,7 @@
PARROT_ASSERT(op >= 0);
- ins = _mk_instruction(name, "", n, r, dirs);
+ ins = _mk_instruction(interp, name, "", n, r, dirs);
ins->opnum = op;
ins->opsize = n + 1;
@@ -390,7 +390,7 @@
char fullname[64] = "", format[128] = "";
if (STREQ(name, ".annotate")) {
- ins = _mk_instruction(name, "", n, r, 0);
+ ins = _mk_instruction(interp, name, "", n, r, 0);
if (emit)
return emitb(interp, unit, ins);
else
@@ -507,7 +507,7 @@
IMCC_debug(interp, DEBUG_PARSER, "%s %s\t%s\n", name, format, fullname);
/* make the instruction */
- ins = _mk_instruction(name, format, n, r, dirs);
+ ins = _mk_instruction(interp, name, format, n, r, dirs);
ins->keys |= keyvec;
/* fill in oplib's info */
@@ -934,7 +934,7 @@
IMCC_push_parser_state(interp);
{
/* Store a copy, in order to know how to free it later */
- char *copyname = mem_sys_strdup(fullname);
+ char *copyname = Parrot_gc_strdup(interp, fullname);
IMCC_INFO(interp)->state->file = copyname;
ext = strrchr(copyname, '.');
}
Modified: branches/boehm_gc_2/compilers/imcc/pbc.c
==============================================================================
--- branches/boehm_gc_2/compilers/imcc/pbc.c Tue Feb 23 19:47:58 2010 (r44397)
+++ branches/boehm_gc_2/compilers/imcc/pbc.c Tue Feb 23 19:48:28 2010 (r44398)
@@ -1275,7 +1275,7 @@
ns_const = ns->color;
if (real_name) {
- char * const p = mem_sys_strdup(real_name + 1);
+ char * const p = Parrot_gc_strdup(interp, real_name + 1);
mem_sys_free(r->name);
r->name = p;
}
@@ -1321,7 +1321,7 @@
unit->subid = r;
else {
/* trim the quotes */
- unit->subid->name = mem_sys_strdup(unit->subid->name + 1);
+ unit->subid->name = Parrot_gc_strdup(interp, unit->subid->name + 1);
unit->subid->name[strlen(unit->subid->name) - 1] = 0;
/* create string constant for it. */
Modified: branches/boehm_gc_2/compilers/imcc/symreg.c
==============================================================================
--- branches/boehm_gc_2/compilers/imcc/symreg.c Tue Feb 23 19:47:58 2010 (r44397)
+++ branches/boehm_gc_2/compilers/imcc/symreg.c Tue Feb 23 19:48:28 2010 (r44398)
@@ -148,7 +148,7 @@
Namespace * const ns = mem_gc_allocate_zeroed_typed(interp, Namespace);
ns->parent = IMCC_INFO(interp)->namespace_stack;
- ns->name = mem_sys_strdup(name);
+ ns->name = Parrot_gc_strdup(interp, name);
IMCC_INFO(interp)->namespace_stack = ns;
}
@@ -271,7 +271,7 @@
r = mem_gc_allocate_zeroed_typed(interp, SymReg);
r->set = t;
r->type = VTREG;
- r->name = mem_sys_strdup(name);
+ r->name = Parrot_gc_strdup(interp, name);
r->color = -1;
r->want_regno = -1;
@@ -625,7 +625,7 @@
return result;
}
- return mem_sys_strdup(name);
+ return Parrot_gc_strdup(interp, name);
}
@@ -727,7 +727,7 @@
r[0] = left;
/* strip delimiters */
- name = mem_sys_strdup(rhs->name + 1);
+ name = Parrot_gc_strdup(interp, rhs->name + 1);
len = strlen(name);
name[len - 1] = '\0';
@@ -939,7 +939,7 @@
if (!IMCC_INFO(interp)->cur_namespace
|| (l = strlen(IMCC_INFO(interp)->cur_namespace->name)) <= 2)
- return mem_sys_strdup(name);
+ return Parrot_gc_strdup(interp, name);
/* TODO keyed syntax */
len = strlen(name) + l + 4;
@@ -992,7 +992,7 @@
r = mem_gc_allocate_zeroed_typed(interp, SymReg);
r->type = VTADDRESS;
- r->name = mem_sys_strdup(name);
+ r->name = Parrot_gc_strdup(interp, name);
_store_symreg(interp, hsh, r);
if (is_lexical)
@@ -1178,7 +1178,7 @@
ASSERT_ARGS(dup_sym)
SymReg * const new_sym = mem_gc_allocate_zeroed_typed(interp, SymReg);
STRUCT_COPY(new_sym, r);
- new_sym->name = mem_sys_strdup(r->name);
+ new_sym->name = Parrot_gc_strdup(interp, r->name);
if (r->nextkey)
new_sym->nextkey = dup_sym(interp, r->nextkey);
More information about the parrot-commits
mailing list