Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/debugger-libs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaruka Matsumoto <harukam0416@gmail.com>2017-06-29 13:01:23 +0300
committerHaruka Matsumoto <harukam0416@gmail.com>2018-01-24 06:25:42 +0300
commit4030a7f618b488f378923fbfdac4b9a441d073c9 (patch)
tree4faa5fb2094a57642a8958e53da18d7f4a25e159 /Mono.Debugger.Soft
parent52e9185c1fd73ef550175b08e688ba2d026510eb (diff)
Create byte array without wrapper objects
In order to support lambda expression, we have to send compiled assembly for the lambda to runtime. It costs much time if we create wrapper objects like ValueImpl and Value for each byte in the compiled assembly. This patch avoids it by sending those bytes without creating wrappers.
Diffstat (limited to 'Mono.Debugger.Soft')
-rw-r--r--Mono.Debugger.Soft/Mono.Debugger.Soft/ArrayMirror.cs9
-rw-r--r--Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs15
2 files changed, 24 insertions, 0 deletions
diff --git a/Mono.Debugger.Soft/Mono.Debugger.Soft/ArrayMirror.cs b/Mono.Debugger.Soft/Mono.Debugger.Soft/ArrayMirror.cs
index 57a7951..b11c94a 100644
--- a/Mono.Debugger.Soft/Mono.Debugger.Soft/ArrayMirror.cs
+++ b/Mono.Debugger.Soft/Mono.Debugger.Soft/ArrayMirror.cs
@@ -1,3 +1,4 @@
+
using System;
using System.Collections;
using System.Collections.Generic;
@@ -92,6 +93,14 @@ namespace Mono.Debugger.Soft
vm.conn.Array_SetValues (id, index, vm.EncodeValues (values));
}
+ public void SetByteValues (byte[] bytes)
+ {
+ if (bytes != null && bytes.Length != Length) {
+ throw new IndexOutOfRangeException ();
+ }
+ vm.conn.ByteArray_SetValues (id, bytes);
+ }
+
IEnumerator IEnumerable.GetEnumerator ()
{
return new SimpleEnumerator (this);
diff --git a/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs b/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
index d4d7b71..c9da1c7 100644
--- a/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
+++ b/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
@@ -2452,6 +2452,21 @@ namespace Mono.Debugger.Soft
SendReceive (CommandSet.ARRAY_REF, (int)CmdArrayRef.SET_VALUES, new PacketWriter ().WriteId (id).WriteInt (index).WriteInt (values.Length).WriteValues (values));
}
+ // This is a special case when setting values of an array that
+ // consists of a large number of bytes. This saves much time and
+ // cost than we create ValueImpl object for each byte.
+ internal void ByteArray_SetValues (long id, byte[] bytes)
+ {
+ int index = 0;
+ var typ = (byte)ElementType.U1;
+ var w = new PacketWriter ().WriteId (id).WriteInt (index).WriteInt (bytes.Length);
+ for (int i = 0; i < bytes.Length; i++) {
+ w.WriteByte (typ);
+ w.WriteInt (bytes[i]);
+ }
+ SendReceive (CommandSet.ARRAY_REF, (int)CmdArrayRef.SET_VALUES, w);
+ }
+
/*
* STRINGS
*/