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
30e0dc79
Commit
30e0dc79
authored
May 15, 2014
by
take_cheeze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support `LVAR` section removing.
parent
c2f77c78
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
8 deletions
+43
-8
include/mruby/irep.h
include/mruby/irep.h
+1
-0
src/dump.c
src/dump.c
+26
-8
src/etc.c
src/etc.c
+16
-0
No files found.
include/mruby/irep.h
View file @
30e0dc79
...
...
@@ -52,6 +52,7 @@ mrb_value mrb_load_irep_cxt(mrb_state*, const uint8_t*, mrbc_context*);
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_remove_lv
(
mrb_state
*
,
struct
mrb_irep
*
);
#if defined(__cplusplus)
}
/* extern "C" { */
...
...
src/dump.c
View file @
30e0dc79
...
...
@@ -860,6 +860,20 @@ is_debug_info_defined(mrb_irep *irep)
return
TRUE
;
}
static
mrb_bool
is_lv_defined
(
mrb_irep
*
irep
)
{
size_t
i
;
if
(
irep
->
lv
)
{
return
TRUE
;
}
for
(
i
=
0
;
i
<
irep
->
rlen
;
++
i
)
{
if
(
is_lv_defined
(
irep
->
reps
[
i
]))
{
return
TRUE
;
}
}
return
FALSE
;
}
int
mrb_dump_irep
(
mrb_state
*
mrb
,
mrb_irep
*
irep
,
int
debug_info
,
uint8_t
**
bin
,
size_t
*
bin_size
)
{
...
...
@@ -867,7 +881,7 @@ mrb_dump_irep(mrb_state *mrb, mrb_irep *irep, int debug_info, uint8_t **bin, siz
size_t
section_irep_size
;
size_t
section_lineno_size
=
0
,
section_lv_size
=
0
;
uint8_t
*
cur
=
NULL
;
mrb_bool
const
debug_info_defined
=
is_debug_info_defined
(
irep
);
mrb_bool
const
debug_info_defined
=
is_debug_info_defined
(
irep
)
,
lv_defined
=
is_lv_defined
(
irep
)
;
mrb_sym
*
lv_syms
=
NULL
;
uint32_t
lv_syms_len
=
0
;
if
(
mrb
==
NULL
)
{
...
...
@@ -900,9 +914,11 @@ mrb_dump_irep(mrb_state *mrb, mrb_irep *irep, int debug_info, uint8_t **bin, siz
}
}
section_lv_size
+=
sizeof
(
struct
rite_section_lv_header
);
create_lv_sym_table
(
mrb
,
irep
,
&
lv_syms
,
&
lv_syms_len
);
section_lv_size
+=
get_lv_section_size
(
mrb
,
irep
,
lv_syms
,
lv_syms_len
);
if
(
lv_defined
)
{
section_lv_size
+=
sizeof
(
struct
rite_section_lv_header
);
create_lv_sym_table
(
mrb
,
irep
,
&
lv_syms
,
&
lv_syms_len
);
section_lv_size
+=
get_lv_section_size
(
mrb
,
irep
,
lv_syms
,
lv_syms_len
);
}
*
bin_size
=
sizeof
(
struct
rite_binary_header
)
+
section_irep_size
+
section_lineno_size
+
section_lv_size
+
...
...
@@ -933,11 +949,13 @@ mrb_dump_irep(mrb_state *mrb, mrb_irep *irep, int debug_info, uint8_t **bin, siz
cur
+=
section_lineno_size
;
}
result
=
write_section_lv
(
mrb
,
irep
,
cur
,
lv_syms
,
lv_syms_len
);
if
(
result
!=
MRB_DUMP_OK
)
{
goto
error_exit
;
if
(
lv_defined
)
{
result
=
write_section_lv
(
mrb
,
irep
,
cur
,
lv_syms
,
lv_syms_len
);
if
(
result
!=
MRB_DUMP_OK
)
{
goto
error_exit
;
}
cur
+=
section_lv_size
;
}
cur
+=
section_lv_size
;
write_footer
(
mrb
,
cur
);
write_rite_binary_header
(
mrb
,
*
bin_size
,
*
bin
);
...
...
src/etc.c
View file @
30e0dc79
...
...
@@ -9,6 +9,7 @@
#include "mruby/data.h"
#include "mruby/class.h"
#include "mruby/re.h"
#include "mruby/irep.h"
struct
RData
*
mrb_data_object_alloc
(
mrb_state
*
mrb
,
struct
RClass
*
klass
,
void
*
ptr
,
const
mrb_data_type
*
type
)
...
...
@@ -182,3 +183,18 @@ mrb_regexp_p(mrb_state *mrb, mrb_value v)
{
return
mrb_class_defined
(
mrb
,
REGEXP_CLASS
)
&&
mrb_obj_is_kind_of
(
mrb
,
v
,
mrb_class_get
(
mrb
,
REGEXP_CLASS
));
}
void
mrb_irep_remove_lv
(
mrb_state
*
mrb
,
mrb_irep
*
irep
)
{
size_t
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