Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Aex.Uni Presents the Core Library

Author
Message
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 4th Feb 2008 00:53
Aex.Uni's Core Library
This library consists of an (open-source) SDK featuring ANSI and Unicode string support, and a garbage collector. Coming soon, a linked list manager, and an array sorter.

Here are the contents of it currently, place these files wherever, preferably: C:\Aex.Uni\Core\Include.

core_base.h


core_string.h


core_gc.h


Hopefully the code should explain it self, any questions feel free to ask.

Cheers,

-naota

With any luck you'll be able to turn a fully functioning program to a crashing program with just a little bit of coding.
Aex.Uni forums
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 6th Feb 2008 02:12
I would also like to note that core_string.h was completely recreated from the original IString I showed over here a while ago. I did not forget about it, I took the advice I was given and redeveloped it.

Also, if anyone has any feedback or suggestions I'd gladly take them. Suggestions and criticism are important for this goes into my own software.

Cheers,

-naota

With any luck you'll be able to turn a fully functioning program to a crashing program with just a little bit of coding.
Aex.Uni forums
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 9th Feb 2008 15:39
Looks like you put some work into this code. Good Job.

I did notice some loops where your copying string data and I think you might be better served by strcpy(this->s,st); or one of its varieties.

I BELIEVE these libs use the CPU native instructions to "bulk" copy "ranges" of ram - something the CPU is actually WIRED to do - and therefore happens BLAZINGLY fast - especially compared to looping through multiple instructions, managing your counter, dereferencing pointers each iteration.

The "Hardwired" method - in Assembly language - is a matter of setting the source location, the destination, and the length... then you almost literally press "FIRE" and the CPU does it all in one instruction... (yes a few clock cycles depending how much your moving) but much faster than man handling it. (It is a little complex setting up the source, destination, etc... but only for people - no work at all for CPU but memory addressing topics are getting a little to out there for this recommendation - because in short - if you just use strcpy you'll see a major speed increase with little effort on your part to convert the loop.

Here is a sample string lib I did that has it - just as a sample for ya:

jfc_string.h


jfc_string.cpp


Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 9th Feb 2008 16:21
I'm liking the look of that garbage collector! Good work.

Your signature has been erased by a mod
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 11th Feb 2008 00:53
@jason p sage
Oh! I know what you're talking about. I actually used that command while developing my OS kernel in ASM, funny I didn't think of it. I'll have a look for it. But here's the thing with using inline ASM, the compiler will actually optimize your code to something completely different (In some cases) and will not do ANY optimizations on it if inline ASM is used. However, by providing an inline function containing the inline ASM, and then calling that inline function in the main code, I suppose that could work. Any thoughts on doing it a quicker way still?

As a general note, I've been working on the core library more and came up with what I call the "MSI" (Modular Structure Interface). It's similar to COM except it actually does garbage collecting. I found a problem in the original version + a better way to implement it so I'm rewriting it right now.

In addition, I added some defines which better inform you of the target operating system, as well as several other functions. Most notably are the "PROC" and "INLINE" defines. PROC specifies the native calling convention you are using (If none are predefined, it'll define __stdcall). Then depending on that it'll do something like "USING_CDECL", "USING_STDCALL", and "USING_FASTCALL" to better help you link in proper libraries to these commands. INLINE will check what compiler you're using, then if you're using MSVC++ it'll specify __forceinline as the inline function, otherwise it'll use inline. The difference is that no matter what __forceinline will cause the function to become inlined with the code, where as inline may or may not work depending on the size of the code. Optimization is up to the end-user.


@Zotoaster
Thanks I made it a while ago and then decided making a more standardized version would be good. Glad you like it btw.


Cheers,

-naota

With any luck you'll be able to turn a fully functioning program to a crashing program with just a little bit of coding.
Aex.Uni forums
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 11th Feb 2008 01:26 Edited at: 11th Feb 2008 01:36
@Aaron - I don't think you need to inline anything. I think when you use the <memory.h> header and commands like memcpy and memset I think it does that for you.

[edit]Meaning - I think it MAKES the CPU do the native fast stuff.

Note however I was trying to use those myself this weekend - sometimes I don't have a problem - this weekend I got frustrated enough to do the same thing you have in your code now - a for loop! Why? I keep screwing up the pointer syntax - and would get exceptions.... I tried a bunch of stuff ... and rescinded to for next - my code 100% working... and someday if I notice speed as issue - I'll revisit.... I try to practice what I preach.. but sometimes - <sigh> [/edit]

Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 12th Feb 2008 20:58
@jason
Its MUCH quicker to just not call a function, rather to do the code yourself, therefor inlining the ASM code keeps compiler optimizations as well as using the single instruction opcode.

Besides, if I can't do something that simple why do something complex?

Cheers,

-naota

With any luck you'll be able to turn a fully functioning program to a crashing program with just a little bit of coding.
Aex.Uni forums
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 13th Feb 2008 01:03
I think you're missing what my goal of telling this to you was all about.

I'm pretty sure the memset, memcpy, strcpy, etc. commands are effectively INLINE functions, further more I believe they are coded in such a way to utilize the CPU's native (fast as heck) memory copying commands - e.g. they are usually written in assembly...

effectively - they are inline assembly code doing CPU native instructions giving you the extra speed.


However I'm in agreement though - that design is important yada yada - but working code is better than none - and going back to tighten bottle necks makes more sense than fighting for days on a routine - whose speed gains might not really even have a positive impact

I'm guilty of all things... except that, and that, and that...

In other words - The only reason I know anything is because I do a lot wrong first.

Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 15th Feb 2008 02:38
Thanks, but my point is that they aren't always inlined. If I write the routine myself, then it will effectively be inline and I know it'll be inlined.

Plus better learning experience.

btw all, I got the MSI portion finished, but forgot to put it on this USB. :/ I'll upload it saturday or sunday (US time).


Cheers,

-naota

With any luck you'll be able to turn a fully functioning program to a crashing program with just a little bit of coding.
Aex.Uni forums
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 16th Feb 2008 19:30
I have the new version ready, its in this zip file with license and readme. MSI (The most complex part) has been explained greatly in its header file.


Cheers,

-naota

With any luck you'll be able to turn a fully functioning program to a crashing program with just a little bit of coding.
Aex.Uni forums

Attachments

Login to view attachments
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 17th Feb 2008 14:33
I know what you mean and what you're saying and I think you have a point. If you really WANT inlined stuff - sometimes its better to do it yourself and force it. If this is what you are saying - I can believe this most readily.

Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 22nd Feb 2008 20:55
Yes, that is what I mean.


Cheers,

-naota

With any luck you'll be able to turn a fully functioning program to a crashing program with just a little bit of coding.
Aex.Uni forums
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 22nd Feb 2008 21:59
You can use the stdlib for linked lists - I have a homebrew one if you want it that's not template based - you have to inherit - and override a couple things - and it can work with any types you want.

Your call.. Works reliably.

Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 23rd Feb 2008 06:27
I already have linked lists set up. But if you wish to show yours off, be my guest.


Cheers,

-naota

With any luck you'll be able to turn a fully functioning program to a crashing program with just a little bit of coding.
Aex.Uni forums
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 23rd Feb 2008 15:06
Thanx Bro - Maybe I will - I'm going to make another thread so I don't clutter up yours. BTW - That Garbage Collector is neat.

Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 23rd Feb 2008 23:06
np

My email actually IS "nocannedmeat@gmail.com". Why? I don't know.
Aex.Uni forums

Login to post a reply

Server time is: 2024-11-20 03:50:07
Your offset time is: 2024-11-20 03:50:07