jvm

When is invokedynamic actually useful (besides lazy constants)?

。_饼干妹妹 提交于 2020-05-27 09:56:22
问题 TL;DR Please provide a piece of code written in some well known dynamic language (e.g. JavaScript) and how that code would look like in Java bytecode using invokedynamic and explain why the usage of invokedynamic is a step forward here. Background I have googled and read quite a lot about the not-that-new-anymore invokedynamic instruction which everyone on the internet agrees on that it will help speed dynamic languages on the JVM. Thanks to stackoverflow I managed to get my own bytecode

Java: How does the VM handle a 64bit `long` on a 32bit processor

房东的猫 提交于 2020-05-25 04:28:11
问题 How does the JVM handle a primitive "long", which is 64bits, on a 32bit processor? Can it utilise mulitple cores in parallel when on a Multi-Core 32bit machine? How much slower are 64bit operations on a 32bit machine? 回答1: It may use multiple cores to run different threads, but it does not use them in parallel for 64 bit calculations. A 64 bit long is basically stored as two 32 bit ints. In order to add them, two additions are needed, keeping track of the carry bit. Multiplication is kind of

How to Determine Whether OpenJDK Installed with Debugging Symbols

☆樱花仙子☆ 提交于 2020-05-17 06:00:15
问题 I installed openjdk-devel and openjdk-devel-debuginfo of the same major/minor version for an architecture in RedHat Linux Server 8+. I would like to make sure that the OpenJDK runtime has symbols for debugging. After installation, I ran the followings: [root@localhost bin]# objdump --syms /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el8_1.x86_64/jre/bin/java /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el8_1.x86_64/jre/bin/java: file format elf64-x86-64 SYMBOL TABLE: 0000000000000270 l

I'm curious about what ldc short for in JVM?

时光总嘲笑我的痴心妄想 提交于 2020-05-15 04:12:48
问题 ByteCode:ldc pushes a one-word constant onto the operand stack. ldc takes a single parameter, , which is the value to push. Most of the bytecodes in JVM can figure out their name by the code description. However, the ldc, I don't see any clue. 回答1: I suppose it is LoaD Constant but I do not have any reference. 回答2: It is Load Constant. It loads an item from the constant pool onto the stack. The available types are: int float java.lang.String java.lang.Class The Java 7 JVM added java.lang

Difference between -XX:+PrintGC and -verbose:gc

醉酒当歌 提交于 2020-05-14 18:57:08
问题 I want to understand the difference between: -XX:+PrintGC and -verbose:gc Apparently these look similar. This article doesn't list the verbose:gc http://www.oracle.com/technetwork/articles/java/vmoptions-jsp-140102.html I also saw these two questions: How to redirect verbose garbage collection output to a file? and https://stackoverflow.com/a/1818039/2266682 but couldn't get much understanding. 回答1: In JDK 8 -verbose:gc is an exact alias for -XX:+PrintGC . However, -verbose:gc is a standard

What is the maximum number of fields a Java class can have?

|▌冷眼眸甩不掉的悲伤 提交于 2020-05-13 19:06:27
问题 Is there a limit to the number of fields a java class or an associated object instance can have, and if so what is it? I am explicitly asking about fields, not methods as was asked in this question: What is the maximum number of methods a Java class can have? 回答1: The class file format contains a list of field declarations whose size is an unsigned short, hence could allow 65535 declarations, but it is not possible to declare 65535 fields in practice. Each field must have a unique name and

What is the maximum number of fields a Java class can have?

自闭症网瘾萝莉.ら 提交于 2020-05-13 19:06:08
问题 Is there a limit to the number of fields a java class or an associated object instance can have, and if so what is it? I am explicitly asking about fields, not methods as was asked in this question: What is the maximum number of methods a Java class can have? 回答1: The class file format contains a list of field declarations whose size is an unsigned short, hence could allow 65535 declarations, but it is not possible to declare 65535 fields in practice. Each field must have a unique name and

Is there any safe way to serialize/deserialize Java Lambda for two different JREs?

笑着哭i 提交于 2020-05-13 09:06:16
问题 There is a client that needs to serialize many lambda functions defined in the client side and send them to the server, which has to be able to correctly deserialize them. The server also have implementations of all those lambda functions in the client, but the details could be slightly different from the client-side implementations (like minor versioning differences). Given that Java Lambdas depends on compiler specific artifacts, simply serializing a lambda function to SerializedLambda and

java.lang.VerifyError: Stack map does not match the one at exception handler

核能气质少年 提交于 2020-05-13 06:20:07
问题 Faced this java.lang.VerifyError with code snippet as below during JVM loading bytecode. try{ ----- } catch (NumberFormatException|CalculationException e) { } Here CalculationException is custom exception which extends java.lang.RuntimeException, while NumberFormatException is standard Java RuntimeException. While the code compile and run fine locally windows machine. It fails with VerifyError on one of the QA/prod/Dev unix node, and works fine on other unix node. While both unix nodes have

JIT C2 method maximum size

依然范特西╮ 提交于 2020-05-09 08:04:11
问题 I was wondering if there is a method maximum size for JIT C2 to compile it. Let's assume there is a method which just maps one class to another, but this class contains a lot of fields. It became hot, C1 optimizes it but at some point C2 will kick in. If byte code is long enough, will C2 ignore that method and do not compile it? I couldn't find any answer for my question. Maybe there is not such a thing? 回答1: There are a number of JIT compiler limits. One of them is HugeMethodLimit equal to