[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Problem using alloca
From: |
Thomas Preud'homme |
Subject: |
Re: [Tinycc-devel] Problem using alloca |
Date: |
Wed, 02 Jul 2014 21:40:29 +0800 |
User-agent: |
KMail/4.12.4 (Linux/3.14-1-amd64; KDE/4.13.1; x86_64; ; ) |
Le mardi 01 juillet 2014 10:20:12, vous avez écrit :
> Yes. Please. You can tell me the steps for be able of send commits ?
Sure but first let's discuss how to make the patch.
1) Downloading the latest development code
So first you'll need a copy of the latest code that we keep in git source code
management tool. You can find an installer for git at [1]. Once installed,
you'll have two programs you can use: git-bash and git-gui if I remember
correctly.
[1] http://git-scm.com/download/
Launch git-bash and there just type: git clone git://repo.or.cz/tinycc.git
This will create a directory "tinycc" in which you'll find the most recent
code.
2) Hacking
From there, you'll have to take a look at lib/alloca86_64.S and
lib/alloca86.S. You'll notice a "cmp $4096,%rax" or "cmp $4096,%eax" whose
goal is to compare the parameter given to alloca (rounded up to a multiple of
16) with 4096. If it's less or equal it will continue at p2 and skip the code
you see below. Otherwise it'll allocate 4096 bytes by substracting this amount
to the stack pointer (esp) and then read something on the stack (the test
instruction) and loop again at the cmp instruction.
Basically it does a loop allocating 4096 bytes at a time and trying to read
one of these byte before continuing the loop. If there is something to do when
allocating 8MB or more, you'll have to add another cmp just before the p1
label to compare eax with this value and then do what needs to be done on
Windows. For this I cannot tell, you seem to know more than me.
3) Committing in the main repo
Once the patch written, you will prepare the file for the commit with git add
lib/alloca86.S lib/alloca86_64.S. Then you should inspect it with "git diff --
cached" to make sure you didn't add spurious whitespace somewhere (it will
appear in red in git). Then if all is ok you can commit with "git commit" and
enter the commit message. At this stage you have a local commit, meaning that
only you have this commit, nobody else has it. You'll need to "push" this
commit to the main repository for everybody to see it. This is done by doing a
"git push ssh://address@hidden/srv/git/tinycc.git mob:mob" that instruct to
push everything you made on branch mob (the one automatically created when you
issued "git clone" initially) on a branch mob on our main repo.
If you have an error message it means somebody else pushed some commits to the
main repo. In this case, just do "git pull --rebase" and then you'll be able
to do the push. If there is any problem, feel free to ask here, I'm sure
you'll find an answer to your question. Note that this answer will not come
from me as I'll be absent for two weeks from this friday.
I look forward to your contribution.
Best regards,
Thomas
signature.asc
Description: This is a digitally signed message part.