version.c: separate Init_ruby_description
* version.c (Init_ruby_description): separate to initialize RUBY_DESCRIPTION constant according to mjit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a40f12b77c
commit
6c70fede0c
9
mjit.c
9
mjit.c
@ -1674,8 +1674,6 @@ system_tmpdir(void)
|
|||||||
/* Minimum value for JIT cache size. */
|
/* Minimum value for JIT cache size. */
|
||||||
#define MIN_CACHE_SIZE 10
|
#define MIN_CACHE_SIZE 10
|
||||||
|
|
||||||
extern const char ruby_description_with_jit[];
|
|
||||||
|
|
||||||
/* Start MJIT worker. Return TRUE if worker is sucessfully started. */
|
/* Start MJIT worker. Return TRUE if worker is sucessfully started. */
|
||||||
static int
|
static int
|
||||||
start_worker(void)
|
start_worker(void)
|
||||||
@ -1702,8 +1700,6 @@ start_worker(void)
|
|||||||
void
|
void
|
||||||
mjit_init(struct mjit_options *opts)
|
mjit_init(struct mjit_options *opts)
|
||||||
{
|
{
|
||||||
VALUE rb_description;
|
|
||||||
|
|
||||||
mjit_opts = *opts;
|
mjit_opts = *opts;
|
||||||
mjit_enabled = TRUE;
|
mjit_enabled = TRUE;
|
||||||
mjit_call_p = TRUE;
|
mjit_call_p = TRUE;
|
||||||
@ -1755,11 +1751,6 @@ mjit_init(struct mjit_options *opts)
|
|||||||
rb_id_table_foreach(RCLASS_CONST_TBL(rb_cObject), valid_class_serials_add_i, NULL);
|
rb_id_table_foreach(RCLASS_CONST_TBL(rb_cObject), valid_class_serials_add_i, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Overwrites RUBY_DESCRIPTION constant */
|
|
||||||
rb_const_remove(rb_cObject, rb_intern("RUBY_DESCRIPTION"));
|
|
||||||
rb_description = rb_usascii_str_new_static(ruby_description_with_jit, strlen(ruby_description_with_jit));
|
|
||||||
rb_define_global_const("RUBY_DESCRIPTION", rb_obj_freeze(rb_description));
|
|
||||||
|
|
||||||
/* Initialize worker thread */
|
/* Initialize worker thread */
|
||||||
start_worker();
|
start_worker();
|
||||||
}
|
}
|
||||||
|
3
ruby.c
3
ruby.c
@ -54,6 +54,8 @@
|
|||||||
|
|
||||||
#include "mjit.h"
|
#include "mjit.h"
|
||||||
|
|
||||||
|
void Init_ruby_description(void);
|
||||||
|
|
||||||
#ifndef HAVE_STDLIB_H
|
#ifndef HAVE_STDLIB_H
|
||||||
char *getenv();
|
char *getenv();
|
||||||
#endif
|
#endif
|
||||||
@ -1633,6 +1635,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
|
|||||||
/* Using TMP_RUBY_PREFIX created by ruby_init_loadpath_safe(). */
|
/* Using TMP_RUBY_PREFIX created by ruby_init_loadpath_safe(). */
|
||||||
mjit_init(&opt->mjit);
|
mjit_init(&opt->mjit);
|
||||||
|
|
||||||
|
Init_ruby_description();
|
||||||
Init_enc();
|
Init_enc();
|
||||||
lenc = rb_locale_encoding();
|
lenc = rb_locale_encoding();
|
||||||
rb_enc_associate(rb_progname, lenc);
|
rb_enc_associate(rb_progname, lenc);
|
||||||
|
24
version.c
24
version.c
@ -33,7 +33,7 @@ const char ruby_release_date[] = RUBY_RELEASE_DATE;
|
|||||||
const char ruby_platform[] = RUBY_PLATFORM;
|
const char ruby_platform[] = RUBY_PLATFORM;
|
||||||
const int ruby_patchlevel = RUBY_PATCHLEVEL;
|
const int ruby_patchlevel = RUBY_PATCHLEVEL;
|
||||||
const char ruby_description[] = RUBY_DESCRIPTION_WITH("");
|
const char ruby_description[] = RUBY_DESCRIPTION_WITH("");
|
||||||
const char ruby_description_with_jit[] = RUBY_DESCRIPTION_WITH(" +JIT");
|
static const char ruby_description_with_jit[] = RUBY_DESCRIPTION_WITH(" +JIT");
|
||||||
const char ruby_copyright[] = RUBY_COPYRIGHT;
|
const char ruby_copyright[] = RUBY_COPYRIGHT;
|
||||||
const char ruby_engine[] = "ruby";
|
const char ruby_engine[] = "ruby";
|
||||||
|
|
||||||
@ -66,11 +66,6 @@ Init_version(void)
|
|||||||
* The SVN revision for this ruby.
|
* The SVN revision for this ruby.
|
||||||
*/
|
*/
|
||||||
rb_define_global_const("RUBY_REVISION", MKINT(revision));
|
rb_define_global_const("RUBY_REVISION", MKINT(revision));
|
||||||
/*
|
|
||||||
* The full ruby version string, like <tt>ruby -v</tt> prints'
|
|
||||||
* This might be overwritten by mjit_init().
|
|
||||||
*/
|
|
||||||
rb_define_global_const("RUBY_DESCRIPTION", MKSTR(description));
|
|
||||||
/*
|
/*
|
||||||
* The copyright string for ruby
|
* The copyright string for ruby
|
||||||
*/
|
*/
|
||||||
@ -86,6 +81,23 @@ Init_version(void)
|
|||||||
rb_define_global_const("RUBY_ENGINE_VERSION", (1 ? version : MKSTR(version)));
|
rb_define_global_const("RUBY_ENGINE_VERSION", (1 ? version : MKSTR(version)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Init_ruby_description(void)
|
||||||
|
{
|
||||||
|
VALUE description;
|
||||||
|
|
||||||
|
if (mjit_opts.on) {
|
||||||
|
description = MKSTR(description_with_jit);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
description = MKSTR(description);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* The full ruby version string, like <tt>ruby -v</tt> prints
|
||||||
|
*/
|
||||||
|
rb_define_global_const("RUBY_DESCRIPTION", description);
|
||||||
|
}
|
||||||
|
|
||||||
/*! Prints the version information of the CRuby interpreter to stdout. */
|
/*! Prints the version information of the CRuby interpreter to stdout. */
|
||||||
void
|
void
|
||||||
ruby_show_version(void)
|
ruby_show_version(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user