mini_racer 0.17.0.pre13 → 0.18.0.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02c93cf015b4c5e591ce5f6b3f61b787c3c12ea1d98b33dde6879461140ef9bd
4
- data.tar.gz: f77c6dbdee02fedcea41a2fe077aa71bc30c2c0dbc0630a1c09ebc90f075e4a1
3
+ metadata.gz: '09b6f546f3eb690b77a080fc028417c8790ad3c9874928b18c09c9a6d8442af4'
4
+ data.tar.gz: 94ef993434f499d638f55a030af21329c30acf2b12724d9931b4976f7284f247
5
5
  SHA512:
6
- metadata.gz: 5b9370d3e4aa2bb017e9c450651381bc3b11880bcfee9448949cdc1cb0a7c01a3bb0836112c10a32d2f9c199c687cea16a5374142e9ba5201b5c526e524b09dc
7
- data.tar.gz: fecf25f26fa787280cc22eccd13deeee4dd554a36ee23e347149bc4e6d34b6a5eab623b8454d6ad0b6ad685e06e47cf8d45625ee015b033a1ed115ffb931e181
6
+ metadata.gz: 2799a356598f7f85b1ed831497bee8ce1957148a91ddf4615420c18b4de869f5a1cbaeca9b4d8d4c141ef5f4535e1bb3d1e9f5845458d7c1842bb78c570911ac
7
+ data.tar.gz: 6a9d199e7cd6e00513cbd75879be61e33b707f422d777f8421764ba14c0e5cabb321a04128eef94cfc8a13c79f3d276f1698e73306b0432662660785d82f14e3
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ - 0.18.0.pre1 - 06-02-2025
2
+ - Updated to node 23.6.1.0
3
+
1
4
  - 0.17.0.pre13 - 04-02-2025
2
5
  - Only issue idle GC once post dispatch - reduces CPU usage for auto cleanup - Sam Saffron
3
6
 
