Commit Graph

1097 Commits

Author SHA1 Message Date
Alexey Andreev
96bf4379c9 Temporarily ignore failing test 2024-08-26 19:40:59 +02:00
Alexey Andreev
ebac13a363 wasm gc: implement Array.getLength and Array.get 2024-08-26 18:14:04 +02:00
Alexey Andreev
ba08fb395c wasm gc: always emit java.lang.Class, fix issue with recursive types 2024-08-25 20:38:02 +02:00
Alexey Andreev
0cda737dca Add test for bug in nullness analysis 2024-08-25 19:34:20 +02:00
Alexey Andreev
4a345610cf wasm gc: reduce number of generated virtual table entries, reduce size of a simple program 2024-08-23 21:10:44 +02:00
Alexey Andreev
3e19ca341e wasm gc: fix support of class initialization, inherit arrays from Object, add support for clone in arrays 2024-08-23 21:10:44 +02:00
Alexey Andreev
335e2da4cf wasm gc: implement System.identityHashCode() and some Integer intrinsics 2024-08-23 10:14:39 +02:00
Alexey Andreev
5d109236d9 wasm gc: fix running tests in JUnit, fix remaining errors so that *few* tests pass 2024-08-21 14:29:56 +02:00
Alexey Andreev
1aebe51256 wasm gc: implement backend-specific virtual table builder 2024-08-20 21:03:51 +02:00
Alexey Andreev
eb0eb1f146 wasm gc: generate field names and write them to name section 2024-08-20 14:16:24 +02:00
Alexey Andreev
29f29cea1d wasm gc: trying to fix virtual calls 2024-08-19 15:02:11 +02:00
Alexey Andreev
5eb1e7d9bc wasm gc: implement intrinsics for Long and Class classes 2024-08-18 19:55:25 +02:00
Alexey Andreev
a97e6574ac Introduce concept of 'weak' cast.
Use weak casts to maintain proper typing within methods during various operations on IR. At generation level, ignore weak casts, except for Wasm GC BE, which turns weak casts into platform casts.
2024-08-18 18:47:04 +02:00
Alexey Andreev
8b52741e04 wasm: avoid generation of types as defined in GC spec
This fixes passing tests in environments that either don't support or prohibit usage of GC spec
2024-08-18 17:51:29 +02:00
Alexey Andreev
199032d48a wasm gc: support Array.newInstance 2024-08-17 20:48:03 +02:00
Alexey Andreev
40fbce0ddd wasm gc: fix issues with virtual calls 2024-08-16 20:42:03 +02:00
Alexey Andreev
8c15885f44 Fix metaprogramming support, fix calculation of virtual tables for final classes 2024-08-14 13:22:27 +02:00
Alexey Andreev
eaf2c8189f wasm gc: implement some basic reflection-specific intrinsics in Object and Class 2024-08-13 20:51:20 +02:00
Alexey Andreev
a84c5fc77f wasm gc: fix issues related to virtual calls 2024-08-13 19:57:48 +02:00
Alexey Andreev
73edc0cf6e wasm gc: support passing arguments to main method 2024-08-12 20:28:11 +02:00
Alexey Andreev
e61301576b wasm gc: support System.arrayCopy for special cases 2024-08-12 17:55:19 +02:00
Alexey Andreev
6af7250e3b wasm: add support for array.copy instruction 2024-08-03 19:55:16 +02:00
Alexey Andreev
92666e8cf0 wasm gc: trying to fix issues with array covariance 2024-08-02 19:11:11 +02:00
Alexey Andreev
dd2e4bb001 wasm: fix error in ClassMetadataRequirements causing compiler crash 2024-08-02 15:26:36 +02:00
Alexey Andreev
8d276f2efd wasm gc: avoid generation of unnecessary supertype functions 2024-08-02 15:03:29 +02:00
Alexey Andreev
8e483245f5 wasm: fix generation of constructor invocation 2024-08-02 14:36:33 +02:00
Alexey Andreev
7ba0a7fe7d wasm gc: export exception tag from module 2024-08-02 14:31:00 +02:00
Alexey Andreev
e4fa6bd364 wasm gc: reduce number of generated virtual tables, fix non-matching types in case of null literals 2024-08-02 13:50:49 +02:00
Alexey Andreev
9b5e1e7661 wasm gc: fix remaining issues that prevent running trivial example 2024-08-01 20:25:18 +02:00
Alexey Andreev
54dc7fe5f8 wasm gc: fix generation issues, get first version that produces module that passes validation 2024-08-01 19:57:12 +02:00
Alexey Andreev
a8d97ad387 wasm gc: cast receivers on devirtualized calls to actual argument type, avoid this cast when possible 2024-07-31 20:49:45 +02:00
Alexey Andreev
75bead66b3 wasm: support instructions that were recently implemented in generator 2024-07-31 17:31:39 +02:00
Alexey Andreev
5572d4b5d7 wasm gc: add subtyping information to types, fix generation of expressions 2024-07-30 20:57:36 +02:00
Alexey Andreev
a1a776ea9b wasm gc: trying to fix type validation 2024-07-30 17:33:31 +02:00
Alexey Andreev
87aaa0b452 wasm gc: fix issues in generation of types, globals and some expressions 2024-07-29 20:41:58 +02:00
Alexey Andreev
ea29208b6c wasm gc: trying to generate types according to unclear spec 2024-07-28 21:04:18 +02:00
Alexey Andreev
a281c19363 wasm gc: draft Wasm GC backend 2024-07-28 14:31:34 +02:00
Alexey Andreev
9f12917de9 js: remove long emulation 2024-07-25 19:43:29 +02:00
Alexey Andreev
f48c24283c wasm: implement transformation from TeaVM tree IR to Wasm GC 2024-07-24 20:21:22 +02:00
Alexey Andreev
172de8e737 wasm: move common part of wasm expression generator in order to later reuse it with Wasm GC BE 2024-07-22 20:16:16 +02:00
Alexey Andreev
025801d385 Limit depth of method analysis in class initializer analysis in order to avoid too deep stack (and therefore SOE) 2024-07-11 18:18:24 +02:00
Alexey Andreev
7efb3c97a0 wasm gc: draft first parts of Wasm GC backend
* class metadata generator
* string pool generator
2024-07-09 19:42:37 +02:00
Alexey Andreev
efcb22b639 wasm: implement global variables
They aren't used by current Wasm BE yet, but will be used by future Wasm GC BE
2024-07-01 19:37:04 +02:00
Alexey Andreev
3ba2282473 wasm: implement several instructions related to reference types
These instructions will be presumably required for implementation of new Wasm GC BE. There's no tests for these changes, since there is no infrastructure to test anything like this. Instead, this code will be covered by tests for corresponding Wasm BE, when it's finally implemented.
2024-06-30 16:19:00 +02:00
Alexey Andreev
d6474c3aeb wasm: add model definitions for GC spec
- refactor Wasm type representation to include reference types
- refactor function representation for consistency with new type system

First step toward Wasm GC support
2024-06-26 20:41:01 +02:00
Alexey Andreev
5d237a98ae wasm: fix writing debug info when some class was not found 2024-05-15 19:24:33 +02:00
Alexey Andreev
1b412073b9 wasm: support exception handling via native exception handling spec 2024-05-09 20:38:17 +02:00
Alexey Andreev
e48dfb27b0 Improve inlining performance by caching method complexity 2024-04-29 16:32:24 +02:00
Alexey Andreev
188d189407 js: improve performance of instanceof against interfaces 2024-04-26 10:37:12 +02:00
Alexey Andreev
a1d711d069 jso: when casting to JS objects, don't fail cast when cast object is null 2024-04-16 20:03:19 +02:00
Alexey Andreev
931f0f1f4a jso: support varargs in exported classes and modules 2024-04-15 20:53:24 +02:00
Alexey Andreev
6a09f181c7 js: add JSTopLevel annotation that allows to import top-level declarations 2024-04-11 20:29:57 +02:00
Alexey Andreev
a6fb67817c jso: improve support of instanceof and cast against JS wrapper types
Fix #808
2024-04-04 21:18:54 +02:00
Alexey Andreev
e069bc3a44 classlib: implement WeakHashMap
Fix #799
2024-04-03 19:11:48 +02:00
Alexey Andreev
bbd02b0067 gradle: implement dev server task 2024-03-20 20:41:10 +01:00
Alexey Andreev
7341fb38a6 Reduce memory consumption 2024-03-18 18:05:06 +01:00
Alexey Andreev
622006de0e Reduce memory consumption 2024-03-18 17:02:42 +01:00
Alexey Andreev
6e416c11d7 Reduce memory consumption in dependency analyzer 2024-03-18 16:21:12 +01:00
Alexey Andreev
055d5df367 js: fix emitting line number to debug info 2024-03-13 12:36:33 +01:00
Alexey Andreev
582fcf904c jso: implement vararg support for method calls 2024-03-12 18:56:19 +01:00
Alexey Andreev
ccfe19994b js: refactor and simplify AstWriter, properly fix case with variable in catch block 2024-03-06 20:24:35 +01:00
Alexey Andreev
393cd7f807 c: don't generate while(condition) loops due to UB in C spec
See https://www.iso-9899.info/n1570.html#6.8.5p6

