Author Topic: Chameleon BASIC  (Read 13930 times)

0 Members and 4 Guests are viewing this topic.

JRS

  • Guest
BASM
« Reply #30 on: December 03, 2014, 08:08:32 AM »
Thanks Mike for the feedback and good to hear you're okay. BASM is about learning ASM and building a compiler. There are already a glut of BASIC compilers on Windows so getting any help from this group isn't surprising. I don't see using floating point math as a negative aspect of the compiler. It makes it more typeless and easier to use. (unless casting is your thing) There is always O2 if a dose of pure speed is the only remedy. For me the only negative aspect of the compiler is it's 32 bit. I'm not knowledgeable enough to know what it's going to take to move it to 64 bit. NAsm seems to tout cross platform and 32/64 bit aware. I'm going to be putting my efforts into the Linux side as there are folks willing to help on that platform.

P.S. I was only asking for help to resolve the callback issue and not asking anyone for any long term commitments to the project.

« Last Edit: December 03, 2014, 11:52:23 AM by John »

Charles Pegge

  • Guest
Re: Chameleon BASIC
« Reply #31 on: December 04, 2014, 12:55:47 AM »

Quote
Did Charles and Mike get abducted by aliens?



Mike Lobanovsky

  • Guest
Re: Chameleon BASIC
« Reply #32 on: December 04, 2014, 05:55:07 AM »
Was that a selfie, Charles? :D


@John:

Sorry but I can hardly analyse efficiently the sources where 32-bit code pointers are represented with double precision quantities and conditioned with a floor() call.

JRS

  • Guest
Re: Chameleon BASIC
« Reply #33 on: December 04, 2014, 09:43:54 AM »
@Mike - Thanks for having a peek!

AIR has discovered a problem in the memory manager when one function calls another. (releases a string on exit and then again down the line) He says the ASM code is sloppy and a rats nest. The C++ translator is fine. He suggests that it should generate C/C++ rather than ASM. I wonder if substituting KoolB ASM with O2 ASM would give Charles a vehicle to get his compiler cross platform in a 32/64 bit way.


« Last Edit: December 04, 2014, 02:30:18 PM by John »

JRS

  • Guest
BASM
« Reply #34 on: December 04, 2014, 04:52:31 PM »
The problem AIR was having on the Linux version works fine on the Windows version.

Code: Text
  1. FUNCTION Func2(s2 AS STRING) AS STRING
  2.   RESULT = s2 + "[Func2]"
  3. END FUNCTION
  4.  
  5. FUNCTION Func1(s1 AS STRING) AS STRING
  6.   s1 = s1 + "[Func1]"
  7.   RESULT = Func2(s1)
  8. END FUNCTION
  9.  
  10. PRINT Func1("[Main]")
  11.  

Windows

C:\BASM\test>C:\BASM\Bin\BASM.exe "testfunc.bas" C:\BASM\Inc\

BASM - Version 1.0 Build 1
Currently compiling "testfunc.bas":
 - Compile time  ->  0.008000 seconds
 - Assemble time ->  0.202000 seconds
 - Linking time  ->  0.126000 seconds
   -------------------------------
 - Total time    ->  0.336000 seconds

C:\BASM\test>testfunc
[Main][Func1][Func2]

C:\BASM\test>


Linux

jrs@laptop:~/BASM64/test$ BASM testfunc.bas

BASM Linux 64 (i386 output) - Version 1.0 Build 1
Currently compiling "testfunc.bas":
 - Compile time  ->  0.001088 seconds
 - Assemble time ->  0.000455 seconds
 - Linking time  ->  0.000230 seconds
   -------------------------------
 - Total time    ->  0.001882 seconds
jrs@laptop:~/BASM64/test$ ./testfunc
Segmentation fault (core dumped)
jrs@laptop:~/BASM64/test$

JRS

  • Guest
BASM Linux
« Reply #35 on: December 04, 2014, 07:23:43 PM »
AIR in a second round was able to fix the problem. (with my example at least)

Quote
In Assembly.h at around line 2243, change the #IFDEF Linux part so it looks like this:

    //With Linux, we like to leave things for the calling process to deal with,
    //so we just do a simple LEAVE and RET
    #ifdef Linux
      Write.Line(Write.ToFunction, "LEAVE");
      Write.Line(Write.ToFunction, "RET");
    #endif

"LEAVE" resets the stack pointer, which was getting corrupted.


jrs@laptop:~/BASM64/test$ BASM testfunc.bas

BASM Linux 64 (i386 output) - Version 1.0 Build 1
Currently compiling "testfunc.bas":
 - Compile time  ->  0.001024 seconds
 - Assemble time ->  0.000626 seconds
 - Linking time  ->  0.000156 seconds
   -------------------------------
 - Total time    ->  0.001894 seconds
jrs@laptop:~/BASM64/test$ ./testfunc
[Main][Func1][Func2]
jrs@laptop:~/BASM64/test$


« Last Edit: December 04, 2014, 09:45:39 PM by John »

Mike Lobanovsky

  • Guest
Re: Chameleon BASIC
« Reply #36 on: December 05, 2014, 04:54:41 AM »
Will you please post Assembly::EndCreateSubFunction()'s entire source, John? The function's existing common code that precedes the Windows/Linux fork you're talking about doesn't go well, asm-wise, with AIR's solution as it is described in your message. I just want to be sure we haven't overlooked anything before I start criticizing the solution proper. :)

JRS

  • Guest
Re: BASM
« Reply #37 on: December 05, 2014, 09:54:11 AM »
Hi Mike!

Not sure what you're asking for. The current Linux BASM source is on Bitbucket if you want to have a peek. We are still trying to get our arms around what we have to work with. At this point the only open issue is Windows callbacks which works on Linux.

If you have any interest in helping / advising / contributing, please join the BASM forum.

I hope to be more helpful after finishing the KoolB tutorials Brian C. Becker did.
« Last Edit: December 05, 2014, 12:51:55 PM by John »

Mike Lobanovsky

  • Guest
Re: Chameleon BASIC
« Reply #38 on: December 05, 2014, 09:32:25 PM »
Hi John,

Thanks for the response. I am not interested in BASM. I was just curious how that particular remedy that you advertised here could possibly fix the sources, Linux or otherwise.

Since I see no constructive response to my simple request to post the problematic function's source code here that was formulated in a perfect English Sprache, I will just restrain myself to mentioning that the alleged solution makes no sense within the context of two common (i.e. effective for both Windows and Linux) asm instructions mov esp, ebp and pop ebp that precede immediately, as per Assembly.h dated December 2, 2014, the extra leave that AIR suggested. The resultant instruction sequence leads inevitably to stack underflow, which is as bad as the very bug you intended to cure.

Your quotation from AIR as it was presented earlier on December 4 (default forum date/time) alone cannot possibly cure the situation. It can only aggravate it. I would not recommend anyone to fix the sources as per your directions in the said post on this forum.
« Last Edit: December 05, 2014, 09:51:43 PM by Mike Lobanovsky »

JRS

  • Guest
BASM
« Reply #39 on: December 05, 2014, 09:53:39 PM »
I passed on your comments to AIR.

It makes it difficult to get momentum behind the BASM project when there is an offer of advice or direction but not interested enough to get involved. I'm trying my best to facilitate and advocate for the BASM project. Open source projects don't work if folks (community) don't get involved. I'm not asking or begging for anyone's help on this project. If it interests you fine. If not feel free to ignore my posts.


Mike Lobanovsky

  • Guest
Re: Chameleon BASIC
« Reply #40 on: December 05, 2014, 10:13:51 PM »
Thanks for passing my feedback on.

Just one more question before I leave this thread. What is then the idea behind posting BASM specifics here rather than just indicating the general progress of the project that you are mentoring? It was the asm code that I reacted to. I would've just taken note of the developments had there been no questionable specifics that caught my eye.

Serves me right though.

JRS

  • Guest
Re: BASM
« Reply #41 on: December 05, 2014, 10:18:34 PM »
Quote
What is then the idea behind posting BASM specifics here rather than just indicating the general progress of the project that you are mentoring facilitating?

I'm advocating for the project and trying to pick up talented programmers (open forum) looking for an interesting project to contribute to. It's the holiday season after all.


JRS

  • Guest
Re: BASM
« Reply #42 on: December 05, 2014, 10:24:22 PM »
Quote from: AIR
You know he's actually 100% right.

The thing is, I'm not thinking about the Windows version.  I'm just playing around.  So viewed from the context he mentioned, I have to agree.

You should probably let him know that what I sent you at the time was part of a "work in progress".  Got to do things in stages, ya know? Come up with an intermediate by-the-seat-of-the-pants faux fix, and then work on overflow/underflow issues.  But you can't do that if you segfault every time you blink at the app!  LOL.

Mike's a good guy, I don't have any issues with what he said.  In fact, please let him know that I appreciate his comments and have nothing but the utmost respect for his coding skills and for him as well!

A.

Mike Lobanovsky

  • Guest
Re: Chameleon BASIC
« Reply #43 on: December 05, 2014, 10:30:20 PM »
Whatever you say. It is an open forum and it is your server, after all.

And please give my best regards to AIR as well. I do respect him as a professional and I admire his cheerful attitude to things in life. :)


JRS

  • Guest
Re: Chameleon BASIC
« Reply #44 on: December 05, 2014, 10:54:49 PM »
Quote
and it is your server

Actually it's Site Genie's server that I lease a VPS instance on.

I thought a language forum was about guys (no gals yet) with a common interest and sharing each others knowledge and contributing to a common cause that benefits everyone. (contributors or not) I think the problem is that there is too much ego and reading between the lines going on. It's childish and I running out of patience dealing with it. I don't know of anyone else that has put their free time and resource into multiple projects with only one goal and that is to keep BASIC alive. I have a consistent and successful track record with my efforts and you won't see me extending my hand out expecting freebies or ask for a free ride.

Hopefully someday you will get the fact that I'm not out to own BASIC and just a guy that believes in the concept of the language an trying to keep it simple.

« Last Edit: December 06, 2014, 12:33:55 AM by John »