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
72928f20
Unverified
Commit
72928f20
authored
Apr 14, 2020
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Apr 14, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4972 from dearblue/boxnan-cptr
Fix `MRB_TT_CPTR` object with `MRB_NAN_BOXING`
parents
81a92100
d0501c69
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
11 deletions
+31
-11
include/mruby/boxing_nan.h
include/mruby/boxing_nan.h
+11
-2
include/mruby/boxing_word.h
include/mruby/boxing_word.h
+0
-5
include/mruby/value.h
include/mruby/value.h
+7
-0
src/etc.c
src/etc.c
+13
-4
No files found.
include/mruby/boxing_nan.h
View file @
72928f20
...
@@ -44,6 +44,9 @@ typedef struct mrb_value {
...
@@ -44,6 +44,9 @@ typedef struct mrb_value {
};
};
)
)
};
};
#ifdef MRB_64BIT
struct
RCptr
*
vp
;
#endif
}
value
;
}
value
;
};
};
}
mrb_value
;
}
mrb_value
;
...
@@ -54,13 +57,15 @@ typedef struct mrb_value {
...
@@ -54,13 +57,15 @@ typedef struct mrb_value {
#define mrb_type(o) (enum mrb_vtype)((uint32_t)0xfff00000 < (o).value.ttt ? mrb_tt(o) : MRB_TT_FLOAT)
#define mrb_type(o) (enum mrb_vtype)((uint32_t)0xfff00000 < (o).value.ttt ? mrb_tt(o) : MRB_TT_FLOAT)
#define mrb_ptr(o) ((void*)((((uintptr_t)0x3fffffffffff)&((uintptr_t)((o).value.p)))<<2))
#define mrb_ptr(o) ((void*)((((uintptr_t)0x3fffffffffff)&((uintptr_t)((o).value.p)))<<2))
#define mrb_float(o) (o).f
#define mrb_float(o) (o).f
#define mrb_cptr(o) mrb_ptr(o)
#define mrb_fixnum(o) (o).value.i
#define mrb_fixnum(o) (o).value.i
#define mrb_symbol(o) (o).value.sym
#define mrb_symbol(o) (o).value.sym
#ifdef MRB_64BIT
#ifdef MRB_64BIT
MRB_API
mrb_value
mrb_nan_boxing_cptr_value
(
struct
mrb_state
*
,
void
*
);
#define mrb_cptr(o) (((struct RCptr*)mrb_ptr(o))->p)
#define BOXNAN_SHIFT_LONG_POINTER(v) (((uintptr_t)(v)>>34)&0x3fff)
#define BOXNAN_SHIFT_LONG_POINTER(v) (((uintptr_t)(v)>>34)&0x3fff)
#else
#else
#define mrb_cptr(o) ((o).value.p)
#define BOXNAN_SHIFT_LONG_POINTER(v) 0
#define BOXNAN_SHIFT_LONG_POINTER(v) 0
#endif
#endif
...
@@ -90,7 +95,11 @@ typedef struct mrb_value {
...
@@ -90,7 +95,11 @@ typedef struct mrb_value {
#define SET_INT_VALUE(r,n) BOXNAN_SET_VALUE(r, MRB_TT_FIXNUM, value.i, (n))
#define SET_INT_VALUE(r,n) BOXNAN_SET_VALUE(r, MRB_TT_FIXNUM, value.i, (n))
#define SET_SYM_VALUE(r,v) BOXNAN_SET_VALUE(r, MRB_TT_SYMBOL, value.sym, (v))
#define SET_SYM_VALUE(r,v) BOXNAN_SET_VALUE(r, MRB_TT_SYMBOL, value.sym, (v))
#define SET_OBJ_VALUE(r,v) BOXNAN_SET_OBJ_VALUE(r, (((struct RObject*)(v))->tt), (v))
#define SET_OBJ_VALUE(r,v) BOXNAN_SET_OBJ_VALUE(r, (((struct RObject*)(v))->tt), (v))
#define SET_CPTR_VALUE(mrb,r,v) BOXNAN_SET_OBJ_VALUE(r, MRB_TT_CPTR, v)
#ifdef MRB_64BIT
#define SET_CPTR_VALUE(mrb,r,v) ((r) = mrb_nan_boxing_cptr_value(mrb, v))
#else
#define SET_CPTR_VALUE(mrb,r,v) BOXNAN_SET_VALUE(r, MRB_TT_CPTR, value.p, v)
#endif
#define SET_UNDEF_VALUE(r) BOXNAN_SET_VALUE(r, MRB_TT_UNDEF, value.i, 0)
#define SET_UNDEF_VALUE(r) BOXNAN_SET_VALUE(r, MRB_TT_UNDEF, value.i, 0)
#endif
/* MRUBY_BOXING_NAN_H */
#endif
/* MRUBY_BOXING_NAN_H */
include/mruby/boxing_word.h
View file @
72928f20
...
@@ -18,11 +18,6 @@ struct RFloat {
...
@@ -18,11 +18,6 @@ struct RFloat {
};
};
#endif
#endif
struct
RCptr
{
MRB_OBJECT_HEADER
;
void
*
p
;
};
enum
mrb_special_consts
{
enum
mrb_special_consts
{
MRB_Qnil
=
0
,
MRB_Qnil
=
0
,
MRB_Qfalse
=
4
,
MRB_Qfalse
=
4
,
...
...
include/mruby/value.h
View file @
72928f20
...
@@ -149,6 +149,13 @@ typedef void mrb_value;
...
@@ -149,6 +149,13 @@ typedef void mrb_value;
#endif
#endif
#if defined(MRB_WORD_BOXING) || (defined(MRB_NAN_BOXING) && defined(MRB_64BIT))
struct
RCptr
{
MRB_OBJECT_HEADER
;
void
*
p
;
};
#endif
#if defined(MRB_NAN_BOXING)
#if defined(MRB_NAN_BOXING)
#include "boxing_nan.h"
#include "boxing_nan.h"
#elif defined(MRB_WORD_BOXING)
#elif defined(MRB_WORD_BOXING)
...
...
src/etc.c
View file @
72928f20
...
@@ -140,7 +140,13 @@ mrb_obj_id(mrb_value obj)
...
@@ -140,7 +140,13 @@ mrb_obj_id(mrb_value obj)
}
}
}
}
#if defined(MRB_NAN_BOXING) && defined(MRB_64BIT)
#define mrb_xxx_boxing_cptr_value mrb_nan_boxing_cptr_value
#endif
#ifdef MRB_WORD_BOXING
#ifdef MRB_WORD_BOXING
#define mrb_xxx_boxing_cptr_value mrb_word_boxing_cptr_value
#ifndef MRB_WITHOUT_FLOAT
#ifndef MRB_WITHOUT_FLOAT
MRB_API
mrb_value
MRB_API
mrb_value
mrb_word_boxing_float_value
(
mrb_state
*
mrb
,
mrb_float
f
)
mrb_word_boxing_float_value
(
mrb_state
*
mrb
,
mrb_float
f
)
...
@@ -164,17 +170,20 @@ mrb_word_boxing_float_pool(mrb_state *mrb, mrb_float f)
...
@@ -164,17 +170,20 @@ mrb_word_boxing_float_pool(mrb_state *mrb, mrb_float f)
return
mrb_obj_value
(
nf
);
return
mrb_obj_value
(
nf
);
}
}
#endif
/* MRB_WITHOUT_FLOAT */
#endif
/* MRB_WITHOUT_FLOAT */
#endif
/* MRB_WORD_BOXING */
#if defined(MRB_WORD_BOXING) || (defined(MRB_NAN_BOXING) && defined(MRB_64BIT))
MRB_API
mrb_value
MRB_API
mrb_value
mrb_
word
_boxing_cptr_value
(
mrb_state
*
mrb
,
void
*
p
)
mrb_
xxx
_boxing_cptr_value
(
mrb_state
*
mrb
,
void
*
p
)
{
{
mrb_value
v
;
mrb_value
v
;
struct
RCptr
*
cptr
=
(
struct
RCptr
*
)
mrb_obj_alloc
(
mrb
,
MRB_TT_CPTR
,
mrb
->
object_class
);
v
.
value
.
p
=
mrb_obj_alloc
(
mrb
,
MRB_TT_CPTR
,
mrb
->
object_class
);
SET_OBJ_VALUE
(
v
,
cptr
);
v
.
value
.
vp
->
p
=
p
;
cptr
->
p
=
p
;
return
v
;
return
v
;
}
}
#endif
/* MRB_WORD_BOXING */
#endif
#if defined _MSC_VER && _MSC_VER < 1900
#if defined _MSC_VER && _MSC_VER < 1900
...
...
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