Cosmos's System.Math.Sqrt plug Fails?

Developer
May 24, 2011 at 2:22 AM
Edited May 24, 2011 at 2:24 AM

Well, when working on drawing a circle, i have a small snippet of code which is able to fill the interior of a circle (when drawing to my test environment, which is a lone bitmap on a form):

int x1;
int x2;
int rSquared = radius * radius;
int counter = (Center.Y + radius);
for (int count = (Center.Y - radius); count <= counter; count++)
{
int ySquared = (count - Center.Y) * (count - Center.Y);
double sqrt = Math.Sqrt(rSquared - ySquared) + 0.5;
x1 = (int)(Center.X + sqrt);
x2 = (int)(Center.X - sqrt);
Vec2 p1 = new Vec2(x1, count);
Vec2 p2 = new Vec2(x2, count);
DrawLine(p1, p2, color);
}
  DrawCircleOutline(Center, radius, color); // So we don't have just the inside of a circle.

 

but this fails when done in Cosmos (and locks up the cpu), and the only point of failure i can find (the rest of the operations are used in other functions which work perfectly) , is the Sqrt function. This is implemented in cosmos with a plug, written in X#.

Because of this problem, I have to do the following do fill the circle:

int x = 0;
int y = radius;
int p = (5 - radius * 4) / 4;

SetPixel((uint)(Center.X), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X, Center.Y + y), color);
SetPixel((uint)(Center.X), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X, Center.Y - y), color);
SetPixel((uint)(Center.X + y), (uint)(Center.Y), color);
DrawLine(Center, new Vec2(Center.X + y, Center.Y), color);
SetPixel((uint)(Center.X - y), (uint)(Center.Y), color);
DrawLine(Center, new Vec2(Center.X - y, Center.Y), color);
while (x < y)
{
x++;
if (p < 0)
{
p += 2 * x + 1;
}
else
{
y--;
p += 2 * (x - y) + 1;
}
if (x == y)
{
SetPixel((uint)(Center.X + x), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X + x, Center.Y + y), color);
SetPixel((uint)(Center.X - x), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X - x, Center.Y + y), color);
SetPixel((uint)(Center.X + x), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X + x, Center.Y - y), color);
SetPixel((uint)(Center.X - x), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X - x, Center.Y - y), color);
}
else
{
if (x < y)
{
SetPixel((uint)(Center.X + x), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X + x, Center.Y + y), color);
SetPixel((uint)(Center.X - x), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X - x, Center.Y + y), color);
SetPixel((uint)(Center.X + x), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X + x, Center.Y - y), color);
SetPixel((uint)(Center.X - x), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X - x, Center.Y - y), color);
SetPixel((uint)(Center.X + y), (uint)(Center.Y + x), color);
DrawLine(Center, new Vec2(Center.X + y, Center.Y + x), color);
SetPixel((uint)(Center.X - y), (uint)(Center.Y + x), color);
DrawLine(Center, new Vec2(Center.X - y, Center.Y + x), color);
SetPixel((uint)(Center.X + y), (uint)(Center.Y - x), color);
DrawLine(Center, new Vec2(Center.X + y, Center.Y - x), color);
SetPixel((uint)(Center.X - y), (uint)(Center.Y - x), color);
DrawLine(Center, new Vec2(Center.X - y, Center.Y - x), color);
}
}
}

And that's certainly less than optimal. 

 

int x = 0;
int y = radius;
int p = (5 - radius * 4) / 4;

