mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
internal/variable.h rework
Eliminated macros. Also marked MJIT_FUNC_EXPORTED functions as such. Some of them are declared in constant.h so edited that file also.
This commit is contained in:
parent
989068cf70
commit
f3a229fe2d
Notes:
git
2019-12-26 20:46:02 +09:00
2 changed files with 54 additions and 18 deletions
|
@ -39,12 +39,15 @@ VALUE rb_mod_private_constant(int argc, const VALUE *argv, VALUE obj);
|
|||
VALUE rb_mod_public_constant(int argc, const VALUE *argv, VALUE obj);
|
||||
VALUE rb_mod_deprecate_constant(int argc, const VALUE *argv, VALUE obj);
|
||||
void rb_free_const_table(struct rb_id_table *tbl);
|
||||
VALUE rb_const_source_location(VALUE, ID);
|
||||
|
||||
MJIT_SYMBOL_EXPORT_BEGIN
|
||||
int rb_autoloading_value(VALUE mod, ID id, VALUE *value, rb_const_flag_t *flag);
|
||||
rb_const_entry_t *rb_const_lookup(VALUE klass, ID id);
|
||||
VALUE rb_public_const_get_at(VALUE klass, ID id);
|
||||
VALUE rb_public_const_get_from(VALUE klass, ID id);
|
||||
int rb_public_const_defined_from(VALUE klass, ID id);
|
||||
rb_const_entry_t *rb_const_lookup(VALUE klass, ID id);
|
||||
int rb_autoloading_value(VALUE mod, ID id, VALUE *value, rb_const_flag_t *flag);
|
||||
VALUE rb_const_source_location(VALUE, ID);
|
||||
VALUE rb_const_source_location_at(VALUE, ID);
|
||||
MJIT_SYMBOL_EXPORT_END
|
||||
|
||||
#endif /* CONSTANT_H */
|
||||
|
|
|
@ -10,29 +10,24 @@
|
|||
* file COPYING are met. Consult the file for details.
|
||||
*/
|
||||
|
||||
#include "ruby/config.h"
|
||||
#include <stddef.h> /* for size_t */
|
||||
#include "constant.h" /* for rb_const_entry_t */
|
||||
#include "internal/stdbool.h" /* for bool */
|
||||
#include "ruby/ruby.h" /* for VALUE */
|
||||
|
||||
/* global variable */
|
||||
|
||||
#define ROBJECT_TRANSIENT_FLAG FL_USER13
|
||||
|
||||
struct rb_global_variable; /* defined in variable.c */
|
||||
|
||||
struct rb_global_entry {
|
||||
struct rb_global_variable *var;
|
||||
ID id;
|
||||
};
|
||||
|
||||
struct rb_global_entry *rb_global_entry(ID);
|
||||
VALUE rb_gvar_get(struct rb_global_entry *);
|
||||
VALUE rb_gvar_set(struct rb_global_entry *, VALUE);
|
||||
VALUE rb_gvar_defined(struct rb_global_entry *);
|
||||
|
||||
/* variable.c */
|
||||
#if USE_TRANSIENT_HEAP
|
||||
#define ROBJECT_TRANSIENT_FLAG FL_USER13
|
||||
#define ROBJ_TRANSIENT_P(obj) FL_TEST_RAW((obj), ROBJECT_TRANSIENT_FLAG)
|
||||
#define ROBJ_TRANSIENT_SET(obj) FL_SET_RAW((obj), ROBJECT_TRANSIENT_FLAG)
|
||||
#define ROBJ_TRANSIENT_UNSET(obj) FL_UNSET_RAW((obj), ROBJECT_TRANSIENT_FLAG)
|
||||
#else
|
||||
#define ROBJ_TRANSIENT_P(obj) 0
|
||||
#define ROBJ_TRANSIENT_SET(obj) ((void)0)
|
||||
#define ROBJ_TRANSIENT_UNSET(obj) ((void)0)
|
||||
#endif
|
||||
void rb_gc_mark_global_tbl(void);
|
||||
size_t rb_generic_ivar_memsize(VALUE);
|
||||
VALUE rb_search_class_path(VALUE);
|
||||
|
@ -46,6 +41,9 @@ rb_gvar_getter_t *rb_gvar_getter_function_of(const struct rb_global_entry *);
|
|||
rb_gvar_setter_t *rb_gvar_setter_function_of(const struct rb_global_entry *);
|
||||
bool rb_gvar_is_traced(const struct rb_global_entry *);
|
||||
void rb_gvar_readonly_setter(VALUE v, ID id, VALUE *_);
|
||||
static inline bool ROBJ_TRANSIENT_P(VALUE obj);
|
||||
static inline void ROBJ_TRANSIENT_SET(VALUE obj);
|
||||
static inline void ROBJ_TRANSIENT_UNSET(VALUE obj);
|
||||
|
||||
RUBY_SYMBOL_EXPORT_BEGIN
|
||||
/* variable.c (export) */
|
||||
|
@ -56,4 +54,39 @@ int rb_class_ivar_set(VALUE klass, ID vid, VALUE value);
|
|||
void rb_iv_tbl_copy(VALUE dst, VALUE src);
|
||||
RUBY_SYMBOL_EXPORT_END
|
||||
|
||||
MJIT_SYMBOL_EXPORT_BEGIN
|
||||
struct rb_global_entry *rb_global_entry(ID);
|
||||
VALUE rb_gvar_get(struct rb_global_entry *);
|
||||
VALUE rb_gvar_set(struct rb_global_entry *, VALUE);
|
||||
VALUE rb_gvar_defined(struct rb_global_entry *);
|
||||
struct st_table *rb_ivar_generic_ivtbl(void);
|
||||
void rb_const_warn_if_deprecated(const rb_const_entry_t *, VALUE, ID);
|
||||
MJIT_SYMBOL_EXPORT_END
|
||||
|
||||
static inline bool
|
||||
ROBJ_TRANSIENT_P(VALUE obj)
|
||||
{
|
||||
#if USE_TRANSIENT_HEAP
|
||||
return FL_TEST_RAW(obj, ROBJECT_TRANSIENT_FLAG);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
ROBJ_TRANSIENT_SET(VALUE obj)
|
||||
{
|
||||
#if USE_TRANSIENT_HEAP
|
||||
FL_SET_RAW(obj, ROBJECT_TRANSIENT_FLAG);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
ROBJ_TRANSIENT_UNSET(VALUE obj)
|
||||
{
|
||||
#if USE_TRANSIENT_HEAP
|
||||
FL_UNSET_RAW(obj, ROBJECT_TRANSIENT_FLAG);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* INTERNAL_VARIABLE_H */
|
||||
|
|
Loading…
Add table
Reference in a new issue