[前][次][番号順一覧][スレッド一覧][生データ]

yarv-diff:333

From: ko1 atdot.net
Date: 18 May 2006 03:09:04 -0000
Subject: [yarv-diff:333] r500 - trunk

Author: ko1
Date: 2006-05-18 12:09:03 +0900 (Thu, 18 May 2006)
New Revision: 500

Modified:
   trunk/ChangeLog
   trunk/signal.c
   trunk/thread.c
   trunk/thread_pthread.h
   trunk/yarvcore.c
Log:
	* signal.c : not mask SIGSEGV

	* thread.c : fix debug output on Win32

	* thread.c, thread_pthread.h : add some debug prints

	* yarvcore.c : mark machine registers on thread_mark



Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-05-17 09:11:55 UTC (rev 499)
+++ trunk/ChangeLog	2006-05-18 03:09:03 UTC (rev 500)
@@ -4,11 +4,23 @@
 #  from Mon, 03 May 2004 01:24:19 +0900
 #
 
+2006-05-18(Thu) 12:05:35 +0900  Koichi Sasada  <ko1 atdot.net>
+
+	* signal.c : not mask SIGSEGV
+
+	* thread.c : fix debug output on Win32
+
+	* thread.c, thread_pthread.h : add some debug prints
+
+	* yarvcore.c : mark machine registers on thread_mark
+
+
 2006-05-17(Wed) 18:09:20 +900  Yukihiro Matsumoto  <matz ruby-lang.org>
 
 	* dir.c (sys_warning): should not call a vararg function
 	  rb_sys_warning() indirectly.  [ruby-core:07886]
 
+
 2006-05-17(Wed) 16:41:41 +900  Yukihiro Matsumoto  <matz ruby-lang.org>
 
 	* re.c (rb_reg_initialize): should not allow modifying literal

Modified: trunk/signal.c
===================================================================
--- trunk/signal.c	2006-05-17 09:11:55 UTC (rev 499)
+++ trunk/signal.c	2006-05-18 03:09:03 UTC (rev 500)
@@ -415,6 +415,7 @@
     sigset_t mask;
     sigfillset(&mask);
     sigdelset(&mask, SIGVTALRM);
+    sigdelset(&mask, SIGSEGV);
     pthread_sigmask(SIG_SETMASK, &mask, NULL);
     trap_last_mask = mask;
 #endif

Modified: trunk/thread.c
===================================================================
--- trunk/thread.c	2006-05-17 09:11:55 UTC (rev 499)
+++ trunk/thread.c	2006-05-18 03:09:03 UTC (rev 500)
@@ -99,9 +99,9 @@
 #include "thread_win32.h"
 
 #define DEBUG_OUT() \
-  WaitForSingleObject(debug_mutex, INFINITE); \
+  WaitForSingleObject(&debug_mutex, INFINITE); \
   printf("%8p - %s", GetCurrentThreadId(), buf); \
-  ReleaseMutex(debug_mutex);
+  ReleaseMutex(&debug_mutex);
 
 #elif defined(HAVE_PTHREAD_H)
 #include "thread_pthread.h"
@@ -249,8 +249,8 @@
 
     native_mutex_lock(&th->vm->global_interpreter_lock);
     {
+	thread_debug("thread start (get lock): %p\n", th);
 	yarv_set_current_running_thread(th);
-	thread_debug("get_lock, start: %p\n", th);
 
 	TH_PUSH_TAG(th);
 	if ((state = EXEC_TAG()) == 0) {
@@ -535,8 +535,8 @@
 	}
 	native_mutex_lock(&th->vm->global_interpreter_lock);
 	yarv_set_current_running_thread(th);
-	thread_debug("rb_thread_schedule/switch done (thid: %p)\n",
-		     th->thread_id);
+	thread_debug("rb_thread_schedule/switch done\n");
+
 	YARV_CHECK_INTS();
     }
 }
@@ -1457,6 +1457,7 @@
     while (result <= 0) {
 	GVL_UNLOCK_RANGE(result = select(fd + 1, &set, 0, 0, 0));
     }
+    thread_debug("rb_thread_wait_fd done\n", fd);
 }
 
 int
@@ -1472,6 +1473,7 @@
     while (result <= 0) {
 	GVL_UNLOCK_RANGE(result = select(fd + 1, 0, &set, 0, 0));
     }
+    thread_debug("rb_thread_fd_writable done\n");
     return Qtrue;
 }
 

Modified: trunk/thread_pthread.h
===================================================================
--- trunk/thread_pthread.h	2006-05-17 09:11:55 UTC (rev 499)
+++ trunk/thread_pthread.h	2006-05-18 03:09:03 UTC (rev 500)
@@ -264,24 +264,29 @@
     th->status = THREAD_STOPPED;
     pthread_cond_init(&th->native_thread_data.sleep_cond, 0);
 
+    thread_debug("native_sleep %d\n", tv ? tv->tv_sec : -1);
     GVL_UNLOCK_BEGIN();
     {
 	pthread_mutex_lock(&th->interrupt_lock);
 	
 	if (th->interrupt_flag) {
 	    /* interrupted.  return immediate */
+	    thread_debug("native_sleep: interrupted before sleep\n");
 	}
 	else {
 	    th->interrupt_function = interrupt_using_pthread_cond_signal;
 	    if (tv == 0) {
 		thread_debug("native_sleep: pthread_cond_wait start\n");
-		pthread_cond_wait(&th->native_thread_data.sleep_cond, &th->interrupt_lock);
+		pthread_cond_wait(&th->native_thread_data.sleep_cond,
+				  &th->interrupt_lock);
 		thread_debug("native_sleep: pthread_cond_wait end\n");
 	    }
 	    else {
 		int r;
-		thread_debug("native_sleep: pthread_cond_timedwait start (%d, %d)\n", ts.tv_sec, ts.tv_nsec);
-		r = pthread_cond_timedwait(&th->native_thread_data.sleep_cond, &th->interrupt_lock, &ts);
+		thread_debug("native_sleep: pthread_cond_timedwait start (%d, %d)\n",
+			     ts.tv_sec, ts.tv_nsec);
+		r = pthread_cond_timedwait(&th->native_thread_data.sleep_cond,
+					   &th->interrupt_lock, &ts);
 		thread_debug("native_sleep: pthread_cond_timedwait end (%d)\n", r);
 	    }
 	    th->interrupt_function = 0;
@@ -291,6 +296,7 @@
 	th->status = prev_status;
     }
     GVL_UNLOCK_END();
+    thread_debug("native_sleep done\n");
 }
 
 void
@@ -336,7 +342,7 @@
     if (!th->native_thread_data.signal_thread_list) {
 	FGLOCK(&signal_thread_list_lock, {
 	    struct yarv_signal_thread_list *list =
-	      xmalloc(sizeof(struct yarv_signal_thread_list));
+	      malloc(sizeof(struct yarv_signal_thread_list));
 	    list->th = th;
 
 	    list->prev = &signal_thread_list_anchor;
@@ -365,7 +371,7 @@
 	    }
 	    th->native_thread_data.signal_thread_list = 0;
 	    list->th = 0;
-	    xfree(list);
+	    free(list);
 	});
     }
     else {

Modified: trunk/yarvcore.c
===================================================================
--- trunk/yarvcore.c	2006-05-17 09:11:55 UTC (rev 499)
+++ trunk/yarvcore.c	2006-05-18 03:09:03 UTC (rev 500)
@@ -713,6 +713,9 @@
 	if (GET_THREAD() != th &&
 	    th->machine_stack_start && th->machine_stack_end) {
 	    yarv_machine_stack_mark(th);
+	    rb_gc_mark_locations((VALUE *)&th->machine_regs,
+				 (VALUE *)(&th->machine_regs) +
+				 sizeof(th->machine_regs) / sizeof(VALUE));
 	}
     }
 


-- 
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧][生データ]