Search found 3447 matches

by MichaelW
Sep 08, 2015 6:09
Forum: General
Topic: How initialize a data memory area as quickly as possible?
Replies: 37
Views: 5322

Re: How initialize a data memory area as quickly as possible

noop wrote: Why do you push and pop the rdi register?
Because per the Microsoft X64 calling convention, RDI is one of the callee-save registers, a short description is here.
I don't know if for my code preserving RDI is actually necessary, but it might be and the conservative approach is to preserve it.
by MichaelW
Sep 08, 2015 5:50
Forum: General
Topic: How initialize a data memory area as quickly as possible?
Replies: 37
Views: 5322

Re: How initialize a data memory area as quickly as possible

MrSwiss wrote: However, you've used what I call "The Disc-Manufacturers Cheat" to calculate Bytes:
1e9
instead of
1024e6
Yes, I should have used the correct value, but in my defense it's the ratio of the results that matters.
by MichaelW
Sep 06, 2015 7:55
Forum: General
Topic: How initialize a data memory area as quickly as possible?
Replies: 37
Views: 5322

Re: How initialize a data memory area as quickly as possible

I tested only the CRT memset, rep stosq, and clear. Running on my Windows 8.1, 4GB laptop, after my initial test with a ~3.6GB array the system required ~5 minutes to recover from heavy use of the disk (swap file or whatever it's currently called), so I settled on an array size of ~1.6GB, and the sy...
by MichaelW
Sep 04, 2015 3:18
Forum: Community Discussion
Topic: [solved] 64 bit ABI and recursion ?
Replies: 8
Views: 2129

Re: [solved] 64 bit ABI and recursion ?

function Factorial( n as longint ) as longint if n = 0 then return 1 else return n * Factorial( n - 1 ) end if end function for i as longint = 0 to 10 print Factorial(i) next sleep Assembly code as compiled with Version 1.03.0 (07-01-2015), built for win64 (64bit): .file "factorial.c" .in...
by MichaelW
Sep 01, 2015 5:04
Forum: General
Topic: Filled Box, ASM
Replies: 12
Views: 3274

Re: Filled Box, ASM

The "test ebx, ebx" is not necessary, because the "dec ebx" will set the zero flag when ebx reaches zero. And while "jne" does exactly the same thing as "jnz", using "jnz" would make it easier to understand the code. Also, while the "rep stos_&q...
by MichaelW
Aug 23, 2015 4:33
Forum: Beginners
Topic: Shared 3.9GB array too big in FB64bits with 8GB RAM
Replies: 13
Views: 2919

Re: Shared 3.9GB array too big in FB64bits with 8GB RAM

Running on my cheap 64-bit, 4GB laptop under Windows 8.1 (probably the base edition), whether I test a dynamic array or memory allocated from the CRT (I think memory for dynamic arrays is also allocated from the CRT), I get a limit of ~15GB. dim as longint x for i as longint = 1000000 to 51200000000...
by MichaelW
Aug 17, 2015 0:00
Forum: Sources, Examples, Tips and Tricks
Topic: Test of X64 Calling Convention
Replies: 1
Views: 1208

Re: Test of X64 Calling Convention

This corrects an error in the above code: #include "crt.bi" ''---------------------------------------------------------------------------- '' For the Microsoft X64 calling convention the first four integer or pointer '' arguments, taken in left to right order as they appear in the paramete...
by MichaelW
Aug 16, 2015 20:39
Forum: Sources, Examples, Tips and Tricks
Topic: Test of X64 Calling Convention
Replies: 1
Views: 1208

Test of X64 Calling Convention

This is just a quick and dirty test I did to fill in some details that the documentation I have been referencing left out. #include "crt.bi" ''---------------------------------------------------------------------------- '' For the Microsoft X64 calling convention the first four integer or ...
by MichaelW
Aug 13, 2015 10:46
Forum: General
Topic: byref: return byval a_pointer vs. return *a_pointer
Replies: 7
Views: 1285

Re: byref: return byval a_pointer vs. return *a_pointer

No, not warning because this syntax with the BYVAL keyword is allowed by the fb compiler and also documented in manual... What is the reason for allowing it? Do you agree that test_b should return a pointer? Per the "byref as integer" it's supposed to return a pointer, and per the "r...
by MichaelW
Aug 13, 2015 4:34
Forum: General
Topic: byref: return byval a_pointer vs. return *a_pointer
Replies: 7
Views: 1285

Re: byref: return byval a_pointer vs. return *a_pointer

It looks to me like test_b should return a pointer, and test_d should trigger a warning. #include <stdio.h> #include <conio.h> int x = 4; int *test_b() { int *px = &x; return px; } int *test_d() { int *px = &x; return *px; // line 15 } int main(void) { printf( "%d\n%d\n", test_b(),...
by MichaelW
Aug 08, 2015 9:44
Forum: Sources, Examples, Tips and Tricks
Topic: Cycle count macros for 32 and 64-bit code
Replies: 10
Views: 6152

Re: Cycle count macros for 32 and 64-bit code

This code is an attempt to measure the caching effects when traversing a large array in increasing large strides. This code uses the newest 64-bit macros (see first post in this thread), and was tested with Version 1.03.0 (07-01-2015), built for win64 (64bit). #include "windows.bi" #includ...
by MichaelW
Aug 06, 2015 0:58
Forum: General
Topic: ASM translation from PB to FB
Replies: 20
Views: 3390

Re: ASM translation from PB to FB

This compiles without warnings or errors (Version 1.02.0 (04-05-2015), built for win32 (32bit)), and executes without triggering an exception: SUB ALPHA_C(BYREF SRC AS LONG, BYREF DEST AS LONG, _ BYVAL W AS LONG, BYVAL H AS LONG, _ BYVAL WS AS LONG, BYVAL WD AS LONG) EXPORT DIM ff AS LONG DIM x AS L...
by MichaelW
Aug 05, 2015 15:25
Forum: General
Topic: ASM translation from PB to FB
Replies: 20
Views: 3390

Re: ASM translation from PB to FB

@AWPStar I added: div BYTE PTR [ff] To my test source and compiling with -gen gcc did not return any errors, but in the assembly output from gcc the instruction compiled to: div BYTE PTR [DWORD PTR [esp+12]] So something is not right. You still have not specified how you are compiling your source wi...
by MichaelW
Aug 05, 2015 11:28
Forum: General
Topic: ASM translation from PB to FB
Replies: 20
Views: 3390

Re: ASM translation from PB to FB

I'm not sure what you mean by "compile with gcc". I can compile my test source, as posted, with -gen gcc using this command line: "\program files (x86)\freebasic32\fbc" -gen gcc -Wc -O2 -v -C -R -RR -s console testpbconversion.bas And get this output: C:\Users\User\FreeBASIC32 My...