2008-01-18 03:56:11 -05:00
|
|
|
#ifndef RUBY_EVAL_INTERN_H
|
|
|
|
#define RUBY_EVAL_INTERN_H
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2008-09-23 18:43:53 -04:00
|
|
|
#include "ruby/ruby.h"
|
* common.mk: clean up
- remove blockinlining.$(OBJEXT) to built
- make ENCODING_H_INCLDUES variable (include/ruby/encoding.h)
- make VM_CORE_H_INCLUDES variable (vm_core.h)
- simplify rules.
- make depends rule to output depend status using gcc -MM.
* include/ruby/mvm.h, include/ruby/vm.h: rename mvm.h to vm.h.
* include/ruby.h: ditto.
* load.c: add inclusion explicitly.
* enumerator.c, object.c, parse.y, thread.c, vm_dump.c:
remove useless inclusion.
* eval_intern.h: cleanup inclusion.
* vm_core.h: rb_thread_t should be defined in this file.
* vm_evalbody.c, vm_exec.c: rename vm_evalbody.c to vm_exec.c.
* vm.h, vm_exec.h: rename vm.h to vm_exec.h.
* insnhelper.h, vm_insnhelper.h: rename insnhelper.h to vm_insnhelper.h.
* vm.c, vm_insnhelper.c, vm_insnhelper.h:
- rename vm_eval() to vm_exec_core().
- rename vm_eval_body() to vm_exec().
- cleanup include order.
* vm_method.c: fix comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-22 20:20:28 -04:00
|
|
|
#include "vm_core.h"
|
|
|
|
|
2015-10-05 03:10:21 -04:00
|
|
|
static inline void
|
2017-10-28 06:01:54 -04:00
|
|
|
vm_passed_block_handler_set(rb_execution_context_t *ec, VALUE block_handler)
|
2015-10-05 03:10:21 -04:00
|
|
|
{
|
2017-06-08 01:22:49 -04:00
|
|
|
vm_block_handler_verify(block_handler);
|
2017-10-28 06:01:54 -04:00
|
|
|
ec->passed_block_handler = block_handler;
|
2015-10-05 03:10:21 -04:00
|
|
|
}
|
2016-07-28 07:02:30 -04:00
|
|
|
|
|
|
|
static inline void
|
2017-10-28 06:01:54 -04:00
|
|
|
pass_passed_block_handler(rb_execution_context_t *ec)
|
2016-07-28 07:02:30 -04:00
|
|
|
{
|
2017-10-28 06:01:54 -04:00
|
|
|
VALUE block_handler = rb_vm_frame_block_handler(ec->cfp);
|
|
|
|
vm_passed_block_handler_set(ec, block_handler);
|
|
|
|
VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_PASSED);
|
2016-07-28 07:02:30 -04:00
|
|
|
}
|
|
|
|
|
2017-10-28 06:01:54 -04:00
|
|
|
#define PASS_PASSED_BLOCK_HANDLER_EC(ec) pass_passed_block_handler(ec)
|
|
|
|
#define PASS_PASSED_BLOCK_HANDLER() pass_passed_block_handler(GET_EC())
|
2006-12-31 10:02:22 -05:00
|
|
|
|
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
#include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
#ifndef EXIT_SUCCESS
|
|
|
|
#define EXIT_SUCCESS 0
|
|
|
|
#endif
|
|
|
|
#ifndef EXIT_FAILURE
|
|
|
|
#define EXIT_FAILURE 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
2012-12-28 09:23:25 -05:00
|
|
|
# ifdef HAVE_CRT_EXTERNS_H
|
|
|
|
# include <crt_externs.h>
|
|
|
|
# else
|
|
|
|
# include "missing/crt_externs.h"
|
|
|
|
# endif
|
2006-12-31 10:02:22 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_STRING_H
|
2007-12-24 23:17:06 -05:00
|
|
|
char *strrchr(const char *, const char);
|
2006-12-31 10:02:22 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
2008-08-08 04:03:19 -04:00
|
|
|
#ifdef HAVE_NET_SOCKET_H
|
2006-12-31 10:02:22 -05:00
|
|
|
#include <net/socket.h>
|
|
|
|
#endif
|
|
|
|
|
2008-03-31 13:58:41 -04:00
|
|
|
#define ruby_setjmp(env) RUBY_SETJMP(env)
|
2011-01-17 17:54:29 -05:00
|
|
|
#define ruby_longjmp(env,val) RUBY_LONGJMP((env),(val))
|
2008-03-31 13:58:41 -04:00
|
|
|
#ifdef __CYGWIN__
|
2009-05-01 00:18:02 -04:00
|
|
|
# ifndef _setjmp
|
|
|
|
int _setjmp(jmp_buf);
|
|
|
|
# endif
|
|
|
|
# ifndef _longjmp
|
|
|
|
NORETURN(void _longjmp(jmp_buf, int));
|
|
|
|
# endif
|
2006-12-31 10:02:22 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_SELECT_H
|
|
|
|
#include <sys/select.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
Solaris sys/select.h switches select to select_large_fdset to support larger
|
|
|
|
file descriptors if FD_SETSIZE is larger than 1024 on 32bit environment.
|
|
|
|
But Ruby doesn't change FD_SETSIZE because fd_set is allocated dynamically.
|
|
|
|
So following definition is required to use select_large_fdset.
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_SELECT_LARGE_FDSET
|
2011-01-17 17:54:29 -05:00
|
|
|
#define select(n, r, w, e, t) select_large_fdset((n), (r), (w), (e), (t))
|
2011-06-15 20:12:55 -04:00
|
|
|
extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
2006-12-31 10:02:22 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
|
|
#include <sys/param.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
2013-11-21 01:33:41 -05:00
|
|
|
|
* cont.c: support Fiber. Check test/ruby/test_fiber.rb for detail.
Fiber is known as "Micro Thread", "Coroutine", and other terms.
At this time, only Fiber#pass is supported to change context.
I want to know more suitable method name/API for Fiber (... do you
know more suitable class name instead of Fiber?) as "suspend/resume",
"call", "yield", "start/kick/stop/restart", ....
* eval.c, eval_intern.h, thread.c, yarvcore.c, yarvcore.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-27 15:12:43 -04:00
|
|
|
#define SAVE_ROOT_JMPBUF(th, stmt) do \
|
2021-08-09 00:21:05 -04:00
|
|
|
if (true) { \
|
* cont.c: support Fiber. Check test/ruby/test_fiber.rb for detail.
Fiber is known as "Micro Thread", "Coroutine", and other terms.
At this time, only Fiber#pass is supported to change context.
I want to know more suitable method name/API for Fiber (... do you
know more suitable class name instead of Fiber?) as "suspend/resume",
"call", "yield", "start/kick/stop/restart", ....
* eval.c, eval_intern.h, thread.c, yarvcore.c, yarvcore.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-27 15:12:43 -04:00
|
|
|
stmt; \
|
|
|
|
} \
|
2021-08-09 00:21:05 -04:00
|
|
|
else if (th) { /* suppress unused-variable warning */ \
|
* cont.c: support Fiber. Check test/ruby/test_fiber.rb for detail.
Fiber is known as "Micro Thread", "Coroutine", and other terms.
At this time, only Fiber#pass is supported to change context.
I want to know more suitable method name/API for Fiber (... do you
know more suitable class name instead of Fiber?) as "suspend/resume",
"call", "yield", "start/kick/stop/restart", ....
* eval.c, eval_intern.h, thread.c, yarvcore.c, yarvcore.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-27 15:12:43 -04:00
|
|
|
} while (0)
|
|
|
|
|
2017-10-26 07:02:13 -04:00
|
|
|
#define EC_PUSH_TAG(ec) do { \
|
|
|
|
rb_execution_context_t * const _ec = (ec); \
|
* blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
* yarv_*_t -> rb_*_t
* yarv_*_struct -> rb_*_struct
* yarv_tag -> rb_vm_tag
* YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
from proc.c to ruby.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 14:00:03 -05:00
|
|
|
struct rb_vm_tag _tag; \
|
2017-06-23 05:43:52 -04:00
|
|
|
_tag.state = TAG_NONE; \
|
2016-09-26 02:43:51 -04:00
|
|
|
_tag.tag = Qundef; \
|
2020-10-13 13:03:21 -04:00
|
|
|
_tag.prev = _ec->tag; \
|
|
|
|
_tag.lock_rec = rb_ec_vm_lock_rec(_ec); \
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2017-10-26 07:02:13 -04:00
|
|
|
#define EC_POP_TAG() \
|
|
|
|
_ec->tag = _tag.prev; \
|
2006-12-31 10:02:22 -05:00
|
|
|
} while (0)
|
|
|
|
|
2017-10-26 07:02:13 -04:00
|
|
|
#define EC_TMPPOP_TAG() \
|
|
|
|
_ec->tag = _tag.prev
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2017-10-26 07:02:13 -04:00
|
|
|
#define EC_REPUSH_TAG() (void)(_ec->tag = &_tag)
|
2013-11-19 12:01:10 -05:00
|
|
|
|
2021-04-29 08:31:05 -04:00
|
|
|
#if defined __GNUC__ && __GNUC__ == 4 && (__GNUC_MINOR__ >= 6 && __GNUC_MINOR__ <= 8) || defined __clang__
|
2017-12-05 22:19:17 -05:00
|
|
|
/* This macro prevents GCC 4.6--4.8 from emitting maybe-uninitialized warnings.
|
|
|
|
* This macro also prevents Clang from dumping core in EC_EXEC_TAG().
|
2017-12-06 17:43:54 -05:00
|
|
|
* (I confirmed Clang 4.0.1 and 5.0.0.)
|
2017-12-05 22:19:17 -05:00
|
|
|
*/
|
2014-04-04 04:34:12 -04:00
|
|
|
# define VAR_FROM_MEMORY(var) __extension__(*(__typeof__(var) volatile *)&(var))
|
|
|
|
# define VAR_INITIALIZED(var) ((var) = VAR_FROM_MEMORY(var))
|
2016-06-17 21:50:49 -04:00
|
|
|
# define VAR_NOCLOBBERED(var) volatile var
|
2014-04-04 04:34:12 -04:00
|
|
|
#else
|
|
|
|
# define VAR_FROM_MEMORY(var) (var)
|
|
|
|
# define VAR_INITIALIZED(var) ((void)&(var))
|
2016-06-17 21:50:49 -04:00
|
|
|
# define VAR_NOCLOBBERED(var) var
|
2014-04-04 04:34:12 -04:00
|
|
|
#endif
|
|
|
|
|
2020-10-14 01:21:57 -04:00
|
|
|
static inline void
|
|
|
|
rb_ec_vm_lock_rec_check(const rb_execution_context_t *ec, unsigned int recorded_lock_rec)
|
|
|
|
{
|
|
|
|
unsigned int current_lock_rec = rb_ec_vm_lock_rec(ec);
|
|
|
|
if (current_lock_rec != recorded_lock_rec) {
|
|
|
|
rb_ec_vm_lock_rec_release(ec, recorded_lock_rec, current_lock_rec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-07 00:41:43 -05:00
|
|
|
/* clear ec->tag->state, and return the value */
|
2013-11-03 20:08:21 -05:00
|
|
|
static inline int
|
2017-11-07 00:41:15 -05:00
|
|
|
rb_ec_tag_state(const rb_execution_context_t *ec)
|
2013-11-03 20:08:21 -05:00
|
|
|
{
|
2020-10-14 01:21:57 -04:00
|
|
|
struct rb_vm_tag *tag = ec->tag;
|
|
|
|
enum ruby_tag_type state = tag->state;
|
|
|
|
tag->state = TAG_NONE;
|
|
|
|
rb_ec_vm_lock_rec_check(ec, tag->lock_rec);
|
2013-11-03 20:08:21 -05:00
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2017-10-28 07:41:08 -04:00
|
|
|
NORETURN(static inline void rb_ec_tag_jump(const rb_execution_context_t *ec, enum ruby_tag_type st));
|
2013-11-03 20:08:21 -05:00
|
|
|
static inline void
|
2017-10-28 07:41:08 -04:00
|
|
|
rb_ec_tag_jump(const rb_execution_context_t *ec, enum ruby_tag_type st)
|
2013-11-03 20:08:21 -05:00
|
|
|
{
|
2017-10-26 07:02:13 -04:00
|
|
|
ec->tag->state = st;
|
|
|
|
ruby_longjmp(ec->tag->buf, 1);
|
2013-11-03 20:08:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
setjmp() in assignment expression rhs is undefined behavior
|
|
|
|
[ISO/IEC 9899:1999] 7.13.1.1
|
|
|
|
*/
|
2017-10-26 07:02:13 -04:00
|
|
|
#define EC_EXEC_TAG() \
|
2017-11-07 00:41:15 -05:00
|
|
|
(ruby_setjmp(_tag.buf) ? rb_ec_tag_state(VAR_FROM_MEMORY(_ec)) : (EC_REPUSH_TAG(), 0))
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2017-10-26 07:02:13 -04:00
|
|
|
#define EC_JUMP_TAG(ec, st) rb_ec_tag_jump(ec, st)
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2011-05-18 09:36:46 -04:00
|
|
|
#define INTERNAL_EXCEPTION_P(exc) FIXNUM_P(exc)
|
|
|
|
|
2015-03-11 08:55:32 -04:00
|
|
|
/* CREF operators */
|
|
|
|
|
2015-11-13 15:02:19 -05:00
|
|
|
#define CREF_FL_PUSHED_BY_EVAL IMEMO_FL_USER1
|
|
|
|
#define CREF_FL_OMOD_SHARED IMEMO_FL_USER2
|
2021-12-02 18:53:39 -05:00
|
|
|
#define CREF_FL_SINGLETON IMEMO_FL_USER3
|
|
|
|
|
|
|
|
static inline int CREF_SINGLETON(const rb_cref_t *cref);
|
2015-03-11 08:55:32 -04:00
|
|
|
|
|
|
|
static inline VALUE
|
|
|
|
CREF_CLASS(const rb_cref_t *cref)
|
|
|
|
{
|
2021-12-02 18:53:39 -05:00
|
|
|
if (CREF_SINGLETON(cref)) {
|
|
|
|
return CLASS_OF(cref->klass_or_self);
|
|
|
|
} else {
|
|
|
|
return cref->klass_or_self;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline VALUE
|
|
|
|
CREF_CLASS_FOR_DEFINITION(const rb_cref_t *cref)
|
|
|
|
{
|
|
|
|
if (CREF_SINGLETON(cref)) {
|
|
|
|
return rb_singleton_class(cref->klass_or_self);
|
|
|
|
} else {
|
|
|
|
return cref->klass_or_self;
|
|
|
|
}
|
2015-03-11 08:55:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline rb_cref_t *
|
|
|
|
CREF_NEXT(const rb_cref_t *cref)
|
|
|
|
{
|
|
|
|
return cref->next;
|
|
|
|
}
|
|
|
|
|
2015-06-02 21:39:16 -04:00
|
|
|
static inline const rb_scope_visibility_t *
|
|
|
|
CREF_SCOPE_VISI(const rb_cref_t *cref)
|
2015-03-11 08:55:32 -04:00
|
|
|
{
|
2015-06-05 07:42:34 -04:00
|
|
|
return &cref->scope_visi;
|
2015-03-11 08:55:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline VALUE
|
|
|
|
CREF_REFINEMENTS(const rb_cref_t *cref)
|
|
|
|
{
|
|
|
|
return cref->refinements;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
CREF_REFINEMENTS_SET(rb_cref_t *cref, VALUE refs)
|
|
|
|
{
|
|
|
|
RB_OBJ_WRITE(cref, &cref->refinements, refs);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
CREF_PUSHED_BY_EVAL(const rb_cref_t *cref)
|
|
|
|
{
|
2015-11-13 15:02:19 -05:00
|
|
|
return cref->flags & CREF_FL_PUSHED_BY_EVAL;
|
2015-03-11 08:55:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
CREF_PUSHED_BY_EVAL_SET(rb_cref_t *cref)
|
|
|
|
{
|
2015-11-13 15:02:19 -05:00
|
|
|
cref->flags |= CREF_FL_PUSHED_BY_EVAL;
|
2015-03-11 08:55:32 -04:00
|
|
|
}
|
|
|
|
|
2021-12-02 18:53:39 -05:00
|
|
|
static inline int
|
|
|
|
CREF_SINGLETON(const rb_cref_t *cref)
|
|
|
|
{
|
|
|
|
return cref->flags & CREF_FL_SINGLETON;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
CREF_SINGLETON_SET(rb_cref_t *cref)
|
|
|
|
{
|
|
|
|
cref->flags |= CREF_FL_SINGLETON;
|
|
|
|
}
|
|
|
|
|
2015-03-11 08:55:32 -04:00
|
|
|
static inline int
|
|
|
|
CREF_OMOD_SHARED(const rb_cref_t *cref)
|
|
|
|
{
|
2015-11-13 15:02:19 -05:00
|
|
|
return cref->flags & CREF_FL_OMOD_SHARED;
|
2015-03-11 08:55:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
CREF_OMOD_SHARED_SET(rb_cref_t *cref)
|
|
|
|
{
|
2015-11-13 15:02:19 -05:00
|
|
|
cref->flags |= CREF_FL_OMOD_SHARED;
|
2015-03-11 08:55:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
CREF_OMOD_SHARED_UNSET(rb_cref_t *cref)
|
|
|
|
{
|
2015-11-13 15:02:19 -05:00
|
|
|
cref->flags &= ~CREF_FL_OMOD_SHARED;
|
2015-03-11 08:55:32 -04:00
|
|
|
}
|
|
|
|
|
2008-03-12 01:47:10 -04:00
|
|
|
enum {
|
|
|
|
RAISED_EXCEPTION = 1,
|
2008-04-30 03:12:37 -04:00
|
|
|
RAISED_STACKOVERFLOW = 2,
|
2008-07-01 04:27:58 -04:00
|
|
|
RAISED_NOMEMORY = 4
|
2008-03-12 01:47:10 -04:00
|
|
|
};
|
2017-11-07 00:22:09 -05:00
|
|
|
#define rb_ec_raised_set(ec, f) ((ec)->raised_flag |= (f))
|
|
|
|
#define rb_ec_raised_reset(ec, f) ((ec)->raised_flag &= ~(f))
|
|
|
|
#define rb_ec_raised_p(ec, f) (((ec)->raised_flag & (f)) != 0)
|
|
|
|
#define rb_ec_raised_clear(ec) ((ec)->raised_flag = 0)
|
2017-11-07 00:12:39 -05:00
|
|
|
int rb_ec_set_raised(rb_execution_context_t *ec);
|
2017-11-07 03:01:26 -05:00
|
|
|
int rb_ec_reset_raised(rb_execution_context_t *ec);
|
2017-10-29 09:49:45 -04:00
|
|
|
int rb_ec_stack_check(rb_execution_context_t *ec);
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2014-06-18 02:16:39 -04:00
|
|
|
VALUE rb_f_eval(int argc, const VALUE *argv, VALUE self);
|
|
|
|
VALUE rb_make_exception(int argc, const VALUE *argv);
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2011-07-26 12:05:35 -04:00
|
|
|
NORETURN(void rb_method_name_error(VALUE, VALUE));
|
|
|
|
|
2021-06-25 18:17:26 -04:00
|
|
|
void rb_fiber_start(rb_fiber_t*);
|
2007-06-05 13:55:07 -04:00
|
|
|
|
2016-01-02 23:59:54 -05:00
|
|
|
NORETURN(void rb_print_undef(VALUE, ID, rb_method_visibility_t));
|
2011-07-26 12:05:35 -04:00
|
|
|
NORETURN(void rb_print_undef_str(VALUE, VALUE));
|
2015-06-02 21:39:16 -04:00
|
|
|
NORETURN(void rb_print_inaccessible(VALUE, ID, rb_method_visibility_t));
|
* vm.c: add a prefix "rb_" to exposed functions
vm_get_ruby_level_next_cfp(), rb_vm_make_env_object(),
vm_stack_to_heap(), vm_make_proc(), vm_invoke_proc(),
vm_get_sourceline(), vm_cref(), vm_localjump_error(),
vm_make_jump_tag_but_local_jump(), vm_jump_tag_but_local_jump().
This changes may affect only core because most of renamed functions
require a pointer of not-exposed struct such as rb_thread_t or NODE.
In short, they are core functions.
* cont.c, eval.c, eval_intern.h, load.c, proc.c, thread.c,
vm_core.h, vm_dump.c, vm_eval.c, vm_exec.c, vm_insnhelper.c:
ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-18 21:38:11 -05:00
|
|
|
NORETURN(void rb_vm_localjump_error(const char *,VALUE, int));
|
2012-12-18 12:04:05 -05:00
|
|
|
NORETURN(void rb_vm_jump_tag_but_local_jump(int));
|
2006-12-31 10:02:22 -05:00
|
|
|
|
* vm.c: add a prefix "rb_" to exposed functions
vm_get_ruby_level_next_cfp(), rb_vm_make_env_object(),
vm_stack_to_heap(), vm_make_proc(), vm_invoke_proc(),
vm_get_sourceline(), vm_cref(), vm_localjump_error(),
vm_make_jump_tag_but_local_jump(), vm_jump_tag_but_local_jump().
This changes may affect only core because most of renamed functions
require a pointer of not-exposed struct such as rb_thread_t or NODE.
In short, they are core functions.
* cont.c, eval.c, eval_intern.h, load.c, proc.c, thread.c,
vm_core.h, vm_dump.c, vm_eval.c, vm_exec.c, vm_insnhelper.c:
ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-18 21:38:11 -05:00
|
|
|
VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val);
|
2015-03-08 17:22:43 -04:00
|
|
|
rb_cref_t *rb_vm_cref(void);
|
2015-11-19 19:17:25 -05:00
|
|
|
rb_cref_t *rb_vm_cref_replace_with_duplicated_cref(void);
|
2016-07-28 07:02:30 -04:00
|
|
|
VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, VALUE block_handler, VALUE filename);
|
2009-05-17 01:02:58 -04:00
|
|
|
void rb_vm_set_progname(VALUE filename);
|
* vm.c, insns.def, eval.c, vm_insnhelper.c: fix CREF handling.
VM value stack frame of block contains cref information.
(dfp[-1] points CREF)
* compile.c, eval_intern.h, eval_method.c, load.c, proc.c,
vm_dump.h, vm_core.h: ditto.
* include/ruby/ruby.h, gc.c: remove T_VALUES because of above
changes.
* bootstraptest/test_eval.rb, test_knownbug.rb: move solved test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-18 23:08:50 -04:00
|
|
|
VALUE rb_vm_cbase(void);
|
2006-12-31 10:02:22 -05:00
|
|
|
|
2017-04-16 21:23:50 -04:00
|
|
|
/* vm_backtrace.c */
|
2017-10-28 09:22:04 -04:00
|
|
|
VALUE rb_ec_backtrace_object(const rb_execution_context_t *ec);
|
|
|
|
VALUE rb_ec_backtrace_str_ary(const rb_execution_context_t *ec, long lev, long n);
|
2020-10-11 07:36:25 -04:00
|
|
|
VALUE rb_ec_backtrace_location_ary(const rb_execution_context_t *ec, long lev, long n, bool skip_internal);
|
2017-04-16 21:23:50 -04:00
|
|
|
|
2009-02-19 01:11:41 -05:00
|
|
|
#ifndef CharNext /* defined as CharNext[AW] on Windows. */
|
2013-04-24 08:52:26 -04:00
|
|
|
# ifdef HAVE_MBLEN
|
2021-03-18 05:48:56 -04:00
|
|
|
# define CharNext(p) rb_char_next(p)
|
2021-04-08 08:26:10 -04:00
|
|
|
static inline char *
|
2021-03-18 05:48:56 -04:00
|
|
|
rb_char_next(const char *p)
|
|
|
|
{
|
|
|
|
if (p) {
|
|
|
|
int len = mblen(p, RUBY_MBCHAR_MAXSIZE);
|
|
|
|
p += len > 0 ? len : 1;
|
|
|
|
}
|
2021-04-08 08:26:10 -04:00
|
|
|
return (char *)p;
|
2021-03-18 05:48:56 -04:00
|
|
|
}
|
2013-04-24 08:52:26 -04:00
|
|
|
# else
|
|
|
|
# define CharNext(p) ((p) + 1)
|
|
|
|
# endif
|
2009-02-19 01:11:41 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined DOSISH || defined __CYGWIN__
|
|
|
|
static inline void
|
|
|
|
translit_char(char *p, int from, int to)
|
|
|
|
{
|
|
|
|
while (*p) {
|
|
|
|
if ((unsigned char)*p == from)
|
|
|
|
*p = to;
|
|
|
|
p = CharNext(p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-01-18 03:56:11 -05:00
|
|
|
#endif /* RUBY_EVAL_INTERN_H */
|