Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Probably bugs #992

Open
scf37 opened this issue Jan 7, 2025 · 5 comments
Open

Probably bugs #992

scf37 opened this issue Jan 7, 2025 · 5 comments

Comments

@scf37
Copy link
Contributor

scf37 commented Jan 7, 2025

numeric.js
return new Long($rt_numberConversionView.getInt32(0, true), $rt_numberConversionView.getInt32(4, true));
There is no identifier 'Long'

ClassReaderSourceHelper.java resolveMethodImplementation

        if (method != null && !method.hasModifier(ElementModifier.ABSTRACT)) {
            return method;
        }

In addition to 'ordinary' abstract methods, there are methods that were made abstract by dead code elimination. In this case, searching for overridden method in superclass might find non-abstract candidate. Specific problem is teavm_javaConstructorExists("java.lang.ClassCastException", "()V") returning true even if this constructor is not used and not even emitted. My solution (might be incorrect, not sure how to do better):

        MethodReader method = cls.getMethod(methodDescriptor);
        if (method != null && !method.hasModifier(ElementModifier.ABSTRACT)) {
            return method;
        }
        // constructors can not be overridden
        if (method != null && method.getName().equals("<init>")) {
            return null;
        }
@konsoletyper
Copy link
Owner

There is no identifier 'Long'

Sure. I forgot to remove this branch when I was getting rid of long emulation. Now in all modern browser typeof BigInt !== 'function' should return false, so we never get into this branch and never get runtime error. Though I can imagine that some JS processing tool may report warning here.

Can you please create a PR so that I could mention you in release notes to next release?

In addition to 'ordinary' abstract methods, there are methods that were made abstract by dead code elimination

Yes, you are right. But the even more major issue here is that DCE does not remove methods, but rather makes them abstract. Previously it was actually removing all unused methods, but then I changed this due to some bugs. Perhaps, I'll revisit this and try to find other fixes for these issues, because current approach seems confusing and error prone.

However, I'm not sure about your solution, I need to review it better, when I have free time.

@konsoletyper
Copy link
Owner

now in all modern browser typeof BigInt !== 'function' should return false

Moreover, next condition, typeof BigInt64Array !== 'function', was introduced to support Safari. But since 2021-09-20, Safari supports BigInt64Array, so we can rely on its presence in all browsers.

@scf37
Copy link
Contributor Author

scf37 commented Jan 8, 2025

Are you OK to drop support for older browsers? Some people I know still use older iphones which are not updated anymore.

@konsoletyper
Copy link
Owner

Looks like the latest device that does not support at least Safari 13, is iPhone 6, which was released more that 10 years ago. I hardly imagine that any major web app (like youtube) supports such ancient iPhone.

@scf37
Copy link
Contributor Author

scf37 commented Jan 8, 2025

#993

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants