zeroc-ice 3.8.2 → 3.8.3

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 (256) hide show
  1. checksums.yaml +4 -4
  2. data/dist/IceRuby/Communicator.cpp +26 -9
  3. data/dist/IceRuby/Config.h +0 -12
  4. data/dist/IceRuby/Connection.cpp +18 -9
  5. data/dist/IceRuby/DefaultSliceLoader.h +1 -1
  6. data/dist/IceRuby/Endpoint.cpp +21 -8
  7. data/dist/IceRuby/Operation.cpp +7 -5
  8. data/dist/IceRuby/Properties.cpp +3 -4
  9. data/dist/IceRuby/Proxy.cpp +11 -19
  10. data/dist/IceRuby/RubySliceLoader.cpp +1 -1
  11. data/dist/IceRuby/RubySliceLoader.h +6 -0
  12. data/dist/IceRuby/Types.cpp +162 -138
  13. data/dist/IceRuby/Types.h +68 -28
  14. data/dist/IceRuby/Util.cpp +14 -78
  15. data/dist/IceRuby/Util.h +7 -17
  16. data/dist/ice/cpp/include/Ice/Communicator.h +31 -8
  17. data/dist/ice/cpp/include/Ice/Config.h +2 -2
  18. data/dist/ice/cpp/include/Ice/Connection.h +24 -8
  19. data/dist/ice/cpp/include/Ice/CtrlCHandler.h +1 -1
  20. data/dist/ice/cpp/include/Ice/Demangle.h +1 -1
  21. data/dist/ice/cpp/include/Ice/Endpoint.h +4 -4
  22. data/dist/ice/cpp/include/Ice/Initialize.h +4 -4
  23. data/dist/ice/cpp/include/Ice/InputStream.h +5 -5
  24. data/dist/ice/cpp/include/Ice/Instrumentation.h +13 -7
  25. data/dist/ice/cpp/include/Ice/LocalExceptions.h +5 -5
  26. data/dist/ice/cpp/include/Ice/Logger.h +7 -0
  27. data/dist/ice/cpp/include/Ice/LoggerUtil.h +1 -1
  28. data/dist/ice/cpp/include/Ice/Object.h +10 -8
  29. data/dist/ice/cpp/include/Ice/ObjectAdapter.h +1 -1
  30. data/dist/ice/cpp/include/Ice/OutgoingAsync.h +5 -2
  31. data/dist/ice/cpp/include/Ice/OutgoingResponse.h +2 -1
  32. data/dist/ice/cpp/include/Ice/OutputStream.h +7 -6
  33. data/dist/ice/cpp/include/Ice/PluginFactory.h +1 -1
  34. data/dist/ice/cpp/include/Ice/Properties.h +3 -3
  35. data/dist/ice/cpp/include/Ice/Proxy.h +192 -50
  36. data/dist/ice/cpp/include/Ice/SSL/ClientAuthenticationOptions.h +3 -3
  37. data/dist/ice/cpp/include/Ice/SSL/EndpointInfo.h +1 -1
  38. data/dist/ice/cpp/include/Ice/SSL/ServerAuthenticationOptions.h +5 -5
  39. data/dist/ice/cpp/include/Ice/ServantLocator.h +1 -1
  40. data/dist/ice/cpp/include/Ice/Service.h +2 -5
  41. data/dist/ice/cpp/include/Ice/SliceLoader.h +1 -1
  42. data/dist/ice/cpp/include/Ice/SlicedData.h +5 -3
  43. data/dist/ice/cpp/include/Ice/StreamHelpers.h +1 -1
  44. data/dist/ice/cpp/include/Ice/StreamableTraits.h +2 -2
  45. data/dist/ice/cpp/include/Ice/StringConverter.h +2 -3
  46. data/dist/ice/cpp/include/Ice/StringUtil.h +2 -7
  47. data/dist/ice/cpp/include/Ice/UUID.h +1 -0
  48. data/dist/ice/cpp/include/Ice/Value.h +2 -2
  49. data/dist/ice/cpp/include/generated/Ice/BuiltinSequences.h +2 -2
  50. data/dist/ice/cpp/include/generated/Ice/Context.h +2 -2
  51. data/dist/ice/cpp/include/generated/Ice/EndpointTypes.h +2 -2
  52. data/dist/ice/cpp/include/generated/Ice/Identity.h +2 -2
  53. data/dist/ice/cpp/include/generated/Ice/Locator.h +50 -14
  54. data/dist/ice/cpp/include/generated/Ice/LocatorRegistry.h +38 -11
  55. data/dist/ice/cpp/include/generated/Ice/Metrics.h +94 -39
  56. data/dist/ice/cpp/include/generated/Ice/OperationMode.h +2 -2
  57. data/dist/ice/cpp/include/generated/Ice/Process.h +34 -8
  58. data/dist/ice/cpp/include/generated/Ice/PropertiesAdmin.h +42 -11
  59. data/dist/ice/cpp/include/generated/Ice/PropertyDict.h +2 -2
  60. data/dist/ice/cpp/include/generated/Ice/RemoteLogger.h +93 -40
  61. data/dist/ice/cpp/include/generated/Ice/ReplyStatus.h +2 -2
  62. data/dist/ice/cpp/include/generated/Ice/Router.h +50 -14
  63. data/dist/ice/cpp/include/generated/Ice/SliceChecksumDict.h +2 -2
  64. data/dist/ice/cpp/include/generated/Ice/Version.h +2 -2
  65. data/dist/ice/cpp/include/generated/IceDiscovery/Lookup.h +66 -14
  66. data/dist/ice/cpp/include/generated/IceLocatorDiscovery/Lookup.h +34 -8
  67. data/dist/ice/cpp/src/Ice/AddDefaultPluginFactories_all.cpp +1 -1
  68. data/dist/ice/cpp/src/Ice/Base64.cpp +47 -137
  69. data/dist/ice/cpp/src/Ice/Base64.h +2 -2
  70. data/dist/ice/cpp/src/Ice/BatchRequestQueue.cpp +28 -13
  71. data/dist/ice/cpp/src/Ice/BatchRequestQueue.h +5 -1
  72. data/dist/ice/cpp/src/Ice/Buffer.cpp +1 -1
  73. data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +1 -1
  74. data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.h +1 -1
  75. data/dist/ice/cpp/src/Ice/Communicator.cpp +4 -3
  76. data/dist/ice/cpp/src/Ice/CommunicatorFlushBatchAsync.cpp +8 -0
  77. data/dist/ice/cpp/src/Ice/ConnectRequestHandler.cpp +5 -15
  78. data/dist/ice/cpp/src/Ice/ConnectRequestHandler.h +1 -1
  79. data/dist/ice/cpp/src/Ice/ConnectionFactory.cpp +6 -8
  80. data/dist/ice/cpp/src/Ice/ConnectionFactory.h +0 -3
  81. data/dist/ice/cpp/src/Ice/ConnectionI.cpp +94 -99
  82. data/dist/ice/cpp/src/Ice/ConnectionI.h +11 -8
  83. data/dist/ice/cpp/src/Ice/ConsoleUtil.cpp +1 -1
  84. data/dist/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +10 -14
  85. data/dist/ice/cpp/src/Ice/EndpointI.h +1 -1
  86. data/dist/ice/cpp/src/Ice/FileUtil.cpp +12 -12
  87. data/dist/ice/cpp/src/Ice/FixedRequestHandler.cpp +1 -1
  88. data/dist/ice/cpp/src/Ice/FixedRequestHandler.h +1 -1
  89. data/dist/ice/cpp/src/Ice/HttpParser.h +0 -2
  90. data/dist/ice/cpp/src/Ice/IdleTimeoutTransceiverDecorator.cpp +6 -3
  91. data/dist/ice/cpp/src/Ice/IncomingRequest.cpp +1 -3
  92. data/dist/ice/cpp/src/Ice/InputStream.cpp +23 -19
  93. data/dist/ice/cpp/src/Ice/Instance.cpp +73 -50
  94. data/dist/ice/cpp/src/Ice/Instance.h +1 -6
  95. data/dist/ice/cpp/src/Ice/LocalExceptions.cpp +1 -1
  96. data/dist/ice/cpp/src/Ice/LocatorInfo.cpp +2 -2
  97. data/dist/ice/cpp/src/Ice/LoggerAdminI.cpp +13 -18
  98. data/dist/ice/cpp/src/Ice/LoggerI.cpp +1 -1
  99. data/dist/ice/cpp/src/Ice/LoggerI.h +2 -2
  100. data/dist/ice/cpp/src/Ice/MetricsAdminI.h +6 -1
  101. data/dist/ice/cpp/src/Ice/MetricsObserverI.h +22 -18
  102. data/dist/ice/cpp/src/Ice/NativePropertiesAdmin.cpp +5 -2
  103. data/dist/ice/cpp/src/Ice/Network.cpp +168 -103
  104. data/dist/ice/cpp/src/Ice/Network.h +12 -7
  105. data/dist/ice/cpp/src/Ice/NetworkProxy.cpp +17 -6
  106. data/dist/ice/cpp/src/Ice/NetworkProxy.h +2 -1
  107. data/dist/ice/cpp/src/Ice/Object.cpp +1 -1
  108. data/dist/ice/cpp/src/Ice/ObjectAdapterI.cpp +56 -19
  109. data/dist/ice/cpp/src/Ice/OpaqueEndpointI.cpp +10 -10
  110. data/dist/ice/cpp/src/Ice/Options.cpp +7 -2
  111. data/dist/ice/cpp/src/Ice/OutgoingAsync.cpp +1 -1
  112. data/dist/ice/cpp/src/Ice/OutputStream.cpp +4 -4
  113. data/dist/ice/cpp/src/Ice/PluginManagerI.cpp +7 -1
  114. data/dist/ice/cpp/src/Ice/Properties.cpp +26 -16
  115. data/dist/ice/cpp/src/Ice/PropertyUtil.cpp +1 -1
  116. data/dist/ice/cpp/src/Ice/ProtocolInstance.cpp +0 -11
  117. data/dist/ice/cpp/src/Ice/ProtocolInstance.h +1 -2
  118. data/dist/ice/cpp/src/Ice/Proxy.cpp +9 -1
  119. data/dist/ice/cpp/src/Ice/ProxyAsync.cpp +110 -13
  120. data/dist/ice/cpp/src/Ice/Random.cpp +68 -7
  121. data/dist/ice/cpp/src/Ice/Random.h +6 -2
  122. data/dist/ice/cpp/src/Ice/Reference.cpp +22 -11
  123. data/dist/ice/cpp/src/Ice/Reference.h +3 -0
  124. data/dist/ice/cpp/src/Ice/ReferenceFactory.cpp +10 -0
  125. data/dist/ice/cpp/src/Ice/RequestHandler.h +3 -1
  126. data/dist/ice/cpp/src/Ice/RequestHandlerCache.cpp +1 -1
  127. data/dist/ice/cpp/src/Ice/RequestHandlerCache.h +1 -1
  128. data/dist/ice/cpp/src/Ice/ResourceConfig.h +3 -3
  129. data/dist/ice/cpp/src/Ice/RetryQueue.cpp +8 -12
  130. data/dist/ice/cpp/src/Ice/SHA1.cpp +11 -11
  131. data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.cpp +0 -6
  132. data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.h +0 -6
  133. data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.cpp +15 -1
  134. data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.cpp +77 -27
  135. data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.h +2 -1
  136. data/dist/ice/cpp/src/Ice/SSL/RFC2253.cpp +2 -2
  137. data/dist/ice/cpp/src/Ice/SSL/SSLUtil.cpp +39 -34
  138. data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.cpp +130 -52
  139. data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.cpp +64 -33
  140. data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.h +0 -1
  141. data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.cpp +3 -3
  142. data/dist/ice/cpp/src/Ice/SSL/SecureTransportTransceiverI.cpp +9 -3
  143. data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.cpp +73 -51
  144. data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.h +0 -8
  145. data/dist/ice/cpp/src/Ice/Selector.cpp +13 -11
  146. data/dist/ice/cpp/src/Ice/ServantManager.cpp +3 -3
  147. data/dist/ice/cpp/src/Ice/Service.cpp +33 -115
  148. data/dist/ice/cpp/src/Ice/StreamSocket.cpp +33 -40
  149. data/dist/ice/cpp/src/Ice/StreamSocket.h +4 -4
  150. data/dist/ice/cpp/src/Ice/StringConverter.cpp +1 -1
  151. data/dist/ice/cpp/src/Ice/StringUtil.cpp +12 -21
  152. data/dist/ice/cpp/src/Ice/SysLoggerI.cpp +136 -100
  153. data/dist/ice/cpp/src/Ice/SysLoggerI.h +7 -3
  154. data/dist/ice/cpp/src/Ice/SystemdJournalI.cpp +1 -1
  155. data/dist/ice/cpp/src/Ice/TcpAcceptor.cpp +7 -7
  156. data/dist/ice/cpp/src/Ice/TcpAcceptor.h +2 -1
  157. data/dist/ice/cpp/src/Ice/TcpBufSize.h +40 -0
  158. data/dist/ice/cpp/src/Ice/TcpConnector.cpp +5 -2
  159. data/dist/ice/cpp/src/Ice/TcpConnector.h +2 -0
  160. data/dist/ice/cpp/src/Ice/TcpTransceiver.cpp +6 -2
  161. data/dist/ice/cpp/src/Ice/ThreadPool.cpp +2 -8
  162. data/dist/ice/cpp/src/Ice/ThreadPool.h +0 -2
  163. data/dist/ice/cpp/src/Ice/Timer.cpp +7 -3
  164. data/dist/ice/cpp/src/Ice/UUID.cpp +1 -2
  165. data/dist/ice/cpp/src/Ice/UdpEndpointI.cpp +4 -1
  166. data/dist/ice/cpp/src/Ice/UdpTransceiver.cpp +136 -123
  167. data/dist/ice/cpp/src/Ice/UdpTransceiver.h +3 -4
  168. data/dist/ice/cpp/src/Ice/WSTransceiver.cpp +96 -27
  169. data/dist/ice/cpp/src/Ice/WSTransceiver.h +1 -1
  170. data/dist/ice/cpp/src/Ice/generated/BuiltinSequences.cpp +2 -2
  171. data/dist/ice/cpp/src/Ice/generated/Context.cpp +2 -2
  172. data/dist/ice/cpp/src/Ice/generated/EndpointTypes.cpp +2 -2
  173. data/dist/ice/cpp/src/Ice/generated/Identity.cpp +2 -2
  174. data/dist/ice/cpp/src/Ice/generated/Locator.cpp +2 -2
  175. data/dist/ice/cpp/src/Ice/generated/LocatorRegistry.cpp +2 -2
  176. data/dist/ice/cpp/src/Ice/generated/Metrics.cpp +2 -2
  177. data/dist/ice/cpp/src/Ice/generated/OperationMode.cpp +2 -2
  178. data/dist/ice/cpp/src/Ice/generated/Process.cpp +2 -2
  179. data/dist/ice/cpp/src/Ice/generated/PropertiesAdmin.cpp +2 -2
  180. data/dist/ice/cpp/src/Ice/generated/PropertyDict.cpp +2 -2
  181. data/dist/ice/cpp/src/Ice/generated/RemoteLogger.cpp +2 -2
  182. data/dist/ice/cpp/src/Ice/generated/ReplyStatus.cpp +2 -2
  183. data/dist/ice/cpp/src/Ice/generated/Router.cpp +2 -2
  184. data/dist/ice/cpp/src/Ice/generated/SliceChecksumDict.cpp +2 -2
  185. data/dist/ice/cpp/src/Ice/generated/Version.cpp +2 -2
  186. data/dist/ice/cpp/src/IceDiscovery/LookupI.cpp +47 -9
  187. data/dist/ice/cpp/src/IceDiscovery/LookupI.h +8 -3
  188. data/dist/ice/cpp/src/IceDiscovery/generated/Lookup.cpp +2 -2
  189. data/dist/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +43 -14
  190. data/dist/ice/cpp/src/IceLocatorDiscovery/generated/Lookup.cpp +2 -2
  191. data/dist/ice/cpp/src/Slice/DocCommentParser.cpp +26 -20
  192. data/dist/ice/cpp/src/Slice/DocCommentParser.h +2 -2
  193. data/dist/ice/cpp/src/Slice/FileTracker.cpp +3 -11
  194. data/dist/ice/cpp/src/Slice/FileTracker.h +0 -2
  195. data/dist/ice/cpp/src/Slice/Grammar.cpp +211 -210
  196. data/dist/ice/cpp/src/Slice/MetadataValidation.cpp +10 -9
  197. data/dist/ice/cpp/src/Slice/Parser.cpp +28 -20
  198. data/dist/ice/cpp/src/Slice/Parser.h +3 -4
  199. data/dist/ice/cpp/src/Slice/Preprocessor.cpp +3 -11
  200. data/dist/ice/cpp/src/Slice/Preprocessor.h +0 -2
  201. data/dist/ice/cpp/src/Slice/Scanner.cpp +3 -3
  202. data/dist/ice/cpp/src/Slice/SliceUtil.cpp +197 -114
  203. data/dist/ice/cpp/src/Slice/StringLiteralUtil.cpp +0 -2
  204. data/dist/ice/cpp/src/Slice/Util.h +21 -9
  205. data/dist/ice/cpp/src/slice2rb/Ruby.cpp +7 -3
  206. data/dist/ice/cpp/src/slice2rb/RubyUtil.cpp +16 -12
  207. data/dist/ice/cpp/src/slice2rb/RubyUtil.h +3 -3
  208. data/dist/ice/slice/Glacier2/Router.ice +3 -3
  209. data/dist/ice/slice/Ice/Metrics.ice +6 -5
  210. data/dist/ice/slice/Ice/RemoteLogger.ice +5 -5
  211. data/dist/ice/slice/IceGrid/Admin.ice +9 -9
  212. data/dist/ice/slice/IceGrid/Descriptor.ice +5 -5
  213. data/dist/ice/slice/IceStorm/Metrics.ice +1 -1
  214. data/dist/lib/Glacier2/Metrics.rb +1 -1
  215. data/dist/lib/Glacier2/PermissionsVerifier.rb +1 -1
  216. data/dist/lib/Glacier2/Router.rb +2 -2
  217. data/dist/lib/Glacier2/SSLInfo.rb +1 -1
  218. data/dist/lib/Glacier2/Session.rb +1 -1
  219. data/dist/lib/Ice/BuiltinSequences.rb +1 -1
  220. data/dist/lib/Ice/CompressBatch.rb +1 -2
  221. data/dist/lib/Ice/Context.rb +1 -1
  222. data/dist/lib/Ice/EndpointSelectionType.rb +1 -2
  223. data/dist/lib/Ice/EndpointTypes.rb +1 -1
  224. data/dist/lib/Ice/Identity.rb +1 -1
  225. data/dist/lib/Ice/IdentitySpaceship.rb +1 -0
  226. data/dist/lib/Ice/Locator.rb +1 -1
  227. data/dist/lib/Ice/LocatorRegistry.rb +1 -1
  228. data/dist/lib/Ice/Metrics.rb +1 -1
  229. data/dist/lib/Ice/OperationMode.rb +2 -3
  230. data/dist/lib/Ice/Process.rb +1 -1
  231. data/dist/lib/Ice/PropertiesAdmin.rb +1 -1
  232. data/dist/lib/Ice/PropertyDict.rb +1 -1
  233. data/dist/lib/Ice/RemoteLogger.rb +2 -3
  234. data/dist/lib/Ice/ReplyStatus.rb +2 -3
  235. data/dist/lib/Ice/Router.rb +1 -1
  236. data/dist/lib/Ice/SliceChecksumDict.rb +1 -1
  237. data/dist/lib/Ice/SliceUtil.rb +2 -2
  238. data/dist/lib/Ice/Struct.rb +1 -0
  239. data/dist/lib/Ice/ToStringMode.rb +1 -2
  240. data/dist/lib/Ice/Value.rb +2 -2
  241. data/dist/lib/Ice/Version.rb +1 -1
  242. data/dist/lib/IceBox/ServiceManager.rb +1 -1
  243. data/dist/lib/IceGrid/Admin.rb +3 -4
  244. data/dist/lib/IceGrid/Descriptor.rb +1 -1
  245. data/dist/lib/IceGrid/Exception.rb +1 -1
  246. data/dist/lib/IceGrid/FileParser.rb +1 -1
  247. data/dist/lib/IceGrid/Registry.rb +2 -3
  248. data/dist/lib/IceGrid/Session.rb +2 -2
  249. data/dist/lib/IceGrid/UserAccountMapper.rb +1 -1
  250. data/dist/lib/IceStorm/IceStorm.rb +1 -1
  251. data/dist/lib/IceStorm/Metrics.rb +1 -1
  252. data/extconf.rb +1 -1
  253. data/ice.gemspec +3 -3
  254. metadata +4 -5
  255. data/dist/ice/cpp/src/Ice/DLLMain.cpp +0 -40
  256. data/dist/ice/cpp/src/Ice/UndefSysMacros.h +0 -37
data/dist/IceRuby/Types.h CHANGED
@@ -21,7 +21,6 @@ namespace IceRuby
21
21
 
22
22
  class ProxyInfo;
23
23
  using ProxyInfoPtr = std::shared_ptr<ProxyInfo>;
24
- using ProxyInfoList = std::vector<ProxyInfoPtr>;
25
24
 
26
25
  //
27
26
  // This class is raised as an exception when object marshaling needs to be aborted.
@@ -35,20 +34,27 @@ namespace IceRuby
35
34
  using ValueMap = std::map<VALUE, std::shared_ptr<Ice::Value>>;
36
35
 
37
36
  class ValueReader;
37
+ class StreamUtil;
38
38
 
39
+ // Tracks the class instances already printed during a stringification, to detect shared instances and cycles.
40
+ // The instances are keyed in a Ruby identity hash (instance => index), whose keys remain valid when GC
41
+ // compaction runs during the stringification.
39
42
  struct PrintObjectHistory
40
43
  {
41
- int index;
42
- std::map<VALUE, int> objects;
44
+ PrintObjectHistory();
45
+
46
+ int index{0}; // the index to assign to the next class instance printed for the first time
47
+ VALUE objects; // Ruby identity hash
43
48
  };
44
49
 
45
50
  //
46
- // The delayed nature of class unmarshaling in the Ice protocol requires us to
47
- // handle unmarshaling using a callback strategy. An instance of UnmarshalCallback
48
- // is supplied to each type's unmarshal() member function. For all types except
49
- // classes, the callback is invoked with the unmarshaled value before unmarshal()
50
- // returns. For class instances, however, the callback may not be invoked until
51
- // the stream's finished() function is called.
51
+ // Slice unmarshaling uses a callback strategy: an instance of UnmarshalCallback is
52
+ // supplied to each type's unmarshal() member function. For all types except classes,
53
+ // the callback is invoked with the unmarshaled value before unmarshal() returns. For
54
+ // class instances, the callback may not be invoked until later, because the Slice 1.0
55
+ // encoding writes instances after the data that references them. The 1.1 encoding is
56
+ // much more linear, but this extension unmarshals both encodings with the same
57
+ // callback logic.
52
58
  //
