Skip to content

Commit 91ff45d

Browse files
committed
bigint 사용/사용안함 타겟 분리
1 parent 3348ae1 commit 91ff45d

File tree

8 files changed

+31
-19
lines changed

8 files changed

+31
-19
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ jobs:
6060
run: |
6161
export RPYTHON="pypy $GITHUB_WORKSPACE/pypy/rpython/bin/rpython"
6262
cd $GITHUB_WORKSPACE
63-
make
63+
make -j 3
6464
- name: Test with snippets
6565
run: |
6666
cd "$GITHUB_WORKSPACE/snippets"
67-
AHEUI="$GITHUB_WORKSPACE/rpaheui-c" ./test.sh --disable logo integer
67+
AHEUI="$GITHUB_WORKSPACE/rpaheui-c" ./test.sh --disable integer
68+
AHEUI="$GITHUB_WORKSPACE/rpaheui-bigint-c" ./test.sh

Makefile

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,35 @@ RPYTHON?=../pypy/rpython/bin/rpython
33
RPYTHONFLAGS?=--opt=jit --translation-jit_opencoder_model=big
44

55

6-
all: aheui-c aheui-py
6+
all: aheui-bigint-c aheui-c aheui-py
77

88
version:
99
echo "VERSION = '`git describe --tags`'" > aheui/version.py
1010

11-
aheui-py:
11+
aheui-py: version
1212
cp rpaheui.py bin/aheui-py
1313
cp rpaheui.py bin/aheui
1414

15-
aheui-c: version
15+
aheui-bigint-c:
16+
RPAHEUI_BIGINT=1 $(RPYTHON) $(RPYTHONFLAGS) --output rpaheui-bigint-c rpaheui.py
17+
18+
aheui-c:
1619
$(RPYTHON) $(RPYTHONFLAGS) rpaheui.py
1720

1821
clean:
19-
rm rpaheui-c
22+
rm rpaheui-smallint rpaheui-bigint
2023

2124
install: aheui-c
22-
cp rpaheui-c /usr/local/bin/rpaheui
25+
cp rpaheui-bigint /usr/local/bin/rpaheui-bigint
26+
cp rpaheui-smallint /usr/local/bin/rpaheui
2327
ln -s /usr/local/bin/rpaheui /usr/local/bin/aheui
2428

25-
test:
26-
if [ -e snippets ]; then cd snippets && git pull; else git clone https://github.com/aheui/snippets; fi
27-
cd snippets && AHEUI="../rpaheui-c" bash test.sh
29+
test-bigint:
30+
cd snippets && AHEUI="../rpaheui-bigint-c" bash test.sh
31+
32+
test-smallint:
33+
cd snippets && AHEUI="../rpaheui-c" bash test.sh --disable integer
2834

29-
testpy:
35+
test-py:
3036
pytest
31-
if [ -e snippets ]; then cd snippets && git pull; else git clone https://github.com/aheui/snippets; fi
32-
cd snippets && AHEUI=../rpaheui.py bash test.sh
37+
cd snippets && AHEUI=../bin/aheui bash test.sh --disable logo

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
```
2525
git clone https://github.com/aheui/rpaheui
2626
make # RPYTHON 환경변수 설정 필요. rpython은 pypy 소스코드를 내려받으면 포함되어 있습니다. 버전은 github actions 설정을 참고해 주세요.
27-
./aheui-c <your-aheui-code>
27+
./aheui-c <아희 코드 파일>
28+
./aheui-bigint-c <큰 정수가 필요한 아희 코드 파일>
2829
```
2930

3031
JIT로 속도 올리기

aheui/aheui.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,6 @@ def mainloop(program, debug):
440440
return 0
441441

442442

443-
444443
def open_w(filename):
445444
return os.open(filename, os.O_WRONLY | os.O_CREAT, 0o644)
446445

@@ -482,7 +481,7 @@ def entry_point(argv):
482481
cmd, source, contents, str_opt_level, target, aheuic_output, comment_aheuis, output, warning_limit, trace_limit = process_options(argv, os.environ)
483482
except SystemExit:
484483
return 1
485-
484+
486485
warnings.limit = warning_limit
487486
if trace_limit >= 0:
488487
jit.set_param(driver, 'trace_limit', trace_limit)

aheui/int/bigint.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
from rpython.rlib.rbigint import rbigint
44

55

6+
NAME = 'bigint'
7+
8+
69
Int = rbigint
710

811

aheui/int/smallint.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
from aheui._compat import _bytestr
88

99

10+
NAME = 'smallint'
11+
12+
1013
Int = int
1114

1215

aheui/option.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import os
66
from aheui._argparse import ArgumentParser
7+
from aheui._compat import bigint
78
from aheui.version import VERSION
89
from aheui import compile
910

@@ -32,11 +33,10 @@
3233
parser.add_argument('--no-c', '--no-c', narg='0', default='no', description='Do not generate `.aheuic` file automatically.', full_description='\tWhat is .aheuic? https://github.com/aheui/snippets/commit/cbb5a12e7cd2db771538ab28dfbc9ad1ada86f35\n')
3334
parser.add_argument('--warning-limit', '--warning-limit', default='', description='Set repetitive warning limit. '' fallbacks to environment variable `RPAHEUI_WARNING_LIMIT`. 0 means no warning. -1 means no limit. Default is 3.')
3435
parser.add_argument('--trace-limit', '--trace-limit', default='', description='Set JIT trace limit. '' fallbacks to environment variable `RPAHEUI_TRACE_LIMIT`.')
35-
parser.add_argument('--version', '-v', narg='-1', default='no', description='Show program version', message=VERSION)
36+
parser.add_argument('--version', '-v', narg='-1', default='no', description='Show program version', message=('%s %s' % (VERSION, bigint.NAME)).encode('utf-8'))
3637
parser.add_argument('--help', '-h', narg='-1', default='no', description='Show this help text')
3738

3839

39-
4040
def kwarg_or_environ(kwargs, environ, arg_key, env_key):
4141
if arg_key in kwargs and kwargs[arg_key] != '':
4242
return (1, kwargs[arg_key])

aheui/warning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def __init__(self, name, message):
1111

1212
def format(self, *args):
1313
return self.message % args
14-
14+
1515

1616
WARNING_LIST = [
1717
Warning(b'write-utf8-range', b'[Warning:UndefinedBehavior:write-utf8-range] value %x is out of unicode codepoint range.'),

0 commit comments

Comments
 (0)