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

yarv-diff:383

From: ko1 atdot.net
Date: 4 Sep 2006 12:12:19 +0900
Subject: [yarv-diff:383] r550 - in branches/parallel: . template

Author: ko1
Date: 2006-09-04 12:12:18 +0900 (Mon, 04 Sep 2006)
New Revision: 550

Added:
   branches/parallel/template/run.gdb
Modified:
   branches/parallel/ChangeLog
   branches/parallel/common.mk
   branches/parallel/eval.c
   branches/parallel/eval_intern.h
   branches/parallel/st.c
   branches/parallel/thread.c
   branches/parallel/thread_pthread.h
   branches/parallel/yarvcore.c
   branches/parallel/yarvcore.h
Log:
	* common.mk : add "loop" rule and fix "run.gdb" rule

	* template/run.gdb : added

	* eval.c : call Cleanup_native_thread()

	* thread_pthread.h : add Cleanup_native_thread()

	* eval_intern.h : fix global lock check

	* st.c : destroy fglock before delete table

	* thread.c : destroy mutex lock before mutex deleted

	* yarvcore.c : destroy locks at free th, vm

	* yarvcore.h : remove unused native_global_lock_struct



Modified: branches/parallel/ChangeLog
===================================================================
--- branches/parallel/ChangeLog	2006-09-03 13:20:57 UTC (rev 549)
+++ branches/parallel/ChangeLog	2006-09-04 03:12:18 UTC (rev 550)
@@ -4,6 +4,27 @@
 #  from Mon, 03 May 2004 01:24:19 +0900
 #
 
+2006-09-04(Mon) 12:05:33 +0900  Koichi Sasada  <ko1 atdot.net>
+
+	* common.mk : add "loop" rule and fix "run.gdb" rule
+
+	* template/run.gdb : added
+
+	* eval.c : call Cleanup_native_thread()
+
+	* thread_pthread.h : add Cleanup_native_thread()
+
+	* eval_intern.h : fix global lock check
+
+	* st.c : destroy fglock before delete table
+
+	* thread.c : destroy mutex lock before mutex deleted
+
+	* yarvcore.c : destroy locks at free th, vm
+
+	* yarvcore.h : remove unused native_global_lock_struct
+
+
 2006-09-03(Sun) 21:53:37 +0900  Koichi Sasada  <ko1 atdot.net>
 
 	* class.c : add rb_define_method_ts API

Modified: branches/parallel/common.mk
===================================================================
--- branches/parallel/common.mk	2006-09-03 13:20:57 UTC (rev 549)
+++ branches/parallel/common.mk	2006-09-04 03:12:18 UTC (rev 550)
@@ -459,14 +459,15 @@
 # vm.o : CFLAGS += -fno-crossjumping
 
 run.gdb:
-	echo b debug_breakpoint > run.gdb
-	echo handle SIGINT nostop
-	echo handle SIGPIPE nostop
-	echo run               >> run.gdb
+	cp $(srcdir)/template/run.gdb run.gdb
 
 gdb: miniruby$(EXEEXT) run.gdb
 	gdb -x run.gdb --quiet --args $(MINIRUBY) -I$(srcdir)/lib $(srcdir)/test.rb
 
+CMD = make run
+loop:
+	sh $(srcdir)/loop.sh '$(CMD)'
+
 # Intel VTune
 
 vtune: miniruby$(EXEEXT)

Modified: branches/parallel/eval.c
===================================================================
--- branches/parallel/eval.c	2006-09-03 13:20:57 UTC (rev 549)
+++ branches/parallel/eval.c	2006-09-04 03:12:18 UTC (rev 550)
@@ -213,7 +213,8 @@
     ex = error_handle(ex);
     ruby_finalize_1();
     POP_THREAD_TAG();
-
+    Cleanup_native_thread();
+    
     if (vm->exit_code) {
 	return vm->exit_code;
     }

Modified: branches/parallel/eval_intern.h
===================================================================
--- branches/parallel/eval_intern.h	2006-09-03 13:20:57 UTC (rev 549)
+++ branches/parallel/eval_intern.h	2006-09-04 03:12:18 UTC (rev 550)
@@ -191,7 +191,7 @@
 #define TH_PUSH_TAG(th) do { \
     struct yarv_tag _tag; \
     yarv_thread_t * const __th = th; \
-    int __locked = GET_VM()->lock_owner_thread == __th;\
+    int __locked = __th->vm->lock_owner_thread == __th;\
     _tag.tag = 0; \
     _tag.prev = __th->tag; \
     __th->tag = &_tag;
@@ -201,6 +201,9 @@
     if (__locked) { \
 	rb_thread_global_lock_acquire(__th); \
     } \
+    else { \
+	rb_thread_global_lock_release(__th); \
+    } \
 } while (0)
 
 #define TH_POP_TAG2() \

Modified: branches/parallel/st.c
===================================================================
--- branches/parallel/st.c	2006-09-03 13:20:57 UTC (rev 549)
+++ branches/parallel/st.c	2006-09-04 03:12:18 UTC (rev 550)
@@ -244,6 +244,7 @@
 	}
     }
     free(table->bins);
+    native_fg_destroy(&table->lock);
     free(table);
 }
 

