1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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, 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
This commit is contained in:
nobu 2007-02-02 16:26:04 +00:00
parent d08112a656
commit 205f310c29
29 changed files with 186 additions and 204 deletions

View file

@ -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.
* 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>
* common.mk (bin): add more dependency. a patch from Tadashi

View file

@ -9,7 +9,7 @@ call_cfunc(func, recv, len, argc, argv)
int len, argc;
const VALUE *argv;
{
// printf("len: %d, argc: %d\n", len, argc);
/* printf("len: %d, argc: %d\n", len, argc); */
if (len >= 0 && argc != len) {
rb_raise(rb_eArgError, "wrong number of arguments(%d for %d)",

View file

@ -702,7 +702,7 @@ new_child_iseq(yarv_iseq_t *iseq, NODE *node,
static int
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();
if (CPDEBUG > 5)
@ -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;
insn = iobj->insn_id;
@ -1274,7 +1274,7 @@ set_sequence(yarv_iseq_t *iseq, LINK_ANCHOR *anchor)
for (j = 0; types[j]; j++) {
char type = types[j];
// printf("--> [%c - (%d-%d)]\n", type, k, j);
/* printf("--> [%c - (%d-%d)]\n", type, k, j); */
switch (type) {
case TS_OFFSET:{
/* label(destination position) */
@ -1448,7 +1448,7 @@ set_exception_table(yarv_iseq_t *iseq)
entry->cont = 0;
}
}
//
iseq->compile_data->catch_table_ary = 0; /* free */
return COMPILE_OK;
}
@ -1600,8 +1600,8 @@ iseq_peephole_optimize(yarv_iseq_t *iseq, LINK_ELEMENT *list)
if (piobj->insn_id == BIN(send)) {
/* TODO: tail call optimization */
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_TAILRECURSION_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); */
}
}
}
@ -1869,7 +1869,7 @@ set_sequence_stackcaching(yarv_iseq_t *iseq, LINK_ANCHOR *anchor)
/* initialize */
state = SCS_XX;
list = FIRST_ELEMENT(anchor);
// dump_disasm_list(list);
/* dump_disasm_list(list); */
/* for each list element */
while (list) {
@ -1879,7 +1879,7 @@ set_sequence_stackcaching(yarv_iseq_t *iseq, LINK_ANCHOR *anchor)
INSN *iobj = (INSN *)list;
insn_id = iobj->insn_id;
// dump_disasm_list(list);
/* dump_disasm_list(list); */
switch (insn_id) {
case BIN(nop):{
@ -2133,11 +2133,11 @@ make_masgn_lhs(yarv_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node)
default:{
DECL_ANCHOR(anchor);
COMPILE_POPED(anchor, "masgn lhs", node);
// dump_disasm_list(FIRST_ELEMENT(anchor));
/* dump_disasm_list(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_ELEM(ret, LAST_ELEMENT(anchor));
/* ADD_ELEM(ret, LAST_ELEMENT(anchor)); */
}
}
@ -2249,7 +2249,7 @@ compile_massign(yarv_iseq_t *iseq, LINK_ANCHOR *ret,
COMPILE(ret, "rhs to ary (splat/default)", rhsn);
ADD_INSN2(ret, nd_line(rhsn), expandarray, INT2FIX(llen),
INT2FIX(lhs_splat));
// rb_bug("unknown rhs: %s", node_name(nd_type(rhsn)));
/* rb_bug("unknown rhs: %s", node_name(nd_type(rhsn))); */
}
}
else {
@ -2464,7 +2464,7 @@ defined_expr(yarv_iseq_t *iseq, LINK_ANCHOR *ret,
ADD_CATCH_ENTRY(CATCH_TYPE_ENSURE, lstart, lend, ensure, lfinish);
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 */
}
@ -4791,7 +4791,7 @@ iseq_build_body(yarv_iseq_t *iseq, LINK_ANCHOR *anchor,
VALUE insn_id;
if (st_lookup(insn_table, rb_ary_entry(obj, 0), &insn_id) == 0) {
// TODO: exception
/* TODO: exception */
rb_bug("unknown instruction: ");
}

View file

@ -213,4 +213,4 @@ r_value(VALUE value)
LINK_ANCHOR name##_body__ = {{0,}, &name##_body__.anchor}; \
LINK_ANCHOR *name = & name##_body__
#endif // _COMPILER_H_INCLUDED_
#endif /* _COMPILER_H_INCLUDED_ */

View file

@ -44,4 +44,4 @@ void gc_check_func();
#endif
#endif // _DEBUG_H_INCLUDED_
#endif /* _DEBUG_H_INCLUDED_ */

32
eval.c
View file

@ -514,7 +514,7 @@ rb_remove_event_hook(rb_event_hook_func_t func)
static void
rb_clear_trace_func(void)
{
// TODO: fix me
/* TODO: fix me */
}
/*
@ -575,8 +575,8 @@ set_trace_func(VALUE obj, VALUE trace)
rb_raise(rb_eTypeError, "trace_func needs to be Proc");
}
// register trace func
// trace_func = trace;
/* register trace func */
/* trace_func = trace; */
for (hook = event_hooks; hook; hook = hook->next) {
if (hook->func == call_trace_func)
@ -614,7 +614,7 @@ get_event_name(rb_event_t event)
static void
call_trace_func(rb_event_t event, NODE *node, VALUE self, ID id, VALUE klass)
{
// TODO: fix me
/* TODO: fix me */
#if 0
int state, raised;
NODE *node_save;
@ -905,9 +905,11 @@ rb_longjmp(tag, mesg)
VALUE at;
yarv_thread_t *th = GET_THREAD();
/*
//while (th->cfp->pc == 0 || th->cfp->iseq == 0) {
//th->cfp++;
//}
*/
if (thread_set_raised(th)) {
th->errinfo = exception_error;
@ -955,7 +957,7 @@ rb_longjmp(tag, mesg)
rb_trap_restore_mask();
if (tag != TAG_FATAL) {
// EXEC_EVENT_HOOK(RUBY_EVENT_RAISE ...)
/* EXEC_EVENT_HOOK(RUBY_EVENT_RAISE ...) */
}
thread_reset_raised(th);
JUMP_TAG(tag);
@ -1072,7 +1074,7 @@ void
rb_raise_jump(mesg)
VALUE mesg;
{
// TODO: fix me
/* TODO: fix me */
rb_longjmp(TAG_RAISE, mesg);
}
@ -1271,7 +1273,7 @@ rb_iterate(VALUE (*it_proc) (VALUE), VALUE data1,
th->cfp = cfp;
}
else{
// SDR(); printf("%p, %p\n", cdfp, escape_dfp);
/* SDR(); printf("%p, %p\n", cdfp, escape_dfp); */
}
}
else if (state == TAG_RETRY) {
@ -1432,8 +1434,8 @@ rb_ensure(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*e_proc)(ANYARGS), VALUE
result = (*b_proc) (data1);
}
POP_TAG();
// TODO: fix me
// retval = prot_tag ? prot_tag->retval : Qnil; /* save retval */
/* TODO: fix me */
/* retval = prot_tag ? prot_tag->retval : Qnil; */ /* save retval */
(*e_proc) (data2);
if (state)
JUMP_TAG(state);
@ -1646,18 +1648,22 @@ rb_call(VALUE klass, VALUE recv, ID mid, int argc, const VALUE *argv, int scope)
{
VALUE val;
/*
//static int level;
//int i;
//for(i=0; i<level; i++){printf(" ");}
//printf("invoke %s (%s)\n", rb_id2name(mid), node_name(nd_type(body)));
//level++;
//printf("%s with %d args\n", rb_id2name(mid), argc);
*/
val =
th_call0(GET_THREAD(), klass, recv, mid, id, argc, argv, body,
noex & NOEX_NOSUPER);
/*
//level--;
//for(i=0; i<level; i++){printf(" ");}
//printf("done %s (%s)\n", rb_id2name(mid), node_name(nd_type(body)));
*/
return val;
}
}
@ -1958,7 +1964,7 @@ eval(VALUE self, VALUE src, VALUE scope, char *file, int line)
th->parse_in_eval--;
th_set_eval_stack(th, iseqval);
th->base_block = 0;
if (0) { // for debug
if (0) { /* for debug */
printf("%s\n", RSTRING_PTR(iseq_disasm(iseqval)));
}
@ -2075,7 +2081,7 @@ exec_under(VALUE (*func) (VALUE), VALUE under, VALUE self, VALUE args)
pcfp->self = self;
if ((blockptr = GC_GUARDED_PTR_REF(*th->cfp->lfp)) != 0) {
/* copy block info */
// TODO: why?
/* TODO: why? */
block = *blockptr;
block.self = self;
*th->cfp->lfp = GC_GUARDED_PTR(&block);
@ -2956,9 +2962,9 @@ rb_dvar_defined(ID id)
iseq->type == ISEQ_TYPE_ENSURE ||
iseq->type == ISEQ_TYPE_EVAL) {
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++) {
// 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) {
return Qtrue;
}

View file

@ -203,37 +203,37 @@ error_handle(int ex)
if (thread_set_raised(th))
return EXIT_FAILURE;
switch (ex & TAG_MASK) {
case 0:
case 0:
status = EXIT_SUCCESS;
break;
case TAG_RETURN:
case TAG_RETURN:
error_pos();
warn_print(": unexpected return\n");
break;
case TAG_NEXT:
case TAG_NEXT:
error_pos();
warn_print(": unexpected next\n");
break;
case TAG_BREAK:
case TAG_BREAK:
error_pos();
warn_print(": unexpected break\n");
break;
case TAG_REDO:
case TAG_REDO:
error_pos();
warn_print(": unexpected redo\n");
break;
case TAG_RETRY:
case TAG_RETRY:
error_pos();
warn_print(": retry outside of rescue clause\n");
break;
case TAG_THROW:
// TODO: fix me
case TAG_THROW:
/* TODO: fix me */
error_pos();
warn_printf(": unexpected throw\n");
break;
case TAG_RAISE:
case TAG_FATAL:
case TAG_RAISE:
case TAG_FATAL:
if (rb_obj_is_kind_of(GET_THREAD()->errinfo, rb_eSystemExit)) {
status = sysexit_status(GET_THREAD()->errinfo);
}
@ -241,7 +241,7 @@ error_handle(int ex)
error_print();
}
break;
default:
default:
rb_bug("Unknown longjmp status %d", ex);
break;
}

View file

@ -266,7 +266,7 @@ static void call_end_proc _((VALUE data));
static void
call_end_proc(VALUE data)
{
// TODO: fix me
/* TODO: fix me */
proc_invoke(data, rb_ary_new2(0), Qundef, 0);
}

View file

@ -211,7 +211,7 @@ load_wait(char *ftptr)
return Qfalse;
}
// TODO: write wait routine
/* TODO: write wait routine */
return Qtrue;
}
@ -376,7 +376,7 @@ rb_require_safe(VALUE fname, int safe)
ruby_current_node = 0;
ruby_sourcefile = rb_source_filename(RSTRING_PTR(path));
ruby_sourceline = 0;
//SCOPE_SET(NOEX_PUBLIC);
/* SCOPE_SET(NOEX_PUBLIC); */
handle = (long)dln_load(RSTRING_PTR(path));
rb_ary_push(ruby_dln_librefs, LONG2NUM(handle));
break;

View file

@ -359,7 +359,7 @@ void
rb_thread_fd_close(fd)
int fd;
{
// TODO: fix me
/* TODO: fix me */
}
VALUE

4
gc.c
View file

@ -487,7 +487,7 @@ rb_fill_value_cache(yarv_thread_t *th)
int i;
VALUE rv;
// LOCK
/* LOCK */
for (i=0; i<YARV_VALUE_CACHE_SIZE; i++) {
VALUE v = rb_newobj_from_heap();
@ -496,7 +496,7 @@ rb_fill_value_cache(yarv_thread_t *th)
}
th->value_cache_ptr = &th->value_cache[0];
rv = rb_newobj_from_heap();
// UNLOCK
/* UNLOCK */
return rv;
}
#endif

View file

@ -143,4 +143,4 @@
#define BASIC_OP_UNREDEFINED_P(op) ((yarv_redefined_flag & (op)) == 0)
#define HEAP_CLASS_OF(obj) RBASIC(obj)->klass
#endif // _INSNHELPER_H_INCLUDED_
#endif /* _INSNHELPER_H_INCLUDED_ */

View file

@ -625,7 +625,7 @@ checkincludearray
if (flag == Qtrue) {
/* NODE_CASE */
for (i = 0; i < RARRAY_LEN(ary); i++) {
// TODO: fix me (use another method dispatch)
/* TODO: fix me (use another method dispatch) */
if (RTEST(rb_funcall2(RARRAY_PTR(ary)[i], idEqq, 1, &obj))) {
result = Qtrue;
break;

6
iseq.c
View file

@ -17,7 +17,7 @@
#include "insns.inc"
#include "insns_info.inc"
// #define MARK_FREE_DEBUG 1
/* #define MARK_FREE_DEBUG 1 */
#include "gc.h"
VALUE rb_cISeq;
@ -388,7 +388,7 @@ compile_string(VALUE str, VALUE file, VALUE line)
if (ruby_nerrs > 0) {
ruby_nerrs = 0;
rb_exc_raise(GET_THREAD()->errinfo); // TODO: check err
rb_exc_raise(GET_THREAD()->errinfo); /* TODO: check err */
}
return node;
}
@ -496,7 +496,7 @@ find_line_no(yarv_iseq_t *iseqdat, unsigned long pos)
return iiary[i].line_no;
}
}
// rb_bug("find_line_no: can't find %lu", pos);
/* rb_bug("find_line_no: can't find %lu", pos); */
return 0;
}

7
main.c
View file

@ -41,9 +41,10 @@ main(int argc, char **argv, char **envp)
#endif
{
RUBY_INIT_STACK ruby_init();
ruby_options(argc, argv);
ruby_run();
RUBY_INIT_STACK;
ruby_init();
ruby_options(argc, argv);
ruby_run();
}
return 0;
}

View file

@ -179,7 +179,7 @@ rb_num_coerce_relop(VALUE x, VALUE y)
static VALUE
num_sadded(VALUE x, VALUE name)
{
// ruby_frame = ruby_frame->prev; /* pop frame for "singleton_method_added" */
/* ruby_frame = ruby_frame->prev; */ /* pop frame for "singleton_method_added" */
/* Numerics should be values; singleton_methods should not be added to them */
rb_raise(rb_eTypeError,
"can't define singleton method \"%s\" for %s",

View file

@ -918,7 +918,7 @@ stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem
if (in_def || in_single) {
yyerror("BEGIN in method");
}
// local_push(0);
/* local_push(0); */
/*%
if (in_def || in_single) {
yyerror("BEGIN in method");
@ -930,8 +930,8 @@ stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem
/*%%%*/
ruby_eval_tree_begin = block_append(ruby_eval_tree_begin,
$4);
// NEW_PREEXE($4));
// local_pop();
/* NEW_PREEXE($4)); */
/* local_pop(); */
$$ = 0;
/*%
$$ = dispatch1(BEGIN, $4);

View file

@ -684,7 +684,7 @@ range_include(VALUE range, VALUE val)
}
return Qfalse;
}
// TODO: ruby_frame->this_func = rb_intern("include?");
/* TODO: ruby_frame->this_func = rb_intern("include?"); */
return rb_call_super(1, &val);
}

View file

@ -66,74 +66,48 @@
#define USE_UNICODE_FULL_RANGE_CTYPE
/* following must not use with USE_CRNL_AS_LINE_TERMINATOR */
/* #define USE_UNICODE_ALL_LINE_TERMINATORS *//* see Unicode.org UTF#18 */
/* #define USE_UNICODE_ALL_LINE_TERMINATORS */ /* see Unicode.org UTF#18 */
#define ONIG_ENCODING_INIT_DEFAULT ONIG_ENCODING_ASCII
/* for encoding system implementation (internal) */
ONIG_EXTERN int onigenc_ascii_get_all_pair_ambig_codes
P_((OnigAmbigType flag, const OnigPairAmbigCodes ** acs));
ONIG_EXTERN int onigenc_nothing_get_all_comp_ambig_codes
P_((OnigAmbigType flag, const OnigCompAmbigCodes ** acs));
ONIG_EXTERN int onigenc_iso_8859_1_get_all_pair_ambig_codes
P_((OnigAmbigType flag, const OnigPairAmbigCodes ** acs));
ONIG_EXTERN int onigenc_ess_tsett_get_all_comp_ambig_codes
P_((OnigAmbigType flag, const OnigCompAmbigCodes ** acs));
ONIG_EXTERN int onigenc_not_support_get_ctype_code_range
P_((int ctype, const OnigCodePoint * sbr[], const OnigCodePoint * mbr[]));
ONIG_EXTERN int onigenc_is_mbc_newline_0x0a
P_((const UChar * p, const UChar * end));
ONIG_EXTERN int onigenc_ascii_get_all_pair_ambig_codes P_((OnigAmbigType flag, const OnigPairAmbigCodes** acs));
ONIG_EXTERN int onigenc_nothing_get_all_comp_ambig_codes P_((OnigAmbigType flag, const OnigCompAmbigCodes** acs));
ONIG_EXTERN int onigenc_iso_8859_1_get_all_pair_ambig_codes P_((OnigAmbigType flag, const OnigPairAmbigCodes** acs));
ONIG_EXTERN int onigenc_ess_tsett_get_all_comp_ambig_codes P_((OnigAmbigType flag, const OnigCompAmbigCodes** acs));
ONIG_EXTERN int onigenc_not_support_get_ctype_code_range P_((int ctype, const OnigCodePoint* sbr[], const OnigCodePoint* mbr[]));
ONIG_EXTERN int onigenc_is_mbc_newline_0x0a P_((const UChar* p, const UChar* end));
/* methods for single byte encoding */
ONIG_EXTERN int onigenc_ascii_mbc_to_normalize
P_((OnigAmbigType flag, const UChar ** p, const UChar * end, UChar * lower));
ONIG_EXTERN int onigenc_ascii_is_mbc_ambiguous
P_((OnigAmbigType flag, const UChar ** p, const UChar * end));
ONIG_EXTERN int onigenc_single_byte_mbc_enc_len P_((const UChar * p));
ONIG_EXTERN OnigCodePoint onigenc_single_byte_mbc_to_code
P_((const UChar * p, const UChar * end));
ONIG_EXTERN int onigenc_ascii_mbc_to_normalize P_((OnigAmbigType flag, const UChar** p, const UChar* end, UChar* lower));
ONIG_EXTERN int onigenc_ascii_is_mbc_ambiguous P_((OnigAmbigType flag, const UChar** p, const UChar* end));
ONIG_EXTERN int onigenc_single_byte_mbc_enc_len P_((const UChar* p));
ONIG_EXTERN OnigCodePoint onigenc_single_byte_mbc_to_code P_((const UChar* p, const UChar* end));
ONIG_EXTERN int onigenc_single_byte_code_to_mbclen P_((OnigCodePoint code));
ONIG_EXTERN int onigenc_single_byte_code_to_mbc_first
P_((OnigCodePoint code));
ONIG_EXTERN int onigenc_single_byte_code_to_mbc
P_((OnigCodePoint code, UChar * buf));
ONIG_EXTERN UChar *onigenc_single_byte_left_adjust_char_head
P_((const UChar * start, const UChar * s));
ONIG_EXTERN int onigenc_always_true_is_allowed_reverse_match
P_((const UChar * s, const UChar * end));
ONIG_EXTERN int onigenc_always_false_is_allowed_reverse_match
P_((const UChar * s, const UChar * end));
ONIG_EXTERN int onigenc_single_byte_code_to_mbc_first P_((OnigCodePoint code));
ONIG_EXTERN int onigenc_single_byte_code_to_mbc P_((OnigCodePoint code, UChar *buf));
ONIG_EXTERN UChar* onigenc_single_byte_left_adjust_char_head P_((const UChar* start, const UChar* s));
ONIG_EXTERN int onigenc_always_true_is_allowed_reverse_match P_((const UChar* s, const UChar* end));
ONIG_EXTERN int onigenc_always_false_is_allowed_reverse_match P_((const UChar* s, const UChar* end));
/* methods for multi byte encoding */
ONIG_EXTERN OnigCodePoint onigenc_mbn_mbc_to_code
P_((OnigEncoding enc, const UChar * p, const UChar * end));
ONIG_EXTERN int onigenc_mbn_mbc_to_normalize
P_((OnigEncoding enc, OnigAmbigType flag, const UChar ** p, const UChar * end,
UChar * lower));
ONIG_EXTERN int onigenc_mbn_is_mbc_ambiguous
P_((OnigEncoding enc, OnigAmbigType flag, const UChar ** p,
const UChar * end));
ONIG_EXTERN OnigCodePoint onigenc_mbn_mbc_to_code P_((OnigEncoding enc, const UChar* p, const UChar* end));
ONIG_EXTERN int onigenc_mbn_mbc_to_normalize P_((OnigEncoding enc, OnigAmbigType flag, const UChar** p, const UChar* end, UChar* lower));
ONIG_EXTERN int onigenc_mbn_is_mbc_ambiguous P_((OnigEncoding enc, OnigAmbigType flag, const UChar** p, const UChar* end));
ONIG_EXTERN int onigenc_mb2_code_to_mbclen P_((OnigCodePoint code));
ONIG_EXTERN int onigenc_mb2_code_to_mbc_first P_((OnigCodePoint code));
ONIG_EXTERN int onigenc_mb2_code_to_mbc
P_((OnigEncoding enc, OnigCodePoint code, UChar * buf));
ONIG_EXTERN int onigenc_mb2_is_code_ctype
P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));
ONIG_EXTERN int onigenc_mb2_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
ONIG_EXTERN int onigenc_mb2_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));
ONIG_EXTERN int onigenc_mb4_code_to_mbclen P_((OnigCodePoint code));
ONIG_EXTERN int onigenc_mb4_code_to_mbc_first P_((OnigCodePoint code));
ONIG_EXTERN int onigenc_mb4_code_to_mbc
P_((OnigEncoding enc, OnigCodePoint code, UChar * buf));
ONIG_EXTERN int onigenc_mb4_is_code_ctype
P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));
ONIG_EXTERN int onigenc_mb4_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
ONIG_EXTERN int onigenc_mb4_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));
ONIG_EXTERN int onigenc_get_all_fold_match_code_ss_0xdf
P_((OnigCodePoint ** codes));
ONIG_EXTERN int onigenc_get_all_fold_match_code_ss_0xdf P_((OnigCodePoint** codes));
/* in enc/unicode.c */
ONIG_EXTERN int onigenc_unicode_is_code_ctype
P_((OnigCodePoint code, unsigned int ctype));
ONIG_EXTERN int onigenc_unicode_get_ctype_code_range
P_((int ctype, const OnigCodePoint * sbr[], const OnigCodePoint * mbr[]));
ONIG_EXTERN int onigenc_unicode_is_code_ctype P_((OnigCodePoint code, unsigned int ctype));
ONIG_EXTERN int onigenc_unicode_get_ctype_code_range P_((int ctype, const OnigCodePoint* sbr[], const OnigCodePoint* mbr[]));
#define ONIGENC_ISO_8859_1_TO_LOWER_CASE(c) \
@ -151,17 +125,15 @@ ONIG_EXTERN const OnigPairAmbigCodes OnigAsciiPairAmbigCodes[];
#endif /* is not ONIG_RUBY_M17N */
ONIG_EXTERN int
onigenc_with_ascii_strncmp
P_((OnigEncoding enc, const UChar * p, const UChar * end,
const UChar * sascii /* ascii */ , int n));
ONIG_EXTERN UChar *onigenc_step
P_((OnigEncoding enc, const UChar * p, const UChar * end, int n));
onigenc_with_ascii_strncmp P_((OnigEncoding enc, const UChar* p, const UChar* end, const UChar* sascii /* ascii */, int n));
ONIG_EXTERN UChar*
onigenc_step P_((OnigEncoding enc, const UChar* p, const UChar* end, int n));
/* defined in regexec.c, but used in enc/xxx.c */
extern int onig_is_in_code_range P_((const UChar * p, OnigCodePoint code));
extern int onig_is_in_code_range P_((const UChar* p, OnigCodePoint code));
ONIG_EXTERN OnigEncoding OnigEncDefaultCharEncoding;
ONIG_EXTERN const UChar *OnigEncAsciiToLowerCaseTable;
ONIG_EXTERN const UChar* OnigEncAsciiToLowerCaseTable;
ONIG_EXTERN const UChar OnigEncAsciiToUpperCaseTable[];
ONIG_EXTERN const unsigned short OnigEncAsciiCtypeTable[];

12
ruby.h
View file

@ -378,12 +378,12 @@ struct RString {
struct RBasic basic;
union {
struct {
long len;
char *ptr;
union {
long capa;
VALUE shared;
} aux;
long len;
char *ptr;
union {
long capa;
VALUE shared;
} aux;
} heap;
char ary[RSTRING_EMBED_LEN_MAX];
} as;

View file

@ -307,7 +307,7 @@ int rb_prohibit_interrupt = 1;
VALUE
rb_get_trap_cmd(int sig)
{
return trap_list[sig].cmd;
return trap_list[sig].cmd;
}
void
@ -498,41 +498,41 @@ rb_trap_exit(void)
void
rb_signal_exec(yarv_thread_t *th, int sig)
{
VALUE cmd = rb_get_trap_cmd(sig);
VALUE cmd = rb_get_trap_cmd(sig);
if (cmd == 0) {
switch (sig) {
case SIGINT:
rb_interrupt();
break;
if (cmd == 0) {
switch (sig) {
case SIGINT:
rb_interrupt();
break;
#ifdef SIGHUP
case SIGHUP:
case SIGHUP:
#endif
#ifdef SIGQUIT
case SIGQUIT:
case SIGQUIT:
#endif
#ifdef SIGALRM
case SIGALRM:
case SIGALRM:
#endif
#ifdef SIGUSR1
case SIGUSR1:
case SIGUSR1:
#endif
#ifdef SIGUSR2
case SIGUSR2:
case SIGUSR2:
#endif
rb_thread_signal_raise(th, signo2signm(sig));
break;
rb_thread_signal_raise(th, signo2signm(sig));
break;
}
}
else if (cmd == Qundef) {
rb_thread_signal_exit(th);
}
else {
yarv_proc_t *proc;
VALUE signum = INT2FIX(sig);
GetProcPtr(cmd, proc);
th_invoke_proc(th, proc, proc->block.self, 1, &signum);
}
}
else if (cmd == Qundef) {
rb_thread_signal_exit(th);
}
else {
yarv_proc_t *proc;
VALUE signum = INT2FIX(sig);
GetProcPtr(cmd, proc);
th_invoke_proc(th, proc, proc->block.self, 1, &signum);
}
}
void
@ -544,7 +544,7 @@ rb_trap_exec(void)
for (i=0; i<NSIG; i++) {
if (trap_pending_list[i]) {
trap_pending_list[i] = 0;
rb_signal_exec(GET_THREAD(), i);
rb_signal_exec(GET_THREAD(), i);
}
}
#endif /* MACOS_UNUSE_SIGNAL */

View file

@ -657,7 +657,7 @@ yarv_thread_execute_interrupts(yarv_thread_t *th)
void
rb_gc_mark_threads()
{
// TODO: remove
/* TODO: remove */
}
/*****************************************************/
@ -678,7 +678,7 @@ yarv_thread_raise(int argc, VALUE *argv, yarv_thread_t *th)
}
exc = rb_make_exception(argc, argv);
// TODO: need synchronization if run threads in parallel
/* TODO: need synchronization if run threads in parallel */
th->throwed_errinfo = exc;
rb_thread_ready(th);
return Qnil;

View file

@ -47,9 +47,9 @@ w32_show_error_message()
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) & lpMsgBuf, 0, NULL);
// {int *a=0; *a=0;}
/* {int *a=0; *a=0;} */
MessageBox(NULL, (LPCTSTR) lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION);
// exit(1);
/* exit(1); */
}
static int
@ -192,7 +192,7 @@ native_mutex_initialize(yarv_thread_lock_t *lock)
{
#if USE_WIN32MUTEX
*lock = CreateMutex(NULL, FALSE, NULL);
// thread_debug("initialize mutex: %p\n", *lock);
/* thread_debug("initialize mutex: %p\n", *lock); */
#else
InitializeCriticalSection(lock);
#endif
@ -215,7 +215,7 @@ thread_start_func_1(void *th_ptr)
thread_start_func_2(th, &stack_start);
thread_cleanup_func(th);
// native_mutex_unlock(&GET_VM()->global_interpreter_lock);
/* native_mutex_unlock(&GET_VM()->global_interpreter_lock); */
thread_debug("close handle - intr: %p, thid: %p\n",
th->native_thread_data.interrupt_event, th->thread_id);

11
vm.c
View file

@ -639,7 +639,7 @@ th_yield_setup_args(yarv_iseq_t *iseq, int argc, VALUE *argv)
}
}
else {
if (argc == 1 && TYPE(argv[0]) == T_ARRAY) {// && iseq->arg_rest == 0) {
if (argc == 1 && TYPE(argv[0]) == T_ARRAY /* && iseq->arg_rest == 0 */) {
VALUE ary = argv[0];
argc = RARRAY_LEN(ary);
@ -965,11 +965,10 @@ check_svar(void)
yarv_thread_t *th = GET_THREAD();
yarv_control_frame_t *cfp = th->cfp;
while ((void *)(cfp + 1) < (void *)(th->stack + th->stack_size)) {
// printf("cfp: %p\n", cfp->magic);
if(cfp->lfp)
if(cfp->lfp[-1] != Qnil &&
TYPE(cfp->lfp[-1]) != T_VALUES){
// dp(cfp->lfp[-1]);
/* printf("cfp: %p\n", cfp->magic); */
if (cfp->lfp && cfp->lfp[-1] != Qnil &&
TYPE(cfp->lfp[-1]) != T_VALUES) {
/* dp(cfp->lfp[-1]); */
rb_bug("!!!illegal svar!!!");
}
cfp++;

9
vm.h
View file

@ -35,16 +35,11 @@ typedef long OFFSET;
* 10: gc check
*/
//#define VMDEBUG 1
//#define VMDEBUG 5
#if 0
#undef VMDEBUG
#define VMDEBUG 3
#endif
// #define COLLECT_USAGE_ANALYSIS
#ifdef COLLECT_USAGE_ANALYSIS
#define USAGE_ANALYSIS_INSN(insn) vm_analysis_insn(insn)
#define USAGE_ANALYSIS_OPERAND(insn, n, op) vm_analysis_operand(insn, n, (VALUE)op)
@ -84,7 +79,7 @@ typedef long OFFSET;
#endif
#define throwdebug if(0)printf
//#define throwdebug printf
/* #define throwdebug printf */
#define SDR2(cfp) vm_stack_dump_raw(GET_THREAD(), (cfp))
@ -287,4 +282,4 @@ default: \
#define BOP_LENGTH 0x800
#define BOP_SUCC 0x1000
#endif // _VM_H_INCLUDED_
#endif /* _VM_H_INCLUDED_ */

View file

@ -31,7 +31,7 @@ control_frame_dump(yarv_thread_t *th, yarv_control_frame_t *cfp)
VALUE tmp;
if (cfp->block_iseq != 0 && BUILTIN_TYPE(cfp->block_iseq) != T_NODE) {
biseq_name = ""; //RSTRING(cfp->block_iseq->name)->ptr;
biseq_name = ""; /* RSTRING(cfp->block_iseq->name)->ptr; */
}
if (lfp < 0 || lfp > th->stack_size) {
@ -306,7 +306,7 @@ stack_dump_each(yarv_thread_t *th, yarv_control_frame_t *cfp)
stack_dump_each(th, cfp + 1);
}
else {
// SDR();
/* SDR(); */
}
}
else {
@ -379,10 +379,10 @@ debug_print_post(yarv_thread_t *th, yarv_control_frame_t *cfp
fprintf(stderr, " (2)");
debug_print_register(th);
#endif
// stack_dump_raw(th, cfp);
/* stack_dump_raw(th, cfp); */
#if VMDEBUG > 2
// stack_dump_thobj(th);
/* stack_dump_thobj(th); */
stack_dump_each(th, th->cfp);
#if OPT_STACK_CACHING
{
@ -512,13 +512,13 @@ vm_analysis_register(int reg, int isset)
VALUE rhash;
VALUE valstr;
char *regstrs[] = {
"pc", // 0
"sp", // 1
"cfp", // 2
"lfp", // 3
"dfp", // 4
"self", // 5
"iseq", // 6
"pc", /* 0 */
"sp", /* 1 */
"cfp", /* 2 */
"lfp", /* 3 */
"dfp", /* 4 */
"self", /* 5 */
"iseq", /* 6 */
};
char *getsetstr[] = {
"get",

View file

@ -24,7 +24,7 @@
#else
#define DECL_SC_REG(type, r, reg) register type reg_##r
#endif
// #define DECL_SC_REG(r, reg) VALUE reg_##r
/* #define DECL_SC_REG(r, reg) VALUE reg_##r */
typedef yarv_iseq_t *ISEQ;

View file

@ -164,7 +164,7 @@ compile_string(VALUE str, VALUE file, VALUE line)
if (ruby_nerrs > 0) {
ruby_nerrs = 0;
rb_exc_raise(GET_THREAD()->errinfo); // TODO: check err
rb_exc_raise(GET_THREAD()->errinfo); /* TODO: check err */
}
return node;
}
@ -229,10 +229,10 @@ vm_free(void *ptr)
yarv_vm_t *vmobj = ptr;
st_free_table(vmobj->living_threads);
// TODO: MultiVM Instance
// VM object should not be cleaned by GC
// ruby_xfree(ptr);
// theYarvVM = 0;
/* TODO: MultiVM Instance */
/* VM object should not be cleaned by GC */
/* ruby_xfree(ptr); */
/* theYarvVM = 0; */
}
FREE_REPORT_LEAVE("vm");
}

View file

@ -339,22 +339,22 @@ typedef struct yarv_vm_struct {
} yarv_vm_t;
typedef struct {
VALUE *pc; // cfp[0]
VALUE *sp; // cfp[1]
VALUE *bp; // cfp[2]
yarv_iseq_t *iseq; // cfp[3]
VALUE magic; // cfp[4]
VALUE self; // cfp[5] // block[0]
VALUE *lfp; // cfp[6] // block[1]
VALUE *dfp; // cfp[7] // block[2]
yarv_iseq_t *block_iseq; // cfp[8] // block[3]
VALUE proc; // cfp[9] // block[4]
ID callee_id; // cfp[10]
ID method_id; // cfp[11] saved in special case
VALUE method_klass; // cfp[12] saved in special case
VALUE prof_time_self; // cfp[13]
VALUE prof_time_chld; // cfp[14]
VALUE dummy; // cfp[15]
VALUE *pc; /* cfp[0] */
VALUE *sp; /* cfp[1] */
VALUE *bp; /* cfp[2] */
yarv_iseq_t *iseq; /* cfp[3] */
VALUE magic; /* cfp[4] */
VALUE self; /* cfp[5] / block[0] */
VALUE *lfp; /* cfp[6] / block[1] */
VALUE *dfp; /* cfp[7] / block[2] */
yarv_iseq_t *block_iseq; /* cfp[8] / block[3] */
VALUE proc; /* cfp[9] / block[4] */
ID callee_id; /* cfp[10] */
ID method_id; /* cfp[11] saved in special case */
VALUE method_klass; /* cfp[12] saved in special case */
VALUE prof_time_self; /* cfp[13] */
VALUE prof_time_chld; /* cfp[14] */
VALUE dummy; /* cfp[15] */
} yarv_control_frame_t;
typedef struct {
@ -636,4 +636,4 @@ void yarv_thread_execute_interrupts(yarv_thread_t *);
#define YARV_CHECK_INTS() \
YARV_CHECK_INTS_TH(GET_THREAD())
#endif // _YARVCORE_H_INCLUDED_
#endif /* _YARVCORE_H_INCLUDED_ */