digitalmars.D - core.cpuid
- Manu (6/6) Oct 29 2011 What's the deal with core.cpuid?
- =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= (5/11) Oct 29 2011 That module was probably designed around the assumption that D would
- Manu (5/17) Oct 29 2011 Seems like a horrible assumption to make when inventing a systems
- Dejan Lekic (4/7) Nov 04 2011 FYI, C/C++ also have cpuid, and it is also pretty low-level like in D (i...
- Jonathan M Davis (7/14) Nov 04 2011 And why not? Thread is in core. So are other modules that it's perfectly...
- Dejan Lekic (5/7) Nov 04 2011 - Mostly because You may end-up writing non-portable code unless you are...
- Jonathan M Davis (14/21) Nov 04 2011 Plenty of core is portable. True, very little in Phobos is non-portable,...
- Don (9/22) Nov 04 2011 That's largely true, but I would agree with Manu that you shouldn't be
- Chante (6/7) Oct 29 2011 I think they just want the "mainstream"
- Andrew Wiley (11/18) Oct 29 2011 There are a few things like this around, and if you look far enough back...
- Chante (3/35) Oct 30 2011 I didn't call you anything.
- =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= (12/32) Oct 30 2011 I actually do use core.cpuid and find it very useful.
- Chante (2/32) Oct 30 2011 You are a stupid man. She is an old hag.
- Don (7/13) Oct 31 2011 core.cpuid exists *because the runtime needs it*. It's deliberately
- Manu (8/22) Oct 31 2011 in std? what's the story with core? is it being deprecated?
- Don (3/27) Oct 31 2011 It isn't entirely x86 specific. There are some stubs for other
- Sean Kelly (15/40) Oct 31 2011 charset=us-ascii
What's the deal with core.cpuid? I realise it is an x86 opcode, but is that something that you really want totally bare in core like that? I'm experimenting with other architectures, and some sort of core.processorInfo would be really nice, surely an API for this stuff should be more generalised...?
Oct 29 2011
On 30-10-2011 02:49, Manu wrote:What's the deal with core.cpuid? I realise it is an x86 opcode, but is that something that you really want totally bare in core like that? I'm experimenting with other architectures, and some sort of core.processorInfo would be really nice, surely an API for this stuff should be more generalised...?That module was probably designed around the assumption that D would never run on !x86 architectures, which is clearly not the case with GDC existing... - Alex
Oct 29 2011
Seems like a horrible assumption to make when inventing a systems programming language that intends to go head to head with C/C++ :) On 30 October 2011 03:51, Alex R=C3=B8nne Petersen <xtzgzorex gmail.com> wr= ote:On 30-10-2011 02:49, Manu wrote:rWhat's the deal with core.cpuid? I realise it is an x86 opcode, but is that something that you really want totally bare in core like that? I'm experimenting with other architectures, and some sort of core.processorInfo would be really nice, surely an API for this stuff should be more generalised...?That module was probably designed around the assumption that D would neve=run on !x86 architectures, which is clearly not the case with GDC existing... - Alex
Oct 29 2011
Manu wrote:Seems like a horrible assumption to make when inventing a systems programming language that intends to go head to head with C/C++ :)FYI, C/C++ also have cpuid, and it is also pretty low-level like in D (ie. developers rarely use cpuid.h directly). You should not (in practice) use "core" modules anyway.
Nov 04 2011
On Friday, November 04, 2011 08:11 Dejan Lekic wrote:Manu wrote:And why not? Thread is in core. So are other modules that it's perfectly normal and acceptable to use. There's nothing wrong with using core modules. Many of them are _intended_ to be used. Stuff generally ends up in core because the D runtime needs it, not because it's something that the common programmer shouldn't be using. - Jonathan M DavisSeems like a horrible assumption to make when inventing a systems programming language that intends to go head to head with C/C++ :)FYI, C/C++ also have cpuid, and it is also pretty low-level like in D (ie. developers rarely use cpuid.h directly). You should not (in practice) use "core" modules anyway.
Nov 04 2011
Jonathan M Davis wrote:And why not? Thread is in core. So are other modules that it's perfectly- Mostly because You may end-up writing non-portable code unless you are realy careful (and you must be if you use core modules! ;). It is similar to the asm{} block - you should not use it at all unless you know what you are doing... Does that make sense?
Nov 04 2011
On Friday, November 04, 2011 10:39 Dejan Lekic wrote:Jonathan M Davis wrote:Plenty of core is portable. True, very little in Phobos is non-portable, so there's less risk of portability issues with Phobos, but much of druntime is quite portable - Thread being one such example. It's primarily the C declarations which aren't necessarily portable. Most of the D code is. Now, it _is_ ultimately to the programmer to be smart about what they're doing, and more stuff in druntime is non-portable than in Phobos, but it's generally pretty clear about what's portable and what isn't. I really don't think that there's any need to tell people to stay away from core. If anything, they'll stay often away from it simply because much of its functionality is not directly necessary (if necessary at all) in your average program. But if you need it, there's nothing wrong with using it, and on the whole, portability isn't a huge issue. - Jonathan M DavisAnd why not? Thread is in core. So are other modules that it's perfectly- Mostly because You may end-up writing non-portable code unless you are realy careful (and you must be if you use core modules! ;). It is similar to the asm{} block - you should not use it at all unless you know what you are doing... Does that make sense?
Nov 04 2011
On 04.11.2011 18:27, Jonathan M Davis wrote:On Friday, November 04, 2011 08:11 Dejan Lekic wrote:That's largely true, but I would agree with Manu that you shouldn't be using core very often. By its nature of being close to the runtime, it's typically low-level stuff, and so it's only your low-level code which should be using it. Probably there is some stuff in there which should be moved out of core, or possibly with a safer wrapper in std. I'm particularly thinking of core.bitop, which currently has a mixture of safe and subtly dangerous functions, and only a small part of it is actually required by the runtime.Manu wrote:And why not? Thread is in core. So are other modules that it's perfectly normal and acceptable to use. There's nothing wrong with using core modules. Many of them are _intended_ to be used. Stuff generally ends up in core because the D runtime needs it, not because it's something that the common programmer shouldn't be using.Seems like a horrible assumption to make when inventing a systems programming language that intends to go head to head with C/C++ :)FYI, C/C++ also have cpuid, and it is also pretty low-level like in D (ie. developers rarely use cpuid.h directly). You should not (in practice) use "core" modules anyway.
Nov 04 2011
"Manu" <turkeyman gmail.com> wrote in message news:mailman.586.1319935753.24802.digitalmars-d puremagic.com...What's the deal with core.cpuid?I think they just want the "mainstream" ("sheeple"/"followers"/"believers"/"90210_ers"/"younsters", etc.). If you don't fit into their petri-dish and aren't cog to add to their self-aggrandizement, they won't let you log in anymore.
Oct 29 2011
On Sat, Oct 29, 2011 at 10:55 PM, Chante <udontspamme never.will.u> wrote:"Manu" <turkeyman gmail.com> wrote in message news:mailman.586.1319935753.24802.digitalmars-d puremagic.com...There are a few things like this around, and if you look far enough back, it's quite simple why things like this happened. Originally, when D was new, DMD essentially was the definition of D, x86 was the only real architecture around, with x86_64 starting to come into play. Now we have more compilers, and x86/64 isn't looking quite like the monopoly it used to be, so this interface will probably need to change. There's no conspiracy here, it's just "what worked" back in the day, and either it's unused or unimportant such that no one has tried to update it thus far. Since this is in core, it's mostly Sean's territory, but I'm sure he'd welcome ideas.What's the deal with core.cpuid?I think they just want the "mainstream" ("sheeple"/"followers"/"believers"/"90210_ers"/"younsters", etc.). If you don't fit into their petri-dish and aren't cog to add to their self-aggrandizement, they won't let you log in anymore.
Oct 29 2011
"Andrew Wiley" <wiley.andrew.j gmail.com> wrote in message news:mailman.591.1319951129.24802.digitalmars-d puremagic.com...On Sat, Oct 29, 2011 at 10:55 PM, Chante <udontspamme never.will.u> wrote:I didn't call you anything."Manu" <turkeyman gmail.com> wrote in message news:mailman.586.1319935753.24802.digitalmars-d puremagic.com...There are a few things like this around, and if you look far enough back, it's quite simple why things like this happened. Originally, when D was new, DMD essentially was the definition of D, x86 was the only real architecture around, with x86_64 starting to come into play. Now we have more compilers, and x86/64 isn't looking quite like the monopoly it used to be, so this interface will probably need to change. There's no conspiracy here, it's just "what worked" back in the day, and either it's unused or unimportant such that no one has tried to update it thus far. Since this is in core, it's mostly Sean's territory, but I'm sure he'd welcome ideas.What's the deal with core.cpuid?I think they just want the "mainstream" ("sheeple"/"followers"/"believers"/"90210_ers"/"younsters", etc.). If you don't fit into their petri-dish and aren't cog to add to their self-aggrandizement, they won't let you log in anymore.
Oct 30 2011
On 30-10-2011 06:05, Andrew Wiley wrote:On Sat, Oct 29, 2011 at 10:55 PM, Chante <udontspamme never.will.u> wrote: "Manu" <turkeyman gmail.com <mailto:turkeyman gmail.com>> wrote in message news:mailman.586.1319935753.24802.digitalmars-d puremagic.com... > What's the deal with core.cpuid? I think they just want the "mainstream" ("sheeple"/"followers"/"believers"/"90210_ers"/"younsters", etc.). If you don't fit into their petri-dish and aren't cog to add to their self-aggrandizement, they won't let you log in anymore. There are a few things like this around, and if you look far enough back, it's quite simple why things like this happened. Originally, when D was new, DMD essentially was the definition of D, x86 was the only real architecture around, with x86_64 starting to come into play. Now we have more compilers, and x86/64 isn't looking quite like the monopoly it used to be, so this interface will probably need to change. There's no conspiracy here, it's just "what worked" back in the day, and either it's unused or unimportant such that no one has tried to update it thus far. Since this is in core, it's mostly Sean's territory, but I'm sure he'd welcome ideas.I actually do use core.cpuid and find it very useful. I think what we need to do is have separate modules for the various architectures, and then have some central wrapper module that wraps the common stuff that most archs share (i.e. "are we using 64-bit pointers?", etc...). We still need to keep the modules with more arch-specific checks public, because someone might actually need to use that information (in my case, I need it to decide which instructions I can emit in my JIT compiler). Speaking of all this, we really need to standardize version identifiers for !x86 architectures in the web site... - Alex
Oct 30 2011
Alex Rønne Petersen wrote:On 30-10-2011 06:05, Andrew Wiley wrote:You are a stupid man. She is an old hag.On Sat, Oct 29, 2011 at 10:55 PM, Chante <udontspamme never.will.u> wrote: "Manu" <turkeyman gmail.com <mailto:turkeyman gmail.com>> wrote in message news:mailman.586.1319935753.24802.digitalmars-d puremagic.com... > What's the deal with core.cpuid? I think they just want the "mainstream" ("sheeple"/"followers"/"believers"/"90210_ers"/"younsters", etc.). If you don't fit into their petri-dish and aren't cog to add to their self-aggrandizement, they won't let you log in anymore. There are a few things like this around, and if you look far enough back, it's quite simple why things like this happened. Originally, when D was new, DMD essentially was the definition of D, x86 was the only real architecture around, with x86_64 starting to come into play. Now we have more compilers, and x86/64 isn't looking quite like the monopoly it used to be, so this interface will probably need to change. There's no conspiracy here, it's just "what worked" back in the day, and either it's unused or unimportant such that no one has tried to update it thus far. Since this is in core, it's mostly Sean's territory, but I'm sure he'd welcome ideas.I actually do use core.cpuid and find it very useful.
Oct 30 2011
On 30.10.2011 02:49, Manu wrote:What's the deal with core.cpuid? I realise it is an x86 opcode, but is that something that you really want totally bare in core like that? I'm experimenting with other architectures, and some sort of core.processorInfo would be really nice, surely an API for this stuff should be more generalised...?core.cpuid exists *because the runtime needs it*. It's deliberately _very_ low level. For example, it is essential that it does NOT perform any memory allocation. The information it provides is CPU-dependent. Basically -- don't use core.cpuid unless you're programming in asm. Indeed, there should be a higher level module (std.sysinfo ?) for more general use.
Oct 31 2011
in std? what's the story with core? is it being deprecated? I would think that cpuid should be a subset of a generalised sysinfo (or processorinfo perhaps)... something you can optionally obtain if you first identify that you're on an x86. Why would there be a 'higher level' module? I'd like a low level query like that for all processors. It just seems weird having an x86-only feature exposed directly in core. On 31 October 2011 09:11, Don <nospam nospam.com> wrote:On 30.10.2011 02:49, Manu wrote:What's the deal with core.cpuid? I realise it is an x86 opcode, but is that something that you really want totally bare in core like that? I'm experimenting with other architectures, and some sort of core.processorInfo would be really nice, surely an API for this stuff should be more generalised...?core.cpuid exists *because the runtime needs it*. It's deliberately _very_ low level. For example, it is essential that it does NOT perform any memory allocation. The information it provides is CPU-dependent. Basically -- don't use core.cpuid unless you're programming in asm. Indeed, there should be a higher level module (std.sysinfo ?) for more general use.
Oct 31 2011
On 31.10.2011 09:34, Manu wrote:in std? what's the story with core? is it being deprecated? I would think that cpuid should be a subset of a generalised sysinfo (or processorinfo perhaps)... something you can optionally obtain if you first identify that you're on an x86. Why would there be a 'higher level' module? I'd like a low level query like that for all processors. It just seems weird having an x86-only feature exposed directly in core.It isn't entirely x86 specific. There are some stubs for other processors (and there's a few things in there which are Itanium-specific).On 31 October 2011 09:11, Don <nospam nospam.com <mailto:nospam nospam.com>> wrote: On 30.10.2011 02:49, Manu wrote: What's the deal with core.cpuid? I realise it is an x86 opcode, but is that something that you really want totally bare in core like that? I'm experimenting with other architectures, and some sort of core.processorInfo would be really nice, surely an API for this stuff should be more generalised...? core.cpuid exists *because the runtime needs it*. It's deliberately _very_ low level. For example, it is essential that it does NOT perform any memory allocation. The information it provides is CPU-dependent. Basically -- don't use core.cpuid unless you're programming in asm. Indeed, there should be a higher level module (std.sysinfo ?) for more general use.
Oct 31 2011
charset=us-ascii core contains the stuff that is intrinsic to the D language. It's separate f= rom std for a number of reasons, but one practical reason is to help prevent= large portions of the standard library being pulled into all apps simply be= cause something in the runtime code wanted to do formatted IO, for example. T= hink of core like java.lang.=20 Sent from my iPhone On Oct 31, 2011, at 1:34 AM, Manu <turkeyman gmail.com> wrote:in std? what's the story with core? is it being deprecated? I would think that cpuid should be a subset of a generalised sysinfo (or p=rocessorinfo perhaps)... something you can optionally obtain if you first id= entify that you're on an x86.=20 Why would there be a 'higher level' module? I'd like a low level query lik=e that for all processors. It just seems weird having an x86-only feature ex= posed directly in core.=20 On 31 October 2011 09:11, Don <nospam nospam.com> wrote: On 30.10.2011 02:49, Manu wrote: What's the deal with core.cpuid? I realise it is an x86 opcode, but is that something that you really want totally bare in core like that? I'm experimenting with other architectures, and some sort of core.processorInfo would be really nice, surely an API for this stuff should be more generalised...? =20 core.cpuid exists *because the runtime needs it*. It's deliberately _very_=low level. For example, it is essential that it does NOT perform any memory= allocation. The information it provides is CPU-dependent.=20 Basically -- don't use core.cpuid unless you're programming in asm. =20 Indeed, there should be a higher level module (std.sysinfo ?) for more gen=eral use.=20 =20 =20 =20 =20 =20
Oct 31 2011