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.
Files changed (129) hide show
  1. data/Gemfile.lock +2 -2
  2. data/bin/furnace-avm2 +5 -1
  3. data/bin/furnace-avm2-decompiler +80 -13
  4. data/bin/furnace-avm2-shell +32 -0
  5. data/furnace-avm2.gemspec +1 -1
  6. data/lib/furnace-avm2/abc.rb +1 -7
  7. data/lib/furnace-avm2/abc/metadata/file.rb +65 -0
  8. data/lib/furnace-avm2/abc/metadata/instance_info.rb +17 -11
  9. data/lib/furnace-avm2/abc/metadata/metadata_info.rb +14 -4
  10. data/lib/furnace-avm2/abc/metadata/method_body_info.rb +11 -3
  11. data/lib/furnace-avm2/abc/metadata/method_info.rb +3 -4
  12. data/lib/furnace-avm2/abc/metadata/multiname_kind_genericname.rb +3 -2
  13. data/lib/furnace-avm2/abc/metadata/multiname_kind_multiname.rb +11 -2
  14. data/lib/furnace-avm2/abc/metadata/multiname_kind_multinamel.rb +4 -0
  15. data/lib/furnace-avm2/abc/metadata/multiname_kind_qname.rb +10 -2
  16. data/lib/furnace-avm2/abc/metadata/multiname_kind_rtqname.rb +4 -0
  17. data/lib/furnace-avm2/abc/metadata/multiname_kind_rtqnamel.rb +4 -0
  18. data/lib/furnace-avm2/abc/metadata/script_info.rb +11 -7
  19. data/lib/furnace-avm2/abc/metadata/trait_class.rb +2 -2
  20. data/lib/furnace-avm2/abc/metadata/trait_info.rb +1 -1
  21. data/lib/furnace-avm2/abc/metadata/trait_method.rb +4 -3
  22. data/lib/furnace-avm2/abc/metadata/trait_slot.rb +2 -2
  23. data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_extend_1.rb +8 -0
  24. data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_extend_16.rb +8 -0
  25. data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_extend_8.rb +8 -0
  26. data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_load_float32.rb +8 -0
  27. data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_load_float64.rb +8 -0
  28. data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_load_int16.rb +8 -0
  29. data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_load_int32.rb +8 -0
  30. data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_load_int8.rb +8 -0
  31. data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_store_float32.rb +8 -0
  32. data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_store_float64.rb +8 -0
  33. data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_store_int16.rb +8 -0
  34. data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_store_int32.rb +8 -0
  35. data/lib/furnace-avm2/abc/opcodes/alchemy/alchemy_store_int8.rb +8 -0
  36. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_add.rb +1 -1
  37. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_add_i.rb +1 -1
  38. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_declocal.rb +1 -1
  39. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_declocal_i.rb +1 -1
  40. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_decrement.rb +1 -1
  41. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_decrement_i.rb +1 -1
  42. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_divide.rb +1 -1
  43. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_equals.rb +1 -1
  44. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_greaterequals.rb +1 -1
  45. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_greaterthan.rb +1 -1
  46. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_inclocal.rb +1 -1
  47. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_inclocal_i.rb +1 -1
  48. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_increment.rb +1 -1
  49. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_increment_i.rb +1 -1
  50. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_lessequals.rb +1 -1
  51. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_lessthan.rb +1 -1
  52. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_modulo.rb +1 -1
  53. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_multiply.rb +1 -1
  54. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_multiply_i.rb +1 -1
  55. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_negate.rb +1 -1
  56. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_negate_i.rb +1 -1
  57. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_not.rb +1 -1
  58. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_strictequals.rb +1 -1
  59. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_subtract.rb +1 -1
  60. data/lib/furnace-avm2/abc/opcodes/arithmetic/as3_subtract_i.rb +1 -1
  61. data/lib/furnace-avm2/abc/opcodes/bitwise/as3_bitand.rb +1 -1
  62. data/lib/furnace-avm2/abc/opcodes/bitwise/as3_bitnot.rb +1 -1
  63. data/lib/furnace-avm2/abc/opcodes/bitwise/as3_bitor.rb +1 -1
  64. data/lib/furnace-avm2/abc/opcodes/bitwise/as3_bitxor.rb +1 -1
  65. data/lib/furnace-avm2/abc/opcodes/bitwise/as3_lshift.rb +1 -1
  66. data/lib/furnace-avm2/abc/opcodes/bitwise/as3_rshift.rb +1 -1
  67. data/lib/furnace-avm2/abc/opcodes/bitwise/as3_urshift.rb +1 -1
  68. data/lib/furnace-avm2/abc/opcodes/control_transfer/as3_lookupswitch.rb +1 -1
  69. data/lib/furnace-avm2/abc/opcodes/control_transfer_opcode.rb +0 -4
  70. data/lib/furnace-avm2/abc/opcodes/exception/as3_newcatch.rb +1 -1
  71. data/lib/furnace-avm2/abc/opcodes/function_invocation/as3_callproplex.rb +4 -0
  72. data/lib/furnace-avm2/abc/opcodes/function_invocation_opcode.rb +4 -0
  73. data/lib/furnace-avm2/abc/opcodes/function_return/as3_returnvalue.rb +1 -1
  74. data/lib/furnace-avm2/abc/opcodes/function_return/as3_returnvoid.rb +1 -1
  75. data/lib/furnace-avm2/abc/opcodes/generic/as3_escxattr.rb +1 -1
  76. data/lib/furnace-avm2/abc/opcodes/generic/as3_escxelem.rb +8 -0
  77. data/lib/furnace-avm2/abc/opcodes/generic/as3_getlex.rb +4 -0
  78. data/lib/furnace-avm2/abc/opcodes/object_manipulation/as3_newfunction.rb +5 -1
  79. data/lib/furnace-avm2/abc/opcodes/property/as3_constructprop.rb +4 -0
  80. data/lib/furnace-avm2/abc/opcodes/property_opcode.rb +4 -0
  81. data/lib/furnace-avm2/abc/opcodes/push_literal/as3_pushuint.rb +11 -0
  82. data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_applytype.rb +1 -1
  83. data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_coerce.rb +5 -1
  84. data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_coerce_a.rb +1 -1
  85. data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_coerce_b.rb +1 -1
  86. data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_coerce_s.rb +1 -1
  87. data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_convert_d.rb +1 -1
  88. data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_convert_i.rb +1 -1
  89. data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_convert_o.rb +1 -1
  90. data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_convert_s.rb +1 -1
  91. data/lib/furnace-avm2/abc/opcodes/type_conversion/as3_convert_u.rb +1 -1
  92. data/lib/furnace-avm2/abc/primitives/opcode_sequence.rb +35 -23
  93. data/lib/furnace-avm2/abc/primitives/record.rb +11 -0
  94. data/lib/furnace-avm2/binary/record.rb +9 -7
  95. data/lib/furnace-avm2/source/declaration_tokens/callee_token.rb +8 -5
  96. data/lib/furnace-avm2/source/declaration_tokens/class_implementations_token.rb +5 -1
  97. data/lib/furnace-avm2/source/declaration_tokens/class_specifiers_token.rb +2 -1
  98. data/lib/furnace-avm2/source/declaration_tokens/class_token.rb +5 -1
  99. data/lib/furnace-avm2/source/declaration_tokens/metadata_token.rb +25 -0
  100. data/lib/furnace-avm2/source/declaration_tokens/method_specifiers_token.rb +4 -3
  101. data/lib/furnace-avm2/source/declaration_tokens/method_token.rb +1 -0
  102. data/lib/furnace-avm2/source/declaration_tokens/multiname_token.rb +28 -13
  103. data/lib/furnace-avm2/source/declaration_tokens/package_token.rb +9 -8
  104. data/lib/furnace-avm2/source/declaration_tokens/scope_token.rb +2 -0
  105. data/lib/furnace-avm2/source/declaration_tokens/script_token.rb +4 -1
  106. data/lib/furnace-avm2/source/declaration_tokens/slot_token.rb +1 -0
  107. data/lib/furnace-avm2/source/declaration_tokens/specifiers_token.rb +11 -9
  108. data/lib/furnace-avm2/source/decompiler.rb +372 -101
  109. data/lib/furnace-avm2/source/implementation_tokens/closure_name_token.rb +7 -0
  110. data/lib/furnace-avm2/source/implementation_tokens/closure_token.rb +9 -0
  111. data/lib/furnace-avm2/source/implementation_tokens/instance_of_token.rb +9 -0
  112. data/lib/furnace-avm2/source/implementation_tokens/supplementary_comment_token.rb +16 -0
  113. data/lib/furnace-avm2/source/implementation_tokens/xml_literal_token.rb +14 -0
  114. data/lib/furnace-avm2/transform/ast_build.rb +3 -2
  115. data/lib/furnace-avm2/transform/ast_normalize.rb +39 -7
  116. data/lib/furnace-avm2/transform/cfg_build.rb +16 -6
  117. data/lib/furnace-avm2/transform/cfg_reduce.rb +4 -3
  118. data/lib/furnace-avm2/transform/nf_normalize.rb +15 -7
  119. data/lib/furnace-avm2/version.rb +1 -1
  120. data/test/basic.as +15 -0
  121. data/test/global.as +11 -0
  122. metadata +46 -29
  123. data/bin/furnace-avm2-benchmark +0 -38
  124. data/lib/furnace-avm2/abc/opcodes/arithmetic_opcode.rb +0 -4
  125. data/lib/furnace-avm2/abc/opcodes/bitwise_opcode.rb +0 -4
  126. data/lib/furnace-avm2/abc/opcodes/exception_opcode.rb +0 -4
  127. data/lib/furnace-avm2/abc/opcodes/function_return_opcode.rb +0 -4
  128. data/lib/furnace-avm2/abc/opcodes/object_manipulation_opcode.rb +0 -4
  129. data/lib/furnace-avm2/abc/opcodes/type_conversion_opcode.rb +0 -4
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "rubygems"
4
- require "bundler/setup"
5
-
6
- $: << File.join(File.dirname(__FILE__), '..', 'lib')
7
-
8
- require "avm2"
9
- require "benchmark"
10
-
11
- puts "Working on #{RUBY_DESCRIPTION}"
12
-
13
- Benchmark.bm(7) do |x|
14
- 5.times do
15
- abc = nil
16
-
17
- GC.start
18
-
19
- x.report("read ") do
20
- File.open(ARGV.first) do |file|
21
- abc = AVM2::ABC::File.new
22
- abc.read(file)
23
- end
24
- end
25
-
26
- x.report("dce ") do
27
- abc.method_bodies.each do |body|
28
- body.code.eliminate_dead!
29
- end
30
- end
31
-
32
- x.report("write ") do
33
- File.open("/dev/null", "w") do |file|
34
- abc.write(file)
35
- end
36
- end
37
- end
38
- end
@@ -1,4 +0,0 @@
1
- module Furnace::AVM2::ABC
2
- class ArithmeticOpcode < Opcode
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module Furnace::AVM2::ABC
2
- class BitwiseOpcode < Opcode
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module Furnace::AVM2::ABC
2
- class ExceptionOpcode < Opcode
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module Furnace::AVM2::ABC
2
- class FunctionReturnOpcode < Opcode
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module Furnace::AVM2::ABC
2
- class ObjectManipulationOpcode < Opcode
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module Furnace::AVM2::ABC
2
- class TypeConversionOpcode < Opcode
3
- end
4
- end