ruby-changes:59495
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Thu, 26 Dec 2019 23:13:31 +0900 (JST)
Subject: [ruby-changes:59495] f3a229fe2d (master): internal/variable.h rework
https://git.ruby-lang.org/ruby.git/commit/?id=f3a229fe2d From f3a229fe2d8b1b5dcc4fc4577341256743421f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Tue, 3 Dec 2019 15:11:09 +0900 Subject: 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. diff --git a/constant.h b/constant.h index 3f1418d..610bdf1 100644 --- a/constant.h +++ b/constant.h @@ -39,12 +39,15 @@ VALUE rb_mod_private_constant(int argc, const VALUE *argv, VALUE obj); https://github.com/ruby/ruby/blob/trunk/constant.h#L39 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 */ diff --git a/internal/variable.h b/internal/variable.h index 1de31f6..1cdc06e 100644 --- a/internal/variable.h +++ b/internal/variable.h @@ -10,29 +10,24 @@ https://github.com/ruby/ruby/blob/trunk/internal/variable.h#L10 * 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 *); https://github.com/ruby/ruby/blob/trunk/internal/variable.h#L41 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); https://github.com/ruby/ruby/blob/trunk/internal/variable.h#L54 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 */ -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/