cpyte 4.2.0__tar.gz → 4.2.2__tar.gz

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.
Files changed (41) hide show
  1. {cpyte-4.2.0/source/cpyte.egg-info → cpyte-4.2.2}/PKG-INFO +1 -1
  2. {cpyte-4.2.0 → cpyte-4.2.2}/pyproject.toml +4 -1
  3. cpyte-4.2.2/source/cpyte/__init__.py +1 -0
  4. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/bytecoding.py +16 -1
  5. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/compiling.py +17 -4
  6. {cpyte-4.2.0 → cpyte-4.2.2/source/cpyte.egg-info}/PKG-INFO +1 -1
  7. cpyte-4.2.0/source/cpyte/__init__.py +0 -1
  8. {cpyte-4.2.0 → cpyte-4.2.2}/MANIFEST.in +0 -0
  9. {cpyte-4.2.0 → cpyte-4.2.2}/readme.md +0 -0
  10. {cpyte-4.2.0 → cpyte-4.2.2}/setup.cfg +0 -0
  11. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/__main__.py +0 -0
  12. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/_bignum_bc.py +0 -0
  13. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/_runtime_bc.py +0 -0
  14. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/astparse.py +0 -0
  15. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/bignum.c +0 -0
  16. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/clib.py +0 -0
  17. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/extension_hooks.py +0 -0
  18. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/formatter.py +0 -0
  19. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/gc_runtime.c +0 -0
  20. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/generate_bc.py +0 -0
  21. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/lexar.py +0 -0
  22. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/linker.py +0 -0
  23. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/lsp_server.py +0 -0
  24. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/mainpie.py +0 -0
  25. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/optimizations.py +0 -0
  26. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/package_manifest.py +0 -0
  27. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/runtime.c +0 -0
  28. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/runtime_scorpion.c +0 -0
  29. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/sef.py +0 -0
  30. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/semantic_analasis.py +0 -0
  31. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/ugc.h +0 -0
  32. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/ui.py +0 -0
  33. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/update_check.py +0 -0
  34. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/winjit_patch.py +0 -0
  35. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte/winjit_stubs.c +0 -0
  36. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte.egg-info/SOURCES.txt +0 -0
  37. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte.egg-info/dependency_links.txt +0 -0
  38. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte.egg-info/entry_points.txt +0 -0
  39. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte.egg-info/requires.txt +0 -0
  40. {cpyte-4.2.0 → cpyte-4.2.2}/source/cpyte.egg-info/top_level.txt +0 -0
  41. {cpyte-4.2.0 → cpyte-4.2.2}/test/test_bignum_jit.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cpyte
3
- Version: 4.2.0
3
+ Version: 4.2.2
4
4
  Summary: The Cpyte programming language compiler
5
5
  Author: Hoang Duy Tung
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cpyte"
7
- version = "4.2.0"
7
+ dynamic = ["version"]
8
8
  description = "The Cpyte programming language compiler"
9
9
  readme = "readme.md"
10
10
  requires-python = ">=3.11"
@@ -23,3 +23,6 @@ cpy = "cpyte.mainpie:main"
23
23
 
24
24
  [tool.setuptools.packages.find]
25
25
  where = ["source"]
26
+
27
+ [tool.setuptools.dynamic]
28
+ version = {attr = "cpyte.__version__"}
@@ -0,0 +1 @@
1
+ __version__ = "4.2.2"
@@ -677,6 +677,7 @@ class LLVM:
677
677
  self._dbg_tracer_fns = {}
678
678
  self._dbg_boxes = {}
679
679
  self._dbg_box_slots = {}
680
+ self._dbg_box_types = {}
680
681
  self._dbg_cur_fn = ""
681
682
  self._dbg_emitted = set()
682
683
  self._dbg_collect = {}
@@ -746,6 +747,7 @@ class LLVM:
746
747
  self._in_emit_iterative = False
747
748
  self._in_decorator = False
748
749
  self._is_decorator_factory = False
750
+ self._func_rettype = None # semantic return type of the current FuncDef
749
751
  self._const_prop: dict = {}
750
752
  self._const_prop_f: dict = {}
751
753
 
@@ -2541,10 +2543,12 @@ class LLVM:
2541
2543
  old_deferred = self._deferred
2542
2544
  old_in_decorator = self._in_decorator
2543
2545
  old_decorator_factory = self._is_decorator_factory
2546
+ old_func_rettype = self._func_rettype
2544
2547
  old_const_prop = self._const_prop
2545
2548
  old_const_prop_f = self._const_prop_f
2546
2549
  self._in_decorator = node.rettype == "decorated"
