mini_racer 0.16.0 → 0.18.1

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: ace23a02267bc807c215b38f85932cb51c8f273fed081606f1569d275776c557
4
- data.tar.gz: 872d4c4d33cf6300ef60b1c30cc4dbef7471bd23c2fa4712af95a9bdeb5f981d
3
+ metadata.gz: d136b28eba55fb9518691cd3dc38a0e95af3171d6d1796c7e892ce411023cfe6
4
+ data.tar.gz: '07829f6048ef890b28574629b94f0371f441fcef176cb3c70c78da266280dd1f'
5
5
  SHA512:
6
- metadata.gz: 0f68505f506845f4e6ef96a742ad718d18eea828ec48bd73afe6ad776191c1019430db75b13bdbbe5dbc492b301dd84d47db20ce6eed3754a3316ba018b85797
7
- data.tar.gz: dee926b81aa7c45144786078b62b5de97700a7a3076dc20359865ee3ab91c5f6063aa5df3ca5e3039a0a95e08a11bf0ea6cd034b87dc32dbb16900c99d7e757e
6
+ metadata.gz: a0a80d3d34ba093a39f95fea716048c448800515667a426558fe00d6ffbd70614a375b64c2be923750d57e868c01a959c4396ab5c9afd25e0caefd2816ca4a82
7
+ data.tar.gz: a3d7655f8f1ec369a1f279f8d983098d4f8fac381e6404116a0d72133e32a06f8c99309001d33628a440085b7b36079bcba318ae6dedd1a1eff0f381e6b8b9d4
data/CHANGELOG CHANGED
@@ -1,3 +1,64 @@
1
+ - 0.18.1 - 03-04-2025
2
+ - Convert round doubles to fixnum for very big floats - this has better parity with JavaScript - Ben Noorhuis
3
+
4
+ - 0.18.0 - 05-03-2025
5
+ - Time for a major release
6
+ - Handle ActiveSupport TimeWithZone objects during serialization - Sam Saffron
7
+
8
+ - 0.18.0.pre1 - 06-02-2025
9
+ - Updated to node 23.6.1.0
10
+
11
+ - 0.17.0.pre13 - 04-02-2025
12
+ - Only issue idle GC once post dispatch - reduces CPU usage for auto cleanup - Sam Saffron
13
+
14
+ - 0.17.0.pre12 - 23-01-2025
15
+ - Corrected off-by-one error with object serialization - Ben Noordhuis
16
+
17
+ - 0.17.0.pre11 - 21-01-2025
18
+ - Corrected encoding bug with deserialization of strings - Ben Noordhuis
19
+
20
+ - 0.17.0.pre10 - 20-01-2025
21
+ - Added back support for partially deserialized objects (objects that do not translate across boundaries are returned as Error properties) - Ben Noordhuis
22
+
23
+ - 0.17.0.pre9 - 13-01-2025
24
+ - For backwards compatibility convert v8 return values to UTF-8 (invalidly encoded string still get returned using V8 encoding)
25
+
26
+ - 0.17.0.pre8 - 11-01-2025
27
+ - Fix handling of UTF 32 LE and Ascii encoding strings - Ben Noordhuis
28
+ - Handle rare edge case in V8 serialization - Ben Noordhuis
29
+
30
+ - 0.17.0.pre7 - 10-01-2025
31
+
32
+ - Objects containing non serializable properties will return an Error object vs raising an exception. Ben Noordhuis
33
+ - Truffle support was added back Eregon
34
+
35
+ - 0.17.0.pre6 - 08-01-2025
36
+
37
+ - Moved all mini_racer interaction with v8 to a dedicated native thread to avoid cross VM stack contamination. Ben Noordhuis
38
+
39
+ - 0.17.0.pre5 - 30-09-2024
40
+
41
+ - Handle segfault from JSON.stringify
42
+ - Fix segfaults around symbol conversion
43
+ - Fix crash on invalid date object
44
+
45
+
46
+ - 0.17.0.pre4 - 18-09-2024
47
+
48
+ - Attempt to change compilation flags to disable strict aliasing to see if it resolves stability issues
49
+
50
+ - 0.17.0.pre3 - 15-09-2024
51
+
52
+ - Text clang based Linux v8 build, in case there is an edge case with GCC compilation
53
+
54
+ - 0.17.0.pre2 - 09-09-2024
55
+
56
+ - Test build to see if disabling Maglev optimisations resolves segfault issues
57
+
58
+ - 0.17.0.pre - 05-09-2024
59
+
60
+ - Test build to see if disabling concurrent GC marking resolves segfault
61
+
1
62
  - 0.16.0 - 05-09-2024
