-
-
Save anonymous/0f7bdd4742cd745a1a37 to your computer and use it in GitHub Desktop.
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
use nqp; | |
use java::util::zip::CRC32:from<Java>; | |
CRC32.^add_method("doubledValue", my method doubledValue ($self:) { | |
return $self.getValue() * 2; | |
}); | |
my $crc32 = CRC32.new; | |
nqp::setmethcacheauth(CRC32, 0); | |
$crc32.update('Hello, Java'.encode('utf-8')); | |
say $crc32.doubledValue; |
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
$ jdb -attach 8000 -sourcepath .:src/vm/jvm/runtime:nqp/src/vm/jvm/runtime/ | |
Set uncaught java.lang.Throwable | |
Set deferred uncaught java.lang.Throwable | |
Initializing jdb ... | |
> | |
VM Started: No frames on the current call stack | |
main[1] stop in org.perl6.nqp.runtime.IndyBootstrap:512 | |
Deferring breakpoint org.perl6.nqp.runtime.IndyBootstrap:512. | |
It will be set after the class is loaded. | |
main[1] run | |
> Set deferred breakpoint org.perl6.nqp.runtime.IndyBootstrap:512 | |
Breakpoint hit: "thread=main", org.perl6.nqp.runtime.IndyBootstrap.methcallResolve_noa(), line=512 bci=74 | |
512 throw ExceptionHandling.dieInternal(tc, | |
main[1] list | |
508 /* Try to resolve method to a coderef. */ | |
509 SixModelObject invocant = (SixModelObject)args[0]; | |
510 SixModelObject invokee = Ops.findmethod(invocant, name, tc); | |
511 if (invokee == null) | |
512 => throw ExceptionHandling.dieInternal(tc, | |
513 "Method '" + name + "' not found for invocant of class '" + Ops.typeName(invocant, tc) + "'"); | |
514 CodeRef cr; | |
515 if (invokee instanceof CodeRef) { | |
516 cr = (CodeRef)invokee; | |
517 } | |
main[1] locals | |
Method arguments: | |
caller = instance of java.lang.invoke.MethodHandles$Lookup(id=3231) | |
cs = instance of java.lang.invoke.MutableCallSite(id=3232) | |
name = "doubledValue" | |
csIdx = 1 | |
tc = instance of org.perl6.nqp.runtime.ThreadContext(id=3234) | |
args = instance of java.lang.Object[1] (id=3235) | |
Local variables: | |
csd = instance of org.perl6.nqp.runtime.CallSiteDescriptor(id=3236) | |
shared = false | |
invocant = instance of __P6opaque__71(id=3237) | |
invokee = null | |
main[1] dump args | |
args = { | |
instance of __P6opaque__71(id=3237) | |
} | |
main[1] print org.perl6.nqp.runtime.Ops.typeName(args[0], tc) | |
org.perl6.nqp.runtime.Ops.typeName(args[0], tc) = "java.util.zip.CRC32" | |
main[1] dump args[0] | |
args[0] = { | |
field_0: instance of __P6opaque__67(id=3263) | |
field_1: instance of org.perl6.nqp.sixmodel.reprs.JavaObjectWrapper(id=3264) | |
field_2: null | |
org.perl6.nqp.sixmodel.reprs.P6OpaqueBaseInstance.delegate: null | |
org.perl6.nqp.sixmodel.SixModelObject.st: instance of org.perl6.nqp.sixmodel.STable(id=3265) | |
org.perl6.nqp.sixmodel.SixModelObject.sc: null | |
} | |
main[1] dump org.perl6.nqp.runtime.Ops.typeName(args[0].field_0, tc) | |
org.perl6.nqp.runtime.Ops.typeName(args[0].field_0, tc) = "Perl6::Metamodel::ContainerDescriptor" | |
main[1] dump org.perl6.nqp.runtime.Ops.typeName(args[0].field_1, tc) | |
org.perl6.nqp.runtime.Ops.typeName(args[0].field_1, tc) = "java.util.zip.CRC32" | |
main[1] dump args[0].st.ModeFlags | |
args[0].st.ModeFlags = 0 | |
main[1] dump args[0].field_1.st.ModeFlags | |
args[0].field_1.st.ModeFlags = 4 | |
main[1] reenter | |
Step completed: "thread=main", org.perl6.nqp.runtime.IndyBootstrap.methcallResolve_noa(), line=501 bci=0 | |
501 CallSiteDescriptor csd = csIdx >= 0 | |
main[1] main[1] list | |
497 | |
498 public static void methcallResolve_noa(Lookup caller, MutableCallSite cs, String name, int csIdx, | |
499 ThreadContext tc, Object... args) { | |
500 /* Resolve callsite descriptor. */ | |
501 => CallSiteDescriptor csd = csIdx >= 0 | |
502 ? tc.curFrame.codeRef.staticInfo.compUnit.callSites[csIdx] | |
503 : Ops.emptyCallSite; | |
504 | |
505 /* Don't update callsite in cases where it's not safe. */ | |
506 boolean shared = tc.curFrame.codeRef.staticInfo.compUnit.shared; | |
main[1] set args[0].field_1.st.ModeFlags = 0 | |
args[0].field_1.st.ModeFlags = 0 = 0 | |
main[1] run | |
> | |
The application exited |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment