Math.mutiplyHigh() is signed

2020-06-23 Thread David Lloyd
In retrospect I don't know why I expected Math.multiplyHigh() to return the high word of the unsigned product of two 64-bit numbers, given that long is signed; in my defence however, the docs don't actually seem to specify. WDYT about a patch like this to clarify? diff --git a/src/java.base/share

Possible subtle memory model error in ClassValue

2020-08-07 Thread David Lloyd
I'm helping a colleague debug a weird problem that occurs in ClassValue on jdk11u (and presumably on upstream as well, though it's presently impossible to verify). As a disclaimer, the problem manifests itself when building native images via GraalVM so it's possible that something is simply broken

Re: PING: RFR(s): (new approach) 8223777: In posix_spawn mode, failing to exec() jspawnhelper does not result in an error

2019-06-04 Thread David Lloyd
In this case, going from what the execve(2) Linux man page says (and Mac seems to agree), if the script were executable it would have a '#!' interpreter string and the kernel would execute it anyway, would it not? What case would be solved by explicitly starting a shell? On Tue, Jun 4, 2019 at 2:1

Re: PING: RFR(s): (new approach) 8223777: In posix_spawn mode, failing to exec() jspawnhelper does not result in an error

2019-06-05 Thread David Lloyd
er to deal with this - look at how long simple fixes are in >> review, we are all busy elsewhere - chances of changing this are small. >> >> Cheers, Thomas >> >> >> On Tue, Jun 4, 2019 at 10:14 PM David Lloyd >> wrote: >> >>> In this case,

Re: PING: RFR(s): (new approach) 8223777: In posix_spawn mode, failing to exec() jspawnhelper does not result in an error

2019-06-05 Thread David Lloyd
https://www.unix.com/man-page/redhat/2/execve/ is from 1997. On Wed, Jun 5, 2019 at 9:50 AM David Lloyd wrote: > If we're talking just Linux though, has this *ever* been an issue? You've > been able to call execve on a shell script since at least 2002 as far as I > can tell

Re: RFR [14] JDK-8225763 Inflater and Deflater should implement AutoCloseable

2019-07-09 Thread David Lloyd
On Tue, Jul 9, 2019 at 8:19 AM Jaikiran Pai wrote: > - In addition, I have sneaked in an unrelated change in this patch, into > the Deflater.end() method: > > public void end() { > synchronized (zsRef) { > +// check if already closed > +if (zsRef.address() ==

Re: RandomAccess Interface and List Heirarchy

2019-09-30 Thread David Lloyd
On Sat, Sep 28, 2019 at 3:39 AM Peter Levart wrote: > > On 9/25/19 12:15 PM, Remi Forax wrote: > > that said, i believe we should deprecate LinkedList (and any other List > > implementation that doesn't implement RandomAccess) because there are too > > much code out there that suppose that list.

Re: Class-Path (in jar file) semantics different between Java 11 and 13 (on Windows)?

2019-11-19 Thread David Lloyd
On Mon, Nov 18, 2019 at 9:37 AM Alan Bateman wrote: > > On 18/11/2019 15:01, Jaikiran Pai wrote: > > : > > > > So this Class-Path entry is being ignored starting Java 13. > > > Yes, bad values are now ignored, bringing an end to an effort on the > run-time over multiple releases to fix the problem

Re: Class-Path (in jar file) semantics different between Java 11 and 13 (on Windows)?

2019-11-19 Thread David Lloyd
On Mon, Nov 18, 2019 at 9:37 AM Alan Bateman wrote: > > On 18/11/2019 15:01, Jaikiran Pai wrote: > > : > > > > So this Class-Path entry is being ignored starting Java 13. > > > Yes, bad values are now ignored, bringing an end to an effort on the > run-time over multiple releases to fix the problem

Re: Class-Path (in jar file) semantics different between Java 11 and 13 (on Windows)?

2019-11-20 Thread David Lloyd
On Wed, Nov 20, 2019 at 2:25 AM Alan Bateman wrote: > > On 19/11/2019 23:25, David Lloyd wrote: > > : > > OK, having read the updated specification (thanks Alan!) I'm now quite > > curious why `/C:/helloworld.jar` is considered invalid. It is in fact > > a val

Re: Class-Path (in jar file) semantics different between Java 11 and 13 (on Windows)?

2019-11-20 Thread David Lloyd
On Wed, Nov 20, 2019 at 9:26 AM Scott Palmer wrote: > > /C:/blah... is “root relative”. The (old) spec says the URL must be "relative > to the code base". What does "code base" mean when not referring to Applets > or RMI? "code base" is generally the URL of the class path entry itself. It's m

Re: Class-Path (in jar file) semantics different between Java 11 and 13 (on Windows)?

2019-11-20 Thread David Lloyd
On Wed, Nov 20, 2019 at 8:59 AM Alan Bateman wrote: > > On 20/11/2019 13:50, David Lloyd wrote: > > : > > OK, but this decision violates both the old and updated spec (and > > makes it difficult to write code that works in both cases: in > > situations that rejec

Re: New candidate JEP: 370: Foreign-Memory Access API

2019-11-25 Thread David Lloyd
On Mon, Nov 25, 2019 at 11:28 AM wrote: > > https://openjdk.java.net/jeps/370 Looks pretty interesting! Why make the API user deal with VarHandles though, as opposed to (say) putting accessor methods directly onto MemoryAddress? -- - DML

Re: New candidate JEP: 370: Foreign-Memory Access API

2019-11-27 Thread David Lloyd
On Mon, Nov 25, 2019 at 11:28 AM wrote: > > https://openjdk.java.net/jeps/370 One more question! Well, two I guess. First, in the interim before Panama or something like it comes to the main project, will it be possible to pass MemoryAddress kinds of things to JNI methods (to replace the curren

Re: New candidate JEP: 370: Foreign-Memory Access API

2019-11-29 Thread David Lloyd
On Thu, Nov 28, 2019 at 11:24 AM Vladimir Ivanov wrote: > > > >> Second, what about an API to allocate memory from the stack? This is > >> really useful in GraalVM (granted they have a sort-of-Panama-ish way > >> of calling C functions already, and they're really quite "loose" when > >> it comes

Re: New candidate JEP: 370: Foreign-Memory Access API

2019-12-01 Thread David Lloyd
On Fri, Nov 29, 2019 at 5:34 PM John Rose wrote: > > On Nov 29, 2019, at 4:24 AM, David Lloyd wrote: > > > Makes sense, it's still early. But now the seed is planted. :) > > > (It’s better documented. Most of the points made here were not new.) Okay, anyway I&

Re: New candidate JEP: 371: Hidden Classes

2020-01-27 Thread David Lloyd
On Fri, Jan 24, 2020 at 4:56 PM David Holmes wrote: > > FYI. I'm a bit curious about this: > To invoke private nestmate instance methods from code in the hidden class, > use invokevirtual or invokeinterface instead of invokespecial. Generated > bytecode that uses invokespecial to invoke a priv

Re: New candidate JEP: 371: Hidden Classes

2020-01-27 Thread David Lloyd
On Mon, Jan 27, 2020 at 12:30 PM Mandy Chung wrote: > > > > On 1/27/20 6:31 AM, Remi Forax wrote: > > I'm a bit curious about this: > > To invoke private nestmate instance methods from code in the hidden class, use > invokevirtual or invokeinterface instead of invokespecial. Generated bytecode > t

Re: JEP draft: Scope Locals

2021-05-19 Thread David Lloyd
On Wed, May 19, 2021 at 4:01 AM Andrew Haley wrote: > On 5/15/21 6:50 PM, Peter Levart wrote: > > What if I wanted to create and start a thread that would be "pristine" - > > not have any ScopeLocal value bound? Is this intentionally not allowed > > in order to make sure that inheritable ScopeLoc

Re: JEP draft: Scope Locals

2021-05-19 Thread David Lloyd
On Wed, May 12, 2021 at 9:43 AM Andrew Haley wrote: > There's been considerable discussion about scope locals on the loom-dev > list, > and it's now time to open this to a wider audience. This subject is > important > because. although scope locals were motivated by the the needs of Loom, > they

Re: JEP 411: Deprecation with removal would break most existing Java libraries

2021-06-14 Thread David Lloyd
On Mon, Jun 14, 2021 at 2:38 AM Peter Firmstone wrote: > 1. Develop authorization layer security provider services in OpenJDK, > back port it to Java 8 and Java 11 (these provide most of the > utilised functionality of SecurityManager, allowing developers to > only implement those whi

Re: JEP 411: Deprecation with removal would break most existing Java libraries

2021-06-16 Thread David Lloyd
On Mon, Jun 14, 2021 at 6:47 PM Peter Firmstone wrote: > SecurityManager depends on Permission, currently there are Permission > checks throughout the JVM, however Permission implementation classes > will be removed, although the Permission class itself won't be. This is incorrect AFAICT. The re

Re: RFR: 8269383: New java.nio.ByteOrder.isBigEndian and isLittleEndian methods

2021-06-25 Thread David Lloyd
Is this better than the current solution of `nativeOrder() == BIG_ENDIAN` other than reducing a few keystrokes? On Fri, Jun 25, 2021 at 8:45 AM Yi Yang wrote: > > Hi, can I have a review of this change that adds two new utility methods for > java.nio.ByteOrder? Looking through the whole JDK code

Re: System.exit deadlock if called within a hook

2022-04-25 Thread David Lloyd
On Mon, Apr 25, 2022 at 8:09 AM wrote: > because it would still run finally blocks, which cannot happen for no return > methods like System.exit and Runtime.halt FWIW I don't think this is correct. `exit` and `halt` etc. cannot *return* but they're definitely allowed to throw an exception (`Secu

Re: System.exit deadlock if called within a hook

2022-04-25 Thread David Lloyd
On Mon, Apr 25, 2022 at 9:25 AM wrote: > > Ok, you're right that it can raise an exception when the calling thread does > not have the security privileges needed. But what if it had them ? Right now > the deadlock comes from the fact is doesn't got back to the caller with an > exception and doe

Re: RFR 8150840: Add an internal system property to control the default level of System.Logger when java.logging is not present.

2016-03-04 Thread David Lloyd
Can they be method refs, or is this one of those cases where it could be early boot where none of that stuff works yet? -- - DML > On Mar 4, 2016, at 10:19 AM, Roger Riggs wrote: > > Hi Daniel, > > Good idea. > > SimpleConsolerLogger.java: > Some of the property accesses could use the existing

Re: Fwd: Re: RFR (12): 8191053: Provide a mechanism to make system's security manager immutable

2018-10-04 Thread David Lloyd
On Wed, Oct 3, 2018 at 7:53 PM Sergey Bylokhov wrote: > Hi, Sean. > One question related to SecurityManager and performance, is it possible > to provide a special version of AccessController.doPrivileged which will > be noop if SecurityManager is not present? TBH that method (at least, the no-arg

6850720: Allow POSIX_SPAWN to be used for ProcessImpl on Linux

2018-10-18 Thread David Lloyd
The issue 6850720 isn't _exactly_ to use POSIX_SPAWN for process launching on Linux, but it's the closest I could find out of what are really a surprisingly large number of issues that refer to posix_spawn in one way or another relating to ProcessImpl. There's a different issue to move from vfork

Re: 6850720: Allow POSIX_SPAWN to be used for ProcessImpl on Linux

2018-10-19 Thread David Lloyd
On Fri, Oct 19, 2018 at 1:56 AM Thomas Stüfe wrote: > > Hi David, > > (for convenience, here the old thread: > http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-September/055333.html) > > I would rather not expose a third way to spawn to the end user. As a > test switch for developers, thi

Re: 6850720: Allow POSIX_SPAWN to be used for ProcessImpl on Linux

2018-10-22 Thread David Lloyd
On Sun, Oct 21, 2018 at 7:25 PM Martin Buchholz wrote: > As author of the vfork strategy ... I'm supportive of the directions in this > thread. Great. > vfork is even (!) less in favor than it used to be, so migrating off of it > seems good. Just make sure we don't bring back the OOM problem

Re: 6850720: Allow POSIX_SPAWN to be used for ProcessImpl on Linux

2018-10-22 Thread David Lloyd
On Mon, Oct 22, 2018 at 1:23 PM Thomas Stüfe wrote: > Hi all, [...] > So far I have not read a single technical reason in this thread why > vfork needs to be abandoned now Note that my patch does not abandon vfork. It does not even change the default exec strategy away from vfork, nor does it ca

Re: 6850720: Allow POSIX_SPAWN to be used for ProcessImpl on Linux

2018-10-23 Thread David Lloyd
I've submitted a bug report via bugreport.java.com. If/when it gets promoted to a proper JIRA with an issue number, I'll see if I can put the patch up on jdk/submit. On Thu, Oct 18, 2018 at 4:42 PM David Lloyd wrote: > > The issue 6850720 isn't _exactly_ to use PO

Re: 6850720: Allow POSIX_SPAWN to be used for ProcessImpl on Linux

2018-10-23 Thread David Lloyd
bug report on JBS for you. Should I? > > (Now I understand the "reuse bug id"). > > > On Tue, Oct 23, 2018 at 3:18 PM David Lloyd wrote: > > > > I've submitted a bug report via bugreport.java.com. If/when it gets > > promoted to a proper JIRA with an

RFR: JDK-8212828 Allow POSIX_SPAWN to be used for ProcessImpl on Linux

2018-10-23 Thread David Lloyd
; > Here you go: > > https://bugs.openjdk.java.net/browse/JDK-8212828 > > If noone else steps in, I can sponsor the change for you. > > Cheers, Thomas > On Tue, Oct 23, 2018 at 4:19 PM David Lloyd wrote: > > > > Sure. I don't have any tracking information on

Re: RFR: JDK-8212828 Allow POSIX_SPAWN to be used for ProcessImpl on Linux

2018-10-23 Thread David Lloyd
David, et.al. > > What would be the rest of the plan for testing? > Usually, changes come with tests and a plan. > What build parameters are needed to run a full set of tests with the change? > > Are there build changes needed? > > Thanks, Roger > > > On 10/23/

Re: RFR: JDK-8212828 Allow POSIX_SPAWN to be used for ProcessImpl on Linux

2018-10-24 Thread David Lloyd
On Wed, Oct 24, 2018 at 1:05 AM Thomas Stüfe wrote: > Review: > > - copyright dates need updating on the C-sources > > - I opt for "#if defined(__solaris__) || defined(_ALLBSD_SOURCE) || > defined(_AIX) || defined(__linux__)" to be removed completely from > unix-specific source files. The ifdef no

Re: RFR: JDK-8212828 Allow POSIX_SPAWN to be used for ProcessImpl on Linux

2018-10-24 Thread David Lloyd
On Wed, Oct 24, 2018 at 8:52 AM Thomas Stüfe wrote: > > Hi David, > > I think we need some form of test, as Alan indicated. > > java/lang/ProcessBuilder/Basic.java should run through. Actually, I > would like it if we would run this test for all valid enabled launch > mechanisms, regardless which

Re: RFR: JDK-8212828 Allow POSIX_SPAWN to be used for ProcessImpl on Linux

2018-10-25 Thread David Lloyd
;> About the test: I added a new line: > >> > >>* @run main/othervm/timeout=300 Basic > >>* @run main/othervm/timeout=300 -Djdk.lang.Process.launchMechanism=fork > >> Basic > >> + * @run main/othervm/timeout=300 > >> -Djdk.lang.Process.launchMechanism=posi

Re: Downport JDK-8212828 (posix_spawn on Linux as non-default) to 11u

2018-11-28 Thread David Lloyd
I'm in favor FWIW. On Wed, Nov 28, 2018 at 9:36 AM Thomas Stüfe wrote: > > Hi all, > > I would like to have this patch in 11u too, so I just did a 11u > downport request. > > Our agreement was that launchMechanism=POSIX_SPAWN would stay as > optional non-default value for jdk12, and at the start o

Re: [11u]: RFR CSR backport: JDK-8220362: Add "POSIX_SPAWN" as valid value to jdk.lang.Process.launchMechanism on Linux

2019-03-11 Thread David Lloyd
Is vfork still guaranteed to be functional by the end of the Java 11 support frame, from the perspective of any organization which supports JDKs of this version? On Fri, Mar 8, 2019 at 9:22 AM Andrew Haley wrote: > > On 3/8/19 2:39 PM, Langer, Christoph wrote: > > please review the CSR backport

Re: Process.exec with the linux posix_spawn mode has a bug

2019-05-11 Thread David Lloyd
On Sat, May 11, 2019 at 9:49 AM Remi Forax wrote: > > I've seen a weird error on my CI [1] since the 15th of February when using > the jdk 13, > i was not able to run jshell* using the programmatic API (java tool) anymore. > > Yesterday, i took the time to track that issue and i believe i've foun

Re: RFR(s): 8223777: In posix_spawn mode, failing to exec() jspawnhelper does not result in an error

2019-05-13 Thread David Lloyd
On Mon, May 13, 2019 at 11:01 AM Thomas Stüfe wrote: > > Hi all, > > may I have please your opinions about the following change: > > Bug: https://bugs.openjdk.java.net/browse/JDK-8223777 > webrev: > http://cr.openjdk.java.net/~stuefe/webrevs/8223777-posix_spawn-no-exec-error/webrev.00/webrev/ > [.

Re: RFR(s): 8223777: In posix_spawn mode, failing to exec() jspawnhelper does not result in an error

2019-05-14 Thread David Lloyd
Pipe communication isn't very costly AFAIK. The added complexity would be waiting for either a thing to appear on the pipe indicating success or else a waitpid/waitid+WNOHANG for exit code 127. But writing a thing to the pipe won't help determine if the subsequent exec succeeded, which is really

Re: RFR(s): 8223777: In posix_spawn mode, failing to exec() jspawnhelper does not result in an error

2019-05-14 Thread David Lloyd
Ah I see. I like the idea, it would mean pretty comprehensive error reporting and should work across platforms too I think. On Tue, May 14, 2019 at 7:16 AM Florian Weimer wrote: > > * David Lloyd: > > > Pipe communication isn't very costly AFAIK. The added complexity >

Re: RFR(s): (new approach) 8223777: In posix_spawn mode, failing to exec() jspawnhelper does not result in an error

2019-05-22 Thread David Lloyd
I'm in favor of what the change is meant to accomplish. I haven't had time to analyze the change in detail, and I may not get time to do so. But I'm not a reviewer in any case, so maybe that doesn't matter too much. On Wed, May 22, 2019 at 1:16 AM Thomas Stüfe wrote: > > Ping... > > Guys, I need

Re: RFR(s): 8060192: Add default method Collection.toArray(generator)

2017-12-07 Thread David Lloyd
Yes! It would be even better for the "toArray(Class)" case if Class had a "getArrayClass()" method which returned the Class, which would allow: return (T[]) Arrays.copyOf(elementData, size, componentType.getArrayClass()); and similar for other array-backed collections. I never understood why

Possible bug in StackFrameInfo#getByteCodeIndex?

2017-12-07 Thread David Lloyd
I was doing some research related to AccessController, and I noted this code [1] in StackFrameInfo#getByteCodeIndex(): @Override public int getByteCodeIndex() { // bci not available for native methods if (isNativeMethod()) return -1; return bci; } Now bci is of type short, an

Re: RFR 4358774: Add null InputStream and OutputStream

2017-12-08 Thread David Lloyd
On Fri, Dec 8, 2017 at 12:38 PM, Brian Burkhalter wrote: > Patrick’s comment made us think again about the naming here as “nullStream()” > would not fit for eventual equivalent methods on Reader and Writer. It might > be better to go with something like > > InputStream InputStream.nullSource();

Re: RFR 4358774: Add null InputStream and OutputStream

2017-12-08 Thread David Lloyd
On Fri, Dec 8, 2017 at 1:03 PM, Brian Burkhalter wrote: > On Dec 8, 2017, at 10:52 AM, David Lloyd wrote: > >> On Fri, Dec 8, 2017 at 12:38 PM, Brian Burkhalter >> wrote: >>> Patrick’s comment made us think again about the naming here as >>> “nullStream()” w

Re: Possible bug in StackFrameInfo#getByteCodeIndex?

2017-12-12 Thread David Lloyd
kFrameInfo.java > @@ -93,7 +93,7 @@ > if (isNativeMethod()) > return -1; > > -return bci; > +return bci & 0x; > } > > Mandy > > On 12/7/17 8:19 PM, David Lloyd wrote: > > I was doing some research related to Acces

Re: Possible bug in StackFrameInfo#getByteCodeIndex?

2017-12-12 Thread David Lloyd
On Mon, Dec 11, 2017 at 9:03 PM, mandy chung wrote: > On 12/11/17 6:31 PM, Martin Buchholz wrote: >> Java has an unsigned 16 bit type. Could bci be of type "char" ? > > Yes but I think keeping it short is fine. Call me strange if you like, but I never liked using char as anything other than a UT

Re: RFR(s): 8060192: Add default method Collection.toArray(generator)

2017-12-12 Thread David Lloyd
On Mon, Dec 11, 2017 at 8:00 PM, John Rose wrote: > I submit to you that such a factory is *not* an IntFunction, because > that only creates half of an array (or 0.01% of one), the empty > version that needs to be populated. A natural array factory API > [...] > The interface would look something

Re: [11] RFR 8193085 Vectorize the nio Buffer equals and compareTo implementations

2017-12-15 Thread David Lloyd
I'm not a reviewer, but I was curious about this change; unfortunately the diff seems to be dominated by case and formatting changes making the actual functional aspect change hard to divine. Within the JBoss unit we have an informal policy that formatting changes should be presented separately so

Re: Adding SocketChannel toString to connection exception messages

2017-12-22 Thread David Lloyd
On Thu, Dec 21, 2017 at 6:35 PM, David Holmes wrote: > I believe there are concerns with too much information that can be > considered "sensitive" (like host names and IP addresses) appearing in error > messages due to them ending up in log files and bug reports. I tend to agree here. However -

Re: Adding SocketChannel toString to connection exception messages

2018-01-03 Thread David Lloyd
On Fri, Dec 29, 2017 at 11:15 AM, Chris Hegarty wrote: > On 29 Dec 2017, at 00:33, Steven Schlansker > wrote: >> Thanks for the discussion! >> >> So, it sounds like amending the message by default is going to be a >> non-starter -- but at least adding the information otherwise might be >> poss

Re: RFR: JDK-8021560,(str) String constructors that take ByteBuffer

2018-02-13 Thread David Lloyd
On Tue, Feb 13, 2018 at 2:41 AM, Alan Bateman wrote: > On 13/02/2018 06:24, Xueming Shen wrote: >> >> Hi, >> >> Please help review the proposal to add following constructors and methods >> in String >> class to take ByteBuffer as the input and output data buffer. >> >> public String(ByteBuffer byt

[JDK-6341887] Patch: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-02-16 Thread David Lloyd
It would be convenient to be able to inflate/deflate a direct or heap byte buffer without having to copy it through an array first. For my Friday mini-project this week, I've decided to take a crack at this. The attached patch is the result. Would anyone be interested in reviewing and maybe spons

Re: [JDK-6341887] Patch: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-02-16 Thread David Lloyd
Also available in more readable form at: https://github.com/dmlloyd/openjdk/commit/becd36e852e55a29a4685577453944552c817b66 On Fri, Feb 16, 2018 at 4:13 PM, David Lloyd wrote: > It would be convenient to be able to inflate/deflate a direct or heap > byte buffer without having to c

Re: [JDK-6341887] Patch: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-02-19 Thread David Lloyd
On Sat, Feb 17, 2018 at 3:18 PM, Xueming Shen wrote: > Hi David, > > Thanks for taking this one :-) some comments here. Thanks for the review! > (1) I would assume you might have to do more for ByteBuffer, something like > [...] > btw, any reason go unsafe to get the byte[]? instead of > Byt

Re: [JDK-6341887] Patch: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-02-19 Thread David Lloyd
On Sun, Feb 18, 2018 at 3:33 AM, Alan Bateman wrote: > Thanks for bringing this one up again Thanks for taking the time to review. > I see Sherman is looking at implementation so I'll stick with the javadoc > for now. At some point it will need a security review to ensure that there > no possibi

Re: Draft JEP: To use UTF-8 as the default charset for the Java virtual machine.

2018-02-21 Thread David Lloyd
I agree with Uwe and Remi; if the default is still changeable, the problem doesn't go away, it simply becomes slightly more insidious. On Wed, Feb 21, 2018 at 12:31 AM, Xueming Shen wrote: > This draft JEP contains a proposal to use UTF-8 as the default charset for > the JVM, so that > APIs that

[JDK-6341887] Patch V2: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-02-22 Thread David Lloyd
This is the second version of the patch first discussed here [1] to add the ability to inflate/deflate to/from heap/direct byte buffers. The patch is attached, as well as benchmark results with the original and new code, and the benchmark source. The patch is also visible online at [2]. Some not

[JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-03-02 Thread David Lloyd
The third... and hopefully final... version of this patch is attached. It is the same as V2, however it also uses Reference.reachabilityFence() defensively on buffers. This may be necessary because there are code paths which may allow such buffers to be GCed after their address is acquired but bef

Re: [JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-03-02 Thread David Lloyd
On Fri, Mar 2, 2018 at 12:49 PM, Xueming Shen wrote: > Hi David, > > (1) Deflater.deflate(Bytebuffer) > the api doc regarding "no_flush" appears to be the copy/paste of the > byte[] version > without being updated to the corresponding ByteBuffer? You're right, I missed that one. I've i

Re: [JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-03-02 Thread David Lloyd
On Fri, Mar 2, 2018 at 2:34 PM, David Lloyd wrote: > On Fri, Mar 2, 2018 at 12:49 PM, Xueming Shen wrote: >> Hi David, >> >> (1) Deflater.deflate(Bytebuffer) >> the api doc regarding "no_flush" appears to be the copy/paste of the >> byte[] v

Re: [JDK-6341887] RFR: Patch V4: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-03-09 Thread David Lloyd
The fourth version of this patch is attached. There is one functional change; the rest are documentation changes. The functional change is that Inflater now updates both the input and output buffer position, as well as the produced/consumed byte count and remaining count, in the event of a DataFo

Re: [JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-03-13 Thread David Lloyd
18 at 2:36 PM, David Lloyd wrote: > On Fri, Mar 2, 2018 at 2:34 PM, David Lloyd wrote: >> On Fri, Mar 2, 2018 at 12:49 PM, Xueming Shen >> wrote: >>> Hi David, >>> >>> (1) Deflater.deflate(Bytebuffer) >>> the api doc regarding "no_

[PATCH] 8188240: Reflection Proxy should skip static methods

2018-03-13 Thread David Lloyd
I worked up a little patch for 8188240. I was able to co-opt an existing test which now fails before the patch and passes after. It's a tiny patch so I'm including it inline. I've CC'd Mandy because she filed the original bug. Here's the patch (use patch -p1 to apply): cut --- 8<

Re: [PATCH] 8188240: Reflection Proxy should skip static methods

2018-03-13 Thread David Lloyd
On Tue, Mar 13, 2018 at 6:31 PM, mandy chung wrote: > I prefer to keep the original test case i.e. create a proxy class from > Runnable and Observer. Instead add a new test case to create a proxy class > with ClashWithRunnable, Runnable and Observer and verify that it does not > include static m

Re: [PATCH] 8188240: Reflection Proxy should skip static methods

2018-03-13 Thread David Lloyd
On Tue, Mar 13, 2018 at 7:16 PM, David Lloyd wrote: > On Tue, Mar 13, 2018 at 6:31 PM, mandy chung wrote: >> I prefer to keep the original test case i.e. create a proxy class from >> Runnable and Observer. Instead add a new test case to create a proxy class >> with ClashW

Re: RFR of 8180451: ByteArrayInputStream should override readAllBytes, readNBytes, and transferTo

2018-03-14 Thread David Lloyd
In: @@ -196,14 +194,32 @@ return len; } +public synchronized byte[] readAllBytes() { +byte[] result = Arrays.copyOfRange(buf, pos, count); +pos = count; +return result; +} + +public synchronized int readNBytes(byte[] b, int off, int len) { +

Re: [PATCH] 8188240: Reflection Proxy should skip static methods

2018-03-14 Thread David Lloyd
On Wed, Mar 14, 2018 at 1:00 PM, mandy chung wrote: > Thanks for adding the new test. Looks okay and some minor comment. > > +try { >: > +} catch (Throwable e) { > +System.err.println("\nTEST FAILED:"); > +e.printStackTrace(); > +throw new

Re: [PATCH] 8188240: Reflection Proxy should skip static methods

2018-03-14 Thread David Lloyd
On Wed, Mar 14, 2018 at 4:31 PM, Aleksey Shipilev wrote: > On 03/14/2018 07:09 PM, David Lloyd wrote: >> On Wed, Mar 14, 2018 at 1:00 PM, mandy chung wrote: >>> Thanks for adding the new test. Looks okay and some minor comment. >>> >>> +try { >&g

Re: [JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-03-16 Thread David Lloyd
output ByteBuffer when DFE > raised (in Java), but > the corresponding "byteWritten" is not being updated before the > exception is thrown. > > -Sherman > > > > > On 3/13/18, 10:46 AM, David Lloyd wrote: >> >> Sorry all, it looks like GMail d

[11] [PATCH] 9053056: Anchor name conflict in ClassLoader JavaDoc

2018-03-21 Thread David Lloyd
Since adding a field called "name" to java.lang.ClassLoader, the "name" anchor which previously referred to the section entitled "binary names" has been broken. The attached doc-only patch changes the name of the anchor to "binary-name". It applies with "patch -p1". -- - DML diff --git a/src/ja

Re: [11] [PATCH] 9053056: Anchor name conflict in ClassLoader JavaDoc

2018-03-21 Thread David Lloyd
I discovered there are a couple of references outside of ClassLoader as well. Here's the updated patch... On Wed, Mar 21, 2018 at 10:58 AM, David Lloyd wrote: > Since adding a field called "name" to java.lang.ClassLoader, the > "name" anchor which previously r

Re: [11] [PATCH] 9053056: Anchor name conflict in ClassLoader JavaDoc

2018-03-21 Thread David Lloyd
otherwise change nothing. > I'm confused by the subject. There is no such bug I submitted it via bugreport.java.com; it hasn't been reviewed yet. I expect it might show up soon. > On Wed, Mar 21, 2018 at 9:03 AM David Lloyd wrote: >> >> I discovered there are

Re: [11] [PATCH] 9053056: Anchor name conflict in ClassLoader JavaDoc

2018-03-21 Thread David Lloyd
Ah, so the submitted bug ID doesn't match the final bug ID. Excellent. On Wed, Mar 21, 2018 at 11:24 AM, Martin Buchholz wrote: > Found it. > https://bugs.openjdk.java.net/browse/JDK-8199947 > -- - DML

Re: [11] [PATCH] 9053056: Anchor name conflict in ClassLoader JavaDoc

2018-03-21 Thread David Lloyd
On Wed, Mar 21, 2018 at 12:04 PM, mandy chung wrote: > > > On 3/21/18 8:58 AM, David Lloyd wrote: > > Since adding a field called "name" to java.lang.ClassLoader, the > "name" anchor which previously referred to the section entitled > "binary nam

Re: RFR of 8180451: ByteArrayInputStream should override readAllBytes, readNBytes, and transferTo

2018-03-21 Thread David Lloyd
Sorry. This looks OK to me (non-reviewer) now. On Wed, Mar 21, 2018 at 1:01 PM, Brian Burkhalter wrote: > This is still in need of final approval, assuming it is OK. > > Thanks, > > Brian > > On Mar 14, 2018, at 10:50 AM, Brian Burkhalter > wrote: > > On Mar 14,

Re: [11] [PATCH] 9053056: Anchor name conflict in ClassLoader JavaDoc

2018-03-21 Thread David Lloyd
On Wed, Mar 21, 2018 at 3:39 PM, mandy chung wrote: > On 3/21/18 10:26 AM, David Lloyd wrote: > > I see it with IntelliJ IDEA when I pop up "quick JavaDoc" on, say, > defineClass and then click on "binary name"; it's actually using the > sources, rath

Re: [JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-03-23 Thread David Lloyd
Are there any further comments on this? If not, would it be possible to get a sponsor for this change? Sorry again for the detached email threads; I've learned my GMail lesson well... Thanks. On Fri, Mar 16, 2018 at 8:25 AM, David Lloyd wrote: > Sorry, that was an error on my part, c

Re: [JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-03-23 Thread David Lloyd
On Fri, Mar 23, 2018 at 12:51 PM, Xueming Shen wrote: > > Hi David, > > Sorry for the late response. I will sponsor this change. Will prepare for > the CSR for > the new APIs. Thanks! > Couple more comments > > (1) Deflater.java/deflate(ByteBuffer, int); > "In the case of FULL_FLUSH or SYNC_FLUS

Re: [JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-03-23 Thread David Lloyd
On Fri, Mar 23, 2018 at 1:06 PM, Alan Bateman wrote: > Is there an up to date webrev on cr.openjdk.java.net that we can review? I'm an outside contributor so I don't have any easy way to prepare one; however, if you wish, you can look at the diff on my GitHub mirror here [1]. In case you're curi

Re: [JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-03-26 Thread David Lloyd
On Mon, Mar 26, 2018 at 9:53 AM, Alan Bateman wrote: > On 23/03/2018 19:17, David Lloyd wrote: >> >> All fixed. You're right, the catch blocks consolidated fairly easily >> and it looks better. I've attached the latest version of the patch. >> > I w

Re: [JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-03-27 Thread David Lloyd
On Tue, Mar 27, 2018 at 10:10 AM, Alan Bateman wrote: > On 27/03/2018 00:09, David Lloyd wrote: >> I was going for some kind of consistency with the array variants (that >> is, name the parameter what it is), though they simply use "b" for >> their parameter name so

Re: [JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-03-28 Thread David Lloyd
On Tue, Mar 27, 2018 at 11:59 AM, David Lloyd wrote: > On Tue, Mar 27, 2018 at 10:10 AM, Alan Bateman > wrote: >> On 27/03/2018 00:09, David Lloyd wrote: >>> I was going for some kind of consistency with the array variants (that >>> is, name the parameter what it

Re: [JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-03-29 Thread David Lloyd
On Wed, Mar 28, 2018 at 11:38 PM, Xueming Shen wrote: > On 3/28/18, 6:14 AM, David Lloyd wrote: >> I've implemented all the other changes except for this one. Latest >> version is attached, online version is here [1]. > > "flush marker" was copy/pasted fro

Re: [JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-03-30 Thread David Lloyd
Thanks! On Fri, Mar 30, 2018 at 11:52 AM, Xueming Shen wrote: > On 3/30/18, 7:07 AM, Alan Bateman wrote: >> >> On 29/03/2018 13:18, David Lloyd wrote: >>> >>> : >>> OK great. In that case, I think all feedback has been accounted for, >>> and

Re: [JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-03-30 Thread David Lloyd
On Fri, Mar 30, 2018 at 12:05 PM, Xueming Shen wrote: > > Hi David, > > (1) Deflater.setDictionary(ByteBuffer) missed a "@since 11" Oops, easy fix. > (2) infalte(...) may not need to catch DFE twice, better (?) to just update > the inputPos/input > at outsider catch as > > if (input =

Re: Patch fixing JDK-8176553

2018-04-04 Thread David Lloyd
Is there anyone who would be willing to sponsor this change? On Tue, Jan 23, 2018 at 4:58 PM, Jan Kalina wrote: > Hi, > I has prepared trivial patch for bug JDK-8176553, which I has reported. > > I will welcome if it could be merged into JDK. > (The bug is present in JDK9 and JDK8 too.) > I am co

Re: Patch fixing JDK-8176553

2018-04-04 Thread David Lloyd
Actually I've talked to Jan and we're going to try again with the more correct subject line & RFR. Thanks. On Wed, Apr 4, 2018 at 8:51 AM, David Lloyd wrote: > Is there anyone who would be willing to sponsor this change? > > On Tue, Jan 23, 2018 at 4:58 PM, Jan Kalina

Re: Promptly freeing the per-thread cached direct buffers when a thread exits

2018-04-05 Thread David Lloyd
On Thu, Apr 5, 2018 at 4:45 PM, Tony Printezis wrote: > Would proposing to introduce thread exit hooks be reasonable? Or is > everyone going to freak out? :-) The hooks can be either per-Thread or even > per-ThreadLocal. And it's OK if the hooks can only be used within java.base. User-accessible

Re: Promptly freeing the per-thread cached direct buffers when a thread exits

2018-04-06 Thread David Lloyd
On Fri, Apr 6, 2018 at 8:57 AM, Tony Printezis wrote: >> ThreadLocal clearing > > Could you clarify what you mean by ThreadLocal clearing? I mean calling ThreadLocal#remove(). > I like the suggestion to add an overridable exit() method to ThreadLocal. If > you want to avoid calling user code by

Re: [JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-04-11 Thread David Lloyd
That's great news, thanks! I'll pull down your updates just so my local copy does not get out of date in the meantime. On Tue, Apr 10, 2018 at 10:49 PM, Xueming Shen wrote: > Hi David, > > The CSR has been approved > https://bugs.openjdk.java.net/browse/JDK-8200527 > > API docs have been updated

Re: [JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-04-18 Thread David Lloyd
+1 from me, thanks! On Wed, Apr 18, 2018 at 3:09 PM, Xueming Shen wrote: > Alan, David, > > Any more update/comment/suggestion on this one? I have updated > DeInflate.java with > some new test cases to cover the newly added methods. Good to go? > > -Sherman > > On 04/10/2018 08:49 PM, Xueming She

Re: [JDK-6341887] RFR: Patch V3: java.util.zip: Add ByteBuffer methods to Inflater/Deflater

2018-04-19 Thread David Lloyd
arcv9. > The C comipler on > solaris-sparcv9 platform does not like those "declaration follow a > statement" new code in > Deflater.c and Inflater.c > > http://cr.openjdk.java.net/~sherman/6341887.David.Lloyd/webrev/ > > Thanks, > Sherman > > > On

Re: [PATCH] minor regex cleanup: use switch for enum

2018-04-23 Thread David Lloyd
FWIW I strongly doubt this will improve performance; probably the opposite in fact, as IIRC an enum switch generates an extra class (though perhaps this has changed). The original code was quite compact and utilized identity comparisons, and given there are only three alternatives it probably was

Re: [PATCH] minor regex cleanup: use switch for enum

2018-04-24 Thread David Lloyd
On Mon, Apr 23, 2018 at 7:42 PM, Isaac Levy wrote: > On Mon, Apr 23, 2018 at 5:18 PM David Lloyd wrote: >> >> FWIW I strongly doubt this will improve performance; probably the >> opposite in fact, as IIRC an enum switch generates an extra class >> (though perhaps this

Re: Charsets for hex/base64

2018-05-03 Thread David Lloyd
I feel like what you're looking for is really a general-purpose data transformation API. I think bending charsets into this shape would be a bad move, but I like the idea of a more generalized solution. Google Guava has such an abstraction, and I know of a couple of others a well. On Thu, May 3,

  1   2   >