2547
2550
  self._is_decorator_factory = node.rettype == "decorated"
2551
+ self._func_rettype = node.rettype
2548
2552
  self.locals = {}
2549
2553
  self.local_types = {}
2550
2554
  self.ssa_values = {}
@@ -2627,6 +2631,7 @@ class LLVM:
2627
2631
  self._deferred = old_deferred
2628
2632
  self._in_decorator = old_in_decorator
2629
2633
  self._is_decorator_factory = old_decorator_factory
2634
+ self._func_rettype = old_func_rettype
2630
2635
  self._const_prop = old_const_prop
2631
2636
  self._const_prop_f = old_const_prop_f
2632
2637
 
@@ -3226,7 +3231,14 @@ class LLVM:
3226
3231
  elif isinstance(value.type, ir.IntType) and isinstance(
3227
3232
  ret_ty, ir.PointerType
3228
3233
  ):
3229
- value = self.builder.inttoptr(value, ret_ty)
3234
+ if self._func_rettype == "big":
3235
+ value = self._promote_to_big(
3236
+ value, getattr(node.value, "inferred_type", None)
3237
+ )
3238
+ elif self._func_rettype == "ubig":
3239
+ value = self._promote_to_ubig(value)
3240
+ else:
3241
+ value = self.builder.inttoptr(value, ret_ty)
3230
3242
  self.builder.ret(value)
3231
3243
  else:
3232
3244
  ret_ty = self.builder.function.ftype.return_type
@@ -3770,6 +3782,9 @@ class LLVM:
3770
3782
  ptr = self.locals.get(var)
3771
3783
  if ptr is None:
3772
3784
  continue
3785
+ ty = self.local_types.get(var)
3786
+ if ty:
3787
+ self._dbg_box_types.setdefault(name, {})[var] = ty
3773
3788
  gep = self.builder.gep(
3774
3789
  box, [ir.Constant(_i32, 0), ir.Constant(_i32, slot)]
3775
3790
  )
@@ -1613,17 +1613,30 @@ def run_aot(
1613
1613
  mod = binding.parse_assembly(llvm_ir)
1614
1614
  # Compile the bignum runtime from source for the host platform (instead
1615
1615
  # of pre-built bitcode) so its libc symbol names match the target OS. The
1616
- # clang round-trip is cached per source-content/triple, and the funcs are
1617
- # marked internal (minus the symbols runtime.o needs) so the IR linker and
1618
- # an early GlobalDCE only carry the bignum helpers this program uses.
1616
+ # clang round-trip is cached per source-content/triple. The IR linker
1617
+ # treats an internal source definition plus a same-named external
1618
+ # declaration already in the destination (the program declares every
1619
+ # bigint_*/ubigint_* helper) as a conflict and DROPS the definition, so we
1620
+ # link FIRST (external definitions) and only then mark the survivors
1621
+ # internal; the later _prune_module GlobalDCE removes the unreferenced
1622
+ # runtime code, keeping only the helpers this program uses and everything
1623
+ # _BIGNUM_KEEP lists for the native AOT link of runtime.o.
1619
1624
  llvm_cc = _find_llvm_cc()
1620
1625
  bignum_ir, err = _cached_c_ir(llvm_cc, _BIGNUM_C, host_target().triple)
1621
1626
  if bignum_ir is None:
1622
1627
  print_err(f"error compiling {_BIGNUM_C}: {format_cc_diag(err.stderr)}")
1623
1628
  raise SystemExit(1)
1624
1629
  bignum_mod = binding.parse_assembly(_remove_probe_stack_ir(bignum_ir))
1625
- _mark_internal(bignum_mod, keep=_BIGNUM_KEEP)
1630
+ src_names = {f.name for f in bignum_mod.functions if not f.is_declaration}
1626
1631
  binding.link_modules(mod, bignum_mod)
1632
+ for fn in mod.functions:
1633
+ if (
1634
+ fn.name in src_names
1635
+ and fn.name not in _BIGNUM_KEEP
1636
+ and not fn.is_declaration
1637
+ and str(fn.linkage) not in ("internal", "private", "linkonce_odr")
1638
+ ):
1639
+ fn.linkage = "internal"
1627
1640
  mod.verify()
1628
1641
  _prune_module(mod)
1629
1642
  optimize(mod, opt_level)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cpyte
3
- Version: 4.2.0
3
+ Version: 4.2.2
4
4
  Summary: The Cpyte programming language compiler
5
5
  Author: Hoang Duy Tung
6
6
  License: MIT
@@ -1 +0,0 @@
1
- __version__ = "3.4.0"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes