furnace-avm2 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/bin/furnace-avm2 +5 -1
- data/bin/furnace-avm2-decompiler +80 -13
- data/bin/furnace-avm2-shell +32 -0
- data/furnace-avm2.gemspec +1 -1
- data/lib/furnace-avm2/abc.rb +1 -7
- data/lib/furnace-avm2/abc/metadata/file.rb +65 -0
- data/lib/furnace-avm2/abc/metadata/instance_info.rb +17 -11
- data/lib/furnace-avm2/abc/metadata/metadata_info.rb +14 -4
- data/lib/furnace-avm2/abc/metadata/method_body_info.rb +11 -3
- data/lib/furnace-avm2/abc/metadata/method_info.rb +3 -4
- data/lib/furnace-avm2/abc/metadata/multiname_kind_genericname.rb +3 -2
- data/lib/furnace-avm2/abc/metadata/multiname_kind_multiname.rb +11 -2
- data/lib/furnace-avm2/abc/metadata/multiname_kind_multinamel.rb +4 -0
- data/lib/furnace-avm2/abc/metadata/multiname_kind_qname.rb +10 -2
- data/lib/furnace-avm2/abc/metadata/multiname_kind_rtqname.rb +4 -0
- data/lib/furnace-avm2/abc/metadata/multiname_kind_rtqnamel.rb +4 -0
- data/lib/furnace-avm2/abc/metadata/script_info.rb +11 -7
- data/lib/furnace-avm2/abc/metadata/trait_class.rb +2 -2
- data/lib/furnace-avm2/abc/metadata/trait_info.rb +1 -1
- data/lib/furnace-avm2/abc/metadata/trait_method.rb +4 -3
- data/lib/furnace-avm2/abc/metadata/trait_slot.rb +2 -2
- data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_extend_1.rb +8 -0
- data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_extend_16.rb +8 -0
- data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_extend_8.rb +8 -0
- data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_load_float32.rb +8 -0
- data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_load_float64.rb +8 -0
- data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_load_int16.rb +8 -0
- data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_load_int32.rb +8 -0
- data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_load_int8.rb +8 -0
- data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_store_float32.rb +8 -0
- data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_store_float64.rb +8 -0
- data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_store_int16.rb +8 -0
- data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_store_int32.rb +8 -0
- data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_store_int8.rb +8 -0
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_add.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_add_i.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_declocal.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_declocal_i.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_decrement.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_decrement_i.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_divide.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_equals.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_greaterequals.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_greaterthan.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_inclocal.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_inclocal_i.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_increment.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_increment_i.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_lessequals.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_lessthan.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_modulo.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_multiply.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_multiply_i.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_negate.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_negate_i.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_not.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_strictequals.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_subtract.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_subtract_i.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/bitwise/as3_bitand.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/bitwise/as3_bitnot.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/bitwise/as3_bitor.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/bitwise/as3_bitxor.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/bitwise/as3_lshift.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/bitwise/as3_rshift.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/bitwise/as3_urshift.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/control_transfer/as3_lookupswitch.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/control_transfer_opcode.rb +0 -4
- data/lib/furnace-avm2/abc/opcodes/exception/as3_newcatch.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/function_invocation/as3_callproplex.rb +4 -0
- data/lib/furnace-avm2/abc/opcodes/function_invocation_opcode.rb +4 -0
- data/lib/furnace-avm2/abc/opcodes/function_return/as3_returnvalue.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/function_return/as3_returnvoid.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/generic/as3_escxattr.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/generic/as3_escxelem.rb +8 -0
- data/lib/furnace-avm2/abc/opcodes/generic/as3_getlex.rb +4 -0
- data/lib/furnace-avm2/abc/opcodes/object_manipulation/as3_newfunction.rb +5 -1
- data/lib/furnace-avm2/abc/opcodes/property/as3_constructprop.rb +4 -0
- data/lib/furnace-avm2/abc/opcodes/property_opcode.rb +4 -0
- data/lib/furnace-avm2/abc/opcodes/push_literal/as3_pushuint.rb +11 -0
- data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_applytype.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_coerce.rb +5 -1
- data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_coerce_a.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_coerce_b.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_coerce_s.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_convert_d.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_convert_i.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_convert_o.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_convert_s.rb +1 -1
- data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_convert_u.rb +1 -1
- data/lib/furnace-avm2/abc/primitives/opcode_sequence.rb +35 -23
- data/lib/furnace-avm2/abc/primitives/record.rb +11 -0
- data/lib/furnace-avm2/binary/record.rb +9 -7
- data/lib/furnace-avm2/source/declaration_tokens/callee_token.rb +8 -5
- data/lib/furnace-avm2/source/declaration_tokens/class_implementations_token.rb +5 -1
- data/lib/furnace-avm2/source/declaration_tokens/class_specifiers_token.rb +2 -1
- data/lib/furnace-avm2/source/declaration_tokens/class_token.rb +5 -1
- data/lib/furnace-avm2/source/declaration_tokens/metadata_token.rb +25 -0
- data/lib/furnace-avm2/source/declaration_tokens/method_specifiers_token.rb +4 -3
- data/lib/furnace-avm2/source/declaration_tokens/method_token.rb +1 -0
- data/lib/furnace-avm2/source/declaration_tokens/multiname_token.rb +28 -13
- data/lib/furnace-avm2/source/declaration_tokens/package_token.rb +9 -8
- data/lib/furnace-avm2/source/declaration_tokens/scope_token.rb +2 -0
- data/lib/furnace-avm2/source/declaration_tokens/script_token.rb +4 -1
- data/lib/furnace-avm2/source/declaration_tokens/slot_token.rb +1 -0
- data/lib/furnace-avm2/source/declaration_tokens/specifiers_token.rb +11 -9
- data/lib/furnace-avm2/source/decompiler.rb +372 -101
- data/lib/furnace-avm2/source/implementation_tokens/closure_name_token.rb +7 -0
- data/lib/furnace-avm2/source/implementation_tokens/closure_token.rb +9 -0
- data/lib/furnace-avm2/source/implementation_tokens/instance_of_token.rb +9 -0
- data/lib/furnace-avm2/source/implementation_tokens/supplementary_comment_token.rb +16 -0
- data/lib/furnace-avm2/source/implementation_tokens/xml_literal_token.rb +14 -0
- data/lib/furnace-avm2/transform/ast_build.rb +3 -2
- data/lib/furnace-avm2/transform/ast_normalize.rb +39 -7
- data/lib/furnace-avm2/transform/cfg_build.rb +16 -6
- data/lib/furnace-avm2/transform/cfg_reduce.rb +4 -3
- data/lib/furnace-avm2/transform/nf_normalize.rb +15 -7
- data/lib/furnace-avm2/version.rb +1 -1
- data/test/basic.as +15 -0
- data/test/global.as +11 -0
- metadata +46 -29
- data/bin/furnace-avm2-benchmark +0 -38
- data/lib/furnace-avm2/abc/opcodes/arithmetic_opcode.rb +0 -4
- data/lib/furnace-avm2/abc/opcodes/bitwise_opcode.rb +0 -4
- data/lib/furnace-avm2/abc/opcodes/exception_opcode.rb +0 -4
- data/lib/furnace-avm2/abc/opcodes/function_return_opcode.rb +0 -4
- data/lib/furnace-avm2/abc/opcodes/object_manipulation_opcode.rb +0 -4
- data/lib/furnace-avm2/abc/opcodes/type_conversion_opcode.rb +0 -4
@@ -37,8 +37,16 @@ module Furnace::AVM2::ABC
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
def collect_ns
|
41
|
-
|
40
|
+
def collect_ns(options)
|
41
|
+
return if options[:no_ns].include?(ns)
|
42
|
+
|
43
|
+
names = options[:names]
|
44
|
+
if names[name].nil?
|
45
|
+
options[:ns].add ns
|
46
|
+
names[name] = ns
|
47
|
+
elsif names[name] != ns
|
48
|
+
options[:no_ns].add ns
|
49
|
+
end
|
42
50
|
end
|
43
51
|
|
44
52
|
def context_size
|
@@ -1,23 +1,27 @@
|
|
1
1
|
module Furnace::AVM2::ABC
|
2
2
|
class ScriptInfo < Record
|
3
3
|
include InitializerBody
|
4
|
+
include RecordWithTraits
|
4
5
|
|
5
6
|
root_ref :initializer, :method
|
6
7
|
|
7
8
|
abc_array_of :trait, :nested, :class => TraitInfo
|
8
9
|
|
9
10
|
def collect_ns
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
options = { ns: Set.new([ non_init_traits[0].name.ns ]), no_ns: Set.new, names: {} }
|
12
|
+
|
13
|
+
initializer.collect_ns(options) if initializer
|
14
|
+
traits.each { |trait| trait.collect_ns(options) }
|
15
|
+
|
16
|
+
options
|
14
17
|
end
|
15
18
|
|
16
19
|
def decompile(options={})
|
17
20
|
Furnace::AVM2::Tokens::PackageToken.new(self,
|
18
|
-
options.merge(
|
19
|
-
|
20
|
-
|
21
|
+
options.merge(collect_ns).merge(
|
22
|
+
package_type: :script,
|
23
|
+
package_name: non_init_traits[0].name)
|
24
|
+
)
|
21
25
|
end
|
22
26
|
|
23
27
|
def any_code?
|
@@ -50,7 +50,7 @@ module Furnace::AVM2::ABC
|
|
50
50
|
variant :Const, :nested, :class => TraitSlot
|
51
51
|
end
|
52
52
|
|
53
|
-
|
53
|
+
root_array_of :metadata, :metadata, :plural => :metadata, :if => :metadata?
|
54
54
|
|
55
55
|
def method_missing(method, *args, &block)
|
56
56
|
data.send(method, *args, &block)
|
@@ -4,15 +4,16 @@ module Furnace::AVM2::ABC
|
|
4
4
|
root_ref :method
|
5
5
|
|
6
6
|
def body
|
7
|
-
root.
|
7
|
+
root.method_body_at(method_idx)
|
8
8
|
end
|
9
9
|
|
10
10
|
def to_astlet(trait)
|
11
11
|
method.to_astlet(method_idx, trait.name.to_astlet)
|
12
12
|
end
|
13
13
|
|
14
|
-
def collect_ns
|
15
|
-
method.collect_ns
|
14
|
+
def collect_ns(options)
|
15
|
+
method.collect_ns(options)
|
16
|
+
body.collect_ns(options) if body
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
@@ -14,9 +14,9 @@ module Furnace::AVM2::ABC
|
|
14
14
|
AST::Node.new(:slot, [ (trait.name ? trait.name.to_astlet : nil), (type ? type.to_astlet : nil), value, idx ])
|
15
15
|
end
|
16
16
|
|
17
|
-
def collect_ns
|
17
|
+
def collect_ns(options)
|
18
18
|
if type
|
19
|
-
type.collect_ns
|
19
|
+
type.collect_ns(options)
|
20
20
|
else
|
21
21
|
[]
|
22
22
|
end
|