Added: branches/parallel/template/run.gdb
===================================================================
--- branches/parallel/template/run.gdb	2006-09-03 13:20:57 UTC (rev 549)
+++ branches/parallel/template/run.gdb	2006-09-04 03:12:18 UTC (rev 550)
@@ -0,0 +1,7 @@
+b debug_breakpoint
+#handle SIGINT nostop
+#handle SIGPIPE nostop
+run
+if !$_exitcode
+	quit
+end

Modified: branches/parallel/thread.c
===================================================================
--- branches/parallel/thread.c	2006-09-03 13:20:57 UTC (rev 549)
+++ branches/parallel/thread.c	2006-09-04 03:12:18 UTC (rev 550)
@@ -2014,6 +2014,7 @@
 	if (mutex->th) {
 	    native_mutex_unlock(&mutex->lock);
 	}
+	native_mutex_destroy(&mutex->lock);
     }
     ruby_xfree(ptr);
 }

Modified: branches/parallel/thread_pthread.h
===================================================================
--- branches/parallel/thread_pthread.h	2006-09-03 13:20:57 UTC (rev 549)
+++ branches/parallel/thread_pthread.h	2006-09-04 03:12:18 UTC (rev 550)
@@ -11,7 +11,10 @@
 #define native_mutex_lock   pthread_mutex_lock
 #define native_mutex_unlock pthread_mutex_unlock
 #define native_mutex_trylock pthread_mutex_trylock
+#define native_mutex_destroy pthread_mutex_destroy
 
+#define native_cond_destroy pthread_cond_destroy
+
 typedef struct native_thread_data_struct {
     void *signal_thread_list;
     pthread_cond_t sleep_cond;
@@ -24,12 +27,14 @@
 #define native_fg_unlock pthread_spin_unlock
 #define native_fg_trylock pthread_spin_trylock
 #define native_fg_init pthread_spin_init
+#define native_fg_destroy pthread_spin_destroy
 #else
 typedef pthread_mutex_t yarv_thread_fglock_t;
 #define native_fg_lock pthread_mutex_lock
 #define native_fg_unlock pthread_mutex_unlock
 #define native_fg_trylock pthread_mutex_trylock
 #define native_fg_init pthread_mutex_init
+#define native_fg_destroy pthread_mutex_destroy
 #endif
 
 void native_fglock_init(yarv_thread_fglock_t *fglock);
@@ -63,6 +68,7 @@
 {
     pthread_mutex_init(lock, 0);
 }
+
 void
 native_fglock_init(yarv_thread_fglock_t *lock)
 {
@@ -88,13 +94,19 @@
 }
 
 static void
-Init_native_thread()
+Init_native_thread(void)
 {
     GET_THREAD()->thread_id = pthread_self();
     native_fglock_init(&signal_thread_list_lock);
     posix_signal(SIGVTALRM, null_func);
 }
 
+void
+Cleanup_native_thread(void) 
+{
+    native_fglock_init(&signal_thread_list_lock);
+}
+
 NOINLINE(static int
 	 thread_start_func_2(yarv_thread_t *th, VALUE *stack_start));
 void static thread_cleanup_func(void *th_ptr);
@@ -388,7 +400,7 @@
 	      malloc(sizeof(struct yarv_signal_thread_list));
 
 	    if (list == 0) {
-		fprintf(stderr, "[FATAL] failed to allocate memory\n");
+		fprintf(stderr, "[FATAL] failed to allocate memory (yarv_add_repeat_interrupt_func)\n");
 		exit(1);
 	    }
 

Modified: branches/parallel/yarvcore.c
===================================================================
--- branches/parallel/yarvcore.c	2006-09-03 13:20:57 UTC (rev 549)
+++ branches/parallel/yarvcore.c	2006-09-04 03:12:18 UTC (rev 550)
@@ -225,13 +225,17 @@
 {
     FREE_REPORT_ENTER("vm");
     if (ptr) {
-	yarv_vm_t *vmobj = ptr;
+	yarv_vm_t *vm = ptr;
 
-	st_free_table(vmobj->living_threads);
+	st_free_table(vm->living_threads);
 	// TODO: MultiVM Instance
 	// VM object should not be cleaned by GC
 	// ruby_xfree(ptr);
 	// theYarvVM = 0;
+
+	native_mutex_destroy(&vm->global_interpreter_lock);
+	native_cond_destroy(&vm->gc_barrier_owner_cond);
+	native_cond_destroy(&vm->gc_barrier_waits_cond);
     }
     FREE_REPORT_LEAVE("vm");
 }
@@ -300,6 +304,8 @@
 	    st_free_table(th->local_storage);
 	}
 
+	native_mutex_destroy(&th->interrupt_lock);
+	
 #if USE_VALUE_CACHE
 	{
 	    VALUE *ptr = th->value_cache_ptr;

Modified: branches/parallel/yarvcore.h
===================================================================
--- branches/parallel/yarvcore.h	2006-09-03 13:20:57 UTC (rev 549)
+++ branches/parallel/yarvcore.h	2006-09-04 03:12:18 UTC (rev 550)
@@ -472,11 +472,6 @@
     struct re_registers regs;
 } yarv_thread_t;
 
-typedef struct native_global_lock_struct {
-    yarv_thread_lock_t lock;
-    yarv_thread_t *th;
-} native_global_lock_t;
-
 /** node -> yarv instruction sequence object */
 VALUE iseq_compile(VALUE self, NODE *node);
 


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

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