1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* include/ruby/signal.h: removed.

* common.mk, class.c, eval.c, eval_intern.h, file.c, gc.c, hash.c,
  io.c, process.c, signal.c: vm_core.h: ditto.
  Some unused external global variables are also removed.
  (rb_prohibit_interrupt, rb_trap_immediate, rb_trap_pending,
  rb_thread_critical)
* ext/openssl/ossl_ssl.c, ext/openssl/ossl_x509store.c,
  ext/readline/readline.c, ext/socket/depend,
  ext/socket/socket.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2008-09-03 08:00:05 +00:00
parent 028c1b16c2
commit 204929af9d
18 changed files with 79 additions and 219 deletions

View file

@ -1,3 +1,17 @@
Wed Sep 3 16:54:46 2008 Koichi Sasada <ko1@atdot.net>
* include/ruby/signal.h: removed.
* common.mk, class.c, eval.c, eval_intern.h, file.c, gc.c, hash.c,
io.c, process.c, signal.c: vm_core.h: ditto.
Some unused external global variables are also removed.
(rb_prohibit_interrupt, rb_trap_immediate, rb_trap_pending,
rb_thread_critical)
* ext/openssl/ossl_ssl.c, ext/openssl/ossl_x509store.c,
ext/readline/readline.c, ext/socket/depend,
ext/socket/socket.c: ditto.
Wed Sep 3 00:23:25 2008 Yusuke Endoh <mame@tsg.ne.jp>
* vm_insnhelper.c (vm_method_missing): copy arguments to allocated

View file

@ -10,7 +10,6 @@
**********************************************************************/
#include "ruby/ruby.h"
#include "ruby/signal.h"
#include "ruby/node.h"
#include "ruby/st.h"
#include "vm_core.h"
@ -819,7 +818,6 @@ rb_singleton_class(VALUE obj)
rb_bug("unknown immediate %ld", obj);
}
DEFER_INTS;
if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON) &&
rb_iv_get(RBASIC(obj)->klass, "__attached__") == obj) {
klass = RBASIC(obj)->klass;
@ -840,7 +838,6 @@ rb_singleton_class(VALUE obj)
FL_UNSET(klass, FL_UNTRUSTED);
}
if (OBJ_FROZEN(obj)) OBJ_FREEZE(klass);
ALLOW_INTS;
return klass;
}

View file

@ -444,7 +444,7 @@ array.$(OBJEXT): {$(VPATH)}array.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}util.h
bignum.$(OBJEXT): {$(VPATH)}bignum.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h
class.$(OBJEXT): {$(VPATH)}class.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}signal.h {$(VPATH)}node.h {$(VPATH)}vm_core.h \
{$(VPATH)}node.h {$(VPATH)}vm_core.h \
{$(VPATH)}debug.h {$(VPATH)}vm_opts.h {$(VPATH)}id.h \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}mvm.h {$(VPATH)}parse.h \
{$(VPATH)}parse.y
@ -468,39 +468,39 @@ enum.$(OBJEXT): {$(VPATH)}enum.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
enumerator.$(OBJEXT): {$(VPATH)}enumerator.c $(RUBY_H_INCLUDES) \
{$(VPATH)}st.h {$(VPATH)}debug.h {$(VPATH)}node.h
error.$(OBJEXT): {$(VPATH)}error.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}vm_core.h {$(VPATH)}signal.h {$(VPATH)}node.h \
{$(VPATH)}vm_core.h {$(VPATH)}node.h \
{$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}mvm.h {$(VPATH)}parse.y
eval.$(OBJEXT): {$(VPATH)}eval.c {$(VPATH)}eval_intern.h \
$(RUBY_H_INCLUDES) {$(VPATH)}st.h {$(VPATH)}node.h {$(VPATH)}util.h \
{$(VPATH)}signal.h {$(VPATH)}vm_core.h {$(VPATH)}debug.h \
{$(VPATH)}vm_core.h {$(VPATH)}debug.h \
{$(VPATH)}vm_opts.h $(ID_H_INCLUDES) {$(VPATH)}thread_$(THREAD_MODEL).h \
{$(VPATH)}dln.h {$(VPATH)}eval_error.c {$(VPATH)}eval_safe.c \
{$(VPATH)}eval_jump.c {$(VPATH)}mvm.h {$(VPATH)}parse.y
load.$(OBJEXT): {$(VPATH)}load.c {$(VPATH)}eval_intern.h \
$(RUBY_H_INCLUDES) {$(VPATH)}st.h {$(VPATH)}node.h {$(VPATH)}util.h \
{$(VPATH)}signal.h {$(VPATH)}vm_core.h {$(VPATH)}debug.h \
{$(VPATH)}vm_core.h {$(VPATH)}debug.h \
{$(VPATH)}vm_opts.h $(ID_H_INCLUDES) {$(VPATH)}thread_$(THREAD_MODEL).h \
{$(VPATH)}dln.h {$(VPATH)}mvm.h {$(VPATH)}parse.y
file.$(OBJEXT): {$(VPATH)}file.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}io.h {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h \
{$(VPATH)}signal.h {$(VPATH)}util.h {$(VPATH)}dln.h
{$(VPATH)}util.h {$(VPATH)}dln.h
gc.$(OBJEXT): {$(VPATH)}gc.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}signal.h {$(VPATH)}node.h {$(VPATH)}re.h {$(VPATH)}regex.h \
{$(VPATH)}node.h {$(VPATH)}re.h {$(VPATH)}regex.h \
{$(VPATH)}oniguruma.h {$(VPATH)}io.h {$(VPATH)}encoding.h \
{$(VPATH)}vm_core.h {$(VPATH)}debug.h {$(VPATH)}vm_opts.h \
$(ID_H_INCLUDES) {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}gc.h \
{$(VPATH)}eval_intern.h {$(VPATH)}util.h {$(VPATH)}mvm.h \
{$(VPATH)}parse.y {$(VPATH)}dln.h
hash.$(OBJEXT): {$(VPATH)}hash.c $(RUBY_H_INCLUDES) $(ID_H_INCLUDES) \
{$(VPATH)}st.h {$(VPATH)}util.h {$(VPATH)}signal.h \
{$(VPATH)}st.h {$(VPATH)}util.h \
{$(VPATH)}eval_intern.h {$(VPATH)}node.h {$(VPATH)}vm_core.h \
{$(VPATH)}mvm.h {$(VPATH)}debug.h {$(VPATH)}vm_opts.h {$(VPATH)}parse.y \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}dln.h
inits.$(OBJEXT): {$(VPATH)}inits.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h
io.$(OBJEXT): {$(VPATH)}io.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}io.h {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h \
{$(VPATH)}signal.h {$(VPATH)}util.h {$(VPATH)}vm_core.h \
{$(VPATH)}util.h {$(VPATH)}vm_core.h \
{$(VPATH)}debug.h {$(VPATH)}vm_opts.h {$(VPATH)}id.h \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}mvm.h {$(VPATH)}node.h \
{$(VPATH)}parse.h {$(VPATH)}parse.y
@ -523,11 +523,11 @@ parse.$(OBJEXT): {$(VPATH)}parse.c {$(VPATH)}parse.y $(RUBY_H_INCLUDES) \
prec.$(OBJEXT): {$(VPATH)}prec.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h
proc.$(OBJEXT): {$(VPATH)}proc.c {$(VPATH)}eval_intern.h \
$(RUBY_H_INCLUDES) {$(VPATH)}st.h {$(VPATH)}node.h {$(VPATH)}util.h \
{$(VPATH)}signal.h {$(VPATH)}vm_core.h {$(VPATH)}debug.h \
{$(VPATH)}vm_core.h {$(VPATH)}debug.h \
{$(VPATH)}vm_opts.h $(ID_H_INCLUDES) {$(VPATH)}thread_$(THREAD_MODEL).h \
{$(VPATH)}dln.h {$(VPATH)}gc.h {$(VPATH)}mvm.h {$(VPATH)}parse.y
process.$(OBJEXT): {$(VPATH)}process.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}signal.h {$(VPATH)}vm_core.h {$(VPATH)}util.h {$(VPATH)}node.h \
{$(VPATH)}vm_core.h {$(VPATH)}util.h {$(VPATH)}node.h \
{$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}io.h {$(VPATH)}encoding.h \
{$(VPATH)}oniguruma.h {$(VPATH)}mvm.h {$(VPATH)}parse.y {$(VPATH)}dln.h
@ -566,12 +566,12 @@ regsyntax.$(OBJEXT): {$(VPATH)}regsyntax.c {$(VPATH)}regint.h \
{$(VPATH)}missing.h {$(VPATH)}intern.h
ruby.$(OBJEXT): {$(VPATH)}ruby.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}node.h {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h \
{$(VPATH)}eval_intern.h {$(VPATH)}util.h {$(VPATH)}signal.h \
{$(VPATH)}eval_intern.h {$(VPATH)}util.h \
{$(VPATH)}vm_core.h {$(VPATH)}debug.h {$(VPATH)}vm_opts.h \
$(ID_H_INCLUDES) {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}dln.h \
{$(VPATH)}mvm.h {$(VPATH)}parse.y
signal.$(OBJEXT): {$(VPATH)}signal.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}signal.h {$(VPATH)}node.h {$(VPATH)}vm_core.h \
{$(VPATH)}node.h {$(VPATH)}vm_core.h \
{$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}mvm.h {$(VPATH)}parse.y
sprintf.$(OBJEXT): {$(VPATH)}sprintf.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
@ -588,7 +588,7 @@ string.$(OBJEXT): {$(VPATH)}string.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
struct.$(OBJEXT): {$(VPATH)}struct.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h
thread.$(OBJEXT): {$(VPATH)}thread.c {$(VPATH)}eval_intern.h \
$(RUBY_H_INCLUDES) {$(VPATH)}st.h {$(VPATH)}node.h {$(VPATH)}util.h \
{$(VPATH)}signal.h {$(VPATH)}vm_core.h {$(VPATH)}debug.h \
{$(VPATH)}vm_core.h {$(VPATH)}debug.h \
{$(VPATH)}vm_opts.h $(ID_H_INCLUDES) {$(VPATH)}thread_$(THREAD_MODEL).h \
{$(VPATH)}dln.h {$(VPATH)}vm.h {$(VPATH)}gc.h \
{$(VPATH)}thread_$(THREAD_MODEL).c {$(VPATH)}mvm.h {$(VPATH)}parse.y
@ -596,7 +596,7 @@ transcode.$(OBJEXT): {$(VPATH)}transcode.c $(RUBY_H_INCLUDES) \
{$(VPATH)}st.h {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h \
{$(VPATH)}transcode_data.h
cont.$(OBJEXT): {$(VPATH)}cont.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}vm_core.h {$(VPATH)}signal.h {$(VPATH)}node.h \
{$(VPATH)}vm_core.h {$(VPATH)}node.h \
{$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}gc.h \
{$(VPATH)}eval_intern.h {$(VPATH)}util.h {$(VPATH)}dln.h {$(VPATH)}mvm.h \
@ -611,13 +611,13 @@ version.$(OBJEXT): {$(VPATH)}version.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}version.h $(srcdir)/revision.h
compile.$(OBJEXT): {$(VPATH)}compile.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}node.h {$(VPATH)}vm_core.h {$(VPATH)}signal.h \
{$(VPATH)}node.h {$(VPATH)}vm_core.h \
{$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}compile.h \
{$(VPATH)}insns.inc {$(VPATH)}insns_info.inc {$(VPATH)}optinsn.inc \
{$(VPATH)}mvm.h {$(VPATH)}parse.y
iseq.$(OBJEXT): {$(VPATH)}iseq.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}node.h {$(VPATH)}gc.h {$(VPATH)}vm_core.h {$(VPATH)}signal.h \
{$(VPATH)}node.h {$(VPATH)}gc.h {$(VPATH)}vm_core.h \
{$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}insns.inc \
{$(VPATH)}insns_info.inc {$(VPATH)}node_name.inc {$(VPATH)}mvm.h \
@ -625,7 +625,7 @@ iseq.$(OBJEXT): {$(VPATH)}iseq.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
vm.$(OBJEXT): {$(VPATH)}vm.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}node.h {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h \
{$(VPATH)}gc.h {$(VPATH)}insnhelper.h {$(VPATH)}eval_intern.h \
{$(VPATH)}util.h {$(VPATH)}signal.h {$(VPATH)}vm_core.h \
{$(VPATH)}util.h {$(VPATH)}vm_core.h \
{$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}dln.h {$(VPATH)}vm.h \
{$(VPATH)}vm_insnhelper.c {$(VPATH)}insns.inc {$(VPATH)}vm_evalbody.c \
@ -633,32 +633,32 @@ vm.$(OBJEXT): {$(VPATH)}vm.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}vm_method.c {$(VPATH)}vm_eval.c {$(VPATH)}mvm.h \
{$(VPATH)}parse.y
vm_dump.$(OBJEXT): {$(VPATH)}vm_dump.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}node.h {$(VPATH)}vm_core.h {$(VPATH)}signal.h \
{$(VPATH)}node.h {$(VPATH)}vm_core.h \
{$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}vm.h {$(VPATH)}mvm.h \
{$(VPATH)}parse.y
debug.$(OBJEXT): {$(VPATH)}debug.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}encoding.h {$(VPATH)}oniguruma.h {$(VPATH)}debug.h \
{$(VPATH)}node.h {$(VPATH)}vm_core.h {$(VPATH)}signal.h \
{$(VPATH)}node.h {$(VPATH)}vm_core.h \
{$(VPATH)}vm_opts.h $(ID_H_INCLUDES) {$(VPATH)}thread_$(THREAD_MODEL).h \
{$(VPATH)}util.h {$(VPATH)}eval_intern.h {$(VPATH)}mvm.h \
{$(VPATH)}parse.y {$(VPATH)}dln.h
blockinlining.$(OBJEXT): {$(VPATH)}blockinlining.c $(RUBY_H_INCLUDES) \
{$(VPATH)}st.h {$(VPATH)}node.h {$(VPATH)}vm_core.h {$(VPATH)}signal.h \
{$(VPATH)}st.h {$(VPATH)}node.h {$(VPATH)}vm_core.h \
{$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}mvm.h {$(VPATH)}parse.y
id.$(OBJEXT): {$(VPATH)}id.c $(RUBY_H_INCLUDES) \
{$(VPATH)}st.h $(ID_H_INCLUDES)
miniprelude.$(OBJEXT): {$(VPATH)}miniprelude.c $(RUBY_H_INCLUDES) \
{$(VPATH)}st.h {$(VPATH)}vm_core.h {$(VPATH)}signal.h {$(VPATH)}node.h \
{$(VPATH)}st.h {$(VPATH)}vm_core.h {$(VPATH)}node.h \
{$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}mvm.h {$(VPATH)}parse.y
prelude.$(OBJEXT): {$(VPATH)}prelude.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
{$(VPATH)}vm_core.h {$(VPATH)}signal.h {$(VPATH)}node.h \
{$(VPATH)}vm_core.h {$(VPATH)}node.h \
{$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}mvm.h {$(VPATH)}parse.y
golf_prelude.$(OBJEXT): {$(VPATH)}golf_prelude.c $(RUBY_H_INCLUDES) \
{$(VPATH)}st.h {$(VPATH)}vm_core.h {$(VPATH)}signal.h {$(VPATH)}node.h \
{$(VPATH)}st.h {$(VPATH)}vm_core.h {$(VPATH)}node.h \
{$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}mvm.h {$(VPATH)}parse.y
goruby.$(OBJEXT): {$(VPATH)}goruby.c {$(VPATH)}main.c $(RUBY_H_INCLUDES) \

