ruby_memprofiler_pprof 0.0.3 → 0.0.4

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.
Files changed (217) hide show
  1. checksums.yaml +4 -4
  2. data/ext/ruby_memprofiler_pprof_ext/collector.c +803 -0
  3. data/ext/ruby_memprofiler_pprof_ext/compat.c +184 -0
  4. data/ext/ruby_memprofiler_pprof_ext/compile_commands.json +1 -0
  5. data/ext/ruby_memprofiler_pprof_ext/extconf.rb +152 -0
  6. data/ext/ruby_memprofiler_pprof_ext/pprof.upb.c +199 -0
  7. data/ext/ruby_memprofiler_pprof_ext/pprof.upb.h +924 -0
  8. data/ext/ruby_memprofiler_pprof_ext/pprof_out.c +430 -0
  9. data/ext/ruby_memprofiler_pprof_ext/ruby_hacks.c +118 -0
  10. data/ext/ruby_memprofiler_pprof_ext/ruby_memprofiler_pprof.c +10 -0
  11. data/ext/ruby_memprofiler_pprof_ext/ruby_memprofiler_pprof.h +183 -0
  12. data/ext/ruby_memprofiler_pprof_ext/ruby_private/ruby26/gc_private.h +324 -0
  13. data/ext/ruby_memprofiler_pprof_ext/ruby_private/ruby27/gc_private.h +339 -0
  14. data/ext/ruby_memprofiler_pprof_ext/ruby_private/ruby30/gc_private.h +361 -0
  15. data/ext/ruby_memprofiler_pprof_ext/ruby_private/ruby31/gc_private.h +374 -0
  16. data/ext/ruby_memprofiler_pprof_ext/ruby_private.h +31 -0
  17. data/ext/ruby_memprofiler_pprof_ext/sample.c +43 -0
  18. data/ext/ruby_memprofiler_pprof_ext/vendor/backtracie/backtracie.h +268 -0
  19. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/BUILD +0 -0
  20. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/CONTRIBUTING.md +0 -0
  21. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/DESIGN.md +0 -0
  22. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/LICENSE +0 -0
  23. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/README.md +0 -0
  24. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/WORKSPACE +0 -0
  25. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/BUILD +0 -0
  26. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/amalgamate.py +0 -0
  27. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/build_defs.bzl +0 -0
  28. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/lua.BUILD +0 -0
  29. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/protobuf.patch +0 -0
  30. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/py_proto_library.bzl +0 -0
  31. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/python_downloads.bzl +0 -0
  32. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/system_python.bzl +0 -0
  33. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/upb_proto_library.bzl +0 -0
  34. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/workspace_deps.bzl +0 -0
  35. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/BUILD +0 -0
  36. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/BUILD.googleapis +0 -0
  37. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/benchmark.cc +0 -0
  38. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/build_defs.bzl +0 -0
  39. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/compare.py +0 -0
  40. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/descriptor.proto +0 -0
  41. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/descriptor_sv.proto +0 -0
  42. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/empty.proto +0 -0
  43. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/gen_protobuf_binary_cc.py +0 -0
  44. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/gen_synthetic_protos.py +0 -0
  45. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/gen_upb_binary_c.py +0 -0
  46. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/cmake/BUILD.bazel +0 -0
  47. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/cmake/README.md +0 -0
  48. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/cmake/build_defs.bzl +0 -0
  49. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/cmake/make_cmakelists.py +0 -0
  50. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/cmake/staleness_test.py +0 -0
  51. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/cmake/staleness_test_lib.py +0 -0
  52. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/docs/render.py +0 -0
  53. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/docs/style-guide.md +0 -0
  54. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/docs/vs-cpp-protos.md +0 -0
  55. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/docs/wrapping-upb.md +0 -0
  56. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/BUILD +0 -0
  57. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/convert.c +0 -0
  58. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/convert.h +0 -0
  59. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/descriptor.c +0 -0
  60. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/descriptor.h +0 -0
  61. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/descriptor_containers.c +0 -0
  62. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/descriptor_containers.h +0 -0
  63. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/descriptor_pool.c +0 -0
  64. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/descriptor_pool.h +0 -0
  65. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/dist/BUILD.bazel +0 -0
  66. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/dist/dist.bzl +0 -0
  67. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/extension_dict.c +0 -0
  68. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/extension_dict.h +0 -0
  69. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/map.c +0 -0
  70. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/map.h +0 -0
  71. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/message.c +0 -0
  72. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/message.h +0 -0
  73. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/minimal_test.py +0 -0
  74. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/BUILD +0 -0
  75. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/README.md +0 -0
  76. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/descriptor_database_test_wrapper.py +0 -0
  77. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/descriptor_pool_test_wrapper.py +0 -0
  78. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/descriptor_test_wrapper.py +0 -0
  79. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/generator_test_wrapper.py +0 -0
  80. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/json_format_test_wrapper.py +0 -0
  81. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/keywords_test_wrapper.py +0 -0
  82. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/message_factory_test_wrapper.py +0 -0
  83. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/message_test_wrapper.py +0 -0
  84. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/proto_builder_test_wrapper.py +0 -0
  85. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/pyproto_test_wrapper.bzl +0 -0
  86. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/reflection_test_wrapper.py +0 -0
  87. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/service_reflection_test_wrapper.py +0 -0
  88. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/symbol_database_test_wrapper.py +0 -0
  89. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/text_encoding_test_wrapper.py +0 -0
  90. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/text_format_test_wrapper.py +0 -0
  91. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/unknown_fields_test_wrapper.py +0 -0
  92. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/well_known_types_test_wrapper.py +0 -0
  93. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/wire_format_test_wrapper.py +0 -0
  94. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/protobuf.c +0 -0
  95. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/protobuf.h +0 -0
  96. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/py_extension.bzl +0 -0
  97. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/python_api.h +0 -0
  98. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/repeated.c +0 -0
  99. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/repeated.h +0 -0
  100. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/unknown_fields.c +0 -0
  101. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/unknown_fields.h +0 -0
  102. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/version_script.lds +0 -0
  103. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/lunit/LICENSE +0 -0
  104. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/lunit/README.google +0 -0
  105. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/lunit/console.lua +0 -0
  106. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/lunit/lunit.lua +0 -0
  107. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/utf8_range/BUILD +0 -0
  108. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/utf8_range/LICENSE +0 -0
  109. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/utf8_range/naive.c +0 -0
  110. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/utf8_range/range2-neon.c +0 -0
  111. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/utf8_range/range2-sse.c +0 -0
  112. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/utf8_range/utf8_range.h +0 -0
  113. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/BUILD.bazel +0 -0
  114. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/README.md +0 -0
  115. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/def.c +0 -0
  116. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/lua_proto_library.bzl +0 -0
  117. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/main.c +0 -0
  118. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/msg.c +0 -0
  119. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/test.proto +0 -0
  120. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/test_upb.lua +0 -0
  121. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/upb.c +0 -0
  122. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/upb.h +0 -0
  123. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/upb.lua +0 -0
  124. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/upbc.cc +0 -0
  125. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/collections.c +0 -0
  126. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/collections.h +0 -0
  127. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/conformance_upb.c +0 -0
  128. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/conformance_upb_failures.txt +0 -0
  129. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/decode.c +0 -0
  130. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/decode.h +0 -0
  131. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/decode_fast.c +0 -0
  132. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/decode_fast.h +0 -0
  133. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/decode_internal.h +0 -0
  134. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/def.c +0 -0
  135. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/def.h +0 -0
  136. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/def.hpp +0 -0
  137. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/empty.proto +0 -0
  138. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/encode.c +0 -0
  139. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/encode.h +0 -0
  140. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/fuzz/BUILD +0 -0
  141. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/fuzz/file_descriptor_parsenew_fuzzer.cc +0 -0
  142. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/json_decode.c +0 -0
  143. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/json_decode.h +0 -0
  144. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/json_encode.c +0 -0
  145. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/json_encode.h +0 -0
  146. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/mini_table.c +0 -0
  147. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/mini_table.h +0 -0
  148. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/mini_table.hpp +0 -0
  149. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/mini_table_accessors.c +0 -0
  150. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/mini_table_accessors.h +0 -0
  151. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/mini_table_accessors_internal.h +0 -0
  152. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/mini_table_accessors_test.cc +0 -0
  153. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/mini_table_test.cc +0 -0
  154. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/msg.c +0 -0
  155. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/msg.h +0 -0
  156. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/msg_internal.h +0 -0
  157. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/msg_test.cc +0 -0
  158. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/msg_test.proto +0 -0
  159. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/port_def.inc +0 -0
  160. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/port_undef.inc +0 -0
  161. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/reflection.c +0 -0
  162. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/reflection.h +0 -0
  163. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/reflection.hpp +0 -0
  164. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/table.c +0 -0
  165. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/table_internal.h +0 -0
  166. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/test.proto +0 -0
  167. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/test_cpp.cc +0 -0
  168. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/test_cpp.proto +0 -0
  169. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/test_generated_code.cc +0 -0
  170. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/test_table.cc +0 -0
  171. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/text_encode.c +0 -0
  172. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/text_encode.h +0 -0
  173. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/upb.c +0 -0
  174. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/upb.h +0 -0
  175. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/upb.hpp +0 -0
  176. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/upb_internal.h +0 -0
  177. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/BUILD +0 -0
  178. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/README.md +0 -0
  179. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/compare.c +0 -0
  180. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/compare.h +0 -0
  181. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/compare_test.cc +0 -0
  182. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/def_to_proto.c +0 -0
  183. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/def_to_proto.h +0 -0
  184. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/def_to_proto_public_import_test.proto +0 -0
  185. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/def_to_proto_regular_import_test.proto +0 -0
  186. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/def_to_proto_test.cc +0 -0
  187. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/def_to_proto_test.proto +0 -0
  188. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/def_to_proto_weak_import_test.proto +0 -0
  189. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/def_to_proto_wweak_import_test.proto +0 -0
  190. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/required_fields.c +0 -0
  191. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/required_fields.h +0 -0
  192. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/required_fields_test.cc +0 -0
  193. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/required_fields_test.proto +0 -0
  194. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upbc/BUILD +0 -0
  195. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upbc/common.cc +0 -0
  196. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upbc/common.h +0 -0
  197. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upbc/protoc-gen-upb.cc +0 -0
  198. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upbc/protoc-gen-upbdefs.cc +0 -0
  199. data/lib/ruby_memprofiler_pprof/atfork.rb +1 -1
  200. data/lib/ruby_memprofiler_pprof/block_flusher.rb +48 -4
  201. data/lib/ruby_memprofiler_pprof/file_flusher.rb +13 -6
  202. data/lib/ruby_memprofiler_pprof/profile_app.rb +8 -12
  203. data/lib/ruby_memprofiler_pprof/profile_data.rb +7 -8
  204. data/lib/ruby_memprofiler_pprof/version.rb +1 -1
  205. data/lib/ruby_memprofiler_pprof.rb +5 -4
  206. data/libexec/ruby_memprofiler_pprof_profile +6 -6
  207. metadata +207 -200
  208. data/ext/ruby_memprofiler_pprof/backtrace.c +0 -429
  209. data/ext/ruby_memprofiler_pprof/collector.c +0 -1055
  210. data/ext/ruby_memprofiler_pprof/compat.c +0 -182
  211. data/ext/ruby_memprofiler_pprof/extconf.rb +0 -72
  212. data/ext/ruby_memprofiler_pprof/pprof.upb.c +0 -170
  213. data/ext/ruby_memprofiler_pprof/pprof.upb.h +0 -848
  214. data/ext/ruby_memprofiler_pprof/pprof_out.c +0 -285
  215. data/ext/ruby_memprofiler_pprof/ruby_memprofiler_pprof.c +0 -11
  216. data/ext/ruby_memprofiler_pprof/ruby_memprofiler_pprof.h +0 -301
  217. data/ext/ruby_memprofiler_pprof/strtab.c +0 -391
@@ -0,0 +1,183 @@
1
+ #ifndef __RUBY_MEMPROFILER_PPROF_H
2
+ #define __RUBY_MEMPROFILER_PPROF_H
3
+
4
+ #include "extconf.h"
5
+
6
+ #include <pthread.h>
7
+ #include <stdarg.h>
8
+ #include <stddef.h>
9
+ #include <stdint.h>
10
+ #include <time.h>
11
+
12
+ #include <backtracie.h>
13
+ #include <ruby.h>
14
+
15
+ // UPB header files trip up a BUNCH of -Wshorten-64-to-32
16
+ // Also ignore -Wpragmas so that if -Wshorten-64-to-32 isn't present
17
+ // (it's a clang only thing), GCC doesn't warn about the unknown warning.
18
+ #pragma GCC diagnostic push
19
+ #pragma GCC diagnostic ignored "-Wpragmas"
20
+ #pragma GCC diagnostic ignored "-Wshorten-64-to-32"
21
+ #include "pprof.upb.h"
22
+ #include <upb/upb.h>
23
+ #pragma GCC diagnostic pop
24
+
25
+ // ======== COMPAT DECLARATIONS ========
26
+
27
+ // For handling differences in ruby versions
28
+ #ifndef HAVE_RB_GC_MARK_MOVABLE
29
+ #define rb_gc_mark_movable(v) rb_gc_mark(v)
30
+ #endif
31
+
32
+ #ifndef RB_PASS_KEYWORDS
33
+ #define RB_SCAN_ARGS_LAST_HASH_KEYWORDS 3
34
+ #define rb_scan_args_kw(kw, c, v, s, ...) rb_scan_args(c, v, s, __VA_ARGS__)
35
+ #endif
36
+
37
+ #ifndef HAVE_RB_EXT_RACTOR_SAFE
38
+ #define rb_ext_ractor_safe(x) \
39
+ do { \
40
+ } while (0)
41
+ #endif
42
+
43
+ // Apparently "I just want a random number, without thinking about whether it's
44
+ // threadsafe, without thinking about whether some other part of the process needs
45
+ // the global seed to be set to some deterministic value, and without calling into
46
+ // the kernel every time" is... too much to ask for.
47
+ // BSD has arc4random(3) for this, but for glibc we have to use one of the threadsafe
48
+ // RNG's and seed a global instance of it, guarded by a mutex....
49
+ // These methods wrap all that rubbish up.
50
+ uint32_t mpp_rand();
51
+ void mpp_rand_init();
52
+
53
+ // Wrapper to get monotonic time. Pre-sierra MacOS doesn't have clock_gettime, so we need a wrapper for this.
54
+ // (n.b. - I haven't actually _implemented_ a fallback for pre-Sierra, but this is where we'd do it)
55
+ // Returns time in nanoseconds.
56
+ struct timespec mpp_gettime_monotonic();
57
+ int64_t mpp_time_delta_nsec(struct timespec t1, struct timespec t2);
58
+
59
+ // These declarations just wrap some things from the standard library that should "always succeed", but call
60
+ // our assertion macro if they fail to abort the program.
61
+ void *mpp_xmalloc(size_t sz);
62
+ void *mpp_realloc(void *mem, size_t newsz);
63
+ void mpp_free(void *mem);
64
+ void mpp_pthread_mutex_lock(pthread_mutex_t *m);
65
+ void mpp_pthread_mutex_unlock(pthread_mutex_t *m);
66
+ int mpp_pthread_mutex_trylock(pthread_mutex_t *m);
67
+ void mpp_pthread_mutex_init(pthread_mutex_t *m, const pthread_mutexattr_t *attr);
68
+ void mpp_pthread_mutex_destroy(pthread_mutex_t *m);
69
+ void mpp_pthread_mutexattr_init(pthread_mutexattr_t *a);
70
+ void mpp_pthread_mutexattr_destroy(pthread_mutexattr_t *a);
71
+ void mpp_pthread_mutexattr_settype(pthread_mutexattr_t *a, int type);
72
+ void mpp_pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));
73
+
74
+ // Need a handy assertion macro. It would be nice to re-use rb_bug for some of this, but that actually
75
+ // requires the GVL (it walks the Ruby stack frames, for one) and we (want to) run some code outside
76
+ // the GVL, so this assertion macro has to be threadsafe. So we just implement it in pretty much a
77
+ // similar way to how stdlib's assert() works (plus some stuff to prefix the gem name to the abort message
78
+ // so users know who is at fault).
79
+ #define MPP_ASSERT_STRINGIFY1(x) #x
80
+ #define MPP_ASSERT_STRINGIFY2(x) MPP_ASSERT_STRINGIFY1(x)
81
+ #define MPP_ASSERT__LINE MPP_ASSERT_STRINGIFY2(__LINE__)
82
+ __attribute__((noreturn)) void mpp_assert_fail(const char *msg, const char *assertion, const char *file,
83
+ const char *line, const char *fn);
84
+ #define MPP_ASSERT_MSG(expr, msg) \
85
+ do { \
86
+ if ((expr) == 0) { \
87
+ mpp_assert_fail((msg), #expr, __FILE__, MPP_ASSERT__LINE, __func__); \
88
+ } \
89
+ } while (0)
90
+ #define MPP_ASSERT_FAIL(msg) MPP_ASSERT_MSG(0, msg)
91
+
92
+ // Log a debug message to "somewhere". This could be smarter in future, but for now, this'll do.
93
+ // The implementation here does not depend on holding the GVL.
94
+ // Will automatically add a trailing newline.
95
+ void mpp_log_debug(const char *pattern, ...);
96
+
97
+ // ======== RUBY HACKS DECLARATIONS ========
98
+
99
+ // An implementation of rb_gc_disable_no_rest; disables the GC without itself triggering
100
+ // the finalisation of the current sweep phase of the GC.
101
+ VALUE mpp_rb_gc_disable_no_rest();
102
+ // An implementation of rb_obj_memsize_of; tells us how big an object is.
103
+ VALUE mpp_rb_obj_memsize_of(VALUE obj);
104
+ // Tells us whether the given VALUE is valid enough still for rb_obj_memsize_of to
105
+ // work on it.
106
+ bool mpp_is_value_still_validish(VALUE obj);
107
+ // Is some other thread blocked waiting for the GVL?
108
+ bool mpp_is_someone_else_waiting_for_gvl();
109
+ // Like rb_ivar_set, but ignore frozen status.
110
+ VALUE mpp_rb_ivar_set_ignore_frozen(VALUE obj, ID key, VALUE value);
111
+
112
+ // ======== SAMPLE DECLARATIONS ========
113
+
114
+ // The struct mpp_sample is the core type for the data collected by ruby_memprofiler_pprof.
115
+
116
+ struct mpp_sample {
117
+ // VALUE of the sampled object that was allocated, or Qundef it it's freed.
118
+ VALUE allocated_value_weak;
119
+ size_t allocated_value_objsize;
120
+ size_t frames_count;
121
+ size_t frames_capacity;
122
+ unsigned int flush_epoch;
123
+ minimal_location_t frames[];
124
+ };
125
+
126
+ // Captures a backtrace for a sample using Backtracie. The resulting sample contains VALUES inside
127
+ // the raw_location struct whcih need to be marked.
128
+ struct mpp_sample *mpp_sample_capture(VALUE allocated_value_weak);
129
+ // Total size of all things owned by the sample, for accounting purposes
130
+ size_t mpp_sample_memsize(struct mpp_sample *sample);
131
+ // free the sample
132
+ void mpp_sample_free(struct mpp_sample *sample);
133
+ // Fill in a provided buffer with the name of a frame.
134
+ size_t mpp_sample_frame_function_name(struct mpp_sample *sample, int frame_index, char *outbuf, size_t outbuf_len);
135
+ // Fill in a provided buffer with the filename of a frame
136
+ size_t mpp_sample_frame_file_name(struct mpp_sample *sample, int frame_index, char *outbuf, size_t outbuf_len);
137
+ // Get the line number of a frame.
138
+ int mpp_sample_frame_line_number(struct mpp_sample *sample, int frame_index);
139
+
140
+ // ======== PROTO SERIALIZATION ROUTINES ========
141
+ struct mpp_pprof_serctx {
142
+ // Defines the allocation routine & memory arena used by this serialisation context. When the ctx
143
+ // is destroyed, we free the entire arena, so no other (protobuf) memory needs to be individually
144
+ // freed.
145
+ upb_alloc allocator;
146
+ upb_Arena *arena;
147
+ // Map of function ID -> function protobuf
148
+ st_table *function_pbs;
149
+ // Map of (function ID, line number) -> location protobufs
150
+ st_table *location_pbs;
151
+ // Map of (function name string ID, file name string ID) -> function ID
152
+ st_table *function_ids;
153
+ // Counter for assigning location IDs
154
+ uint64_t loc_counter;
155
+ // Counter for assigning function IDs
156
+ uint64_t function_id_counter;
157
+ // Map of (string, len) -> string table index
158
+ st_table *strings;
159
+ // Counter for assigning string table indexes.
160
+ int strings_counter;
161
+ // The protobuf representation we are building up.
162
+ perftools_profiles_Profile *profile_proto;
163
+
164
+ // A buffer which, if non-NULL, points into the upb arena and can be stolen for interning strings.
165
+ char *scratch_buffer;
166
+ size_t scratch_buffer_strlen;
167
+ size_t scratch_buffer_capa;
168
+
169
+ // Toggle to interrupt (toggled from Ruby's GVL unblocking function)
170
+ uint8_t interrupt;
171
+ };
172
+
173
+ struct mpp_pprof_serctx *mpp_pprof_serctx_new(char *errbuf, size_t errbuflen);
174
+ void mpp_pprof_serctx_destroy(struct mpp_pprof_serctx *ctx);
175
+ int mpp_pprof_serctx_add_sample(struct mpp_pprof_serctx *ctx, struct mpp_sample *sample, char *errbuf,
176
+ size_t errbuflen);
177
+ int mpp_pprof_serctx_serialize(struct mpp_pprof_serctx *ctx, char **buf_out, size_t *buflen_out, char *errbuf,
178
+ size_t errbuflen);
179
+
180
+ // ======== COLLECTOR RUBY CLASS ========
181
+ void mpp_setup_collector_class();
182
+
183
+ #endif
@@ -0,0 +1,324 @@
1
+ #ifndef GC_PRIVATE_H
2
+ #define GC_PRIVATE_H
3
+
4
+
5
+ typedef struct RVALUE {
6
+ union {
7
+ struct {
8
+ VALUE flags; /* always 0 for freed obj */
9
+ struct RVALUE *next;
10
+ } free;
11
+ struct RBasic basic;
12
+ struct RObject object;
13
+ struct RClass klass;
14
+ struct RFloat flonum;
15
+ struct RString string;
16
+ struct RArray array;
17
+ struct RRegexp regexp;
18
+ struct RHash hash;
19
+ struct RData data;
20
+ struct RTypedData typeddata;
21
+ struct RStruct rstruct;
22
+ struct RBignum bignum;
23
+ struct RFile file;
24
+ struct RMatch match;
25
+ struct RRational rational;
26
+ struct RComplex complex;
27
+ union {
28
+ rb_cref_t cref;
29
+ struct vm_svar svar;
30
+ struct vm_throw_data throw_data;
31
+ struct vm_ifunc ifunc;
32
+ struct MEMO memo;
33
+ struct rb_method_entry_struct ment;
34
+ const rb_iseq_t iseq;
35
+ rb_env_t env;
36
+ struct rb_imemo_tmpbuf_struct alloc;
37
+ rb_ast_t ast;
38
+ } imemo;
39
+ struct {
40
+ struct RBasic basic;
41
+ VALUE v1;
42
+ VALUE v2;
43
+ VALUE v3;
44
+ } values;
45
+ } as;
46
+ #if GC_DEBUG
47
+ const char *file;
48
+ int line;
49
+ #endif
50
+ } RVALUE;
51
+
52
+ #define RANY(o) ((RVALUE*)(o))
53
+ #define STACK_CHUNK_SIZE 500
54
+
55
+ typedef struct stack_chunk {
56
+ VALUE data[STACK_CHUNK_SIZE];
57
+ struct stack_chunk *next;
58
+ } stack_chunk_t;
59
+
60
+ typedef struct mark_stack {
61
+ stack_chunk_t *chunk;
62
+ stack_chunk_t *cache;
63
+ int index;
64
+ int limit;
65
+ size_t cache_size;
66
+ size_t unused_cache_size;
67
+ } mark_stack_t;
68
+
69
+ typedef struct rb_heap_struct {
70
+ RVALUE *freelist;
71
+
72
+ struct heap_page *free_pages;
73
+ struct heap_page *using_page;
74
+ struct list_head pages;
75
+ struct heap_page *sweeping_page; /* iterator for .pages */
76
+ #if GC_ENABLE_INCREMENTAL_MARK
77
+ struct heap_page *pooled_pages;
78
+ #endif
79
+ size_t total_pages; /* total page count in a heap */
80
+ size_t total_slots; /* total slot count (about total_pages * HEAP_PAGE_OBJ_LIMIT) */
81
+ } rb_heap_t;
82
+
83
+ typedef uintptr_t bits_t;
84
+ enum {
85
+ BITS_SIZE = sizeof(bits_t),
86
+ BITS_BITLENGTH = ( BITS_SIZE * CHAR_BIT )
87
+ };
88
+
89
+ struct heap_page_header {
90
+ struct heap_page *page;
91
+ };
92
+
93
+ struct heap_page_body {
94
+ struct heap_page_header header;
95
+ /* char gap[]; */
96
+ /* RVALUE values[]; */
97
+ };
98
+
99
+
100
+ /* default tiny heap size: 16KB */
101
+ #define HEAP_PAGE_ALIGN_LOG 14
102
+ #define CEILDIV(i, mod) (((i) + (mod) - 1)/(mod))
103
+ enum {
104
+ HEAP_PAGE_ALIGN = (1UL << HEAP_PAGE_ALIGN_LOG),
105
+ HEAP_PAGE_ALIGN_MASK = (~(~0UL << HEAP_PAGE_ALIGN_LOG)),
106
+ REQUIRED_SIZE_BY_MALLOC = (sizeof(size_t) * 5),
107
+ HEAP_PAGE_SIZE = (HEAP_PAGE_ALIGN - REQUIRED_SIZE_BY_MALLOC),
108
+ HEAP_PAGE_OBJ_LIMIT = (unsigned int)((HEAP_PAGE_SIZE - sizeof(struct heap_page_header))/sizeof(struct RVALUE)),
109
+ HEAP_PAGE_BITMAP_LIMIT = CEILDIV(CEILDIV(HEAP_PAGE_SIZE, sizeof(struct RVALUE)), BITS_BITLENGTH),
110
+ HEAP_PAGE_BITMAP_SIZE = (BITS_SIZE * HEAP_PAGE_BITMAP_LIMIT),
111
+ HEAP_PAGE_BITMAP_PLANES = USE_RGENGC ? 4 : 1 /* RGENGC: mark, unprotected, uncollectible, marking */
112
+ };
113
+
114
+ struct heap_page {
115
+ short total_slots;
116
+ short free_slots;
117
+ short final_slots;
118
+ struct {
119
+ unsigned int before_sweep: 1;
120
+ unsigned int has_remembered_objects: 1;
121
+ unsigned int has_uncollectible_shady_objects: 1;
122
+ unsigned int in_tomb: 1;
123
+ } flags;
124
+
125
+ struct heap_page *free_next;
126
+ RVALUE *start;
127
+ RVALUE *freelist;
128
+ struct list_node page_node;
129
+
130
+ #if USE_RGENGC
131
+ bits_t wb_unprotected_bits[HEAP_PAGE_BITMAP_LIMIT];
132
+ #endif
133
+ /* the following three bitmaps are cleared at the beginning of full GC */
134
+ bits_t mark_bits[HEAP_PAGE_BITMAP_LIMIT];
135
+ #if USE_RGENGC
136
+ bits_t uncollectible_bits[HEAP_PAGE_BITMAP_LIMIT];
137
+ bits_t marking_bits[HEAP_PAGE_BITMAP_LIMIT];
138
+ #endif
139
+ };
140
+
141
+ typedef struct gc_profile_record {
142
+ int flags;
143
+
144
+ double gc_time;
145
+ double gc_invoke_time;
146
+
147
+ size_t heap_total_objects;
148
+ size_t heap_use_size;
149
+ size_t heap_total_size;
150
+
151
+ #if GC_PROFILE_MORE_DETAIL
152
+ double gc_mark_time;
153
+ double gc_sweep_time;
154
+
155
+ size_t heap_use_pages;
156
+ size_t heap_live_objects;
157
+ size_t heap_free_objects;
158
+
159
+ size_t allocate_increase;
160
+ size_t allocate_limit;
161
+
162
+ double prepare_time;
163
+ size_t removing_objects;
164
+ size_t empty_objects;
165
+ #if GC_PROFILE_DETAIL_MEMORY
166
+ long maxrss;
167
+ long minflt;
168
+ long majflt;
169
+ #endif
170
+ #endif
171
+ #if MALLOC_ALLOCATED_SIZE
172
+ size_t allocated_size;
173
+ #endif
174
+
175
+ #if RGENGC_PROFILE > 0
176
+ size_t old_objects;
177
+ size_t remembered_normal_objects;
178
+ size_t remembered_shady_objects;
179
+ #endif
180
+ } gc_profile_record;
181
+
182
+ typedef struct rb_objspace {
183
+ struct {
184
+ size_t limit;
185
+ size_t increase;
186
+ #if MALLOC_ALLOCATED_SIZE
187
+ size_t allocated_size;
188
+ size_t allocations;
189
+ #endif
190
+ } malloc_params;
191
+
192
+ struct {
193
+ unsigned int mode : 2;
194
+ unsigned int immediate_sweep : 1;
195
+ unsigned int dont_gc : 1;
196
+ unsigned int dont_incremental : 1;
197
+ unsigned int during_gc : 1;
198
+ unsigned int gc_stressful: 1;
199
+ unsigned int has_hook: 1;
200
+ #if USE_RGENGC
201
+ unsigned int during_minor_gc : 1;
202
+ #endif
203
+ #if GC_ENABLE_INCREMENTAL_MARK
204
+ unsigned int during_incremental_marking : 1;
205
+ #endif
206
+ } flags;
207
+
208
+ rb_event_flag_t hook_events;
209
+ size_t total_allocated_objects;
210
+
211
+ rb_heap_t eden_heap;
212
+ rb_heap_t tomb_heap; /* heap for zombies and ghosts */
213
+
214
+ struct {
215
+ rb_atomic_t finalizing;
216
+ } atomic_flags;
217
+
218
+ struct mark_func_data_struct {
219
+ void *data;
220
+ void (*mark_func)(VALUE v, void *data);
221
+ } *mark_func_data;
222
+
223
+ mark_stack_t mark_stack;
224
+ size_t marked_slots;
225
+
226
+ struct {
227
+ struct heap_page **sorted;
228
+ size_t allocated_pages;
229
+ size_t allocatable_pages;
230
+ size_t sorted_length;
231
+ RVALUE *range[2];
232
+ size_t freeable_pages;
233
+
234
+ /* final */
235
+ size_t final_slots;
236
+ VALUE deferred_final;
237
+ } heap_pages;
238
+
239
+ st_table *finalizer_table;
240
+
241
+ struct {
242
+ int run;
243
+ int latest_gc_info;
244
+ gc_profile_record *records;
245
+ gc_profile_record *current_record;
246
+ size_t next_index;
247
+ size_t size;
248
+
249
+ #if GC_PROFILE_MORE_DETAIL
250
+ double prepare_time;
251
+ #endif
252
+ double invoke_time;
253
+
254
+ #if USE_RGENGC
255
+ size_t minor_gc_count;
256
+ size_t major_gc_count;
257
+ #if RGENGC_PROFILE > 0
258
+ size_t total_generated_normal_object_count;
259
+ size_t total_generated_shady_object_count;
260
+ size_t total_shade_operation_count;
261
+ size_t total_promoted_count;
262
+ size_t total_remembered_normal_object_count;
263
+ size_t total_remembered_shady_object_count;
264
+
265
+ #if RGENGC_PROFILE >= 2
266
+ size_t generated_normal_object_count_types[RUBY_T_MASK];
267
+ size_t generated_shady_object_count_types[RUBY_T_MASK];
268
+ size_t shade_operation_count_types[RUBY_T_MASK];
269
+ size_t promoted_types[RUBY_T_MASK];
270
+ size_t remembered_normal_object_count_types[RUBY_T_MASK];
271
+ size_t remembered_shady_object_count_types[RUBY_T_MASK];
272
+ #endif
273
+ #endif /* RGENGC_PROFILE */
274
+ #endif /* USE_RGENGC */
275
+
276
+ /* temporary profiling space */
277
+ double gc_sweep_start_time;
278
+ size_t total_allocated_objects_at_gc_start;
279
+ size_t heap_used_at_gc_start;
280
+
281
+ /* basic statistics */
282
+ size_t count;
283
+ size_t total_freed_objects;
284
+ size_t total_allocated_pages;
285
+ size_t total_freed_pages;
286
+ } profile;
287
+ struct gc_list *global_list;
288
+
289
+ VALUE gc_stress_mode;
290
+
291
+ #if USE_RGENGC
292
+ struct {
293
+ VALUE parent_object;
294
+ int need_major_gc;
295
+ size_t last_major_gc;
296
+ size_t uncollectible_wb_unprotected_objects;
297
+ size_t uncollectible_wb_unprotected_objects_limit;
298
+ size_t old_objects;
299
+ size_t old_objects_limit;
300
+
301
+ #if RGENGC_ESTIMATE_OLDMALLOC
302
+ size_t oldmalloc_increase;
303
+ size_t oldmalloc_increase_limit;
304
+ #endif
305
+
306
+ #if RGENGC_CHECK_MODE >= 2
307
+ struct st_table *allrefs_table;
308
+ size_t error_count;
309
+ #endif
310
+ } rgengc;
311
+ #if GC_ENABLE_INCREMENTAL_MARK
312
+ struct {
313
+ size_t pooled_slots;
314
+ size_t step_slots;
315
+ } rincgc;
316
+ #endif
317
+ #endif /* USE_RGENGC */
318
+
319
+ #if GC_DEBUG_STRESS_TO_CLASS
320
+ VALUE stress_to_class;
321
+ #endif
322
+ } rb_objspace_t;
323
+
324
+ #endif