From 07ac58747f84412ea476b911fd25219093c581ed Mon Sep 17 00:00:00 2001 From: charliesome Date: Sat, 9 Nov 2013 21:17:06 +0000 Subject: * compile.c (iseq_compile_each): emit opt_str_freeze if the #freeze method is called on a static string literal with no arguments. * defs/id.def (firstline): add freeze so idFreeze is available * insns.def (opt_str_freeze): add opt_str_freeze instruction which pushes a frozen string literal without allocating a new object if String#freeze is not overriden * string.c (Init_String): define String#freeze * vm.c (vm_init_redefined_flag): define BOP_FREEZE on String class as a basic operation * vm_insnhelper.h: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm.c | 1 + 1 file changed, 1 insertion(+) (limited to 'vm.c') diff --git a/vm.c b/vm.c index 7d07b66..77a77ea 100644 --- a/vm.c +++ b/vm.c @@ -1082,6 +1082,7 @@ vm_init_redefined_flag(void) OP(EmptyP, EMPTY_P), (C(Array), C(String), C(Hash)); OP(Succ, SUCC), (C(Fixnum), C(String), C(Time)); OP(EqTilde, MATCH), (C(Regexp), C(String)); + OP(Freeze, FREEZE), (C(String)); #undef C #undef OP } -- cgit v1.1