Skip to content

Conversation

@kinke
Copy link

@kinke kinke commented Jan 23, 2016

Everything starting from struct FrameInfo, especially the inline assembly parts, still needs to be done.
Not tested at all, except for basic compilability. :]

…g std::terminate

remove vcruntime hacks
when converting to exception to error, do not rethrow if the catch handles errors, too
@kinke kinke force-pushed the msvc_x64 branch 3 times, most recently from f28d365 to 3493e19 Compare January 24, 2016 12:24
@kinke
Copy link
Author

kinke commented Jan 24, 2016

I've fixed a few bugs and added some comments...

@rainers
Copy link
Owner

rainers commented Jan 25, 2016

Realized just now, that this PR is against my branch ;-)
I think it should not actually change the win64 EH right now, but preparation for the switch are fine.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function already exists as rt.util.container.xmalloc.

@kinke
Copy link
Author

kinke commented Jan 25, 2016

Oh right - that's too bad. The GC won't help here either, right? So the only 2 solutions are either building these structs at compile time or pre-allocating a reasonable chunk of memory and dying with an OutOfMemoryError (or just terminating) in case it doesn't suffice, correct? :/ And all of this because of these crappy 32-bit offsets for x64, dammit...

@rainers
Copy link
Owner

rainers commented Jan 25, 2016

I think the GC could work, but the base pointer needs to be saved in the exception stack, too. That would prevent premature collection.
Another option might be to let the data just leak. It's unlikely it will exceed the 64kB, even less likely for larger chunks.

@rainers
Copy link
Owner

rainers commented Jan 25, 2016

building these structs at compile time

D exceptions are not created while being thrown, so it needs the dynamic type to generate the _ThrowInfo. It would have to be added to the ClassInfo or similar where it's accessible via virtual dispatch. In C++, it is just created with the throw statement.

@kinke
Copy link
Author

kinke commented Jan 25, 2016

It would have to be added to the ClassInfo

That's what I meant - a TypeDescriptor, CatchableType, CatchableTypeArray and _ThrowInfo for each Throwable subclass. But I'm not keen on implementing such a scheme. ;)

@kinke
Copy link
Author

kinke commented Jan 30, 2016

Another option might be to let the data just leak. It's unlikely it will exceed the 64kB, even less likely for larger chunks.

I only just now realized what you meant - not freeing the previous block when growing. That sounds like the most straight-forward approach to me, and the total memory consumption should be manageable, especially in times where even smartphones have Gigabytes of memory. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants