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
40d63f77
Commit
40d63f77
authored
May 17, 2013
by
Ryan Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed the each_object callback so that a pointer is passed for the object, instead of the struct.
parent
da6b61db
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
14 deletions
+6
-14
include/mruby/gc.h
include/mruby/gc.h
+2
-10
mrbgems/mruby-objectspace/src/mruby_objectspace.c
mrbgems/mruby-objectspace/src/mruby_objectspace.c
+3
-3
src/gc.c
src/gc.c
+1
-1
No files found.
include/mruby/gc.h
View file @
40d63f77
/*
/*
** gc.
c
- garbage collector for mruby
** gc.
h
- garbage collector for mruby
**
**
** See Copyright Notice in mruby.h
** See Copyright Notice in mruby.h
*/
*/
...
@@ -7,18 +7,10 @@
...
@@ -7,18 +7,10 @@
#ifndef MRUBY_GC_H
#ifndef MRUBY_GC_H
#define MRUBY_GC_H
#define MRUBY_GC_H
#if defined(__cplusplus)
extern
"C"
{
#endif
#include "mruby.h"
#include "mruby.h"
#include "mruby/value.h"
#include "mruby/value.h"
typedef
int
each_object_callback
(
mrb_state
*
mrb
,
struct
RBasic
obj
,
void
*
data
);
typedef
int
each_object_callback
(
mrb_state
*
mrb
,
struct
RBasic
*
obj
,
void
*
data
);
void
mrb_objspace_each_objects
(
mrb_state
*
mrb
,
each_object_callback
*
callback
,
void
*
data
);
void
mrb_objspace_each_objects
(
mrb_state
*
mrb
,
each_object_callback
*
callback
,
void
*
data
);
#if defined(__cplusplus)
}
/* extern "C" { */
#endif
#endif
/* MRUBY_GC_H */
#endif
/* MRUBY_GC_H */
mrbgems/mruby-objectspace/src/mruby_objectspace.c
View file @
40d63f77
...
@@ -31,12 +31,12 @@ struct os_count_struct {
...
@@ -31,12 +31,12 @@ struct os_count_struct {
size_t
counts
[
MRB_TT_MAXDEFINE
+
1
];
size_t
counts
[
MRB_TT_MAXDEFINE
+
1
];
};
};
void
os_count_object_type
(
mrb_state
*
mrb
,
struct
RBasic
obj
,
void
*
data
)
void
os_count_object_type
(
mrb_state
*
mrb
,
struct
RBasic
*
obj
,
void
*
data
)
{
{
struct
os_count_struct
*
obj_count
;
struct
os_count_struct
*
obj_count
;
obj_count
=
(
struct
os_count_struct
*
)(
data
);
obj_count
=
(
struct
os_count_struct
*
)(
data
);
obj_count
->
counts
[
mrb_type
(
obj
)
]
++
;
obj_count
->
counts
[
obj
->
tt
]
++
;
if
(
is_dead
(
mrb
,
&
obj
))
if
(
is_dead
(
mrb
,
obj
))
{
{
obj_count
->
freed
++
;
obj_count
->
freed
++
;
}
}
...
...
src/gc.c
View file @
40d63f77
...
@@ -1153,7 +1153,7 @@ mrb_objspace_each_objects(mrb_state *mrb, each_object_callback* callback, void *
...
@@ -1153,7 +1153,7 @@ mrb_objspace_each_objects(mrb_state *mrb, each_object_callback* callback, void *
p
=
page
->
objects
;
p
=
page
->
objects
;
pend
=
p
+
MRB_HEAP_PAGE_SIZE
;
pend
=
p
+
MRB_HEAP_PAGE_SIZE
;
for
(;
p
<
pend
;
p
++
)
{
for
(;
p
<
pend
;
p
++
)
{
callback
(
mrb
,
p
->
as
.
basic
,
data
);
callback
(
mrb
,
&
p
->
as
.
basic
,
data
);
}
}
page
=
page
->
next
;
page
=
page
->
next
;
...
...
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