Skip to content

Commit

Permalink
* call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
Browse files Browse the repository at this point in the history
  eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c,
  insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y,
  range.c, regenc.h, ruby.h, signal.c, thread.c, thread_win32.ci,
  vm.c, vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
  fixed indents and non-C90 comments.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Feb 2, 2007
1 parent d08112a commit 205f310
Show file tree
Hide file tree
Showing 29 changed files with 186 additions and 204 deletions.
11 changes: 10 additions & 1 deletion ChangeLog
@@ -1,7 +1,16 @@
Sat Feb 3 00:49:51 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> Sat Feb 3 01:25:31 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>


* proc.c (yarv_proc_alloc): needs return. * proc.c (yarv_proc_alloc): needs return.


* call_cfunc.ci, compile.c, compile.h, debug.h, eval.c,
eval_error.h, eval_jump.h, eval_load.c, eval_thread.c, gc.c,
insnhelper.h, insns.def, iseq.c, main.c, numeric.c, parse.y,
range.c, ruby.h, signal.c, thread.c, thread_win32.ci, vm.c,
vm.h, vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fixed indents and non-C90 comments.

* regenc.h: revert to before YARV.

Fri Feb 2 23:39:42 2007 Yukihiro Matsumoto <matz@ruby-lang.org> Fri Feb 2 23:39:42 2007 Yukihiro Matsumoto <matz@ruby-lang.org>


* common.mk (bin): add more dependency. a patch from Tadashi * common.mk (bin): add more dependency. a patch from Tadashi
Expand Down
2 changes: 1 addition & 1 deletion call_cfunc.ci
Expand Up @@ -9,7 +9,7 @@ call_cfunc(func, recv, len, argc, argv)
int len, argc; int len, argc;
const VALUE *argv; const VALUE *argv;
{ {
// printf("len: %d, argc: %d\n", len, argc); /* printf("len: %d, argc: %d\n", len, argc); */


if (len >= 0 && argc != len) { if (len >= 0 && argc != len) {
rb_raise(rb_eArgError, "wrong number of arguments(%d for %d)", rb_raise(rb_eArgError, "wrong number of arguments(%d for %d)",
Expand Down
28 changes: 14 additions & 14 deletions compile.c
Expand Up @@ -702,7 +702,7 @@ new_child_iseq(yarv_iseq_t *iseq, NODE *node,
static int static int
iseq_setup(yarv_iseq_t *iseq, LINK_ANCHOR *anchor) iseq_setup(yarv_iseq_t *iseq, LINK_ANCHOR *anchor)
{ {
// debugs("[compile step 2] (iseq_array_to_linkedlist)\n"); /* debugs("[compile step 2] (iseq_array_to_linkedlist)\n"); */


GC_CHECK(); GC_CHECK();
if (CPDEBUG > 5) if (CPDEBUG > 5)
Expand Down Expand Up @@ -1256,7 +1256,7 @@ set_sequence(yarv_iseq_t *iseq, LINK_ANCHOR *anchor)
} }
} }


// fprintf(stderr, "insn: %-16s, sp: %d\n", insn_name(iobj->insn_id), sp); /* fprintf(stderr, "insn: %-16s, sp: %d\n", insn_name(iobj->insn_id), sp); */


operands = iobj->operands; operands = iobj->operands;
insn = iobj->insn_id; insn = iobj->insn_id;
Expand All @@ -1274,7 +1274,7 @@ set_sequence(yarv_iseq_t *iseq, LINK_ANCHOR *anchor)


for (j = 0; types[j]; j++) { for (j = 0; types[j]; j++) {
char type = types[j]; char type = types[j];
// printf("--> [%c - (%d-%d)]\n", type, k, j); /* printf("--> [%c - (%d-%d)]\n", type, k, j); */
switch (type) { switch (type) {
case TS_OFFSET:{ case TS_OFFSET:{
/* label(destination position) */ /* label(destination position) */
Expand Down Expand Up @@ -1448,7 +1448,7 @@ set_exception_table(yarv_iseq_t *iseq)
entry->cont = 0; entry->cont = 0;
} }
} }
//
iseq->compile_data->catch_table_ary = 0; /* free */ iseq->compile_data->catch_table_ary = 0; /* free */
return COMPILE_OK; return COMPILE_OK;
} }
Expand Down Expand Up @@ -1600,8 +1600,8 @@ iseq_peephole_optimize(yarv_iseq_t *iseq, LINK_ELEMENT *list)
if (piobj->insn_id == BIN(send)) { if (piobj->insn_id == BIN(send)) {
/* TODO: tail call optimization */ /* TODO: tail call optimization */
if (piobj->operands[2] == 0) { if (piobj->operands[2] == 0) {
//piobj->operands[3] = INT2FIX(FIX2INT(piobj->operands[3]) | VM_CALL_TAILCALL_BIT); /* piobj->operands[3] = INT2FIX(FIX2INT(piobj->operands[3]) | VM_CALL_TAILCALL_BIT); */
//piobj->operands[3] = INT2FIX(FIX2INT(piobj->operands[3]) | VM_CALL_TAILRECURSION_BIT); /* piobj->operands[3] = INT2FIX(FIX2INT(piobj->operands[3]) | VM_CALL_TAILRECURSION_BIT); */
} }
} }
} }
Expand Down Expand Up @@ -1869,7 +1869,7 @@ set_sequence_stackcaching(yarv_iseq_t *iseq, LINK_ANCHOR *anchor)
/* initialize */ /* initialize */
state = SCS_XX; state = SCS_XX;
list = FIRST_ELEMENT(anchor); list = FIRST_ELEMENT(anchor);
// dump_disasm_list(list); /* dump_disasm_list(list); */


/* for each list element */ /* for each list element */
while (list) { while (list) {
Expand All @@ -1879,7 +1879,7 @@ set_sequence_stackcaching(yarv_iseq_t *iseq, LINK_ANCHOR *anchor)
INSN *iobj = (INSN *)list; INSN *iobj = (INSN *)list;
insn_id = iobj->insn_id; insn_id = iobj->insn_id;


// dump_disasm_list(list); /* dump_disasm_list(list); */


switch (insn_id) { switch (insn_id) {
case BIN(nop):{ case BIN(nop):{
Expand Down Expand Up @@ -2133,11 +2133,11 @@ make_masgn_lhs(yarv_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node)
default:{ default:{
DECL_ANCHOR(anchor); DECL_ANCHOR(anchor);
COMPILE_POPED(anchor, "masgn lhs", node); COMPILE_POPED(anchor, "masgn lhs", node);
// dump_disasm_list(FIRST_ELEMENT(anchor)); /* dump_disasm_list(FIRST_ELEMENT(anchor)); */
REMOVE_ELEM(FIRST_ELEMENT(anchor)); REMOVE_ELEM(FIRST_ELEMENT(anchor));
// dump_disasm_list(FIRST_ELEMENT(anchor)); /* dump_disasm_list(FIRST_ELEMENT(anchor)); */
ADD_SEQ(ret, anchor); ADD_SEQ(ret, anchor);
// ADD_ELEM(ret, LAST_ELEMENT(anchor)); /* ADD_ELEM(ret, LAST_ELEMENT(anchor)); */
} }
} }


Expand Down Expand Up @@ -2249,7 +2249,7 @@ compile_massign(yarv_iseq_t *iseq, LINK_ANCHOR *ret,
COMPILE(ret, "rhs to ary (splat/default)", rhsn); COMPILE(ret, "rhs to ary (splat/default)", rhsn);
ADD_INSN2(ret, nd_line(rhsn), expandarray, INT2FIX(llen), ADD_INSN2(ret, nd_line(rhsn), expandarray, INT2FIX(llen),
INT2FIX(lhs_splat)); INT2FIX(lhs_splat));
// rb_bug("unknown rhs: %s", node_name(nd_type(rhsn))); /* rb_bug("unknown rhs: %s", node_name(nd_type(rhsn))); */
} }
} }
else { else {
Expand Down Expand Up @@ -2464,7 +2464,7 @@ defined_expr(yarv_iseq_t *iseq, LINK_ANCHOR *ret,


ADD_CATCH_ENTRY(CATCH_TYPE_ENSURE, lstart, lend, ensure, lfinish); ADD_CATCH_ENTRY(CATCH_TYPE_ENSURE, lstart, lend, ensure, lfinish);
return 1; return 1;
// rb_bug("unimplemented defined: %s", node_name(nd_type(node))); /* rb_bug("unimplemented defined: %s", node_name(nd_type(node))); */
} /* end of default */ } /* end of default */
} }


Expand Down Expand Up @@ -4791,7 +4791,7 @@ iseq_build_body(yarv_iseq_t *iseq, LINK_ANCHOR *anchor,
VALUE insn_id; VALUE insn_id;


if (st_lookup(insn_table, rb_ary_entry(obj, 0), &insn_id) == 0) { if (st_lookup(insn_table, rb_ary_entry(obj, 0), &insn_id) == 0) {
// TODO: exception /* TODO: exception */
rb_bug("unknown instruction: "); rb_bug("unknown instruction: ");
} }


Expand Down
2 changes: 1 addition & 1 deletion compile.h
Expand Up @@ -213,4 +213,4 @@ r_value(VALUE value)
LINK_ANCHOR name##_body__ = {{0,}, &name##_body__.anchor}; \ LINK_ANCHOR name##_body__ = {{0,}, &name##_body__.anchor}; \
LINK_ANCHOR *name = & name##_body__ LINK_ANCHOR *name = & name##_body__


#endif // _COMPILER_H_INCLUDED_ #endif /* _COMPILER_H_INCLUDED_ */
2 changes: 1 addition & 1 deletion debug.h
Expand Up @@ -44,4 +44,4 @@ void gc_check_func();


#endif #endif


#endif // _DEBUG_H_INCLUDED_ #endif /* _DEBUG_H_INCLUDED_ */
32 changes: 19 additions & 13 deletions eval.c
Expand Up @@ -514,7 +514,7 @@ rb_remove_event_hook(rb_event_hook_func_t func)
static void static void
rb_clear_trace_func(void) rb_clear_trace_func(void)
{ {
// TODO: fix me /* TODO: fix me */
} }


/* /*
Expand Down Expand Up @@ -575,8 +575,8 @@ set_trace_func(VALUE obj, VALUE trace)
rb_raise(rb_eTypeError, "trace_func needs to be Proc"); rb_raise(rb_eTypeError, "trace_func needs to be Proc");
} }


// register trace func /* register trace func */
// trace_func = trace; /* trace_func = trace; */


for (hook = event_hooks; hook; hook = hook->next) { for (hook = event_hooks; hook; hook = hook->next) {
if (hook->func == call_trace_func) if (hook->func == call_trace_func)
Expand Down Expand Up @@ -614,7 +614,7 @@ get_event_name(rb_event_t event)
static void static void
call_trace_func(rb_event_t event, NODE *node, VALUE self, ID id, VALUE klass) call_trace_func(rb_event_t event, NODE *node, VALUE self, ID id, VALUE klass)
{ {
// TODO: fix me /* TODO: fix me */
#if 0 #if 0
int state, raised; int state, raised;
NODE *node_save; NODE *node_save;
Expand Down Expand Up @@ -905,9 +905,11 @@ rb_longjmp(tag, mesg)
VALUE at; VALUE at;
yarv_thread_t *th = GET_THREAD(); yarv_thread_t *th = GET_THREAD();


/*
//while (th->cfp->pc == 0 || th->cfp->iseq == 0) { //while (th->cfp->pc == 0 || th->cfp->iseq == 0) {
//th->cfp++; //th->cfp++;
//} //}
*/


if (thread_set_raised(th)) { if (thread_set_raised(th)) {
th->errinfo = exception_error; th->errinfo = exception_error;
Expand Down Expand Up @@ -955,7 +957,7 @@ rb_longjmp(tag, mesg)


rb_trap_restore_mask(); rb_trap_restore_mask();
if (tag != TAG_FATAL) { if (tag != TAG_FATAL) {
// EXEC_EVENT_HOOK(RUBY_EVENT_RAISE ...) /* EXEC_EVENT_HOOK(RUBY_EVENT_RAISE ...) */
} }
thread_reset_raised(th); thread_reset_raised(th);
JUMP_TAG(tag); JUMP_TAG(tag);
Expand Down Expand Up @@ -1072,7 +1074,7 @@ void
rb_raise_jump(mesg) rb_raise_jump(mesg)
VALUE mesg; VALUE mesg;
{ {
// TODO: fix me /* TODO: fix me */
rb_longjmp(TAG_RAISE, mesg); rb_longjmp(TAG_RAISE, mesg);
} }


Expand Down Expand Up @@ -1271,7 +1273,7 @@ rb_iterate(VALUE (*it_proc) (VALUE), VALUE data1,
th->cfp = cfp; th->cfp = cfp;
} }
else{ else{
// SDR(); printf("%p, %p\n", cdfp, escape_dfp); /* SDR(); printf("%p, %p\n", cdfp, escape_dfp); */
} }
} }
else if (state == TAG_RETRY) { else if (state == TAG_RETRY) {
Expand Down Expand Up @@ -1432,8 +1434,8 @@ rb_ensure(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*e_proc)(ANYARGS), VALUE
result = (*b_proc) (data1); result = (*b_proc) (data1);
} }
POP_TAG(); POP_TAG();
// TODO: fix me /* TODO: fix me */
// retval = prot_tag ? prot_tag->retval : Qnil; /* save retval */ /* retval = prot_tag ? prot_tag->retval : Qnil; */ /* save retval */
(*e_proc) (data2); (*e_proc) (data2);
if (state) if (state)
JUMP_TAG(state); JUMP_TAG(state);
Expand Down Expand Up @@ -1646,18 +1648,22 @@ rb_call(VALUE klass, VALUE recv, ID mid, int argc, const VALUE *argv, int scope)


{ {
VALUE val; VALUE val;
/*
//static int level; //static int level;
//int i; //int i;
//for(i=0; i<level; i++){printf(" ");} //for(i=0; i<level; i++){printf(" ");}
//printf("invoke %s (%s)\n", rb_id2name(mid), node_name(nd_type(body))); //printf("invoke %s (%s)\n", rb_id2name(mid), node_name(nd_type(body)));
//level++; //level++;
//printf("%s with %d args\n", rb_id2name(mid), argc); //printf("%s with %d args\n", rb_id2name(mid), argc);
*/
val = val =
th_call0(GET_THREAD(), klass, recv, mid, id, argc, argv, body, th_call0(GET_THREAD(), klass, recv, mid, id, argc, argv, body,
noex & NOEX_NOSUPER); noex & NOEX_NOSUPER);
/*
//level--; //level--;
//for(i=0; i<level; i++){printf(" ");} //for(i=0; i<level; i++){printf(" ");}
//printf("done %s (%s)\n", rb_id2name(mid), node_name(nd_type(body))); //printf("done %s (%s)\n", rb_id2name(mid), node_name(nd_type(body)));
*/
return val; return val;
} }
} }
Expand Down Expand Up @@ -1958,7 +1964,7 @@ eval(VALUE self, VALUE src, VALUE scope, char *file, int line)
th->parse_in_eval--; th->parse_in_eval--;
th_set_eval_stack(th, iseqval); th_set_eval_stack(th, iseqval);
th->base_block = 0; th->base_block = 0;
if (0) { // for debug if (0) { /* for debug */
printf("%s\n", RSTRING_PTR(iseq_disasm(iseqval))); printf("%s\n", RSTRING_PTR(iseq_disasm(iseqval)));
} }


Expand Down Expand Up @@ -2075,7 +2081,7 @@ exec_under(VALUE (*func) (VALUE), VALUE under, VALUE self, VALUE args)
pcfp->self = self; pcfp->self = self;
if ((blockptr = GC_GUARDED_PTR_REF(*th->cfp->lfp)) != 0) { if ((blockptr = GC_GUARDED_PTR_REF(*th->cfp->lfp)) != 0) {
/* copy block info */ /* copy block info */
// TODO: why? /* TODO: why? */
block = *blockptr; block = *blockptr;
block.self = self; block.self = self;
*th->cfp->lfp = GC_GUARDED_PTR(&block); *th->cfp->lfp = GC_GUARDED_PTR(&block);
Expand Down Expand Up @@ -2956,9 +2962,9 @@ rb_dvar_defined(ID id)
iseq->type == ISEQ_TYPE_ENSURE || iseq->type == ISEQ_TYPE_ENSURE ||
iseq->type == ISEQ_TYPE_EVAL) { iseq->type == ISEQ_TYPE_EVAL) {
int i; int i;
// printf("local size: %d\n", iseq->local_size); /* printf("local size: %d\n", iseq->local_size); */
for (i = 0; i < iseq->local_size; i++) { for (i = 0; i < iseq->local_size; i++) {
// printf("id (%4d): %s\n", i, rb_id2name(iseq->local_tbl[i])); /* printf("id (%4d): %s\n", i, rb_id2name(iseq->local_tbl[i])); */
if (iseq->local_tbl[i] == id) { if (iseq->local_tbl[i] == id) {
return Qtrue; return Qtrue;
} }
Expand Down
22 changes: 11 additions & 11 deletions eval_error.h
Expand Up @@ -203,45 +203,45 @@ error_handle(int ex)
if (thread_set_raised(th)) if (thread_set_raised(th))
return EXIT_FAILURE; return EXIT_FAILURE;
switch (ex & TAG_MASK) { switch (ex & TAG_MASK) {
case 0: case 0:
status = EXIT_SUCCESS; status = EXIT_SUCCESS;
break; break;


case TAG_RETURN: case TAG_RETURN:
error_pos(); error_pos();
warn_print(": unexpected return\n"); warn_print(": unexpected return\n");
break; break;
case TAG_NEXT: case TAG_NEXT:
error_pos(); error_pos();
warn_print(": unexpected next\n"); warn_print(": unexpected next\n");
break; break;
case TAG_BREAK: case TAG_BREAK:
error_pos(); error_pos();
warn_print(": unexpected break\n"); warn_print(": unexpected break\n");
break; break;
case TAG_REDO: case TAG_REDO:
error_pos(); error_pos();
warn_print(": unexpected redo\n"); warn_print(": unexpected redo\n");
break; break;
case TAG_RETRY: case TAG_RETRY:
error_pos(); error_pos();
warn_print(": retry outside of rescue clause\n"); warn_print(": retry outside of rescue clause\n");
break; break;
case TAG_THROW: case TAG_THROW:
// TODO: fix me /* TODO: fix me */
error_pos(); error_pos();
warn_printf(": unexpected throw\n"); warn_printf(": unexpected throw\n");
break; break;
case TAG_RAISE: case TAG_RAISE:
case TAG_FATAL: case TAG_FATAL:
if (rb_obj_is_kind_of(GET_THREAD()->errinfo, rb_eSystemExit)) { if (rb_obj_is_kind_of(GET_THREAD()->errinfo, rb_eSystemExit)) {
status = sysexit_status(GET_THREAD()->errinfo); status = sysexit_status(GET_THREAD()->errinfo);
} }
else { else {
error_print(); error_print();
} }
break; break;
default: default:
rb_bug("Unknown longjmp status %d", ex); rb_bug("Unknown longjmp status %d", ex);
break; break;
} }
Expand Down
2 changes: 1 addition & 1 deletion eval_jump.h
Expand Up @@ -266,7 +266,7 @@ static void call_end_proc _((VALUE data));
static void static void
call_end_proc(VALUE data) call_end_proc(VALUE data)
{ {
// TODO: fix me /* TODO: fix me */
proc_invoke(data, rb_ary_new2(0), Qundef, 0); proc_invoke(data, rb_ary_new2(0), Qundef, 0);
} }


Expand Down
4 changes: 2 additions & 2 deletions eval_load.c
Expand Up @@ -211,7 +211,7 @@ load_wait(char *ftptr)
return Qfalse; return Qfalse;
} }


// TODO: write wait routine /* TODO: write wait routine */
return Qtrue; return Qtrue;
} }


Expand Down Expand Up @@ -376,7 +376,7 @@ rb_require_safe(VALUE fname, int safe)
ruby_current_node = 0; ruby_current_node = 0;
ruby_sourcefile = rb_source_filename(RSTRING_PTR(path)); ruby_sourcefile = rb_source_filename(RSTRING_PTR(path));
ruby_sourceline = 0; ruby_sourceline = 0;
//SCOPE_SET(NOEX_PUBLIC); /* SCOPE_SET(NOEX_PUBLIC); */
handle = (long)dln_load(RSTRING_PTR(path)); handle = (long)dln_load(RSTRING_PTR(path));
rb_ary_push(ruby_dln_librefs, LONG2NUM(handle)); rb_ary_push(ruby_dln_librefs, LONG2NUM(handle));
break; break;
Expand Down
2 changes: 1 addition & 1 deletion eval_thread.c
Expand Up @@ -359,7 +359,7 @@ void
rb_thread_fd_close(fd) rb_thread_fd_close(fd)
int fd; int fd;
{ {
// TODO: fix me /* TODO: fix me */
} }


VALUE VALUE
Expand Down
4 changes: 2 additions & 2 deletions gc.c
Expand Up @@ -487,7 +487,7 @@ rb_fill_value_cache(yarv_thread_t *th)
int i; int i;
VALUE rv; VALUE rv;


// LOCK /* LOCK */
for (i=0; i<YARV_VALUE_CACHE_SIZE; i++) { for (i=0; i<YARV_VALUE_CACHE_SIZE; i++) {
VALUE v = rb_newobj_from_heap(); VALUE v = rb_newobj_from_heap();


Expand All @@ -496,7 +496,7 @@ rb_fill_value_cache(yarv_thread_t *th)
} }
th->value_cache_ptr = &th->value_cache[0]; th->value_cache_ptr = &th->value_cache[0];
rv = rb_newobj_from_heap(); rv = rb_newobj_from_heap();
// UNLOCK /* UNLOCK */
return rv; return rv;
} }
#endif #endif
Expand Down
2 changes: 1 addition & 1 deletion insnhelper.h
Expand Up @@ -143,4 +143,4 @@
#define BASIC_OP_UNREDEFINED_P(op) ((yarv_redefined_flag & (op)) == 0) #define BASIC_OP_UNREDEFINED_P(op) ((yarv_redefined_flag & (op)) == 0)
#define HEAP_CLASS_OF(obj) RBASIC(obj)->klass #define HEAP_CLASS_OF(obj) RBASIC(obj)->klass


#endif // _INSNHELPER_H_INCLUDED_ #endif /* _INSNHELPER_H_INCLUDED_ */

0 comments on commit 205f310

Please sign in to comment.