26
eval.c
View file

@ -75,7 +75,6 @@ ruby_init(void)
#endif
ruby_prog_init();
ALLOW_INTS;
}
POP_TAG();
@ -731,31 +730,6 @@ rb_ensure(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*e_proc)(ANYARGS), VALUE
return result;
}
VALUE
rb_with_disable_interrupt(VALUE (*proc)(ANYARGS), VALUE data)
{
VALUE result = Qnil; /* OK */
int status;
DEFER_INTS;
{
int thr_critical = rb_thread_critical;
rb_thread_critical = Qtrue;
PUSH_TAG();
if ((status = EXEC_TAG()) == 0) {
result = (*proc) (data);
}
POP_TAG();
rb_thread_critical = thr_critical;
}
ENABLE_INTS;
if (status)
JUMP_TAG(status);
return result;
}
static ID
frame_func_id(rb_control_frame_t *cfp)
{

View file

@ -15,7 +15,6 @@
#include "ruby/ruby.h"
#include "ruby/node.h"
#include "ruby/util.h"
#include "ruby/signal.h"
#include "vm_core.h"
#ifdef HAVE_STDLIB_H
@ -231,5 +230,6 @@ VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, const rb_blo
void rb_thread_terminate_all(void);
VALUE rb_vm_top_self();
VALUE rb_vm_cbase(void);
void rb_trap_restore_mask(void);
#endif /* RUBY_EVAL_INTERN_H */

View file

@ -11,8 +11,6 @@
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
#include <rubysig.h>
#include <rubyio.h>
#if defined(HAVE_UNISTD_H)
# include <unistd.h> /* for read(), and write() */

View file

@ -9,7 +9,6 @@
* (See the file 'LICENCE'.)
*/
#include "ossl.h"
#include <rubysig.h>
#define WrapX509Store(klass, obj, st) do { \
if (!st) { \

View file

@ -35,7 +35,6 @@
#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/signal.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>

View file

@ -1,5 +1,5 @@
socket.o: socket.c $(hdrdir)/ruby/ruby.h $(arch_hdrdir)/ruby/config.h \
$(hdrdir)/ruby/defines.h $(hdrdir)/ruby/io.h $(hdrdir)/ruby/signal.h \
$(hdrdir)/ruby/defines.h $(hdrdir)/ruby/io.h \
sockport.h constants.h
getnameinfo.o: getnameinfo.c $(arch_hdrdir)/ruby/config.h addrinfo.h sockport.h
getaddrinfo.o: getaddrinfo.c $(arch_hdrdir)/ruby/config.h addrinfo.h sockport.h

View file

@ -11,7 +11,6 @@
#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/signal.h"
#include "ruby/util.h"
#include <stdio.h>
#include <sys/types.h>

1
file.c
View file

@ -21,7 +21,6 @@
#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/signal.h"
#include "ruby/util.h"
#include "dln.h"

32
gc.c
View file

@ -12,7 +12,6 @@
**********************************************************************/
#include "ruby/ruby.h"
#include "ruby/signal.h"
#include "ruby/st.h"
#include "ruby/node.h"
#include "ruby/re.h"
@ -553,10 +552,10 @@ vm_xmalloc(rb_objspace_t *objspace, size_t size)
(malloc_increase+size) > malloc_limit) {
garbage_collect(objspace);
}
RUBY_CRITICAL(mem = malloc(size));
mem = malloc(size);
if (!mem) {
if (garbage_collect(objspace)) {
RUBY_CRITICAL(mem = malloc(size));
mem = malloc(size);
}
if (!mem) {
rb_memerror();
@ -592,10 +591,10 @@ vm_xrealloc(rb_objspace_t *objspace, void *ptr, size_t size)
ptr = (size_t *)ptr - 1;
#endif
RUBY_CRITICAL(mem = realloc(ptr, size));
mem = realloc(ptr, size);
if (!mem) {
if (garbage_collect(objspace)) {
RUBY_CRITICAL(mem = realloc(ptr, size));
mem = realloc(ptr, size);
}
if (!mem) {
rb_memerror();
@ -623,7 +622,7 @@ vm_xfree(rb_objspace_t *objspace, void *ptr)
objspace->malloc_params.allocations--;
#endif
RUBY_CRITICAL(free(ptr));
free(ptr);
}
void *
@ -772,15 +771,15 @@ allocate_heaps(rb_objspace_t *objspace, size_t next_heaps_length)
size_t size;
size = next_heaps_length*sizeof(struct heaps_slot);
RUBY_CRITICAL(
if (heaps_used > 0) {
p = (struct heaps_slot *)realloc(heaps, size);
if (p) heaps = p;
}
else {
p = heaps = (struct heaps_slot *)malloc(size);
}
);
if (heaps_used > 0) {
p = (struct heaps_slot *)realloc(heaps, size);
if (p) heaps = p;
}
else {
p = heaps = (struct heaps_slot *)malloc(size);
}
if (p == 0) {
during_gc = 0;
rb_memerror();
@ -796,7 +795,8 @@ assign_heap_slot(rb_objspace_t *objspace)
int objs;
objs = HEAP_OBJ_LIMIT;
RUBY_CRITICAL(p = (RVALUE*)malloc(HEAP_SIZE));
p = (RVALUE*)malloc(HEAP_SIZE);
if (p == 0) {
during_gc = 0;
rb_memerror();

9
hash.c
View file

@ -15,7 +15,6 @@
#include "ruby/ruby.h"
#include "ruby/st.h"
#include "ruby/util.h"
#include "ruby/signal.h"
#ifdef __APPLE__
#include <crt_externs.h>
@ -37,12 +36,6 @@ VALUE rb_cHash;
static VALUE envtbl;
static ID id_hash, id_yield, id_default;
static VALUE
eql(VALUE *args)
{
return (VALUE)rb_eql(args[0], args[1]);
}
static int
rb_any_cmp(VALUE a, VALUE b)
{
@ -63,7 +56,7 @@ rb_any_cmp(VALUE a, VALUE b)
args[0] = a;
args[1] = b;
return !rb_with_disable_interrupt(eql, (VALUE)args);
return !rb_eql(a, b);
}
VALUE

View file

@ -1,92 +0,0 @@
/**********************************************************************
rubysig.h -
$Author$
created at: Wed Aug 16 01:15:38 JST 1995
Copyright (C) 1993-2007 Yukihiro Matsumoto
**********************************************************************/
#ifndef RUBYSIG_H
#define RUBYSIG_H 1
#if defined(__cplusplus)
extern "C" {
#if 0
} /* satisfy cc-mode */
#endif
#endif
#include <errno.h>
#ifdef _WIN32
typedef LONG rb_atomic_t;
# define ATOMIC_TEST(var) InterlockedExchange(&(var), 0)
# define ATOMIC_SET(var, val) InterlockedExchange(&(var), (val))
# define ATOMIC_INC(var) InterlockedIncrement(&(var))
# define ATOMIC_DEC(var) InterlockedDecrement(&(var))
/* Windows doesn't allow interrupt while system calls */
# define TRAP_BEG do {\
rb_atomic_t trap_immediate = ATOMIC_SET(rb_trap_immediate, 1)
# define TRAP_END\
ATOMIC_SET(rb_trap_immediate, trap_immediate);\
} while (0)
# define RUBY_CRITICAL(statements) do {\
rb_atomic_t trap_immediate = ATOMIC_SET(rb_trap_immediate, 0);\
statements;\
ATOMIC_SET(rb_trap_immediate, trap_immediate);\
} while (0)
#else
typedef int rb_atomic_t;
# define ATOMIC_TEST(var) ((var) ? ((var) = 0, 1) : 0)
# define ATOMIC_SET(var, val) ((var) = (val))
# define ATOMIC_INC(var) (++(var))
# define ATOMIC_DEC(var) (--(var))
# define TRAP_BEG do {\
int trap_immediate = rb_trap_immediate;\
rb_trap_immediate = 1
# define TRAP_END \
rb_trap_immediate = trap_immediate;\
} while (0)
# define RUBY_CRITICAL(statements) do {\
int trap_immediate = rb_trap_immediate;\
rb_trap_immediate = 0;\
statements;\
rb_trap_immediate = trap_immediate;\
} while (0)
#endif
RUBY_EXTERN rb_atomic_t rb_trap_immediate;
RUBY_EXTERN int rb_prohibit_interrupt;
#define DEFER_INTS (rb_prohibit_interrupt++)
#define ALLOW_INTS do {\
rb_prohibit_interrupt--;\
} while (0)
#define ENABLE_INTS (rb_prohibit_interrupt--)
VALUE rb_with_disable_interrupt(VALUE(*)(ANYARGS),VALUE);
RUBY_EXTERN rb_atomic_t rb_trap_pending;
void rb_trap_restore_mask(void);
RUBY_EXTERN int rb_thread_critical;
void rb_thread_schedule(void);
#if defined(__cplusplus)
#if 0
{ /* satisfy cc-mode */
#endif
} /* extern "C" { */
#endif
#endif /* RUBYSIG_H */

16
io.c
View file

@ -13,7 +13,6 @@
#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/signal.h"
#include "vm_core.h"
#include <ctype.h>
#include <errno.h>
@ -557,7 +556,6 @@ io_fflush(rb_io_t *fptr)
wbuf_len = fptr->wbuf_len;
l = wbuf_len;
if (PIPE_BUF < l &&
!rb_thread_critical &&
!rb_thread_alone() &&
wsplit_p(fptr)) {
l = PIPE_BUF;
@ -795,7 +793,6 @@ io_fwrite(VALUE str, rb_io_t *fptr)
retry:
l = n;
if (PIPE_BUF < l &&
!rb_thread_critical &&
!rb_thread_alone() &&
wsplit_p(fptr)) {
l = PIPE_BUF;
@ -2653,9 +2650,7 @@ rb_getc(FILE *f)
int c;
rb_read_check(f);
TRAP_BEG;
c = getc(f);
TRAP_END;
return c;
}
@ -3412,9 +3407,8 @@ rb_io_syswrite(VALUE io, VALUE str)
if (!rb_thread_fd_writable(fptr->fd)) {
rb_io_check_closed(fptr);
}
TRAP_BEG;
n = write(fptr->fd, RSTRING_PTR(str), RSTRING_LEN(str));
TRAP_END;
if (n == -1) rb_sys_fail_path(fptr->pathv);
@ -6329,20 +6323,16 @@ io_cntl(int fd, int cmd, long narg, int io_p)
int retval;
#ifdef HAVE_FCNTL
TRAP_BEG;
# if defined(__CYGWIN__)
retval = io_p?ioctl(fd, cmd, (void*)narg):fcntl(fd, cmd, narg);
# else
retval = io_p?ioctl(fd, cmd, narg):fcntl(fd, cmd, narg);
# endif
TRAP_END;
#else
if (!io_p) {
rb_notimplement();
}
TRAP_BEG;
retval = ioctl(fd, cmd, narg);
TRAP_END;
#endif
return retval;
}
@ -6529,7 +6519,7 @@ rb_f_syscall(int argc, VALUE *argv)
argv++;
i++;
}
TRAP_BEG;
switch (argc) {
case 1:
retval = syscall(arg[0]);
@ -6583,7 +6573,7 @@ rb_f_syscall(int argc, VALUE *argv)
break;
#endif /* atarist */
}
TRAP_END;
if (retval < 0) rb_sys_fail(0);
return INT2NUM(retval);
#else

