-
-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into truffle-head
- 9.4.12.0
- 9.4.11.0
- 9.4.10.0
- 9.4.9.0
- 9.4.8.0
- 9.4.7.0
- 9.4.6.0
- 9.4.5.0
- 9.4.4.0
- 9.4.3.0
- 9.4.2.0
- 9.4.1.0
- 9.4.0.0
- 9.3.15.0
- 9.3.14.0
- 9.3.13.0
- 9.3.12.0
- 9.3.11.0
- 9.3.10.0
- 9.3.9.0
- 9.3.8.0
- 9.3.7.0
- 9.3.6.0
- 9.3.5.0
- 9.3.4.0
- 9.3.3.0
- 9.3.2.0
- 9.3.1.0
- 9.3.0.0
- 9.2.21.0
- 9.2.20.1
- 9.2.20.0
- 9.2.19.0
- 9.2.18.0
- 9.2.17.0
- 9.2.16.0
- 9.2.15.0
- 9.2.14.0
- 9.2.13.0
- 9.2.12.0
- 9.2.11.1
- 9.2.11.0
- 9.2.10.0
- 9.2.9.0
- 9.2.8.0
- 9.2.7.0
- 9.2.6.0
- 9.2.5.0
- 9.2.4.1
- 9.2.4.0
- 9.2.3.0
- 9.2.2.0
- 9.2.1.0
- 9.2.0.0
- 9.1.17.0
- 9.1.16.0
- 9.1.15.0
- 9.1.14.0
- 9.1.13.0
- 9.1.12.0
- 9.1.11.0
- 9.1.10.0
- 9.1.9.0
- 9.1.8.0
- 9.1.7.0
- 9.1.6.0
- 9.1.5.0
- 9.1.4.0
- 9.1.3.0
- 9.1.2.0
- 9.1.1.0
- 9.1.0.0
Showing
13 changed files
with
330 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
# Designed for ExecJS 2.6.0, but I'll allow it to try to work with anything for now | ||
|
||
require 'execjs/runtime' | ||
require 'json' | ||
|
||
module ExecJS | ||
|
||
class TruffleRuntime < Runtime | ||
|
||
JS_MIME_TYPE = 'application/javascript' | ||
|
||
class Context < Runtime::Context | ||
|
||
STRINGIFY = Truffle::Interop.eval(JS_MIME_TYPE, 'JSON.stringify') | ||
PARSE = Truffle::Interop.eval(JS_MIME_TYPE, 'JSON.parse') | ||
|
||
def initialize(runtime, source = '') | ||
exec source | ||
end | ||
|
||
def exec(source, options = {}) | ||
Truffle::Interop.eval JS_MIME_TYPE, source | ||
nil | ||
end | ||
|
||
def eval(source, options = {}) | ||
unbox(Truffle::Interop.eval(JS_MIME_TYPE, source)) | ||
end | ||
|
||
def call(identifier, *args) | ||
function = Truffle::Interop.eval(JS_MIME_TYPE, identifier) | ||
unbox(function.call(function, *args.map { |arg| box(arg) })) | ||
end | ||
|
||
private | ||
|
||
def unbox(value) | ||
if Truffle::Interop.boxed_primitive?(value) | ||
Truffle::Interop.unbox_value(value) | ||
else | ||
JSON.parse(Truffle::Interop.java_string_to_ruby(STRINGIFY.call(STRINGIFY, value))) | ||
end | ||
end | ||
|
||
def box(value) | ||
if Truffle::Interop.boxed_primitive?(value) || value.is_a?(String) | ||
value | ||
else | ||
PARSE.call(PARSE, JSON.generate(value)) | ||
end | ||
end | ||
|
||
end | ||
|
||
def name | ||
'Truffle' | ||
end | ||
|
||
def available? | ||
defined?(Truffle::Interop) && Truffle::Interop.eval(JS_MIME_TYPE, 'true') | ||
rescue RubyTruffleError | ||
false | ||
end | ||
|
||
end | ||
|
||
# Monkey patches | ||
|
||
module Runtimes | ||
|
||
@runtimes = nil | ||
|
||
class << self | ||
|
||
alias_method :original_runtimes, :runtimes | ||
|
||
def runtimes | ||
@runtimes ||= ([TruffleRuntime.new] + original_runtimes) | ||
end | ||
|
||
end | ||
|
||
end | ||
|
||
self.runtime = Runtimes.autodetect | ||
|
||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
critical(JRUBY-3749):BigDecimal.new doesn't segfault when using a very large string to build the number | ||
fails:BigDecimal.new creates a new object of class BigDecimal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# Run with for example JRUBY_OPTS='-J-cp ..../trufflejs.jar' | ||
|
||
if [[ $JRUBY_OPTS != *"trufflejs.jar"* ]] | ||
then | ||
echo 'No trufflejs.jar found in $JRUBY_OPTS - skipping ExecJS integration test' | ||
exit 0 | ||
fi | ||
|
||
bin/jruby -X-T bin/gem install execjs -v 2.6.0 | ||
ruby -X+T -Ilib/ruby/gems/shared/gems/execjs-2.6.0/lib test/truffle/integration/execjs/checkruntime.rb | ||
ruby -X+T -Ilib/ruby/gems/shared/gems/execjs-2.6.0/lib test/truffle/integration/execjs/simple.rb | ||
ruby -X+T -Ilib/ruby/gems/shared/gems/execjs-2.6.0/lib test/truffle/integration/execjs/coffeescript.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require 'execjs' | ||
require 'truffle/execjs' | ||
|
||
exit 1 unless ExecJS.runtime.name == 'Truffle' |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Example from the ExecJS README.md | ||
|
||
# Copyright (c) 2015-2016 Sam Stephenson | ||
# Copyright (c) 2015-2016 Josh Peek | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining | ||
# a copy of this software and associated documentation files (the | ||
# "Software"), to deal in the Software without restriction, including | ||
# without limitation the rights to use, copy, modify, merge, publish, | ||
# distribute, sublicense, and/or sell copies of the Software, and to | ||
# permit persons to whom the Software is furnished to do so, subject to | ||
# the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be | ||
# included in all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
require "execjs" | ||
require "truffle/execjs" | ||
|
||
# Not using the remote file as we can't inflate the data it gives us at the moment | ||
#require "open-uri" | ||
source = File.read(File.join(File.dirname(__FILE__), 'coffeescript.js')) # open("http://coffeescript.org/extras/coffee-script.js").read | ||
|
||
context = ExecJS.compile(source) | ||
exit 1 unless context.call("CoffeeScript.compile", "square = (x) -> x * x", bare: true) == "var square;\n\nsquare = function(x) {\n return x * x;\n};\n" | ||
# => "var square;\nsquare = function(x) {\n return x * x;\n};" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Example from the ExecJS README.md | ||
|
||
# Copyright (c) 2015-2016 Sam Stephenson | ||
# Copyright (c) 2015-2016 Josh Peek | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining | ||
# a copy of this software and associated documentation files (the | ||
# "Software"), to deal in the Software without restriction, including | ||
# without limitation the rights to use, copy, modify, merge, publish, | ||
# distribute, sublicense, and/or sell copies of the Software, and to | ||
# permit persons to whom the Software is furnished to do so, subject to | ||
# the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be | ||
# included in all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
require "execjs" | ||
require "truffle/execjs" | ||
exit 1 unless ExecJS.eval("'red yellow blue'.split(' ')") == ["red", "yellow", "blue"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters