Giter Site home page Giter Site logo

Comments (6)

joshuawarner32 avatar joshuawarner32 commented on May 19, 2024

Turns out this is because of a recent change in the jdk7 dev branch:

changeset: 5501:bcba89ce0a8c
user: sla
date: Tue Nov 27 09:23:54 2012 +0100
summary: 8003322: Add instrumentation points for tracing of I/O calls

The change replaced the read()| native method with a read0()|, and implemented read()I to defer to read0()I, with some instrumentation.

The fix to make avian compatible is simple:

diff --git a/src/classpath-openjdk.cpp b/src/classpath-openjdk.cpp
index 0cf5e3b..b8173d3 100644
--- a/src/classpath-openjdk.cpp
+++ b/src/classpath-openjdk.cpp
@@ -2002,7 +2002,7 @@ interceptFileOperations(Thread* t, bool updateRuntimeData)
         intercept(t, fileInputStreamClass, "open", "(Ljava/lang/String;)V",
                   voidPointer(openFile), updateRuntimeData);

-        intercept(t, fileInputStreamClass, "read", "()I",
+        intercept(t, fileInputStreamClass, "read0", "()I",
                   voidPointer(readByteFromFile), updateRuntimeData);

         intercept(t, fileInputStreamClass, "readBytes", "([BII)I",

The trick will be making avian compatible with both the old version and the new version of openjdk.

from avian.

joshuawarner32 avatar joshuawarner32 commented on May 19, 2024

@dicej, any thoughts on how we can fix this, while (hopefully) maintaining compatibility with both versions?

from avian.

dicej avatar dicej commented on May 19, 2024

On Fri, 6 Dec 2013, Joshua Warner wrote:

@dicej, any thoughts on how we can fix this, while (hopefully) maintaining
compatibility with both versions?

The intercept function will just do nothing if it can't find the method,
so we should be able to just have two calls to intercept: one for read and
another for read0.

from avian.

joshuawarner32 avatar joshuawarner32 commented on May 19, 2024

The read()I method will always be present - the difference is whether it's a native method (old) or a Java method that delegates to read0()I.

The current implementation of intercept won't work because it doesn't pay any attention to the ACC_NATIVE flag; in fact, it unconditionally sets it.

from avian.

dicej avatar dicej commented on May 19, 2024

On Fri, 6 Dec 2013, Joshua Warner wrote:

The read()I method will always be present - the difference is whether it's a
native method (old) or a Java method that delegates to read0()I.

The current implementation of intercept won't work because it doesn't pay
any attention to the ACC_NATIVE flag; in fact, it unconditionally sets it.

Then call findMethodOrNull before calling intercept to see if it's native
or not.

from avian.

joshuawarner32 avatar joshuawarner32 commented on May 19, 2024

That would make too much sense. (mild face palm)

Expect a pull request coming your way soon...

from avian.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.