View file

@ -12,7 +12,6 @@
**********************************************************************/
#include "ruby/ruby.h"
#include "ruby/signal.h"
#include "ruby/io.h"
#include "ruby/util.h"
#include "vm_core.h"
@ -610,7 +609,6 @@ rb_waitpid_blocking(void *data)
struct waitpid_arg *arg = data;
#endif
TRAP_BEG;
#if defined NO_WAITPID
result = wait(data);
#elif defined HAVE_WAITPID
@ -618,7 +616,7 @@ rb_waitpid_blocking(void *data)
#else /* HAVE_WAIT4 */
result = wait4(arg->pid, arg->st, arg->flags, NULL);
#endif
TRAP_END;
return (VALUE)result;
}

View file

@ -12,12 +12,28 @@
**********************************************************************/
#include "ruby/ruby.h"
#include "ruby/signal.h"
#include "ruby/node.h"
#include "vm_core.h"
#include <signal.h>
#include <stdio.h>
#ifdef _WIN32
typedef LONG rb_atomic_t;
# define ATOMIC_TEST(var) InterlockedExchange(&(var), 0)
# define ATOMIC_SET(var, val) InterlockedExchange(&(var), (val))
# define ATOMIC_INC(var) InterlockedIncrement(&(var))
# define ATOMIC_DEC(var) InterlockedDecrement(&(var))
#else
typedef int rb_atomic_t;
# define ATOMIC_TEST(var) ((var) ? ((var) = 0, 1) : 0)
# define ATOMIC_SET(var, val) ((var) = (val))
# define ATOMIC_INC(var) (++(var))
# define ATOMIC_DEC(var) (--(var))
#endif
#ifdef __BEOS__
#undef SIGBUS
#endif
@ -393,13 +409,6 @@ static struct {
VALUE cmd;
int safe;
} trap_list[NSIG];
static rb_atomic_t trap_pending_list[NSIG];
#if 0
static char rb_trap_accept_nativethreads[NSIG];
#endif
rb_atomic_t rb_trap_pending;
rb_atomic_t rb_trap_immediate;
int rb_prohibit_interrupt = 1;
VALUE
rb_get_trap_cmd(int sig)
@ -641,22 +650,6 @@ rb_signal_exec(rb_thread_t *th, int sig)
}
}
void
rb_trap_exec(void)
{
#ifndef MACOS_UNUSE_SIGNAL
int i;
for (i=0; i<NSIG; i++) {
if (trap_pending_list[i]) {
trap_pending_list[i] = 0;
rb_signal_exec(GET_THREAD(), i);
}
}
#endif /* MACOS_UNUSE_SIGNAL */
rb_trap_pending = 0;
}
struct trap_arg {
#if USE_TRAP_MASK
# ifdef HAVE_SIGPROCMASK

View file

@ -18,7 +18,6 @@
#include "ruby/ruby.h"
#include "ruby/mvm.h"
#include "ruby/signal.h"
#include "ruby/st.h"
#include "ruby/node.h"
@ -324,8 +323,8 @@ struct rb_vm_struct
struct st_table *loading_table;
/* signal */
rb_atomic_t signal_buff[RUBY_NSIG];
rb_atomic_t buffered_signal_size;
int signal_buff[RUBY_NSIG];
int buffered_signal_size;
/* hook */
rb_event_hook_t *event_hooks;