Fix #885
2024-02-19 20:35:21 +01:00
Alexey Andreev
c1b3deedff Support @Inherited annotation on annotations
Fix #883
2024-02-19 20:14:00 +01:00
Bernd Busse
d067b986df JS: fix catch variable not getting minified 2024-02-17 21:05:06 +03:00
Alexey Andreev
ab253fd34a Fix class initializer compilation for WASI target 2024-02-17 19:04:37 +01:00
Alexey Andreev
8db406c603 jso: implement exporting Java methods to JS
Fix #785
2024-02-15 21:00:10 +01:00
Alexey Andreev
6ac598b927 js: add limit for top-level declarations
Rationale: turns out that V8 utilizes stack even to represent module-level functions.
This can cause SOE when there's too many classes and methods in source JVM
2024-02-01 09:41:50 +01:00
Alexey Andreev
ca273390ef Remove outdated file 2024-01-30 15:46:20 +01:00
Alexey Andreev
4049bc529e js: introduce setting to choose module type 2023-12-23 16:32:55 +01:00
Alexey Andreev
1c292f3fbe Fix calculating comparison in constant propagation 2023-11-25 17:23:50 +01:00
Alexey Andreev
6695103f49 Increase upper complexity threshold for inlining 2023-11-25 15:58:00 +01:00
Alexey Andreev
ac2c084290 js: add ability so refer to local files in source maps. Add copying of source files to Gradle plugin. 2023-11-24 21:28:37 +01:00
Alexey Andreev
6543e68f8a JS: fix naming of variables in no-obfuscation mode 2023-11-24 17:38:50 +01:00
Alexey Andreev
86efdb0809 JS: remove legacy way to generate names, fix issue with duplication of some top-level names in no-optimization mode
Fix #860
2023-11-23 17:22:03 +01:00
Alexey Andreev
57c22ab2c8 JS: fix some runtime function names not being mangled 2023-11-22 18:49:37 +01:00
Alexey Andreev
3282ae3b59 Refactor mechanism that resolves methods and fields parsed from bytecode and reports errors about missing items 2023-11-20 19:50:20 +01:00
Alexey Andreev
89661e52fb JS: fix output to console in obfuscated mode 2023-11-20 18:57:51 +01:00
Alexey Andreev
e877cc86e4 JS: remove unused runtime function 2023-11-13 10:46:06 +01:00
Alexey Andreev
1955973c3b JS: fix removal of unused functions in handwritten JS 2023-11-13 10:37:30 +01:00
Alexey Andreev
083ecbdad2 wasm/c: add support for class flags 2023-11-08 21:02:31 +01:00
Alexey Andreev
726702dd7f wasm: fix programmatic initialization of a class that is statically initialized by optimizer 2023-11-08 19:59:24 +01:00
Alexey Andreev
f6e38e94f7 c: fix typo in macro name 2023-11-08 09:52:27 +01:00
Alexey Andreev
8f8b33c0b1 js: split runtime into smaller parts 2023-11-07 20:26:10 +01:00
Alexey Andreev
9c6f23d280 classlib: optimize console output in JS backend 2023-11-07 20:00:33 +01:00
Alexey Andreev
0ee994e913 Improve class initializer elimination 2023-11-07 18:46:01 +01:00
Alexey Andreev
eca3dc61f5 junit: fix exception reporting 2023-11-07 18:01:33 +01:00
Alexey Andreev
21137c57a3 JS: merge let statements to get better minification; rewrite some Array methods to generate less dependencies on runtime 2023-11-06 19:18:18 +01:00
Alexey Andreev
717bbf4a57 JS: strip unused functions from hand-written runtime 2023-11-05 22:41:57 +01:00
Alexey Andreev
485d23d675 JS: fix native toString in Java String class
Fix #847
2023-11-05 10:20:49 +01:00
Alexey Andreev
8b6c6a5ca9 Fix checkstyle error 2023-11-05 10:05:45 +01:00
Alexey Andreev
5ec4450bf8 JS: render all declarations into one remembered fragment, then output this fragment to real output 2023-11-05 08:55:24 +01:00
Alexey Andreev
ceffde38f3 JS: use ES6 arrow functions and let where possible 2023-11-02 21:10:35 +01:00
Alexey Andreev
6738d6f1f8 JS: add remembering source writer, refactor PreparedMethod and Renderer to use it, get rid of $rt_globals 2023-11-02 19:03:10 +01:00
Alexey Andreev
8024d84ed5 JS: split SourceWriter into interface and implementation part 2023-10-31 20:58:56 +01:00
Alexey Andreev
23ad999bbd JS: get rid of IOException in SourceWriter and related classes 2023-10-31 20:09:55 +01:00
Alexey Andreev
32ee8943c1 JS: rewrite more natives with templates, get rid of runtime aliases in minification mode 2023-10-31 19:29:32 +01:00
Alexey Andreev
a1cc817504 JS: rewrite more native generators with templates, fix issues in template engine 2023-10-29 20:17:18 +01:00
Alexey Andreev
eb0f4fb090 Improve JS templating so that it could be used in native generators 2023-10-29 17:16:55 +01:00
Alexey Andreev
5d5fb47ca8 JS: add conditional intrinsic to JS template engine, use it to get rid of remaining generated methods in runtime 2023-10-26 21:17:24 +02:00
Alexey Andreev
16cd0aaab2 JS: introduce JS template engine to write runtime, rewrite several functions using this engine 2023-10-24 21:20:27 +02:00
Alexey Andreev
7acc81ce4d JS: remove lazy creation of primitive classes 2023-10-21 20:07:49 +02:00
Alexey Andreev
60d0b07f83 JS: refactor array implementation in native JS 2023-10-21 19:42:55 +02:00
Alexey Andreev
bb0d4a4fc6 JS: remove old polyfill 2023-10-21 19:30:16 +02:00
Alexey Andreev
02b3c92912 JS: use native string to represent internals of java.lang.String 2023-10-21 19:30:16 +02:00
Alexey Andreev
0e2052d91c C: fix compiler warning 2023-10-21 19:28:42 +02:00
Alexey Andreev
8b1732d442 JS: fix issue in minified mode 2023-10-17 19:13:14 +02:00
Alexey Andreev
a78eec93d6 metaprogramming: use unprocessed class source to get program templates
This should prevent class transformations from applying twice, which can cause some errors.
2023-10-17 07:55:01 +02:00
Alexey Andreev
cd9db17d73 JS: improve performance float<->int reinterpretation conversion, improve performance of Double.equals. 2023-10-16 17:27:12 +02:00
Alexey Andreev
5bc398415d classlib: implement Atomic*FieldUpdater classes
Fix #750
2023-10-15 19:51:44 +02:00
Alexey Andreev
70540b2df0 JS: fix UMD wrapper for case when 'exports' exists, but is null 2023-10-11 14:01:24 +02:00
Alexey Andreev
d33c491a33 Gradle: report build progress from build tasks 2023-10-10 19:01:24 +02:00
Alexey Andreev
3d65d38375 Massive refactoring around Wasm support
1. Get rid of old exception handling IR transformer in favor of generation of EH code inside BE
2. Get rid of no-setjmp/longjmp support in C BE
3. Fix various bugs in WebAssembly BE
4. Suppress remaining failing tests for Wasm
5. Enable running Wasm tests by default
2023-10-08 10:36:03 +02:00
Alexey Andreev
2c00df288f wasm: fix ServiceLoader 2023-10-02 14:05:25 +02:00
Alexey Andreev
7806a699c5 wasm: fixing debug C generator 2023-09-30 20:19:22 +02:00
Alexey Andreev
47973face1 Simplify test runner, remove parallel run, remove HtmlUnit runner, fix Wasm tests 2023-09-29 21:11:23 +02:00
Alexey Andreev
d4113a6744 classlib: improve Math min/max implementations in C and Wasm
Follow-up to ihromant's "fix Math min/max functions in JS"
2023-09-28 17:02:18 +02:00
Alexey Andreev
ab507bb22b wasm: fix bugs in coroutine support 2023-09-27 20:28:09 +02:00
Alexey Andreev
219de85e24 Improve performance of PhiUpdater 2023-09-27 19:36:02 +02:00
Alexey Andreev
7fd3166f9b wasm: support Date.toString 2023-09-27 14:30:20 +02:00
Alexey Andreev
348b71685d js: fix object id generator 2023-09-27 13:51:37 +02:00
Alexey Andreev
9c0e3b5e59 Remove unnecessary test file 2023-09-26 23:02:34 +02:00
Alexey Andreev
b7cf7b593c wasm: when building tests, resolve absolute paths to source files in DWARF 2023-09-26 23:02:16 +02:00
Alexey Andreev
e84a1a8531 wasm: fix raw conversion of float and double to int and long 2023-09-25 20:25:49 +02:00
Alexey Andreev
c2c1d78f13 wasm: fix issue in exception handling transformer 2023-09-25 20:25:49 +02:00
Alexey Andreev
fa2e003dd6 classlib: fix crash in WeakReference constructor
It occurred when ReferenceQueue.remove method was never used

