This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.List; | |
class ClassWithState implements Cloneable { | |
int x = 15; | |
Long y = Long.MAX_VALUE / 3; | |
String z = new String("new Z"); | |
List<String> data = Arrays.asList("a", "b", "and", "c"); | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Java HotSpot(TM) 64-Bit Server VM warning: PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output | |
Loaded disassembler from /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/hsdis-amd64.dylib | |
Decoding compiled method 0x00000001063bb1d0: | |
Code: | |
[Disassembling for mach='i386:x86-64'] | |
[Entry Point] | |
[Constants] | |
# {method} 'indexOf' '(II)I' in 'java/lang/String' | |
# this: rsi:rsi = 'java/lang/String' | |
# parm0: rdx = int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Java HotSpot(TM) 64-Bit Server VM warning: PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output | |
Loaded disassembler from /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/hsdis-amd64.dylib | |
Decoding compiled method 0x000000010c060290: | |
Code: | |
[Disassembling for mach='i386:x86-64'] | |
[Entry Point] | |
[Constants] | |
# {method} 'indexOf' '(II)I' in 'java/lang/String' | |
# this: rsi:rsi = 'java/lang/String' | |
# parm0: rdx = int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pcm.x "java -Xms4g -Xmx5g com.vyazelenko.blog.copyobject.TestClone" -nc -ns | |
Intel(r) Performance Counter Monitor V2.5.1 (2013-06-25 13:44:03 +0200 ID=76b6d1f) | |
Copyright (c) 2009-2012 Intel Corporation | |
Num logical cores: 8 | |
Num sockets: 1 | |
Threads per core: 2 | |
Core PMU (perfmon) version: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"java -Xms4g -Xmx5g com.vyazelenko.blog.copyobject.TestConstructor" -nc -ns | |
Intel(r) Performance Counter Monitor V2.5.1 (2013-06-25 13:44:03 +0200 ID=76b6d1f) | |
Copyright (c) 2009-2012 Intel Corporation | |
Num logical cores: 8 | |
Num sockets: 1 | |
Threads per core: 2 | |
Core PMU (perfmon) version: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.vyazelenko.blog.copyobject; | |
import com.vyazelenko.blog.copyobject.primitives.clone.CloneCopy; | |
import com.vyazelenko.blog.copyobject.primitives.constructor.ConstructorCopy; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class TestConstructor { | |
public static List<Copyable> results; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.vyazelenko.blog.copyobject; | |
import com.vyazelenko.blog.copyobject.primitives.clone.CloneCopy; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class TestClone { | |
public static List<Copyable> results; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Decoding compiled method 0x00000001063b9390: | |
Code: | |
[Entry Point] | |
[Verified Entry Point] | |
[Constants] | |
# {method} 'callCopy' '()Lcom/vyazelenko/blog/copyobject/Copyable;' in 'com/vyazelenko/blog/copyobject/TestClone' | |
# [sp+0x20] (sp of caller) | |
0x00000001063b94e0: mov %eax,-0x14000(%rsp) | |
0x00000001063b94e7: push %rbp | |
0x00000001063b94e8: sub $0x10,%rsp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Decoding compiled method 0x000000010c064b50: | |
Code: | |
[Entry Point] | |
[Verified Entry Point] | |
[Constants] | |
# {method} 'callCopy' '()Lcom/vyazelenko/blog/copyobject/Copyable;' in 'com/vyazelenko/blog/copyobject/TestConstructor' | |
# [sp+0x20] (sp of caller) | |
0x000000010c064ca0: mov %eax,-0x14000(%rsp) | |
0x000000010c064ca7: push %rbp | |
0x000000010c064ca8: sub $0x10,%rsp ;*synchronization entry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java -XX:+PrintCompilation com.vyazelenko.blog.copyobject.TestConstructor | |
59 1 java.lang.String::hashCode (55 bytes) | |
61 2 java.lang.String::indexOf (70 bytes) | |
70 3 sun.nio.cs.UTF_8$Encoder::encode (361 bytes) | |
77 4 java.lang.Object::<init> (1 bytes) | |
80 5 java.util.ArrayList::add (29 bytes) | |
80 6 java.util.ArrayList::ensureCapacityInternal (23 bytes) | |
81 7 java.util.ArrayList::ensureExplicitCapacity (26 bytes) | |
81 8 com.vyazelenko.blog.copyobject.TestConstructor::callCopy (7 bytes) | |
81 9 com.vyazelenko.blog.copyobject.primitives.constructor.ConstructorCopy::copy (9 bytes) |
NewerOlder