Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Objectteams » Question about OTDRE
Question about OTDRE [message #1768318] Mon, 17 July 2017 12:36 Go to next message
Lars Schütze is currently offline Lars SchützeFriend
Messages: 43
Registered: March 2012
Location: Germany
Member

Hi,

I am just digging through the code to assemble all the details together how things work w.r.t. the implementation of the dynamic runtime weaving.

In the CreateCallAllBindingsCallInOrgMethod I've seen some interesting peace of code (line 111-116) which I do not understand why it is needed. They have been added with commit ea5e55ac71fa3c12fddeb561a423a8e76f9fdfc1 in order to fix Bug 494415.

		if (method.name.equals("<init>")) { // set bit 0x8000000 to signal the ctor
			newInstructions.add(createLoadIntConstant(0xffff_ffff));
			newInstructions.add(createLoadIntConstant(0x7fff_ffff)); // 0x80000000 causes NPE in ASM :(
			newInstructions.add(new InsnNode(Opcodes.IXOR)); // indirectly creates the desired 0x80000000
			newInstructions.add(new InsnNode(Opcodes.IOR));
		}


Now, the IXOR constructs the 0x800_000 which cannot be constructed using the ASM API. But what is the task of the IOR operator following just thereafter?

Furthermore, why is it needed to put 0x800_000 on the stack "to signal the ctor"? Directly before that code this and a load instruction for the boundMethodId as constant is put on the stack. Directly thereafter the arguments for callAllBindings are assembled together and is called by invokevirtual.

[Updated on: Mon, 17 July 2017 12:40]

Report message to a moderator

Re: Question about OTDRE [message #1768320 is a reply to message #1768318] Mon, 17 July 2017 12:57 Go to previous messageGo to next message
Lars Schütze is currently offline Lars SchützeFriend
Messages: 43
Registered: March 2012
Location: Germany
Member

Oh, I just found the answer myself :-O

The highest bit signals it to be a constructor which is again read from Team.java so that before and replace bindings can be forbidden.
Re: Question about OTDRE [message #1768343 is a reply to message #1768320] Mon, 17 July 2017 17:10 Go to previous messageGo to next message
Lars Schütze is currently offline Lars SchützeFriend
Messages: 43
Registered: March 2012
Location: Germany
Member

Seems like
int flaggedMethodId = methodId | 0x800_0000; newInstructions.add(createLoadIntConstant(flaggedMethodId));
would be a good substitude without recalculating this everytime.
Re: Question about OTDRE [message #1769623 is a reply to message #1768343] Wed, 02 August 2017 09:03 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Lars Schütze wrote on Mon, 17 July 2017 19:10
Seems like
int flaggedMethodId = methodId | 0x800_0000; newInstructions.add(createLoadIntConstant(flaggedMethodId));
would be a good substitude without recalculating this everytime.


Sure, doing less at runtime would be great.

Have you tried your approach?
Wouldn't that trigger the same problem in ASM?
I admit I don't recall how exactly ASM failed.
Re: Question about OTDRE [message #1774250 is a reply to message #1769623] Thu, 12 October 2017 08:33 Go to previous messageGo to next message
Lars Schütze is currently offline Lars SchützeFriend
Messages: 43
Registered: March 2012
Location: Germany
Member

I was looking if there was ever a bug in ASM when loading negative int constants, and also compiled a snipped with javac to look how the resulting bytecode looks like.
The problem is in the function
createLoadIntConstant
as the first if statement checks if the integer is lower than 5. That is true, and as such it would try to generate an arbitrary low value that ASM does not understand (Opcodes.I_LOAD + i). Hence, the problem and NullPointerException. I already fixed in my local branch and also all the boundaries for the other ones.
Re: Question about OTDRE [message #1800883 is a reply to message #1768318] Wed, 09 January 2019 11:49 Go to previous messageGo to next message
zino garphy is currently offline zino garphyFriend
Messages: 3
Registered: January 2019
Junior Member
Lars Schütze wrote on Mon, 17 July 2017 12:36
Hi,

I am just digging through the code to assemble all the details together how things work w.r.t. the implementation of the dynamic runtime weaving.

In the CreateCallAllBindingsCallInOrgMethod I've seen some interesting peace of code (line 111-116) which I do not understand why it is needed. They have been added with commit ea5e55ac71fa3c12fddeb561a423a8e76f9fdfc1 in order to fix Bug 494415.

		if (method.name.equals("<init>")) { // set bit 0x8000000 to signal the ctor
			newInstructions.add(createLoadIntConstant(0xffff_ffff));
			newInstructions.add(createLoadIntConstant(0x7fff_ffff)); // 0x80000000 causes NPE in ASM :(
			newInstructions.add(new InsnNode(Opcodes.IXOR)); // indirectly creates the desired 0x80000000
			newInstructions.add(new InsnNode(Opcodes.IOR));
		}


Now, the IXOR constructs the 0x800_000 which cannot be constructed using the ASM API. But what is the task of the IOR operator following just thereafter? Chaturbate Xnxx Tubegalore

Furthermore, why is it needed to put 0x800_000 on the stack "to signal the ctor"? Directly before that code this and a load instruction for the boundMethodId as constant is put on the stack. Directly thereafter the arguments for callAllBindings are assembled together and is called by invokevirtual.

The highest bit signals it to be a constructor which is again read from Team.java so that before and replace bindings can be forbidden.

[Updated on: Wed, 09 January 2019 20:08]

Report message to a moderator

Re: Question about OTDRE [message #1836273 is a reply to message #1800883] Sun, 27 December 2020 21:42 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
To close the loop here: this problem has been fixed via https://bugs.eclipse.org/520460 (OTDT 2.7)
Previous Topic:Exported Product does not run ObjectTeams
Next Topic:Change code generated for base call in callin
Goto Forum:
  


Current Time: Thu Mar 28 18:53:51 GMT 2024

Powered by FUDForum. Page generated in 0.06234 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top