2
63
 
3
64
  - Sadly still seeing segfaults, reverted back 18.19.0.0
data/README.md CHANGED
@@ -12,9 +12,12 @@ MiniRacer has an adapter for [execjs](https://github.com/rails/execjs) so it can
12
12
 
13
13
  ## Supported Ruby Versions & Troubleshooting
14
14
 
15
- MiniRacer only supports non-EOL versions of Ruby. See [Ruby Maintenance Branches](https://www.ruby-lang.org/en/downloads/branches/) for the list of non-EOL Rubies. If you require support for older versions of Ruby install an older version of the gem.
15
+ MiniRacer only supports non-EOL versions of Ruby. See [Ruby Maintenance Branches](https://www.ruby-lang.org/en/downloads/branches/) for the list of non-EOL Rubies. If you require support for older versions of Ruby install an older version of the gem. [TruffleRuby](https://github.com/oracle/truffleruby) is also supported.
16
16
 
17
- MiniRacer **does not support** [Ruby built on MinGW](https://github.com/rubyjs/mini_racer/issues/252#issuecomment-1201172236), "pure windows" no Cygwin, no WSL2 (see https://github.com/rubyjs/libv8-node/issues/9).
17
+ MiniRacer **does not support**
18
+
19
+ * [Ruby built on MinGW](https://github.com/rubyjs/mini_racer/issues/252#issuecomment-1201172236), "pure windows" no Cygwin, no WSL2 (see https://github.com/rubyjs/libv8-node/issues/9)
20
+ * [JRuby](https://www.jruby.org)
18
21
 
19
22
  If you have a problem installing MiniRacer, please consider the following steps:
20
23
 
@@ -94,19 +97,6 @@ context.eval("var a = new Array(10000); while(true) {a = a.concat(new Array(1000
94
97
  # => V8OutOfMemoryError is raised
95
98
  ```
96
99
 
97
- ### Object marshal max Stack Ddepth Support
98
-
99
- Contexts can specify a stack depth limit for object marshalling. Max depth is unbounded by default.
100
-
101
- ```ruby
102
- # terminates script if stack depth exceeds max during marshal
103
- context = MiniRacer::Context.new(marshal_stack_depth: 500)
104
- context.attach("a", proc{|a| a})
105
-
106
- context.eval("let arr = []; arr.push(arr); a(arr)")
107
- # => RuntimeError is raised
108
- ```
109
-
110
100
  ### Rich Debugging with File Name in Stack Trace Support
111
101
 
112
102
  You can provide `filename:` to `#eval` which will be used in stack traces produced by V8:
@@ -203,58 +193,9 @@ context.eval("counter")
203
193
  # => 1
204
194
  ```
205
195
 
206
- ### Shared isolates
207
-
208
- By default, MiniRacer's contexts each have their own isolate (V8 runtime). For efficiency, it is possible to re-use an isolate across contexts:
209
-
210
- ```ruby
211
- isolate = MiniRacer::Isolate.new
212
-
213
- context1 = MiniRacer::Context.new(isolate: isolate)
214
- context2 = MiniRacer::Context.new(isolate: isolate)
215
-
216
- context1.isolate == context2.isolate
217
- # => true
218
- ```
219
-
220
- The main benefit of this is avoiding creating/destroying isolates when not needed (for example if you use a lot of contexts).
221
-
222
- The caveat with this is that a given isolate can only execute one context at a time, so don't share isolates across contexts that you want to run concurrently.
223
-
224
- Also, note that if you want to use shared isolates together with snapshots, you need to first create an isolate with that snapshot, and then create contexts from that isolate:
225
-
226
- ```ruby
227
- snapshot = MiniRacer::Snapshot.new("function hello() { return 'world!'; }")
228
-
229
- isolate = MiniRacer::Isolate.new(snapshot)
230
-
231
- context = MiniRacer::Context.new(isolate: isolate)
232
-
233
- context.eval("hello()")
234
- # => "world!"
235
- ```
236
-
237
- Re-using the same isolate 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 isolate 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:
238
-
239
- ```ruby
240
- isolate = MiniRacer::Isolate.new
241
-
242
- context = MiniRacer::Context.new(isolate: isolate)
243
-
244
- # do stuff with that context...
245
-
246
- # give up to 100ms for V8 garbage collection
247
- isolate.idle_notification(100)
248
-
249
- # force V8 to perform a full GC
250
- isolate.low_memory_notification
251
- ```
252
-
253
- This can come in handy to force V8 GC runs for example in between requests if you use MiniRacer on a web application.
254
-
255
- 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.`
196
+ ### Garbage collection
256
197
 
257
- Additionally you may automate this process on a context by defining it with `MiniRacer::Content.new(ensure_gc_after_idle: 1000)`. Using this will ensure V8 will run a full GC using `context.isolate.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 isolates 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.
258
199
 
259
200
  ### V8 Runtime flags
260
201
 
@@ -298,7 +239,7 @@ Please refer to http://node.green/ as a reference on other harmony features.
298
239
 
299
240
  A list of all V8 runtime flags can be found using `node --v8-options`, or else by perusing [the V8 source code for flags (make sure to use the right version of V8)](https://github.com/v8/v8/blob/master/src/flags/flag-definitions.h).
300
241
 
301
- Note that runtime flags must be set before any other operation (e.g. creating a context, a snapshot or an isolate), otherwise an exception will be thrown.
242
+ Note that runtime flags must be set before any other operation (e.g. creating a context or a snapshot), otherwise an exception will be thrown.
302
243
 
303
244
  Flags:
304
245
 
@@ -423,7 +364,8 @@ Or install it yourself as:
423
364
  $ gem install mini_racer
424
365
  ```
425
366
 
426
- **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.
427
369
 
428
370
  ## Similar Projects
429
371
 
@@ -1,5 +1,7 @@
1
1
  require 'mkmf'
2
2
 
3
+ $srcs = ["mini_racer_extension.c", "mini_racer_v8.cc"]
4
+
3
5
  if RUBY_ENGINE == "truffleruby"
4
6
  File.write("Makefile", dummy_makefile($srcdir).join(""))
5
7
  return
@@ -17,8 +19,11 @@ $CXXFLAGS += " -Wall" unless $CXXFLAGS.split.include? "-Wall"
17
19
  $CXXFLAGS += " -g" unless $CXXFLAGS.split.include? "-g"
18
20
  $CXXFLAGS += " -rdynamic" unless $CXXFLAGS.split.include? "-rdynamic"
19
21
  $CXXFLAGS += " -fPIC" unless $CXXFLAGS.split.include? "-rdynamic" or IS_DARWIN
20
- $CXXFLAGS += " -std=c++17"
22
+ $CXXFLAGS += " -std=c++20"
21
23
  $CXXFLAGS += " -fpermissive"
24
+ $CXXFLAGS += " -fno-rtti"
25
+ $CXXFLAGS += " -fno-exceptions"
26
+ $CXXFLAGS += " -fno-strict-aliasing"
22
27
  #$CXXFLAGS += " -DV8_COMPRESS_POINTERS"
23
28
  $CXXFLAGS += " -fvisibility=hidden "
24
29
 
@@ -42,28 +47,6 @@ if ENV['CXX']
42
47
  CONFIG['CXX'] = ENV['CXX']
43
48
  end
44
49
 
45
- CXX11_TEST = <<EOS
46
- #if __cplusplus <= 199711L
47
- # error A compiler that supports at least C++11 is required in order to compile this project.
48
- #endif
49
- EOS
50
-
51
- `echo "#{CXX11_TEST}" | #{CONFIG['CXX']} -std=c++0x -x c++ -E -`
52
- unless $?.success?
53
- warn <<EOS
54
-
55
-
56
- WARNING: C++11 support is required for compiling mini_racer. Please make sure
57
- you are using a compiler that supports at least C++11. Examples of such
58
- compilers are GCC 4.7+ and Clang 3.2+.
59
-
60
- If you are using Travis, consider either migrating your build to Ubuntu Trusty or
61
- installing GCC 4.8. See mini_racer's README.md for more information.
62
-
63
-
64
- EOS
65
- end
66
-
67
50
  CONFIG['LDSHARED'] = '$(CXX) -shared' unless IS_DARWIN
68
51
  if CONFIG['warnflags']
69
52
  CONFIG['warnflags'].gsub!('-Wdeclaration-after-statement', '')