l0n0lc 0.9.2__py3-none-any.whl → 0.9.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- l0n0lc/jit.py +6 -3
- {l0n0lc-0.9.2.dist-info → l0n0lc-0.9.4.dist-info}/METADATA +30 -30
- {l0n0lc-0.9.2.dist-info → l0n0lc-0.9.4.dist-info}/RECORD +6 -6
- {l0n0lc-0.9.2.dist-info → l0n0lc-0.9.4.dist-info}/WHEEL +0 -0
- {l0n0lc-0.9.2.dist-info → l0n0lc-0.9.4.dist-info}/licenses/LICENSE +0 -0
- {l0n0lc-0.9.2.dist-info → l0n0lc-0.9.4.dist-info}/top_level.txt +0 -0
l0n0lc/jit.py
CHANGED
@@ -113,7 +113,10 @@ class py2cpp编译器(ast.NodeVisitor):
|
|
113
113
|
self.c函数名 = f'function_{self.函数名.encode().hex()}'
|
114
114
|
else:
|
115
115
|
self.c函数名 = self.函数名
|
116
|
-
|
116
|
+
代码文件地址 = inspect.getfile(被编译的函数)
|
117
|
+
文件名 = os.path.split(代码文件地址)[1]
|
118
|
+
文件名hash = hashlib.blake2s(代码文件地址.encode(), digest_size=8).hexdigest()
|
119
|
+
self.文件前缀 = f'{文件名hash}_{文件名}_{self.函数名}_@'
|
117
120
|
|
118
121
|
def 编译(self):
|
119
122
|
语法树 = ast.parse(self.源代码)
|
@@ -559,10 +562,10 @@ class py2cpp编译器(ast.NodeVisitor):
|
|
559
562
|
值 = self.获取值(node.value)
|
560
563
|
目标类型 = self.获取值(node.annotation)
|
561
564
|
if 目标类型 is None:
|
562
|
-
self.抛出代码异常(f'
|
565
|
+
self.抛出代码异常(f'不支持的类型:{node.annotation}', node)
|
563
566
|
c类型 = py类型转c类型(目标类型)
|
564
567
|
if c类型 is None:
|
565
|
-
self.抛出代码异常(f'
|
568
|
+
self.抛出代码异常(f'不支持的类型:{目标类型}', node)
|
566
569
|
self._赋值(node.target, 值, node, str(c类型))
|
567
570
|
|
568
571
|
def 获取定义(self):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: l0n0lc
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.4
|
4
4
|
Summary: 一个将python函数翻译为c++函数并运行的jit编译器
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
6
6
|
Requires-Python: >=3.10
|
@@ -235,25 +235,25 @@ vv: 1
|
|
235
235
|
```bash
|
236
236
|
ls -al ./l0n0lcoutput
|
237
237
|
total 136
|
238
|
-
drwxr-xr-x 2 root root 4096 Sep
|
239
|
-
drwxrwxrwx 11 1000 1000 4096 Sep
|
240
|
-
-rw-r--r-- 1 root root
|
241
|
-
-rw-r--r-- 1 root root 167 Sep
|
242
|
-
-rwxr-xr-x 1 root root
|
243
|
-
-rw-r--r-- 1 root root
|
244
|
-
-rw-r--r-- 1 root root
|
245
|
-
-rwxr-xr-x 1 root root
|
246
|
-
-rw-r--r-- 1 root root
|
247
|
-
-rw-r--r-- 1 root root 106 Sep
|
248
|
-
-rwxr-xr-x 1 root root
|
249
|
-
-rw-r--r-- 1 root root
|
250
|
-
-rw-r--r-- 1 root root 164 Sep
|
251
|
-
-rwxr-xr-x 1 root root
|
238
|
+
drwxr-xr-x 2 root root 4096 Sep 19 00:58 .
|
239
|
+
drwxrwxrwx 11 1000 1000 4096 Sep 19 00:58 ..
|
240
|
+
-rw-r--r-- 1 root root 1811 Sep 19 00:58 c31f68e99ed4ce3c_hello_world.py_jit_all_ops_@7801528c3d61baf7.cpp
|
241
|
+
-rw-r--r-- 1 root root 167 Sep 19 00:58 c31f68e99ed4ce3c_hello_world.py_jit_all_ops_@7801528c3d61baf7.h
|
242
|
+
-rwxr-xr-x 1 root root 23584 Sep 19 00:58 c31f68e99ed4ce3c_hello_world.py_jit_all_ops_@7801528c3d61baf7.so
|
243
|
+
-rw-r--r-- 1 root root 1531 Sep 19 00:58 c31f68e99ed4ce3c_hello_world.py_test_add_@469de6acaaabc570.cpp
|
244
|
+
-rw-r--r-- 1 root root 398 Sep 19 00:58 c31f68e99ed4ce3c_hello_world.py_test_add_@469de6acaaabc570.h
|
245
|
+
-rwxr-xr-x 1 root root 40408 Sep 19 00:58 c31f68e99ed4ce3c_hello_world.py_test_add_@469de6acaaabc570.so
|
246
|
+
-rw-r--r-- 1 root root 155 Sep 19 00:58 c31f68e99ed4ce3c_hello_world.py_test_other_fn_@75fdd928ab58a8e3.cpp
|
247
|
+
-rw-r--r-- 1 root root 106 Sep 19 00:58 c31f68e99ed4ce3c_hello_world.py_test_other_fn_@75fdd928ab58a8e3.h
|
248
|
+
-rwxr-xr-x 1 root root 15648 Sep 19 00:58 c31f68e99ed4ce3c_hello_world.py_test_other_fn_@75fdd928ab58a8e3.so
|
249
|
+
-rw-r--r-- 1 root root 219 Sep 19 00:58 c31f68e99ed4ce3c_hello_world.py_test编译的函数_@3bf4501e0408a243.cpp
|
250
|
+
-rw-r--r-- 1 root root 164 Sep 19 00:58 c31f68e99ed4ce3c_hello_world.py_test编译的函数_@3bf4501e0408a243.h
|
251
|
+
-rwxr-xr-x 1 root root 15688 Sep 19 00:58 c31f68e99ed4ce3c_hello_world.py_test编译的函数_@3bf4501e0408a243.so
|
252
252
|
|
253
253
|
```
|
254
|
-
## 5.
|
254
|
+
## 5. c31f68e99ed4ce3c_hello_world.py_jit_all_ops_@7801528c3d61baf7.cpp
|
255
255
|
```c++
|
256
|
-
#include "
|
256
|
+
#include "c31f68e99ed4ce3c_hello_world.py_jit_all_ops_@7801528c3d61baf7.h"
|
257
257
|
extern "C" int64_t jit_all_ops (int64_t a, int64_t b)
|
258
258
|
{
|
259
259
|
auto x = 42;
|
@@ -348,7 +348,7 @@ extern "C" int64_t jit_all_ops (int64_t a, int64_t b)
|
|
348
348
|
}
|
349
349
|
|
350
350
|
```
|
351
|
-
## 6.
|
351
|
+
## 6. c31f68e99ed4ce3c_hello_world.py_jit_all_ops_@7801528c3d61baf7.h
|
352
352
|
```c++
|
353
353
|
#pragma once
|
354
354
|
#include <cstdint>
|
@@ -358,9 +358,9 @@ extern "C" int64_t jit_all_ops (int64_t a, int64_t b)
|
|
358
358
|
#include <vector>
|
359
359
|
extern "C" int64_t jit_all_ops (int64_t a, int64_t b);
|
360
360
|
```
|
361
|
-
## 7.
|
361
|
+
## 7. c31f68e99ed4ce3c_hello_world.py_test_add_@469de6acaaabc570.cpp
|
362
362
|
```c++
|
363
|
-
#include "
|
363
|
+
#include "c31f68e99ed4ce3c_hello_world.py_test_add_@469de6acaaabc570.h"
|
364
364
|
extern "C" int64_t test_add (int64_t a, int64_t b)
|
365
365
|
{
|
366
366
|
if ((a > 1))
|
@@ -423,12 +423,12 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
|
|
423
423
|
}
|
424
424
|
|
425
425
|
```
|
426
|
-
## 8.
|
426
|
+
## 8. c31f68e99ed4ce3c_hello_world.py_test_add_@469de6acaaabc570.h
|
427
427
|
```c++
|
428
428
|
#pragma once
|
429
|
-
#include "
|
430
|
-
#include "
|
431
|
-
#include "
|
429
|
+
#include "c31f68e99ed4ce3c_hello_world.py_jit_all_ops_@7801528c3d61baf7.h"
|
430
|
+
#include "c31f68e99ed4ce3c_hello_world.py_test_other_fn_@75fdd928ab58a8e3.h"
|
431
|
+
#include "c31f68e99ed4ce3c_hello_world.py_test编译的函数_@3bf4501e0408a243.h"
|
432
432
|
#include <cmath>
|
433
433
|
#include <cstdint>
|
434
434
|
#include <iostream>
|
@@ -436,32 +436,32 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
|
|
436
436
|
#include <unordered_map>
|
437
437
|
extern "C" int64_t test_add (int64_t a, int64_t b);
|
438
438
|
```
|
439
|
-
## 9.
|
439
|
+
## 9. c31f68e99ed4ce3c_hello_world.py_test_other_fn_@75fdd928ab58a8e3.cpp
|
440
440
|
```c++
|
441
|
-
#include "
|
441
|
+
#include "c31f68e99ed4ce3c_hello_world.py_test_other_fn_@75fdd928ab58a8e3.h"
|
442
442
|
extern "C" int64_t test_other_fn (int64_t a, int64_t b)
|
443
443
|
{
|
444
444
|
return (a - b);
|
445
445
|
}
|
446
446
|
|
447
447
|
```
|
448
|
-
## 10.
|
448
|
+
## 10. c31f68e99ed4ce3c_hello_world.py_test_other_fn_@75fdd928ab58a8e3.h
|
449
449
|
```c++
|
450
450
|
#pragma once
|
451
451
|
#include <cstdint>
|
452
452
|
#include <string>
|
453
453
|
extern "C" int64_t test_other_fn (int64_t a, int64_t b);
|
454
454
|
```
|
455
|
-
## 11.
|
455
|
+
## 11. c31f68e99ed4ce3c_hello_world.py_test编译的函数_@3bf4501e0408a243.cpp
|
456
456
|
```c++
|
457
|
-
#include "
|
457
|
+
#include "c31f68e99ed4ce3c_hello_world.py_test编译的函数_@3bf4501e0408a243.h"
|
458
458
|
extern "C" int64_t /*test编译的函数*/ function_74657374e7bc96e8af91e79a84e587bde695b0 (int64_t a, int64_t b)
|
459
459
|
{
|
460
460
|
return (a * b);
|
461
461
|
}
|
462
462
|
|
463
463
|
```
|
464
|
-
## 12.
|
464
|
+
## 12. c31f68e99ed4ce3c_hello_world.py_test编译的函数_@3bf4501e0408a243.h
|
465
465
|
```c++
|
466
466
|
#pragma once
|
467
467
|
#include <cstdint>
|
@@ -2,11 +2,11 @@ l0n0lc/StdList.py,sha256=0NTIpaRrNHaCiLrRbEVob21pZHa8S8rfaBRALPT-tD0,889
|
|
2
2
|
l0n0lc/StdMap.py,sha256=997LCvP0ewNciabbmGHVL2eUgMakHBsR3c5HQmOwC_E,666
|
3
3
|
l0n0lc/__init__.py,sha256=fUC6TMeN_fEL7HDazrBEdoWOQkXi5uSGZb7LZj6juog,137
|
4
4
|
l0n0lc/c基础处理.py,sha256=GrCPZpLsyfQD8XZQhOCb5y8v9NCZ6bU4C_xfJGx-pvQ,5723
|
5
|
-
l0n0lc/jit.py,sha256=
|
5
|
+
l0n0lc/jit.py,sha256=wwipFTZnlXwKlazha5b0p5iKCiL0Fy8nhVthOwcMa48,26017
|
6
6
|
l0n0lc/编译.py,sha256=Ty4gPDHAB1jn8LgnE4w3R06bOAEeYr8iwqahYf6QeHI,2154
|
7
7
|
l0n0lc/通用.py,sha256=RkqP9cMhKhl2h4YxOpAWFFftIPXLZTYMyOOD1PuB59M,4630
|
8
|
-
l0n0lc-0.9.
|
9
|
-
l0n0lc-0.9.
|
10
|
-
l0n0lc-0.9.
|
11
|
-
l0n0lc-0.9.
|
12
|
-
l0n0lc-0.9.
|
8
|
+
l0n0lc-0.9.4.dist-info/licenses/LICENSE,sha256=1L-MAjulZ3kpbYwsJtlXpDVITRxykna2Ecg_521YfkA,1093
|
9
|
+
l0n0lc-0.9.4.dist-info/METADATA,sha256=HHQtMWvEW6_RX1eno-W3chzTzv0XfcYMtXhLmKpFCTs,10994
|
10
|
+
l0n0lc-0.9.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
11
|
+
l0n0lc-0.9.4.dist-info/top_level.txt,sha256=Q21D_eEY_-xgRUPwATGp9YDKSBO4w_7MI2MYxQI1aT4,7
|
12
|
+
l0n0lc-0.9.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|