Fix #756
2023-09-24 13:47:15 +02:00
Alexey Andreev
390861f835 wasm: fix producing programs with detached basic blocks 2023-09-22 21:26:34 +02:00
Alexey Andreev
98ec4597d6 Fix dominator tree algorithm 2023-09-22 21:26:34 +02:00
Alexey Andreev
1cd635afa5 Fix node splitting in irreducible CFG 2023-09-22 07:51:49 +02:00
Ivan Hetman
8277671376
classlib: make difference between raw and normal floating points to int conversion 2023-09-20 23:51:55 +03:00
Alexey Andreev
edf2d33f84 js: optimize long operations 2023-09-20 19:28:01 +02:00
Alexey Andreev
2e7e11292b C: implement Long.compareUnsigned 2023-09-19 11:34:50 +02:00
Alexey Andreev
e2ee9f1dbb classlib: improve precision of float/double parsing and formatting 2023-09-13 19:40:00 +02:00
Alexey Andreev
401fcabeae wasm: support ServiceLoader 2023-08-28 19:32:22 +02:00
Alexey Andreev
70d0658b47 wasm/c: fix bugs in coroutine transformation 2023-08-28 17:16:31 +02:00
Alexey Andreev
40c4f03e3b Coroutine transformation: minor improvements 2023-08-28 14:10:34 +02:00
Alexey Andreev
bd2d2cb49b wasm: fix exceptions in DWARF generator 2023-08-28 13:18:26 +02:00
Alexey Andreev
36060b37e3 wasm: another attempt to make class reference visible in chrome dev tools 2023-08-27 00:26:03 +02:00
Alexey Andreev
cacf09dca8 wasm: generate field description in DWARF 2023-08-26 20:48:29 +02:00
Alexey Andreev
fed6a2d0ef wasm: change language in DWARF from Java to C++
This is due to weird issue in lldb (from which Chrome dev tools
are derived), which does not parse DWARF functions if there's
no support for language "type system"
2023-08-25 20:43:34 +02:00
Alexey Andreev
e576a985dd wasm: don't generate separate declarations for methods in DWARF 2023-08-24 06:45:41 +02:00
Alexey Andreev
49485efdff wasm: fix line section in DWARF 2023-08-23 21:10:42 +02:00
Alexey Andreev
e3bbf12f49 wasm: use bulk memory operations when necessary 2023-08-22 17:13:06 +02:00
Alexey Andreev
e291128948 wasm: support Long.compareUnsigned 2023-08-22 17:11:26 +02:00
Alexey Andreev
f6131a8248 wasm: fix Array.get with enabled inlining 2023-08-22 17:11:04 +02:00
Alexey Andreev
9ecb3ad817 classlib: support ReferenceQueue.remove 2023-08-21 20:13:06 +02:00
Alexey Andreev
e9d206eed0 wasm: fix NPE 2023-08-19 17:10:53 +02:00
Alexey Andreev
0e7d6b65b4 wasm: add stats generator 2023-08-19 16:59:49 +02:00
Alexey Andreev
a7f115a541 classlib: implement Integer.compareUnsigned in Wasm and C 2023-08-18 17:55:01 +02:00
Alexey Andreev
22864c88f2 js: support WeakReference 2023-08-10 20:47:01 +02:00
Alexey Andreev
b9f5e9be1c JS: optimize case when JS method returns java.lang.Object and then treated as JS object 2023-08-04 20:40:57 +02:00