[macruby-changes] [1249] MacRuby/branches/experimental
source_changes at macosforge.org
source_changes at macosforge.org
Sat Mar 28 21:30:48 PDT 2009
Revision: 1249
http://trac.macosforge.org/projects/ruby/changeset/1249
Author: lsansonetti at apple.com
Date: 2009-03-28 21:30:47 -0700 (Sat, 28 Mar 2009)
Log Message:
-----------
more compiler-side of regexp support
Modified Paths:
--------------
MacRuby/branches/experimental/eval.c
MacRuby/branches/experimental/roxor.cpp
Modified: MacRuby/branches/experimental/eval.c
===================================================================
--- MacRuby/branches/experimental/eval.c 2009-03-29 03:48:11 UTC (rev 1248)
+++ MacRuby/branches/experimental/eval.c 2009-03-29 04:30:47 UTC (rev 1249)
@@ -693,22 +693,6 @@
}
VALUE
-rb_errinfo(void)
-{
- // TODO
- return Qnil;
-}
-
-void
-rb_set_errinfo(VALUE err)
-{
- if (!NIL_P(err) && !rb_obj_is_kind_of(err, rb_eException)) {
- rb_raise(rb_eTypeError, "assigning non-exception to $!");
- }
- // TODO
-}
-
-VALUE
rb_rubylevel_errinfo(void)
{
return get_errinfo();
Modified: MacRuby/branches/experimental/roxor.cpp
===================================================================
--- MacRuby/branches/experimental/roxor.cpp 2009-03-29 03:48:11 UTC (rev 1248)
+++ MacRuby/branches/experimental/roxor.cpp 2009-03-29 04:30:47 UTC (rev 1249)
@@ -408,6 +408,7 @@
VALUE backref;
VALUE broken_with;
VALUE last_status;
+ VALUE errinfo;
int safe_level;
std::map<NODE *, rb_vm_block_t *> blocks;
std::map<double, struct rb_float_cache *> float_cache;
@@ -1957,6 +1958,7 @@
backref = Qnil;
broken_with = Qundef;
last_status = Qnil;
+ errinfo = Qnil;
current_block = NULL;
previous_block = NULL;
@@ -2869,12 +2871,14 @@
return compile_dstr(node);
case NODE_DREGX:
+ case NODE_DREGX_ONCE: // TODO optimize NODE_DREGX_ONCE
{
Value *val = compile_dstr(node);
const int flag = node->nd_cflag;
if (newRegexpFunc == NULL) {
- newRegexpFunc = cast<Function>(module->getOrInsertFunction("rb_reg_new_str",
+ newRegexpFunc = cast<Function>(module->getOrInsertFunction(
+ "rb_reg_new_str",
RubyObjTy, RubyObjTy, Type::Int32Ty, NULL));
}
@@ -3597,14 +3601,30 @@
}
break;
+ case NODE_MATCH:
case NODE_MATCH2:
case NODE_MATCH3:
{
- assert(node->nd_recv);
- assert(node->nd_value);
+ Value *reTarget;
+ Value *reSource;
- Value *reSource = compile_node(node->nd_recv);
- Value *reTarget = compile_node(node->nd_value);
+ if (nd_type(node) == NODE_MATCH) {
+ assert(node->nd_lit != 0);
+ reTarget = ConstantInt::get(RubyObjTy, node->nd_lit);
+ reSource = nilVal; // TODO this should get $_
+ }
+ else {
+ assert(node->nd_recv);
+ assert(node->nd_value);
+ if (nd_type(node) == NODE_MATCH2) {
+ reTarget = compile_node(node->nd_recv);
+ reSource = compile_node(node->nd_value);
+ }
+ else {
+ reTarget = compile_node(node->nd_value);
+ reSource = compile_node(node->nd_recv);
+ }
+ }
std::vector<Value *> params;
void *cache = GET_VM()->method_cache_get(selEqTilde, false);
@@ -6192,6 +6212,27 @@
}
extern "C"
+VALUE
+rb_errinfo(void)
+{
+ return GET_VM()->errinfo;
+}
+
+void
+rb_set_errinfo(VALUE err)
+{
+ if (!NIL_P(err) && !rb_obj_is_kind_of(err, rb_eException)) {
+ rb_raise(rb_eTypeError, "assigning non-exception to $!");
+ }
+ if (GET_VM()->errinfo != Qnil) {
+ rb_objc_release((void *)GET_VM()->errinfo);
+ }
+ GET_VM()->errinfo = err;
+ rb_objc_retain((void *)err);
+}
+
+
+extern "C"
const char *
rb_sourcefile(void)
{
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090328/bdee9cbf/attachment-0001.html>
More information about the macruby-changes
mailing list