SetPixel((uint)(Center.X), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X, Center.Y + y), color);
SetPixel((uint)(Center.X), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X, Center.Y - y), color);
SetPixel((uint)(Center.X + y), (uint)(Center.Y), color);
DrawLine(Center, new Vec2(Center.X + y, Center.Y), color);
SetPixel((uint)(Center.X - y), (uint)(Center.Y), color);
DrawLine(Center, new Vec2(Center.X - y, Center.Y), color);
while (x < y)
{
x++;
if (p < 0)
{
p += 2 * x + 1;
}
else
{
y--;
p += 2 * (x - y) + 1;
}
if (x == y)
{
SetPixel((uint)(Center.X + x), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X + x, Center.Y + y), color);
SetPixel((uint)(Center.X - x), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X - x, Center.Y + y), color);
SetPixel((uint)(Center.X + x), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X + x, Center.Y - y), color);
SetPixel((uint)(Center.X - x), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X - x, Center.Y - y), color);
}
else
{
if (x < y)
{
SetPixel((uint)(Center.X + x), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X + x, Center.Y + y), color);
SetPixel((uint)(Center.X - x), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X - x, Center.Y + y), color);
SetPixel((uint)(Center.X + x), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X + x, Center.Y - y), color);
SetPixel((uint)(Center.X - x), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X - x, Center.Y - y), color);
SetPixel((uint)(Center.X + y), (uint)(Center.Y + x), color);
DrawLine(Center, new Vec2(Center.X + y, Center.Y + x), color);
SetPixel((uint)(Center.X - y), (uint)(Center.Y + x), color);
DrawLine(Center, new Vec2(Center.X - y, Center.Y + x), color);
SetPixel((uint)(Center.X + y), (uint)(Center.Y - x), color);
DrawLine(Center, new Vec2(Center.X + y, Center.Y - x), color);
SetPixel((uint)(Center.X - y), (uint)(Center.Y - x), color);
DrawLine(Center, new Vec2(Center.X - y, Center.Y - x), color);
}
}
}
Coordinator
May 24, 2011 at 7:13 AM
Please try to do some isolated tests with sqrt, ie use it separately and see if it works. (if not, please let us know what does happen and what you expected)

On Tue, May 24, 2011 at 3:22 AM, blah38621 <notifications@codeplex.com> wrote:

From: blah38621

Well, when working on drawing a circle, i have a small snippet of code which is able to fill the interior of a circle:

[code]

int x1;
int x2;
int rSquared = radius * radius;
int counter = (Center.Y + radius);
for (int count = (Center.Y - radius); count <= counter; count++)
{
int ySquared = (count - Center.Y) * (count - Center.Y);
double sqrt = Math.Sqrt(rSquared - ySquared) + 0.5;
x1 = (int)(Center.X + sqrt);
x2 = (int)(Center.X - sqrt);
Vec2 p1 = new Vec2(x1, count);
Vec2 p2 = new Vec2(x2, count);
DrawLine(p1, p2, color);
}
DrawCircleOutline(Center, radius, color); // So we don't have just the inside of a circle.

[/code]

but these fails, and the only point of failure i can find (the rest of the operations are used in other functions which work perfectly) , is the Sqrt function. This is implemented in cosmos with a plug, written in X#.

Because of this problem, I have to do the following do fill the circle:

[code]

int x = 0;
int y = radius;
int p = (5 - radius * 4) / 4;

SetPixel((uint)(Center.X), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X, Center.Y + y), color);
SetPixel((uint)(Center.X), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X, Center.Y - y), color);
SetPixel((uint)(Center.X + y), (uint)(Center.Y), color);
DrawLine(Center, new Vec2(Center.X + y, Center.Y), color);
SetPixel((uint)(Center.X - y), (uint)(Center.Y), color);
DrawLine(Center, new Vec2(Center.X - y, Center.Y), color);
while (x < y)
{
x++;
if (p < 0)
{
p += 2 * x + 1;
}
else
{
y--;
p += 2 * (x - y) + 1;
}
if (x == y)
{
SetPixel((uint)(Center.X + x), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X + x, Center.Y + y), color);
SetPixel((uint)(Center.X - x), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X - x, Center.Y + y), color);
SetPixel((uint)(Center.X + x), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X + x, Center.Y - y), color);
SetPixel((uint)(Center.X - x), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X - x, Center.Y - y), color);
}
else
{
if (x < y)
{
SetPixel((uint)(Center.X + x), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X + x, Center.Y + y), color);
SetPixel((uint)(Center.X - x), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X - x, Center.Y + y), color);
SetPixel((uint)(Center.X + x), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X + x, Center.Y - y), color);
SetPixel((uint)(Center.X - x), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X - x, Center.Y - y), color);
SetPixel((uint)(Center.X + y), (uint)(Center.Y + x), color);
DrawLine(Center, new Vec2(Center.X + y, Center.Y + x), color);
SetPixel((uint)(Center.X - y), (uint)(Center.Y + x), color);
DrawLine(Center, new Vec2(Center.X - y, Center.Y + x), color);
SetPixel((uint)(Center.X + y), (uint)(Center.Y - x), color);
DrawLine(Center, new Vec2(Center.X + y, Center.Y - x), color);
SetPixel((uint)(Center.X - y), (uint)(Center.Y - x), color);
DrawLine(Center, new Vec2(Center.X - y, Center.Y - x), color);
}
}
}
_

int x = 0;
int y = radius;
int p = (5 - radius * 4) / 4;

SetPixel((uint)(Center.X), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X, Center.Y + y), color);
SetPixel((uint)(Center.X), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X, Center.Y - y), color);
SetPixel((uint)(Center.X + y), (uint)(Center.Y), color);
DrawLine(Center, new Vec2(Center.X + y, Center.Y), color);
SetPixel((uint)(Center.X - y), (uint)(Center.Y), color);
DrawLine(Center, new Vec2(Center.X - y, Center.Y), color);
while (x < y)
{
x++;
if (p < 0)
{
p += 2 * x + 1;
}
else
{
y--;
p += 2 * (x - y) + 1;
}
if (x == y)
{
SetPixel((uint)(Center.X + x), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X + x, Center.Y + y), color);
SetPixel((uint)(Center.X - x), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X - x, Center.Y + y), color);
SetPixel((uint)(Center.X + x), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X + x, Center.Y - y), color);
SetPixel((uint)(Center.X - x), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X - x, Center.Y - y), color);
}
else
{
if (x < y)
{
SetPixel((uint)(Center.X + x), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X + x, Center.Y + y), color);
SetPixel((uint)(Center.X - x), (uint)(Center.Y + y), color);
DrawLine(Center, new Vec2(Center.X - x, Center.Y + y), color);
SetPixel((uint)(Center.X + x), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X + x, Center.Y - y), color);
SetPixel((uint)(Center.X - x), (uint)(Center.Y - y), color);
DrawLine(Center, new Vec2(Center.X - x, Center.Y - y), color);
SetPixel((uint)(Center.X + y), (uint)(Center.Y + x), color);
DrawLine(Center, new Vec2(Center.X + y, Center.Y + x), color);
SetPixel((uint)(Center.X - y), (uint)(Center.Y + x), color);
DrawLine(Center, new Vec2(Center.X - y, Center.Y + x), color);
SetPixel((uint)(Center.X + y), (uint)(Center.Y - x), color);
DrawLine(Center, new Vec2(Center.X + y, Center.Y - x), color);
SetPixel((uint)(Center.X - y), (uint)(Center.Y - x), color);
DrawLine(Center, new Vec2(Center.X - y, Center.Y - x), color);
}
}
}

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Coordinator
May 24, 2011 at 7:50 PM
Edited May 24, 2011 at 9:29 PM

I have checked out and this is your problem:

double k = 50.5;

 int k2 = (int)k;

 

k2 is zero.

 

Edit: is now fixed

Coordinator
May 24, 2011 at 7:54 PM
On 5/24/2011 2:50 PM, Trivalik wrote:
> I have checked out and this is your problem:
>
> double k = 50.5;
>
> int k2 = (int)k;
>
> k2 is zero.

So Cosmos has a conversion bug?
Developer
May 26, 2011 at 1:03 AM

While yes, I'm sure you've managed to fix it (the top method still freezes on me, but with my new drawing method, i can deal with that bit not working), all applying your newest update has caused, is to crash my vm when i try to use the second method (minus the line drawing, i'm only drawing the outline).

 

Any chance I could get a bit of help here XD (before I un-update my working copy? )

Coordinator
May 26, 2011 at 3:44 AM

Please debug the cosmos project and reduce this part to a few lines. That i can show what wrong is. If you use Console.Write or WriteLine, this crashs at the moment, because no plug check is there.

Coordinator
May 26, 2011 at 7:33 AM
Please reduce your crash to a 3-line sample, which makes debugging doable, s we'll have to debug on an assembler level, and those files are 4MB at minimum, so it really helps if you could reduce the code you have....

On Thu, May 26, 2011 at 2:03 AM, blah38621 <notifications@codeplex.com> wrote:

From: blah38621

While yes, I'm sure you've managed to fix it (the top method still freezes on me, but with my new drawing method, i can deal with that bit not working), all applying your newest update has caused, is to crash my vm when i try to use the second method (minus the line drawing, i'm only drawing the outline).

Any chance I could get a bit of help here XD (before I un-update my working copy? )

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Developer
May 26, 2011 at 2:41 PM

k, I'll post a much smaller version of the code that causes it to crash when I get home, for now all I know is that it crashes very near when it's done drawing the circle. Also, it refuses to draw at anything other than an X position (in the vec2), of 0. When I try to change the X value, all it does is go up. (due to the method I use to draw, draw operations wrap around to the right side of the screen)

Coordinator
May 26, 2011 at 8:09 PM

Please try the last version, so be sure that there is no method wrong plugged, like Console.Write(Double), if so comes some compile error, that doesnt really show which method is the error maker:

Example: For Console.WriteLine(Double) is it:

Error 9 Plug needed. System.UInt32  Microsoft.Win32.Win32Native.GetConsoleOutputCP()

at Cosmos.IL2CPU.ILScanner.ScanMethod(MethodBase aMethod, Boolean aIsPlug) in xxx\IL2CPU\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 663

at Cosmos.IL2CPU.ILScanner.ScanQueue() in xxx\IL2CPU\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 782

at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod) in xxx\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 284

at Cosmos.Build.MSBuild.IL2CPUTask.Execute() in xxx\IL2CPU\source2\Build\Cosmos.Build.MSBuild\IL2CPUTask.cs:line 244 C:\Program Files (x86)\MSBuild\Cosmos\Cosmos.targets 32 10 CosmosKernel2Boot

Developer
May 26, 2011 at 8:57 PM
Edited May 26, 2011 at 9:03 PM

Edit:

Woops, looks like it was my local copy that was the problem.

Developer
May 26, 2011 at 11:18 PM
Edited May 26, 2011 at 11:59 PM

WELL now It's not my code that's the problem, it's Cosmos's kernal. I just checked every method I used indivually, and it ALWAYS shuts down after the run method is called once. and only once.  The kernel is supposed to be looping. It's not. More specifically, this loop is failing:

 


BeforeRun();
while (!mStopped)
{
Run();
}
AfterRun();

 

Both  the before and after run calls are being run, but the run call is only being called once.

 

 

Edit:

The only way i can get it to keep running is to use a while(true) loop in the main run method. I have no idea what's wrong.

Coordinator
May 27, 2011 at 7:25 AM
Trivalik, for checking which method caused a compiler crash, have a look at the assembler log. It's a .html file in the output directory. It basically contains the scanner's graph. Search for the method in the exception text, then you'll see it's a subitem of an item. This item is the one calling the subitem. You can click on the item, to see what it's called by, etc....


blah: are you sure you're not setting mStopped to true?



On Fri, May 27, 2011 at 12:18 AM, blah38621 <notifications@codeplex.com> wrote:

From: blah38621

WELL now It's not my code that's the problem, it's Cosmos's kernal. I just checked every method I used indivually, and it ALWAYS shuts down after the run method is called once. and only once. The kernel is supposed to be looping. It's not. More specifically, this loop is failing:


BeforeRun();
while (!mStopped)
{
Run();
}
AfterRun();

Both the before and after run calls are being run, but the run call is only being called once.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Developer
May 27, 2011 at 1:47 PM

Yes, that's one thing I'm sure of, as one of the refactoring methods i tried was to remove that check and just use a while(true) loop in the main kernel file, but it still refused to run more than once. (I know it was using my modified version because the output filesize was different).  I also know I'm not setting it to true due to the fact my main kernel file is < 100 lines. And my backend files (the drawing functions, a few math plugs (sine, cosine, and floor(just converted to a string and removed everything after the decimal, before parsing as an Int32 and casting as a double)), and my modified mouse code (which i still can't get to work and I don't see why. I'm going to try an X# version when I get home today))

The only real significant portion of my code is the bit that draws me a pallet reference in the top left corner of the screen (each color is a 4x4 square, and the entire thing is offset by 1 pixel from the edge. (I have a calculated vga pallet, I use a step of 42 except for the last step where I step to 255 instead of 252. (I have the first 2 colors manually set to black and white respectively))). Other than that there's a small bit of code that either does or doesn't draw a circle depending on if a keypress is pending, and another line that would draw a circle if the mouse state were to change (which it's thusfar not been doing XD). That's really all there is to the kernel other than a Update call on the last line. (to update the screen)

Coordinator
May 27, 2011 at 2:00 PM
Instead of claiming it's not your code (i'm not saying it actually is), put a try....catch around all code (in the catch, just put a simple writeline("Error")) and check if the mStopped is still false..

On Fri, May 27, 2011 at 2:47 PM, blah38621 <notifications@codeplex.com> wrote:

From: blah38621

Yes, that's one thing I'm sure of, as one of the refactoring methods i tried was to remove that check and just use a while(true) loop in the main kernel file, but it still refused to run more than once. (I know it was using my modified version because the output filesize was different). I also know I'm not setting it to true due to the fact my main kernel file is < 100 lines. And my backend files (the drawing functions, a few math plugs (sine, cosine, and floor(just converted to a string and removed everything after the decimal, before parsing as an Int32 and casting as a double)), and my modified mouse code (which i still can't get to work and I don't see why. I'm going to try an X# version when I get home today))

The only real significant portion of my code is the bit that draws me a pallet reference in the top left corner of the screen (each color is a 4x4 square, and the entire thing is offset by 1 pixel from the edge. (I have a calculated vga pallet, I use a step of 42 except for the last step where I step to 255 instead of 252. (I have the first 2 colors manually set to black and white respectively))). Other than that there's a small bit of code that either does or doesn't draw a circle depending on if a keypress is pending, and another line that would draw a circle if the mouse state were to change (which it's thusfar not been doing XD). That's really all there is to the kernel other than a Update call on the last line. (to update the screen)

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Developer
May 27, 2011 at 3:00 PM

I did try putting a try catch around the run command in the while(true) loop that I had switched to in the kernel, it didn't have any effect, it still stopped on me. And although I'm not certain it's not my code, i am reasonably sure it's not, due to the fact it works perfectly if i put all of my code in a while(true) loop in the run method (I had reverted the kernel back to how it was at that point). Am I missing something here?

 

btw, as I'm working in graphics mode, and without a debugger attached (unless you have any idea how to do remote debugging from a windows machine while the actual program is running on a linux machine? (my qemu client does support attaching a gdb debugger)), I'm pretty sure the Console.WriteLine would have no real effect. (am I wrong here?)

Coordinator
May 27, 2011 at 4:05 PM

The Console.WriteLine which is not plugged, is a problem.

Coordinator
May 27, 2011 at 4:10 PM
.WriteLine not showing up might have to do with the fact that the kernel is still waiting for the debugger to attach. Go to the project properties, and set Debug Mode to None.

On Fri, May 27, 2011 at 5:05 PM, Trivalik <notifications@codeplex.com> wrote:

From: Trivalik

The Console.WriteLine which is not plugged, is a problem.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Developer
May 27, 2011 at 8:47 PM

I already build with debug mode set to none. (I have no experience in the gdb debugger so I haven't even messed with trying to do it remotely)

Coordinator
May 27, 2011 at 9:43 PM
our debugger doesn't use gdb...

On 5/27/11, blah38621 <notifications@codeplex.com> wrote:
> From: blah38621
>
> I already build with debug mode set to none. (I have no experience in the
> gdb debugger so I haven't even messed with trying to do it remotely)
>
>
Coordinator
May 27, 2011 at 9:45 PM
also, pkease try with qemu on a different machine. we stepoed away
from qemu because it had bugs......

On 5/27/11, Matthijs ter Woord <matthijsterwoord@gmail.com> wrote:
> our debugger doesn't use gdb...
>
> On 5/27/11, blah38621 <notifications@codeplex.com> wrote:
>> From: blah38621
>>
>> I already build with debug mode set to none. (I have no experience in the
>> gdb debugger so I haven't even messed with trying to do it remotely)
>>
>>
>
Developer
Jun 12, 2011 at 9:07 PM
Edited Jun 12, 2011 at 11:08 PM

btw, the Math.Sqrt function really doesn't work :P (Last I checked, the square root of 4, 9, and 5, were 2, 3, and 2.236... respectivly, not 4, 9, and 5 respectivly :P) I'm also checking it right now.

 

 

And, I can't do a thing about it, because comparison of doubles doesn't work.

Coordinator
Jun 13, 2011 at 3:29 PM
> btw, the Math.Sqrt function really doesn't work :P (Last I checked, the
> square root of 4, 9, and 5, were 2, 3, and 2.236... respectivly, not 4,
> 9, and 5 respectivly :P)

That looks broken. :)
Developer
Jun 13, 2011 at 7:18 PM

I have a method in C# that works, but I can't use it until comparing doubles works.

Coordinator
Jun 14, 2011 at 1:53 AM
> I have a method in C# that works, but I can't use it until comparing
> doubles works.

Want to work on Doubles? :)
Developer
Jun 14, 2011 at 2:13 AM

well, the sqrt function is fixed with Trivialik's checkin, so mostly i want structs to work XD

Coordinator
Jun 14, 2011 at 7:25 AM
Structs work, at least partially. What's not working with them?

On Tue, Jun 14, 2011 at 3:13 AM, blah38621 <notifications@codeplex.com> wrote:

From: blah38621

well, the sqrt function is fixed with Trivialik's checkin, so mostly i want structs to work XD

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Coordinator
Jun 14, 2011 at 7:25 AM
(That is, they used to work)

On Tue, Jun 14, 2011 at 8:24 AM, Matthijs ter Woord <matthijsterwoord@gmail.com> wrote:
Structs work, at least partially. What's not working with them?


On Tue, Jun 14, 2011 at 3:13 AM, blah38621 <notifications@codeplex.com> wrote:

From: blah38621

well, the sqrt function is fixed with Trivialik's checkin, so mostly i want structs to work XD

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com



Developer
Jun 14, 2011 at 6:41 PM

Well, there are multiple things that don't work  with structs :P So here is a short list of the things i've encountered:

- Methods with a return type of a struct (well, at least      "System.Single System.Math.Abs(System.Single)"      refuses to plug)
- Stucts with constructors lose the first argument when called inside the calling of another method. (See the StructTest project in my user folder for an example of this)
- Generic types with structs fail miserably (that's why my flood-fill code got a x00 cpu exception, it was in the modulus instruction in the Queue)

There are also a few other things, I just can't remember them atm.

Coordinator
Jun 15, 2011 at 7:20 AM
- Regarding the plugging issue, i'm guessing you're making the plug wrong..)
- Second one doesn't make sense. Could you post a snippet with code explaining the issue?
- Third one could be related to something else..


On Tue, Jun 14, 2011 at 7:41 PM, blah38621 <notifications@codeplex.com> wrote:

From: blah38621

Well, there are multiple things that don't work with structs :P So here is a short list of the things i've encountered:

- Methods with a return type of a struct (well, at least "System.Single System.Math.Abs(System.Single)" refuses to plug)
- Stucts with constructors lose the first argument when called inside the calling of another method. (See the StructTest project in my user folder for an example of this)
- Generic types with structs fail miserably (that's why my flood-fill code got a x00 cpu exception, it was in the modulus instruction in the Queue)

There are also a few other things, I just can't remember them atm.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Coordinator
Jun 15, 2011 at 12:00 PM

I am not sure about plugs works always:

this does also not work as expected, in il2cpu.x86

public static unsafe void Ctor(String aThis, char aChar, int aLength,
    [FieldAccess(Name = "System.Int32 System.String.m_stringLength")] ref int aStringLength,
    [FieldAccess(Name = "System.Char System.String.m_firstChar")] ref char* aFirstChar)
{
    aStringLength = aLength;
    for (int i = 0; i < aLength; i++) {
        aFirstChar[i] = aChar;
    }
}

Coordinator
Jun 15, 2011 at 12:03 PM
Trivalik: what do you get? (and what do you expect)

On Wed, Jun 15, 2011 at 1:01 PM, Trivalik <notifications@codeplex.com> wrote:

From: Trivalik

I am not sure about plugs works always:

this does also not work as expected, in il2cpu.x86

public static unsafe void Ctor(String aThis, char aChar, int aLength,
    [FieldAccess(Name = "System.Int32 System.String.m_stringLength")] ref int aStringLength,
    [FieldAccess(Name = "System.Char System.String.m_firstChar")] ref char* aFirstChar)
{
    aStringLength = aLength;
    for (int i = 0; i < aLength; i++) {
        aFirstChar[i] = aChar;
    }
}

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Coordinator
Jul 14, 2011 at 1:10 PM

In current build does it crash in MemAlloc at UpdateDebugDisplay(); .   In older versions was the crash on a other position. ( I expect a working string function that has a length from one specified character.)

Furthermore would i remark that debug key F10 seem always work like F11!!!

Coordinator
Jul 14, 2011 at 1:19 PM
Hey Trivalik!

What cosmos version are you using?
Please report all debugger issues to the developer list...

On Thu, Jul 14, 2011 at 2:10 PM, Trivalik <notifications@codeplex.com> wrote:

From: Trivalik

In current build does it crash in MemAlloc at UpdateDebugDisplay(); . In older versions was the crash on a other position. ( I expect a working string function that has a length from one specified character.)

Furthermore would i remark that debug key F10 seem always work like F11!!!

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Coordinator
Jul 14, 2011 at 3:17 PM
On 7/14/2011 8:10 AM, Trivalik wrote:
> Furthermore would i remark that debug key F10 seem always work like F11!!!

I noted this recently and its already on the short list.