Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
e3bc680d
Unverified
Commit
e3bc680d
authored
Jul 11, 2018
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Jul 11, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4068 from yurie/mrbc
add mrbc option `--remove-lv`
parents
ea435f99
a921b936
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
17 deletions
+26
-17
include/mruby/irep.h
include/mruby/irep.h
+1
-0
mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c
mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c
+9
-0
mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c
mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c
+1
-17
mrbgems/mruby-compiler/core/codegen.c
mrbgems/mruby-compiler/core/codegen.c
+15
-0
No files found.
include/mruby/irep.h
View file @
e3bc680d
...
...
@@ -56,6 +56,7 @@ void mrb_irep_free(mrb_state*, struct mrb_irep*);
void
mrb_irep_incref
(
mrb_state
*
,
struct
mrb_irep
*
);
void
mrb_irep_decref
(
mrb_state
*
,
struct
mrb_irep
*
);
void
mrb_irep_cutref
(
mrb_state
*
,
struct
mrb_irep
*
);
void
mrb_irep_remove_lv
(
mrb_state
*
mrb
,
mrb_irep
*
irep
);
MRB_END_DECL
...
...
mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c
View file @
e3bc680d
...
...
@@ -18,6 +18,7 @@ struct mrbc_args {
const
char
*
initname
;
mrb_bool
check_syntax
:
1
;
mrb_bool
verbose
:
1
;
mrb_bool
remove_lv
:
1
;
unsigned
int
flags
:
4
;
};
...
...
@@ -33,6 +34,7 @@ usage(const char *name)
"-B<symbol> binary <symbol> output in C language format"
,
"-e generate little endian iseq data"
,
"-E generate big endian iseq data"
,
"--remove-lv remove local variables"
,
"--verbose run at verbose mode"
,
"--version print the version"
,
"--copyright print the copyright"
,
...
...
@@ -142,6 +144,10 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct mrbc_args *args)
mrb_show_copyright
(
mrb
);
exit
(
EXIT_SUCCESS
);
}
else
if
(
strcmp
(
argv
[
i
]
+
2
,
"remove-lv"
)
==
0
)
{
args
->
remove_lv
=
TRUE
;
break
;
}
return
-
1
;
default:
return
i
;
...
...
@@ -232,6 +238,9 @@ dump_file(mrb_state *mrb, FILE *wfp, const char *outfile, struct RProc *proc, st
int
n
=
MRB_DUMP_OK
;
mrb_irep
*
irep
=
proc
->
body
.
irep
;
if
(
args
->
remove_lv
)
{
mrb_irep_remove_lv
(
mrb
,
irep
);
}
if
(
args
->
initname
)
{
n
=
mrb_dump_irep_cfunc
(
mrb
,
irep
,
args
->
flags
,
wfp
,
args
->
initname
);
if
(
n
==
MRB_DUMP_INVALID_ARGUMENT
)
{
...
...
mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c
View file @
e3bc680d
...
...
@@ -12,22 +12,6 @@ struct strip_args {
mrb_bool
lvar
;
};
static
void
irep_remove_lv
(
mrb_state
*
mrb
,
mrb_irep
*
irep
)
{
int
i
;
if
(
irep
->
lv
)
{
mrb_free
(
mrb
,
irep
->
lv
);
irep
->
lv
=
NULL
;
}
for
(
i
=
0
;
i
<
irep
->
rlen
;
++
i
)
{
irep_remove_lv
(
mrb
,
irep
->
reps
[
i
]);
}
}
static
void
print_usage
(
const
char
*
f
)
{
...
...
@@ -99,7 +83,7 @@ strip(mrb_state *mrb, struct strip_args *args)
/* clear lv if --lvar is enabled */
if
(
args
->
lvar
)
{
irep_remove_lv
(
mrb
,
irep
);
mrb_
irep_remove_lv
(
mrb
,
irep
);
}
wfile
=
fopen
(
filename
,
"wb"
);
...
...
mrbgems/mruby-compiler/core/codegen.c
View file @
e3bc680d
...
...
@@ -3092,3 +3092,18 @@ mrb_generate_code(mrb_state *mrb, parser_state *p)
{
return
generate_code
(
mrb
,
p
,
VAL
);
}
void
mrb_irep_remove_lv
(
mrb_state
*
mrb
,
mrb_irep
*
irep
)
{
int
i
;
if
(
irep
->
lv
)
{
mrb_free
(
mrb
,
irep
->
lv
);
irep
->
lv
=
NULL
;
}
for
(
i
=
0
;
i
<
irep
->
rlen
;
++
i
)
{
mrb_irep_remove_lv
(
mrb
,
irep
->
reps
[
i
]);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment