Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REG2.063a] Issue 10096 - __traits(allMembers) triggers out of bounds error #2043

Merged
2 commits merged into from
May 16, 2013

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented May 16, 2013

http://d.puremagic.com/issues/show_bug.cgi?id=10096

Do not list internal members in __traits(allMembers)

  • Names starting double underscore does not appear its result.
    Now, __cpctor, __invariant, __xopEquals, __fieldPostBlit, __aggrPostBlit, __fieldDtor, __aggrDtor, and others are not listed in there.
  • Except __ctor, __dtor, and __postblit. They are already used in Phobos, so temporary keep them for backward compatibility.

9rnsr added 2 commits May 17, 2013 00:22
Internal member names should not be listed in __traits(allMembers)
- Names starting double underscore does not appear its result.
  __cpctor, __invariant, __xopEquals, __fieldPostBlit,
  __aggrPostBlit, __fieldDtor, __aggrDtor, and others...
- Except __ctor, __dtor, and __postblit. They are already used in Phobos, so
  temporary keep them for backward compatibility.
@IgorStepanov
Copy link
Contributor

"By the way question". For nested classes __traits(allMember) doesn't show "outer" pseudo-field. Why? Yes, this field automatically adding by compiler. but this is real field with offset value, for example. May be we need to add this field to __traits(allMember) result for nested classes?

@IgorStepanov
Copy link
Contributor

About "__ctor": Do this name is documented and considered standart? I'm working under runtime reflections extension for druntime now, and I must know: Can I use __traits(allMember) for __ctor finding or I need to add special-case for this function. Can I use this name (__ctor) to constructor finding?

@9rnsr
Copy link
Contributor Author

9rnsr commented May 16, 2013

Because dmd does not map outer directly to the hidden context field. It would behave as same as built-in stringof property.

@9rnsr
Copy link
Contributor Author

9rnsr commented May 16, 2013

I think __(ctor|dtor|__postblit) should not be documented. For the problem, I opened bug 10097.

@IgorStepanov
Copy link
Contributor

I think __(ctor|dtor|__postblit) should not be documented. For the problem, I opened bug 10097.

Is there another way to access to constructor/destrucor functions? And not simple access, but finding all overloads with __traits(getOverloads, Foo, "XXX"). Mat be we can use this keyword for it?

struct Foo
{
  this(int){}
  this(this){}
  ~this(){}
}


We can allow next syntax:
Foo.this -- simple constructor and may be postblit.
Foo.~this -- destructor.
__traits(getOverloads, Foo, "this"); //All constructors include postblit.

Because dmd does not map outer directly to the hidden context field. It would behave as same as built-in stringof property.

outer field looks like field. We can get offset of it, pass by ref to function and get pointer of it.

class Bar
{
    class Nested
    {

    }
}

ref Bar byRef(ref Bar b)
{
    return b;
}

void main()
{
    auto nested = (new Bar).new Bar.Nested;
    enum off = nested.outer.offsetof;//we can get offset
    void* pnested = &nested.outer;   //get pointre
    auto b = byRef(nested.outer);    //and path by ref
}

@ghost
Copy link

ghost commented May 16, 2013

LGTM.

@ghost
Copy link

ghost commented May 16, 2013

Can't we disable this test at least for freebsd:

core.thread.ThreadException@src/core/thread.d(886): Unable to set thread priority

It's really wasting so much time for us..

@braddr
Copy link
Member

braddr commented May 16, 2013

It happens most often on freebsd, true, but it does happen on other
platforms as well. The "wasting time" phrase is a bad one too. It's
exposing a very real problem which is pretty much the entire point of
doing the testing.

I'm rather against disabling it. If it bothers you, and it should, then
the right answer is to volunteer to investigate and fix. It's certainly
unlikely to fix itself.

On 5/16/13 1:14 PM, Andrej Mitrovic wrote:

Can't we disable this test at least for freebsd:

|core.thread.ThreadException@src/core/thread.d(886): Unable to set thread priority
|

It's really wasting so much time for us..


Reply to this email directly or view it on GitHub
#2043 (comment).

@ghost
Copy link

ghost commented May 16, 2013

Someone who knows their way around Posix and concurrency (ideally the implementer) should work on it. I know very little about the two or I'd jump in with both hands.

@IgorStepanov
Copy link
Contributor

What is a cause of this fall? What code pthread_getschedparam return before test fall?

@dnadlinger
Copy link
Member

Interestingly, the thread priority issue has also started to occur on my Linux box recently, when I was running some rather unrelated test case in the bugger. Haven't had time to investigate it more closely, though – it still seems to occur highly non-deterministically.

@IgorStepanov
Copy link
Contributor

May be we need to add more debug print in error point? I think, we need to know returned value of pthread_getschedparam and m_addr. As I know, pthread_getschedparam has a single error case: invalid thread address. Can m_addr be invalid?

ghost pushed a commit that referenced this pull request May 16, 2013
[REG2.063a] Issue 10096 - __traits(allMembers) triggers out of bounds error
@ghost ghost merged commit d714fb1 into dlang:master May 16, 2013
@ibuclaw
Copy link
Member

ibuclaw commented Dec 25, 2019

This caused a regression.

https://issues.dlang.org/show_bug.cgi?id=10100

This pull request was closed.
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.

5 participants