53
59
  class UnmarshalCallback
54
60
  {
@@ -57,28 +63,32 @@ namespace IceRuby
57
63
 
58
64
  //
59
65
  // The unmarshaled() member function receives the unmarshaled value. The
60
- // last two arguments are the values passed to unmarshal() for use by
61
- // UnmarshalCallback implementations.
66
+ // next two arguments are the values passed to unmarshal() for use by
67
+ // UnmarshalCallback implementations, and the last argument is the
68
+ // StreamUtil attached to the stream.
62
69
  //
63
- virtual void unmarshaled(VALUE, VALUE, void*) = 0;
70
+ virtual void unmarshaled(VALUE, VALUE, void*, StreamUtil*) = 0;
64
71
  };
65
72
  using UnmarshalCallbackPtr = std::shared_ptr<UnmarshalCallback>;
66
73
 
67
74
  //
68
75
  // ReadValueCallback retains all of the information necessary to store an unmarshaled
69
- // Slice value as a Ruby object.
76
+ // Slice value as a Ruby object. Its only owner is the StreamUtil attached to the
77
+ // stream (the stream's patch entries hold non-owning pointers), so it never outlives
78
+ // the StreamUtil and _util remains valid for its whole lifetime.
70
79
  //
71
80
  class ReadValueCallback final
72
81
  {
73
82
  public:
74
- ReadValueCallback(const ClassInfoPtr&, const UnmarshalCallbackPtr&, VALUE, void*);
83
+ ReadValueCallback(const ClassInfoPtr&, const UnmarshalCallbackPtr&, VALUE, void*, StreamUtil*);
75
84
 
76
85
  void invoke(const std::shared_ptr<Ice::Value>&);
77
86
 
78
87
  private:
79
88
  ClassInfoPtr _info;
80
89
  UnmarshalCallbackPtr _cb;
81
- VALUE _target;
90
+ StreamUtil* _util;
91
+ long _targetIndex;
82
92
  void* _closure;
83
93
  };
84
94
  using ReadValueCallbackPtr = std::shared_ptr<ReadValueCallback>;
@@ -93,6 +103,12 @@ namespace IceRuby
93
103
  StreamUtil();
94
104
  ~StreamUtil();
95
105
 
106
+ // Registers a GC root tied to the address of _held, so it's neither copyable nor movable.
107
+ StreamUtil(const StreamUtil&) = delete;
108
+ StreamUtil(StreamUtil&&) = delete;
109
+ StreamUtil& operator=(const StreamUtil&) = delete;
110
+ StreamUtil& operator=(StreamUtil&&) = delete;
111
+
96
112
  //
97
113
  // Keep a reference to a ReadValueCallback for patching purposes.
98
114
  //
@@ -103,6 +119,15 @@ namespace IceRuby
103
119
  //
104
120
  void add(const std::shared_ptr<ValueReader>&);
105
121
 
122
+ //
123
+ // Keep a Ruby object reachable for the lifetime of the stream and return an index
124
+ // that recovers it via getHeldValue. The objects are held in a Ruby array whose
125
+ // elements the GC updates when compaction moves them, so getHeldValue remains
126
+ // valid where a raw VALUE copy in native code would go stale.
127
+ //
128
+ long hold(VALUE);
129
+ VALUE getHeldValue(long index) const;
130
+
106
131
  //
107
132
  // Updated the sliced data information for all stored object instances.
108
133
  //
@@ -114,6 +139,7 @@ namespace IceRuby
114
139
  private:
115
140
  std::vector<ReadValueCallbackPtr> _callbacks;
116
141
  std::set<std::shared_ptr<ValueReader>> _readers;
142
+ VALUE _held; // Ruby array created on first use by hold()
117
143
  static VALUE _slicedDataType;
118
144
  static VALUE _sliceInfoType;
119
145
  };
@@ -134,7 +160,7 @@ namespace IceRuby
134
160
 
135
161
  virtual bool usesClasses() const; // Default implementation returns false.
136
162
 
137
- void unmarshaled(VALUE, VALUE, void*) override; // Default implementation is assert(false).
163
+ void unmarshaled(VALUE, VALUE, void*, StreamUtil*) override; // Default implementation is assert(false).
138
164
 
139
165
  virtual void destroy();
140
166
 
@@ -167,7 +193,6 @@ namespace IceRuby
167
193
  KindString
168
194
  };
169
195
 
170
- PrimitiveInfo();
171
196
  PrimitiveInfo(Kind);
172
197
 
173
198
  std::string getId() const final;
@@ -220,7 +245,7 @@ namespace IceRuby
220
245
  class DataMember final : public UnmarshalCallback
221
246
  {
222
247
  public:
223
- void unmarshaled(VALUE, VALUE, void*) final;
248
+ void unmarshaled(VALUE, VALUE, void*, StreamUtil*) final;
224
249
 
225
250
  std::string name;
226
251
  TypeInfoPtr type;
@@ -282,7 +307,7 @@ namespace IceRuby
282
307
 
283
308
  void marshal(VALUE, Ice::OutputStream*, ValueMap*, bool) final;
284
309
  void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, VALUE, void*, bool) final;
285
- void unmarshaled(VALUE, VALUE, void*) final;
310
+ void unmarshaled(VALUE, VALUE, void*, StreamUtil*) final;
286
311
 
287
312
  void print(VALUE, IceInternal::Output&, PrintObjectHistory*) final;
288
313
 
@@ -321,7 +346,7 @@ namespace IceRuby
321
346
  void marshal(VALUE, Ice::OutputStream*, ValueMap*, bool) final;
322
347
  void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, VALUE, void*, bool) final;
323
348
  void marshalElement(VALUE, VALUE, Ice::OutputStream*, ValueMap*);
324
- void unmarshaled(VALUE, VALUE, void*) final;
349
+ void unmarshaled(VALUE, VALUE, void*, StreamUtil*) final;
325
350
 
326
351
  void print(VALUE, IceInternal::Output&, PrintObjectHistory*) final;
327
352
  void printElement(VALUE, VALUE, IceInternal::Output&, PrintObjectHistory*);
@@ -331,7 +356,7 @@ namespace IceRuby
331
356
  class KeyCallback final : public UnmarshalCallback
332
357
  {
333
358
  public:
334
- void unmarshaled(VALUE, VALUE, void*) final;
359
+ void unmarshaled(VALUE, VALUE, void*, StreamUtil*) final;
335
360
 
336
361
  VALUE key;
337
362
  };
@@ -397,6 +422,8 @@ namespace IceRuby
397
422
  public:
398
423
  static ProxyInfoPtr create(VALUE);
399
424
 
425
+ // TODO: the 2nd and 3rd parameters are dead code, and should be removed in 3.9.
426
+ // They cannot be removed yet because slice2rb generated code which passes them in.
400
427
  void define(VALUE, VALUE, VALUE);
401
428
 
402
429
  std::string getId() const final;
@@ -412,14 +439,7 @@ namespace IceRuby
412
439
 
413
440
  void print(VALUE, IceInternal::Output&, PrintObjectHistory*) final;
414
441
 
415
- void destroy() final;
416
-
417
- bool isA(const ProxyInfoPtr&);
418
-
419
442
  const std::string id;
420
- const bool isBase; // Is this the ClassInfo for Ice::ObjectPrx?
421
- const ProxyInfoPtr base;
422
- const ProxyInfoList interfaces;
423
443
  const VALUE rubyClass;
424
444
  const VALUE typeObj;
425
445
 
@@ -451,6 +471,12 @@ namespace IceRuby
451
471
  ValueWriter(VALUE, ValueMap*, const ClassInfoPtr&);
452
472
  ~ValueWriter();
453
473
 
474
+ // Registers a GC root tied to the address of _object, so it's neither copyable nor movable.
475
+ ValueWriter(const ValueWriter&) = delete;
476
+ ValueWriter(ValueWriter&&) = delete;
477
+ ValueWriter& operator=(const ValueWriter&) = delete;
478
+ ValueWriter& operator=(ValueWriter&&) = delete;
479
+
454
480
  void ice_preMarshal() final;
455
481
 
456
482
  void _iceWrite(Ice::OutputStream*) const final;
@@ -474,6 +500,12 @@ namespace IceRuby
474
500
  ValueReader(VALUE, const ClassInfoPtr&);
475
501
  ~ValueReader();
476
502
 
503
+ // Registers a GC root tied to the address of _object, so it's neither copyable nor movable.
504
+ ValueReader(const ValueReader&) = delete;
505
+ ValueReader(ValueReader&&) = delete;
506
+ ValueReader& operator=(const ValueReader&) = delete;
507
+ ValueReader& operator=(ValueReader&&) = delete;
508
+
477
509
  void ice_postUnmarshal() final;
478
510
 
479
511
  void _iceWrite(Ice::OutputStream*) const final;
@@ -495,10 +527,18 @@ namespace IceRuby
495
527
  class ExceptionReader final : public Ice::UserException
496
528
  {
497
529
  public:
530
+ // Each constructor registers a GC root tied to the address of the new instance's _ex member, and the
531
+ // destructor unregisters it. The copy constructor must remain available: the exception machinery copies the
532
+ // reader into the exception storage. The other special members are deleted so that none can transfer or
533
+ // assign _ex without the matching registration.
498
534
  ExceptionReader(const ExceptionInfoPtr&);
499
535
  ExceptionReader(const ExceptionReader&);
500
536
  ~ExceptionReader();
501
537
 
538
+ ExceptionReader(ExceptionReader&&) = delete;
539
+ ExceptionReader& operator=(const ExceptionReader&) = delete;
540
+ ExceptionReader& operator=(ExceptionReader&&) = delete;
541
+
502
542
  const char* ice_id() const noexcept final;
503
543
  void ice_throw() const final;
504
544
 
@@ -9,28 +9,25 @@ using namespace IceRuby;
9
9
 
10
10
  namespace
11
11
  {
12
- template<typename T> bool setVersion(VALUE p, const T& version)
12
+ template<typename T> void setVersion(VALUE p, const T& version)
13
13
  {
14
14
  volatile VALUE major = callRuby(rb_int2inum, version.major);
15
15
  volatile VALUE minor = callRuby(rb_int2inum, version.minor);
16
16
  rb_ivar_set(p, rb_intern("@major"), major);
17
17
  rb_ivar_set(p, rb_intern("@minor"), minor);
18
-
19
- return true;
20
18
  }
21
19
 
22
- template<typename T> bool getVersion(VALUE p, T& v)
20
+ template<typename T> void getVersion(VALUE p, T& v)
23
21
  {
24
22
  volatile VALUE major = callRuby(rb_ivar_get, p, rb_intern("@major"));
25
23
  volatile VALUE minor = callRuby(rb_ivar_get, p, rb_intern("@minor"));
26
24
 
27
- long m;
25
+ int32_t m;
28
26
 
29
27
  m = getInteger(major);
30
28
  if (m < 0 || m > 255)
31
29
  {
32
30
  throw RubyException(rb_eTypeError, "version major must be a value between 0 and 255");
33
- return false;
34
31
  }
35
32
  v.major = m;
36
33
 
@@ -38,11 +35,8 @@ namespace
38
35
  if (m < 0 || m > 255)
39
36
  {
40
37
  throw RubyException(rb_eTypeError, "version minor must be a value between 0 and 255");
41
- return false;
42
38
  }
43
39
  v.minor = m;
44
-
45
- return true;
46
40
  }
47
41
 
48
42
  template<typename T> VALUE createVersion(const T& version, const char* type)
@@ -51,11 +45,7 @@ namespace
51
45
  assert(!NIL_P(rbType));
52
46
 
53
47
  volatile VALUE obj = callRuby(rb_class_new_instance, 0, static_cast<VALUE*>(0), rbType);
54
-
55
- if (!setVersion<T>(obj, version))
56
- {
57
- return Qnil;
58
- }
48
+ setVersion<T>(obj, version);
59
49
 
60
50
  return obj;
61
51
  }
@@ -126,13 +116,7 @@ IceRuby::isString(VALUE val)
126
116
  bool
127
117
  IceRuby::isArray(VALUE val)
128
118
  {
129
- return TYPE(val) == T_ARRAY || callRuby(rb_respond_to, val, rb_intern("to_arr")) != 0;
130
- }
131
-
132
- bool
133
- IceRuby::isHash(VALUE val)
134
- {
135
- return TYPE(val) == T_HASH || callRuby(rb_respond_to, val, rb_intern("to_hash")) != 0;
119
+ return TYPE(val) == T_ARRAY || callRuby(rb_respond_to, val, rb_intern("to_ary")) != 0;
136
120
  }
137
121
 
138
122
  string
@@ -156,17 +140,6 @@ namespace
156
140
  T ret;
157
141
  };
158
142
 
159
- //
160
- // Wrapper function to call rb_num2long with rb_protect
161
- //
162
- VALUE
163
- rb_num2long_wrapper(VALUE val)
164
- {
165
- RubyCallArgs<long>* data = (RubyCallArgs<long>*)val;
166
- data->ret = rb_num2long(data->val);
167
- return val;
168
- }
169
-
170
143
  //
171
144
  // Wrapper function to call rb_num2ll with rb_protect
172
145
  //
@@ -179,17 +152,15 @@ namespace
179
152
  }
180
153
  }
181
154
 
182
- long
155
+ int32_t
183
156
  IceRuby::getInteger(VALUE val)
184
157
  {
185
- RubyCallArgs<long> arg = {val, -1};
186
- int error = 0;
187
- rb_protect(rb_num2long_wrapper, (VALUE)&arg, &error);
188
- if (error)
158
+ int64_t value = getLong(val);
159
+ if (value < INT32_MIN || value > INT32_MAX)
189
160
  {
190
- throw RubyException(rb_eTypeError, "unable to convert value to an int");
161
+ throw RubyException(rb_eRangeError, "value is out of the range of a 32-bit integer");
191
162
  }
192
- return arg.ret;
163
+ return static_cast<int32_t>(value);
193
164
  }
194
165
 
195
166
  int64_t
@@ -216,7 +187,7 @@ IceRuby::arrayToStringSeq(VALUE val, vector<string>& seq)
216
187
  for (long i = 0; i < RARRAY_LEN(arr); ++i)
217
188
  {
218
189
  string s = getString(RARRAY_AREF(arr, i));
219
- seq.push_back(getString(RARRAY_AREF(arr, i)));
190
+ seq.push_back(std::move(s));
220
191
  }
221
192
  return true;
222
193
  }
@@ -236,21 +207,6 @@ IceRuby::stringSeqToArray(const vector<string>& seq)
236
207
  return result;
237
208
  }
238
209
 
239
- VALUE
240
- IceRuby::createNumSeq(const vector<byte>& v)
241
- {
242
- volatile VALUE result = createArray(v.size());
243
- long i = 0;
244
- if (v.size() > 0)
245
- {
246
- for (vector<byte>::const_iterator p = v.begin(); p != v.end(); ++p, ++i)
247
- {
248
- RARRAY_ASET(result, i, INT2FIX(std::to_integer<int>(*p)));
249
- }
250
- }
251
- return result;
252
- }
253
-
254
210
  namespace
255
211
  {
256
212
  struct HashToContextIterator : public IceRuby::HashIterator
@@ -298,11 +254,7 @@ IceRuby::contextToHash(const Ice::Context& ctx)
298
254
  }
299
255
 
300
256
  extern "C" VALUE
301
- #ifdef RUBY_BLOCK_CALL_FUNC_TAKES_BLOCKARG // Defined Ruby >= 2.1
302
257
  IceRuby_Util_hash_foreach_callback(VALUE val, VALUE arg, int, const VALUE*, VALUE)
303
- #else
304
- IceRuby_Util_hash_foreach_callback(VALUE val, VALUE arg, int, VALUE*)
305
- #endif
306
258
  {
307
259
  VALUE key = rb_ary_entry(val, 0);
308
260
  VALUE value = rb_ary_entry(val, 1);
@@ -319,16 +271,6 @@ IceRuby_Util_hash_foreach_callback(VALUE val, VALUE arg, int, VALUE*)
319
271
  return val;
320
272
  }
