[前][次][番号順一覧][スレッド一覧]

ruby-changes:49641

From: mame <ko1@a...>
Date: Wed, 10 Jan 2018 14:57:20 +0900 (JST)
Subject: [ruby-changes:49641] mame:r61757 (trunk): iseq.c: Succinct bitvector now supports 32-bit machine

mame	2018-01-10 14:57:15 +0900 (Wed, 10 Jan 2018)

  New Revision: 61757

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61757

  Log:
    iseq.c: Succinct bitvector now supports 32-bit machine
    
    Second try of succinct bitvector.

  Modified files:
    trunk/iseq.c
    trunk/vm_core.h
Index: iseq.c
===================================================================
--- iseq.c	(revision 61756)
+++ iseq.c	(revision 61757)
@@ -2840,9 +2840,9 @@ struct succ_index_table { https://github.com/ruby/ruby/blob/trunk/iseq.c#L2840
 } succ_index_table;
 
 #define imm_block_rank_set(v, i, r) (v) |= (uint64_t)(r) << (7 * (i))
-#define imm_block_rank_get(v, i) ((int) (((v) & 0x7fL << (i) * 7) >> ((i) * 7)))
+#define imm_block_rank_get(v, i) (((int)((v) >> ((i) * 7))) & 0x7f)
 #define small_block_rank_set(v, i, r) (v) |= (uint64_t)(r) << (9 * ((i) - 1))
-#define small_block_rank_get(v, i) ((int) ((i) == 0 ? 0 : ((v) & 0x1ffL << ((i) - 1) * 9) >> (((i) - 1) * 9)))
+#define small_block_rank_get(v, i) ((i) == 0 ? 0 : (((int)((v) >> (((i) - 1) * 9))) & 0x1ff))
 
 static struct succ_index_table *
 succ_index_table_create(int max_pos, int *data, int size)
@@ -2868,7 +2868,7 @@ succ_index_table_create(int max_pos, int https://github.com/ruby/ruby/blob/trunk/iseq.c#L2868
 	    if (j) small_block_rank_set(sd_block->small_block_ranks, j, small_rank);
 	    for (i = 0; i < 64; i++) {
 		if (r < size && data[r] == k * 512 + j * 64 + i + IMMEDIATE_TABLE_SIZE) {
-		    bits |= 1L << i;
+		    bits |= ((uint64_t)1) << i;
 		    r++;
 		}
 	    }
@@ -2897,7 +2897,7 @@ succ_index_table_invert(int max_pos, str https://github.com/ruby/ruby/blob/trunk/iseq.c#L2897
     for (k = 0; k < succ_size; k++) {
 	for (j = 0; j < 8; j++) {
 	    for (i = 0; i < 64; i++) {
-		if (sd->succ_part[k].bits[j] & (1L << i)) {
+		if (sd->succ_part[k].bits[j] & (((uint64_t)1) << i)) {
 		    *p++ = k * 512 + j * 64 + i + IMMEDIATE_TABLE_SIZE;
 		}
 	    }
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 61756)
+++ vm_core.h	(revision 61757)
@@ -63,7 +63,7 @@ https://github.com/ruby/ruby/blob/trunk/vm_core.h#L63
  *   2: succinct bitvector
  */
 #ifndef VM_INSN_INFO_TABLE_IMPL
-# define VM_INSN_INFO_TABLE_IMPL 1
+# define VM_INSN_INFO_TABLE_IMPL 2
 #endif
 
 #include "ruby/ruby.h"

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]