mjit 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1626471981e035dec1407f5e53ee5ab9fc3ec15a1f2c74bd7469959b9879b0c9
4
+ data.tar.gz: '0385b2b8fba5a93889c3a722b76836825deeaad66635ef0f500b0c93a8eef5da'
5
+ SHA512:
6
+ metadata.gz: 87e442d6ddf1db13b57ddc25469393f3b6551f70bc38e8114d24f068aa0cb72a69d3439ffcb96251d3c76e4273f7e3bdea2314d9104ac58c54fb35550a839cb5
7
+ data.tar.gz: 65f9e3a343033a239bc8a28731dc5685b52e10f41e61dda232c1a876f274737b54e7a125974fe48e0e34aa608de5bb38f45dd2f526dc2a6986ee66832ad00968
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.so
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in mjit.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,29 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ mjit (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.1.2)
10
+ method_source (0.9.0)
11
+ pry (0.11.3)
12
+ coderay (~> 1.1.0)
13
+ method_source (~> 0.9.0)
14
+ rake (10.5.0)
15
+ rake-compiler (1.0.4)
16
+ rake
17
+
18
+ PLATFORMS
19
+ ruby
20
+
21
+ DEPENDENCIES
22
+ bundler
23
+ mjit!
24
+ pry
25
+ rake
26
+ rake-compiler
27
+
28
+ BUNDLED WITH
29
+ 1.16.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Takashi Kokubun
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # MJIT
2
+
3
+ This is unofficial. Own your risk!
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'mjit'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install mjit
20
+
21
+ ## Usage
22
+
23
+ When you use this gem, you must start Ruby with --jit. Otherwise it segfaults.
24
+
25
+ ```rb
26
+ # This stops MJIT's internal profiler. Actually this doesn't stop MJIT compilation.
27
+ RubyVM::MJIT.disable
28
+
29
+ # This enables it again.
30
+ RubyVM::MJIT.enable
31
+ ```
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ require 'rake/extensiontask'
4
+
5
+ task :build => :compile
6
+
7
+ Rake::ExtensionTask.new('mjit') do |ext|
8
+ ext.lib_dir = 'lib/mjit'
9
+ end
10
+
11
+ task :default => [:clobber, :compile]
data/bin/console ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'mjit'
5
+
6
+ require 'pry'
7
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,3 @@
1
+ require 'mkmf'
2
+
3
+ create_makefile('mjit/mjit')
data/ext/mjit/mjit.c ADDED
@@ -0,0 +1,27 @@
1
+ #include "ruby.h"
2
+
3
+ extern VALUE rb_cRubyVM;
4
+ extern int mjit_init_p;
5
+
6
+ /* Calling this without --jit would cause SEGV. */
7
+ static VALUE
8
+ mjit_enable(VALUE self)
9
+ {
10
+ mjit_init_p = 1;
11
+ return Qtrue;
12
+ }
13
+
14
+ static VALUE
15
+ mjit_disable(VALUE self)
16
+ {
17
+ mjit_init_p = 0;
18
+ return Qfalse;
19
+ }
20
+
21
+ void
22
+ Init_mjit()
23
+ {
24
+ VALUE rb_mMJIT = rb_const_get(rb_cRubyVM, rb_intern("MJIT"));
25
+ rb_define_singleton_method(rb_mMJIT, "enable", mjit_enable, 0);
26
+ rb_define_singleton_method(rb_mMJIT, "disable", mjit_disable, 0);
27
+ }
data/lib/mjit.rb ADDED
@@ -0,0 +1 @@
1
+ require 'mjit/mjit'
data/mjit.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = 'mjit'
6
+ spec.version = '0.1.0'
7
+ spec.authors = ['Takashi Kokubun']
8
+ spec.email = ['takashikkbn@gmail.com']
9
+
10
+ spec.summary = %q{Unofficial MJIT utilities}
11
+ spec.description = %q{Unofficial MJIT utilities}
12
+ spec.homepage = 'https://github.com/k0kubun/mjit-disable'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ f.match(%r{^(test|spec|features)/})
17
+ end
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+ spec.required_ruby_version = '> 2.5.0'
22
+
23
+ spec.add_development_dependency 'bundler'
24
+ spec.add_development_dependency 'pry'
25
+ spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'rake-compiler'
27
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mjit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Takashi Kokubun
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-03-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake-compiler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Unofficial MJIT utilities
70
+ email:
71
+ - takashikkbn@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - Gemfile.lock
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/console
83
+ - bin/setup
84
+ - ext/mjit/extconf.rb
85
+ - ext/mjit/mjit.c
86
+ - lib/mjit.rb
87
+ - mjit.gemspec
88
+ homepage: https://github.com/k0kubun/mjit-disable
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">"
99
+ - !ruby/object:Gem::Version
100
+ version: 2.5.0
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.7.6
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Unofficial MJIT utilities
112
+ test_files: []