321
273
 
322
- extern "C"
323
- {
324
- // Defined Ruby >= 2.1. Ruby 2.7 enables RB_BLOCK_CALL_FUNC_STRICT by default
325
- #ifdef RB_BLOCK_CALL_FUNC_STRICT
326
- typedef rb_block_call_func_t ICE_RUBY_HASH_FOREACH_CALLBACK;
327
- #else
328
- typedef VALUE (*ICE_RUBY_HASH_FOREACH_CALLBACK)(...);
329
- #endif
330
- }
331
-
332
274
  void
333
275
  IceRuby::hashIterate(VALUE h, HashIterator& iter)
334
276
  {
@@ -340,7 +282,7 @@ IceRuby::hashIterate(VALUE h, HashIterator& iter)
340
282
  rb_intern("each"),
341
283
  0,
342
284
  static_cast<VALUE*>(0),
343
- reinterpret_cast<ICE_RUBY_HASH_FOREACH_CALLBACK>(IceRuby_Util_hash_foreach_callback),
285
+ IceRuby_Util_hash_foreach_callback,
344
286
  reinterpret_cast<VALUE>(&iter));
345
287
  }
346
288
 
@@ -397,7 +339,7 @@ IceRuby::createEncodingVersion(const Ice::EncodingVersion& v)
397
339
  return createVersion<Ice::EncodingVersion>(v, Ice_EncodingVersion);
398
340
  }
399
341
 
400
- bool
342
+ void
401
343
  IceRuby::getEncodingVersion(VALUE p, Ice::EncodingVersion& v)
402
344
  {
403
345
  volatile VALUE cls = callRuby(rb_path2class, Ice_EncodingVersion);
@@ -408,12 +350,7 @@ IceRuby::getEncodingVersion(VALUE p, Ice::EncodingVersion& v)
408
350
  throw RubyException(rb_eTypeError, "value is not an Ice::EncodingVersion");
409
351
  }
410
352
 
411
- if (!getVersion<Ice::EncodingVersion>(p, v))
412
- {
413
- return false;
414
- }
415
-
416
- return true;
353
+ getVersion<Ice::EncodingVersion>(p, v);
417
354
  }
418
355
 
419
356
  VALUE
@@ -445,7 +382,6 @@ namespace
445
382
  VALUE createRubyException(const char* typeId, std::array<VALUE, N> args, bool fallbackToLocalException = false)
446
383
  {
447
384
  // Convert the exception's typeId to its mapped Ruby type by removing the leading "::".
448
- // This function should only ever be called on Ice local exceptions which don't use 'ruby:identifier'.
449
385
  string className = string{typeId}.substr(2);
450
386
  assert(className.starts_with("Ice::"));
451
387
 
data/dist/IceRuby/Util.h CHANGED
@@ -51,11 +51,6 @@ namespace IceRuby
51
51
  //
52
52
  bool isArray(VALUE);
53
53
 
54
- //
55
- // Returns true if the value is a hash or can be converted into a hash.
56
- //
57
- bool isHash(VALUE);
58
-
59
54
  //
60
55
  // Convert a Ruby value into a string. May raise RubyException.
61
56
  //
@@ -67,9 +62,10 @@ namespace IceRuby
67
62
  VALUE createString(std::string_view);
68
63
 
69
64
  //
70
- // Convert a Ruby value into a long. May raise RubyException.
65
+ // Convert a Ruby value into an std::int32_t. Raises RangeError if the value is outside the range of a
66
+ // 32-bit integer. May raise RubyException.
71
67
  //
72
- long getInteger(VALUE);
68
+ std::int32_t getInteger(VALUE);
73
69
 
74
70
  //
75
71
  // Convert a Ruby value into an std::int64_t. May raise RubyException.
@@ -89,12 +85,6 @@ namespace IceRuby
89
85
  //
90
86
  VALUE stringSeqToArray(const std::vector<std::string>&);
91
87
 
92
- //
93
- // Convert a vector of std::byte into a Ruby array of numbers.
94
- // May raise RubyException.
95
- //
96
- VALUE createNumSeq(const std::vector<std::byte>&);
97
-
98
88
  //
99
89
  // Convert a Ruby hash to Ice::Context. Returns true on success
100
90
  // and false if the value is not a hash. May raise RubyException.
@@ -140,14 +130,14 @@ namespace IceRuby
140
130
  VALUE createEncodingVersion(const Ice::EncodingVersion&);
141
131
 
142
132
  //
143
- // Extracts the members of an encoding version.
133
+ // Extracts the members of an encoding version. May raise RubyException.
144
134
  //
145
- bool getEncodingVersion(VALUE, Ice::EncodingVersion&);
135
+ void getEncodingVersion(VALUE, Ice::EncodingVersion&);
146
136
 
147
137
  //
148
138
  // The callRuby functions are used to invoke Ruby C API functions
149
139
  // while translating any Ruby exception into RubyException so that
150
- // C++ objects are cleaned up properly. Overloadings are provided
140
+ // C++ objects are cleaned up properly. Overloads are provided
151
141
  // to support API functions that accept multiple arguments.
152
142
  //
153
143
  template<typename Fun> VALUE callRuby(Fun fun);
@@ -306,7 +296,7 @@ namespace IceRuby
306
296
  //
307
297
  // The callRubyVoid functions are used to invoke Ruby C API functions
308
298
  // while translating any Ruby exception into RubyException so that
309
- // C++ objects are cleaned up properly. Overloadings are provided
299
+ // C++ objects are cleaned up properly. Overloads are provided
310
300
  // to support API functions that accept multiple arguments.
311
301
  //
312
302
  template<typename Fun> void callRubyVoid(Fun fun);