data/README.md CHANGED
@@ -97,19 +97,6 @@ context.eval("var a = new Array(10000); while(true) {a = a.concat(new Array(1000
97
97
  # => V8OutOfMemoryError is raised
98
98
  ```
99
99
 
100
- ### Object marshal max Stack Ddepth Support
101
-
102
- Contexts can specify a stack depth limit for object marshalling. Max depth is unbounded by default.
103
-
104
- ```ruby
105
- # terminates script if stack depth exceeds max during marshal
106
- context = MiniRacer::Context.new(marshal_stack_depth: 500)
107
- context.attach("a", proc{|a| a})
108
-
109
- context.eval("let arr = []; arr.push(arr); a(arr)")
110
- # => RuntimeError is raised
111
- ```
112
-
113
100
  ### Rich Debugging with File Name in Stack Trace Support
114
101
 
115
102
  You can provide `filename:` to `#eval` which will be used in stack traces produced by V8:
@@ -208,25 +195,7 @@ context.eval("counter")
208
195
 
209
196
  ### Garbage collection
210
197
 
211
- Re-using the same context over and over again means V8's garbage collector will have to run to clean it up every now and then; it's possible to trigger a _blocking_ V8 GC run inside your context by running the `idle_notification` method on it, which takes a single argument: the amount of time (in milliseconds) that V8 should use at most for garbage collecting:
212
-
213
- ```ruby
214
- context = MiniRacer::Context.new
215
-
216
- # do stuff with that context...
217
-
218
- # give up to 100ms for V8 garbage collection
219
- context.idle_notification(100)
220
-
221
- # force V8 to perform a full GC
222
- context.low_memory_notification
223
- ```
224
-
225
- This can come in handy to force V8 GC runs for example in between requests if you use MiniRacer on a web application.
226
-
227
- Note that this method maps directly to [`v8::Isolate::IdleNotification`](http://bespin.cz/~ondras/html/classv8_1_1Isolate.html#aea16cbb2e351de9a3ae7be2b7cb48297), and that in particular its return value is the same (true if there is no further garbage to collect, false otherwise) and the same caveats apply, in particular that `there is no guarantee that the [call will return] within the time limit.`
228
-
229
- Additionally you may automate this process on a context by defining it with `MiniRacer::Context.new(ensure_gc_after_idle: 1000)`. Using this will ensure V8 will run a full GC using `context.low_memory_notification` 1 second after the last eval on the context. Low memory notification is both slower and more aggressive than an idle_notification and will ensure long living contexts use minimal amounts of memory.
198
+ You can make the garbage collector more aggressive by defining the context with `MiniRacer::Context.new(ensure_gc_after_idle: 1000)`. Using this will ensure V8 will run a full GC using `context.low_memory_notification` 1 second after the last eval on the context. Low memory notifications ensure long living contexts use minimal amounts of memory.
230
199
 
231
200
  ### V8 Runtime flags
232
201
 
@@ -395,7 +364,8 @@ Or install it yourself as:
395
364
  $ gem install mini_racer
396
365
  ```
397
366
 
398
- **Note** using v8.h and compiling MiniRacer requires a C++11 standard compiler, more specifically clang 3.5 (or later) or GCC 6.3 (or later).
367
+ **Note** using v8.h and compiling MiniRacer requires a C++20 capable compiler.
368
+ gcc >= 12.2 and Xcode >= 13 are, at the time of writing, known to work.
399
369
 
400
370
  ## Similar Projects
401
371
 
@@ -19,7 +19,7 @@ $CXXFLAGS += " -Wall" unless $CXXFLAGS.split.include? "-Wall"
19
19
  $CXXFLAGS += " -g" unless $CXXFLAGS.split.include? "-g"
20
20
  $CXXFLAGS += " -rdynamic" unless $CXXFLAGS.split.include? "-rdynamic"
21
21
  $CXXFLAGS += " -fPIC" unless $CXXFLAGS.split.include? "-rdynamic" or IS_DARWIN
22
- $CXXFLAGS += " -std=c++17"
22
+ $CXXFLAGS += " -std=c++20"
23
23
  $CXXFLAGS += " -fpermissive"
24
24
  $CXXFLAGS += " -fno-rtti"
25
25
  $CXXFLAGS += " -fno-exceptions"
@@ -47,28 +47,6 @@ if ENV['CXX']
47
47
  CONFIG['CXX'] = ENV['CXX']
48
48
  end
49
49
 
50
- CXX11_TEST = <<EOS
51
- #if __cplusplus <= 199711L
52
- # error A compiler that supports at least C++11 is required in order to compile this project.
53
- #endif
54
- EOS
55
-
56
- `echo "#{CXX11_TEST}" | #{CONFIG['CXX']} -std=c++0x -x c++ -E -`
57
- unless $?.success?
58
- warn <<EOS
59
-
60
-
61
- WARNING: C++11 support is required for compiling mini_racer. Please make sure
62
- you are using a compiler that supports at least C++11. Examples of such
63
- compilers are GCC 4.7+ and Clang 3.2+.
64
-
65
- If you are using Travis, consider either migrating your build to Ubuntu Trusty or
66
- installing GCC 4.8. See mini_racer's README.md for more information.
67
-
68
-
69
- EOS
70
- end
71
-
72
50
  CONFIG['LDSHARED'] = '$(CXX) -shared' unless IS_DARWIN
73
51
  if CONFIG['warnflags']
74
52
  CONFIG['warnflags'].gsub!('-Wdeclaration-after-statement', '')
@@ -703,7 +703,6 @@ static void dispatch1(Context *c, const uint8_t *p, size_t n)
703
703
  case 'C': return v8_timedwait(c, p+1, n-1, v8_call);
704
704
  case 'E': return v8_timedwait(c, p+1, n-1, v8_eval);
705
705
  case 'H': return v8_heap_snapshot(c->pst);
706
- case 'I': return v8_idle_notification(c->pst, p+1, n-1);
707
706
  case 'P': return v8_pump_message_loop(c->pst);
708
707
  case 'S': return v8_heap_stats(c->pst);
709
708
  case 'T': return v8_snapshot(c->pst, p+1, n-1);
@@ -1301,20 +1300,6 @@ static VALUE context_pump_message_loop(VALUE self)
1301
1300
  return rendezvous(c, &b); // takes ownership of |b|
1302
1301
  }
1303
1302
 
1304
- static VALUE context_idle_notification(VALUE self, VALUE arg)
1305
- {
1306
- Context *c;
1307
- Ser s;
1308
-
1309
- Check_Type(arg, T_FIXNUM);
1310
- TypedData_Get_Struct(self, Context, &context_type, c);
1311
- // request is (I)dle notification, idle_time_in_seconds
1312
- ser_init1(&s, 'I');
1313
- ser_num(&s, LONG2FIX(arg) / 1e3);
1314
- // response is |undefined|
1315
- return rendezvous(c, &s.b); // takes ownership of |s.b|
1316
- }
1317
-
1318
1303
  static VALUE context_low_memory_notification(VALUE self)
1319
1304
  {
1320
1305
  Buf req, res;
@@ -1638,7 +1623,6 @@ void Init_mini_racer_extension(void)
1638
1623
  rb_define_method(c, "heap_stats", context_heap_stats, 0);
1639
1624
  rb_define_method(c, "heap_snapshot", context_heap_snapshot, 0);
1640
1625
  rb_define_method(c, "pump_message_loop", context_pump_message_loop, 0);
1641
- rb_define_method(c, "idle_notification", context_idle_notification, 1);
1642
1626
  rb_define_method(c, "low_memory_notification", context_low_memory_notification, 0);
1643
1627
  rb_define_alloc_func(c, context_alloc);
1644
1628
 
@@ -834,26 +834,6 @@ fail:
834
834
  }
835
835
  }
836
836
 
837
- extern "C" void v8_idle_notification(State *pst, const uint8_t *p, size_t n)
838
- {
839
- State& st = *pst;
840
- v8::TryCatch try_catch(st.isolate);
841
- v8::HandleScope handle_scope(st.isolate);
842
- v8::ValueDeserializer des(st.isolate, p, n);
843
- des.ReadHeader(st.context).Check();
844
- double idle_time_in_seconds = .01;
845
- {
846
- v8::Local<v8::Value> idle_time_in_seconds_v;
847
- if (!des.ReadValue(st.context).ToLocal(&idle_time_in_seconds_v)) goto fail;
848
- if (!idle_time_in_seconds_v->NumberValue(st.context).To(&idle_time_in_seconds)) goto fail;
849
- }
850
- fail:
851
- double now = platform->MonotonicallyIncreasingTime();
852
- bool stop = st.isolate->IdleNotificationDeadline(now + idle_time_in_seconds);
853
- auto result = v8::Boolean::New(st.isolate, stop);
854
- if (!reply(st, result)) abort();
855
- }
856
-
857
837
  extern "C" void v8_low_memory_notification(State *pst)
858
838
  {
859
839
  pst->isolate->LowMemoryNotification();
@@ -45,7 +45,6 @@ void v8_heap_snapshot(struct State *pst);
45
45
  void v8_pump_message_loop(struct State *pst);
46
46
  void v8_snapshot(struct State *pst, const uint8_t *p, size_t n);
47
47
  void v8_warmup(struct State *pst, const uint8_t *p, size_t n);
48
- void v8_idle_notification(struct State *pst, const uint8_t *p, size_t n);
49
48
  void v8_low_memory_notification(struct State *pst);
50
49
  void v8_terminate_execution(struct State *pst); // called from ruby or watchdog thread
51
50
  void v8_single_threaded_enter(struct State *pst, struct Context *c, void (*f)(struct Context *c));
@@ -67,10 +67,6 @@ module MiniRacer
67
67
  GC.start
68
68
  end
69
69
 
70
- def idle_notification(idle_time)
71
- true
72
- end
73
-
74
70
  private
75
71
 
76
72
  @context_initialized = false
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MiniRacer
4
- VERSION = "0.17.0.pre13"
5
- LIBV8_NODE_VERSION = "~> 22.7.0.4"
4
+ VERSION = "0.18.0.pre1"
5
+ LIBV8_NODE_VERSION = "~> 23.6.1.0"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_racer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0.pre13
4
+ version: 0.18.0.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-04 00:00:00.000000000 Z
11
+ date: 2025-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 22.7.0.4
89
+ version: 23.6.1.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 22.7.0.4
96
+ version: 23.6.1.0
97
97
  description: Minimal embedded v8 engine for Ruby
98
98
  email:
99
99
  - sam.saffron@gmail.com
@@ -123,9 +123,9 @@ licenses:
123
123
  - MIT
124
124
  metadata:
125
125
  bug_tracker_uri: https://github.com/discourse/mini_racer/issues
126
- changelog_uri: https://github.com/discourse/mini_racer/blob/v0.17.0.pre13/CHANGELOG
127
- documentation_uri: https://www.rubydoc.info/gems/mini_racer/0.17.0.pre13
128
- source_code_uri: https://github.com/discourse/mini_racer/tree/v0.17.0.pre13
126
+ changelog_uri: https://github.com/discourse/mini_racer/blob/v0.18.0.pre1/CHANGELOG
127
+ documentation_uri: https://www.rubydoc.info/gems/mini_racer/0.18.0.pre1
128
+ source_code_uri: https://github.com/discourse/mini_racer/tree/v0.18.0.pre1
129
129
  post_install_message:
130
130
  rdoc_options: []
131
131
  require_paths: