summaryrefslogtreecommitdiff
path: root/vm_dump.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-09 09:25:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-09 09:25:32 +0000
commit5a647a3f5fd011f8558c7f9e90cd65e70e73eb40 (patch)
tree294dcb47e83e5480b1fa992aba8a4b4025c8a626 /vm_dump.c
parent250dd0702111d5c2086f007b1b31ecc1e36ade40 (diff)
* include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.
* *.c: no cache in init functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_dump.c')
-rw-r--r--vm_dump.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/vm_dump.c b/vm_dump.c
index c9e0657..80bb13e 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -425,18 +425,16 @@ debug_print_post(rb_thread_t *th, rb_control_frame_t *cfp
void
vm_analysis_insn(int insn)
{
- static ID usage_hash;
- static ID bigram_hash;
+ ID usage_hash;
+ ID bigram_hash;
static int prev_insn = -1;
VALUE uh;
VALUE ihash;
VALUE cv;
- if (usage_hash == 0) {
- usage_hash = rb_intern("USAGE_ANALYSIS_INSN");
- bigram_hash = rb_intern("USAGE_ANALYSIS_INSN_BIGRAM");
- }
+ CONST_ID(usage_hash, "USAGE_ANALYSIS_INSN");
+ CONST_ID(bigram_hash, "USAGE_ANALYSIS_INSN_BIGRAM");
uh = rb_const_get(rb_cVM, usage_hash);
if ((ihash = rb_hash_aref(uh, INT2FIX(insn))) == Qnil) {
ihash = rb_hash_new();
@@ -473,7 +471,7 @@ extern VALUE insn_operand_intern(int insn, int op_no, VALUE op,
void
vm_analysis_operand(int insn, int n, VALUE op)
{
- static ID usage_hash;
+ ID usage_hash;
VALUE uh;
VALUE ihash;
@@ -481,9 +479,7 @@ vm_analysis_operand(int insn, int n, VALUE op)
VALUE valstr;
VALUE cv;
- if (usage_hash == 0) {
- usage_hash = rb_intern("USAGE_ANALYSIS_INSN");
- }
+ CONST_ID(usage_hash, "USAGE_ANALYSIS_INSN");
uh = rb_const_get(rb_cVM, usage_hash);
if ((ihash = rb_hash_aref(uh, INT2FIX(insn))) == Qnil) {
@@ -507,11 +503,11 @@ vm_analysis_operand(int insn, int n, VALUE op)
void
vm_analysis_register(int reg, int isset)
{
- static ID usage_hash;
+ ID usage_hash;
VALUE uh;
VALUE rhash;
VALUE valstr;
- char *regstrs[] = {
+ static const char regstrs[][5] = {
"pc", /* 0 */
"sp", /* 1 */
"cfp", /* 2 */
@@ -520,7 +516,7 @@ vm_analysis_register(int reg, int isset)
"self", /* 5 */
"iseq", /* 6 */
};
- char *getsetstr[] = {
+ static const char getsetstr[][4] = {
"get",
"set",
};
@@ -528,12 +524,11 @@ vm_analysis_register(int reg, int isset)
VALUE cv;
- if (usage_hash == 0) {
+ CONST_ID(usage_hash, "USAGE_ANALYSIS_REGS");
+ if (syms[0] == 0) {
char buff[0x10];
int i;
- usage_hash = rb_intern("USAGE_ANALYSIS_REGS");
-
for (i = 0; i < sizeof(regstrs) / sizeof(regstrs[0]); i++) {
int j;
for (j = 0; j < 2; j++) {