jbarnette-johnson 1.0.0.20090326161333 → 1.0.0.20090402144841
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +8 -3
- data/Rakefile +1 -0
- data/ext/spidermonkey/runtime.c +36 -12
- data/johnson.gemspec +5 -5
- data/lib/johnson/runtime.rb +1 -1
- data/lib/johnson/spidermonkey/runtime.rb +9 -0
- data/lib/tasks/testing.rake +8 -8
- data/vendor/spidermonkey/Makefile.in +0 -13
- data/vendor/spidermonkey/Makefile.ref +1 -0
- data/vendor/spidermonkey/config.mk +0 -4
- data/vendor/spidermonkey/fdlibm/fdlibm.mak +1453 -1453
- data/vendor/spidermonkey/js.msg +1 -0
- data/vendor/spidermonkey/jsapi.c +1 -1
- data/vendor/spidermonkey/jsarray.c +38 -30
- data/vendor/spidermonkey/jsarray.h +3 -0
- data/vendor/spidermonkey/jscpucfg.c +14 -1
- data/vendor/spidermonkey/jsdate.c +17 -25
- data/vendor/spidermonkey/jsdbgapi.c +6 -3
- data/vendor/spidermonkey/jsgc.c +10 -2
- data/vendor/spidermonkey/jsinterp.c +77 -51
- data/vendor/spidermonkey/jsinterp.h +5 -1
- data/vendor/spidermonkey/jsmath.c +1 -2
- data/vendor/spidermonkey/jsnum.c +19 -8
- data/vendor/spidermonkey/jsobj.c +27 -11
- data/vendor/spidermonkey/jsopcode.c +1 -1
- data/vendor/spidermonkey/jsparse.c +33 -9
- data/vendor/spidermonkey/jsregexp.c +15 -3
- data/vendor/spidermonkey/jsscan.c +142 -133
- data/vendor/spidermonkey/jsscope.c +12 -3
- data/vendor/spidermonkey/jsscope.h +2 -2
- data/vendor/spidermonkey/jsstr.c +5 -4
- data/vendor/spidermonkey/jsxml.c +82 -77
- metadata +3 -3
- data/MINGW32.mk +0 -124
- data/vendor/spidermonkey/config/FreeBSD.mk +0 -103
- data/vendor/spidermonkey/js.mak +0 -4438
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
-
=== 1.
|
1
|
+
=== 1.1.0 (pending)
|
2
2
|
|
3
|
-
*
|
4
|
-
|
3
|
+
* First real/RubyForge release!
|
4
|
+
* Cleaned up the build.
|
5
|
+
* Updated to a more recent SpiderMonkey.
|
6
|
+
* Fixed allocation-during-GC bugs.
|
5
7
|
|
8
|
+
=== 1.0.0 (2008-03-11)
|
9
|
+
|
10
|
+
* Birthday!
|
data/Rakefile
CHANGED
@@ -21,6 +21,7 @@ HOE = Hoe.new "johnson", Johnson::VERSION do |p|
|
|
21
21
|
p.clean_globs << "lib/johnson/spidermonkey.bundle"
|
22
22
|
p.clean_globs << "tmp"
|
23
23
|
p.clean_globs << "vendor/spidermonkey/**/*.OBJ"
|
24
|
+
p.clean_globs << "ext/**/*.{o,so,bundle,a,log}"
|
24
25
|
|
25
26
|
p.extra_deps << "rake"
|
26
27
|
p.extra_dev_deps << "rake-compiler"
|
data/ext/spidermonkey/runtime.c
CHANGED
@@ -30,6 +30,30 @@ static JSTrapStatus trap_handler( JSContext *UNUSED(context),
|
|
30
30
|
return JSTRAP_CONTINUE;
|
31
31
|
}
|
32
32
|
|
33
|
+
/*
|
34
|
+
* call-seq:
|
35
|
+
* clear_trap(script, line_num)
|
36
|
+
*
|
37
|
+
* Set the trap at +script+ and +line_num+ to +block+
|
38
|
+
*/
|
39
|
+
static VALUE clear_trap(VALUE self, VALUE script, VALUE linenum)
|
40
|
+
{
|
41
|
+
JohnsonRuntime* runtime;
|
42
|
+
Data_Get_Struct(self, JohnsonRuntime, runtime);
|
43
|
+
|
44
|
+
JSContext * context = johnson_get_current_context(runtime);
|
45
|
+
jsval compiled_js;
|
46
|
+
if(!convert_to_js(runtime, script, &compiled_js))
|
47
|
+
rb_raise(rb_eRuntimeError, "Couldn't get compiled script.");
|
48
|
+
|
49
|
+
JSScript * js_script = (JSScript *)JS_GetPrivate(context, JSVAL_TO_OBJECT(compiled_js));
|
50
|
+
|
51
|
+
jsbytecode * pc = JS_LineNumberToPC(context, js_script, (uintN)NUM2INT(linenum));
|
52
|
+
JS_ClearTrap(context, js_script, pc, NULL, NULL);
|
53
|
+
|
54
|
+
return self;
|
55
|
+
}
|
56
|
+
|
33
57
|
/*
|
34
58
|
* call-seq:
|
35
59
|
* set_trap(script, parsecode, block)
|
@@ -228,24 +252,21 @@ initialize_native(VALUE self, VALUE UNUSED(options))
|
|
228
252
|
{
|
229
253
|
JohnsonRuntime* runtime;
|
230
254
|
Data_Get_Struct(self, JohnsonRuntime, runtime);
|
231
|
-
|
255
|
+
|
232
256
|
if ((runtime->js = JS_NewRuntime(0x100000))
|
233
257
|
&& (runtime->jsids = create_id_hash())
|
234
|
-
&& (runtime->rbids = create_id_hash())
|
235
|
-
)
|
258
|
+
&& (runtime->rbids = create_id_hash()))
|
236
259
|
{
|
237
260
|
JS_SetRuntimePrivate(runtime->js, (void *)self);
|
238
261
|
JS_SetGCCallbackRT(runtime->js, gc_callback);
|
239
262
|
|
240
263
|
JSContext* context = johnson_get_current_context(runtime);
|
241
|
-
|
242
|
-
|
243
|
-
&& (JS_AddNamedRoot(context, &(runtime->global), "runtime->global"))
|
244
|
-
) {
|
264
|
+
|
265
|
+
if (runtime->global = JS_GetGlobalObject(context))
|
245
266
|
return self;
|
246
|
-
}
|
247
267
|
}
|
248
268
|
|
269
|
+
// clean up after an initialization failure
|
249
270
|
|
250
271
|
if (runtime->rbids)
|
251
272
|
JS_HashTableDestroy(runtime->rbids);
|
@@ -270,16 +291,18 @@ JSContext* johnson_get_current_context(JohnsonRuntime * runtime)
|
|
270
291
|
|
271
292
|
static void deallocate(JohnsonRuntime* runtime)
|
272
293
|
{
|
273
|
-
|
274
|
-
|
275
|
-
|
294
|
+
// our gc callback can create ruby objects, so disable it
|
295
|
+
JS_SetGCCallbackRT(runtime->js, NULL);
|
296
|
+
|
297
|
+
JSContext *context = NULL;
|
276
298
|
JSContext *iterator = NULL;
|
277
299
|
|
278
300
|
while ((context = JS_ContextIterator(runtime->js, &iterator)) != NULL) {
|
301
|
+
JS_SetContextPrivate(iterator, NULL);
|
279
302
|
JS_DestroyContext(iterator);
|
280
303
|
iterator = NULL;
|
281
304
|
}
|
282
|
-
|
305
|
+
|
283
306
|
JS_DestroyRuntime(runtime->js);
|
284
307
|
free(runtime);
|
285
308
|
}
|
@@ -303,4 +326,5 @@ void init_Johnson_SpiderMonkey_Runtime(VALUE spidermonkey)
|
|
303
326
|
rb_define_method(klass, "evaluate_compiled_script", evaluate_compiled_script, 1);
|
304
327
|
rb_define_private_method(klass, "native_compile", native_compile, 3);
|
305
328
|
rb_define_private_method(klass, "set_trap", set_trap, 3);
|
329
|
+
rb_define_private_method(klass, "clear_trap", clear_trap, 2);
|
306
330
|
}
|
data/johnson.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{johnson}
|
5
|
-
s.version = "1.0.0.
|
5
|
+
s.version = "1.0.0.20090402144841"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["John Barnette", "Aaron Patterson", "Yehuda Katz", "Matthew Draper"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-04-02}
|
10
10
|
s.default_executable = %q{johnson}
|
11
11
|
s.description = %q{}
|
12
12
|
s.email = ["jbarnette@rubyforge.org", "aaron.patterson@gmail.com", "wycats@gmail.com", "matthew@trebex.net"]
|
@@ -30,15 +30,15 @@ Gem::Specification.new do |s|
|
|
30
30
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
31
31
|
s.add_runtime_dependency(%q<rake>, [">= 0"])
|
32
32
|
s.add_development_dependency(%q<rake-compiler>, [">= 0"])
|
33
|
-
s.add_development_dependency(%q<hoe>, [">= 1.
|
33
|
+
s.add_development_dependency(%q<hoe>, [">= 1.12.1"])
|
34
34
|
else
|
35
35
|
s.add_dependency(%q<rake>, [">= 0"])
|
36
36
|
s.add_dependency(%q<rake-compiler>, [">= 0"])
|
37
|
-
s.add_dependency(%q<hoe>, [">= 1.
|
37
|
+
s.add_dependency(%q<hoe>, [">= 1.12.1"])
|
38
38
|
end
|
39
39
|
else
|
40
40
|
s.add_dependency(%q<rake>, [">= 0"])
|
41
41
|
s.add_dependency(%q<rake-compiler>, [">= 0"])
|
42
|
-
s.add_dependency(%q<hoe>, [">= 1.
|
42
|
+
s.add_dependency(%q<hoe>, [">= 1.12.1"])
|
43
43
|
end
|
44
44
|
end
|
data/lib/johnson/runtime.rb
CHANGED
@@ -7,6 +7,7 @@ module Johnson #:nodoc:
|
|
7
7
|
@debugger = nil
|
8
8
|
@compiled_scripts = {}
|
9
9
|
@gcthings = {}
|
10
|
+
@traps = []
|
10
11
|
initialize_native(options)
|
11
12
|
self["Ruby"] = Object
|
12
13
|
end
|
@@ -42,6 +43,13 @@ module Johnson #:nodoc:
|
|
42
43
|
evaluate_compiled_script(compiled_script)
|
43
44
|
end
|
44
45
|
|
46
|
+
def evaluate_compiled script
|
47
|
+
evaluate_compiled_script(script)
|
48
|
+
@traps.each do |trap_tuple|
|
49
|
+
clear_trap(*trap_tuple)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
45
53
|
###
|
46
54
|
# Compile +script+ with +filename+ and +linenum+
|
47
55
|
def compile(script, filename=nil, linenum=nil)
|
@@ -57,6 +65,7 @@ module Johnson #:nodoc:
|
|
57
65
|
|
58
66
|
compiled_script = @compiled_scripts[filename]
|
59
67
|
set_trap(compiled_script, linenum, block)
|
68
|
+
@traps << [compiled_script, linenum]
|
60
69
|
end
|
61
70
|
|
62
71
|
class << self
|
data/lib/tasks/testing.rake
CHANGED
@@ -5,31 +5,31 @@ namespace :test do
|
|
5
5
|
VALGRIND_BASIC_OPTS = "--num-callers=50 --error-limit=no --partial-loads-ok=yes --undef-value-errors=no"
|
6
6
|
|
7
7
|
desc "run test suite under valgrind with basic ruby options"
|
8
|
-
task :valgrind => :
|
9
|
-
cmdline = "valgrind #{VALGRIND_BASIC_OPTS} #{
|
8
|
+
task :valgrind => :compile do
|
9
|
+
cmdline = "valgrind #{VALGRIND_BASIC_OPTS} ruby #{HOE.make_test_cmd}"
|
10
10
|
puts cmdline
|
11
11
|
system cmdline
|
12
12
|
end
|
13
13
|
|
14
14
|
desc "run test suite under valgrind with memory-fill ruby options"
|
15
|
-
task :valgrind_mem => :
|
15
|
+
task :valgrind_mem => :compile do
|
16
16
|
# fill malloced memory with "m" and freed memory with "f"
|
17
|
-
cmdline = "valgrind #{VALGRIND_BASIC_OPTS} --freelist-vol=100000000 --malloc-fill=6D --free-fill=66 #{
|
17
|
+
cmdline = "valgrind #{VALGRIND_BASIC_OPTS} --freelist-vol=100000000 --malloc-fill=6D --free-fill=66 ruby #{HOE.make_test_cmd}"
|
18
18
|
puts cmdline
|
19
19
|
system cmdline
|
20
20
|
end
|
21
21
|
|
22
22
|
desc "run test suite under valgrind with memory-zero ruby options"
|
23
|
-
task :valgrind_mem0 => :
|
23
|
+
task :valgrind_mem0 => :compile do
|
24
24
|
# fill malloced and freed memory with 0
|
25
|
-
cmdline = "valgrind #{VALGRIND_BASIC_OPTS} --freelist-vol=100000000 --malloc-fill=00 --free-fill=00 #{
|
25
|
+
cmdline = "valgrind #{VALGRIND_BASIC_OPTS} --freelist-vol=100000000 --malloc-fill=00 --free-fill=00 ruby #{HOE.make_test_cmd}"
|
26
26
|
puts cmdline
|
27
27
|
system cmdline
|
28
28
|
end
|
29
29
|
|
30
30
|
desc "run test suite under gdb"
|
31
|
-
task :gdb => :
|
32
|
-
cmdline = "gdb --args #{
|
31
|
+
task :gdb => :compile do
|
32
|
+
cmdline = "gdb --args ruby #{HOE.make_test_cmd}"
|
33
33
|
puts cmdline
|
34
34
|
system cmdline
|
35
35
|
end
|
@@ -411,19 +411,6 @@ endif
|
|
411
411
|
ifdef CROSS_COMPILE
|
412
412
|
# jscpucfg needs to know when it's supposed to produce a config for the target
|
413
413
|
JSCPUCFG_DEFINES = $(ACDEFINES)
|
414
|
-
|
415
|
-
# This is incredibly hacky. Darwin NSPR uses the same MDCPUCFG for multiple
|
416
|
-
# processors, and determines which processor to configure for based on
|
417
|
-
# #ifdef i386. This macro is among the NSPR defines, but is also automatically
|
418
|
-
# defined by the compiler when building for i386. It therefore needs to be
|
419
|
-
# defined here if targeting i386, and explicitly undefined otherwise.
|
420
|
-
ifeq ($(OS_ARCH),Darwin)
|
421
|
-
ifeq ($(TARGET_CPU),powerpc)
|
422
|
-
JSCPUCFG_DEFINES += -Ui386
|
423
|
-
else
|
424
|
-
JSCPUCFG_DEFINES += -Di386=1
|
425
|
-
endif
|
426
|
-
endif
|
427
414
|
endif
|
428
415
|
|
429
416
|
ifeq ($(OS_ARCH),QNX)
|
@@ -94,9 +94,6 @@ endif
|
|
94
94
|
ifeq ($(OS_ARCH),Linux)
|
95
95
|
OS_CONFIG := Linux_All
|
96
96
|
else
|
97
|
-
ifeq ($(OS_ARCH),FreeBSD)
|
98
|
-
OS_CONFIG := FreeBSD
|
99
|
-
else
|
100
97
|
ifeq ($(OS_ARCH),dgux)
|
101
98
|
OS_CONFIG := dgux
|
102
99
|
else
|
@@ -107,7 +104,6 @@ OS_CONFIG := $(OS_ARCH)$(OS_OBJTYPE)$(OS_RELEASE)
|
|
107
104
|
endif
|
108
105
|
endif
|
109
106
|
endif
|
110
|
-
endif
|
111
107
|
|
112
108
|
ASFLAGS =
|
113
109
|
DEFINES =
|