Ticket #149 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Weaving into system classes

Reported by: stephan Owned by: stephan
Priority: major Milestone: OTDT_1.2.3
Component: runtime-environment Version: pre_1.0
Keywords: topprax-jira Cc:

Description (last modified by stephan) (diff)

From Jira issue TPX-475

The current bytecode transformation mechanism of the OTRE uses the jmangler framework, which is not able to transform system classes (loaded by the bootstrap classloader). Thus, at the moment it is not possible to adapt system classes by callin bindings.

The JPLIS weaving strategy does not have this restriction. It is possible to use this experimental (incomplete!) weaving strategy by activating the checkbox "Java 5 JPLIS Launching (experimental)" in the OTDT-Eclipse launch configuration. Now the adaptation of system classes is possible, BUT:

  • the base class is a system class thus loaded by the bootstrap class loader
  • callin weaving adds references to teams into the base class
  • these classes are unknown to the bootstrap classloader -> ClassNotFoundException!

Workaround: add whole project and the "otre.jar" to the bootstrap classpath in the launch configuration.
Of course this is not very reasonable!

by Christine Hundt

Change History

Changed 3 years ago by stephan

  • type changed from defect to enhancement
  • description modified (diff)

Some advances:

It might suffice to put a minimal jar into the boot classpath containing only the classes from org.objectteams.* (excluding sub-packages).

The reference from chaining wrappers back to the concrete team could be avoided by using reflection for the call to the team's callin wrapper.

Now I'm struggling with a JVM-crash:

Error: guarantee(thread->is_Java_thread(),"crucial check - the VM thread cannot and must not escape to Java code")

Changed 3 years ago by stephan

Initial implementation (following the previous comment) is in r18986.

(the JVM crash was caused by broken bytecode, calling java with -verify -Xverify:all revealed mismatching signatures etc.)

Patch r18986 only addresses before and after callins. replace remains to be done, once we decide to keep this strategy.

OTSample-Flightbonus mostly works including

public class FrameAdapter extends WindowAdaptor playedBy Window { ... }

The BonusDialog?, however, is not yet displayed in the JPLIS variant. (something about broken callin-to-callin).

Also integration with launch configuration types is an open issue, mainly because we now need to put a new otre-min.jar into the bootstrap classpath.

Changed 3 years ago by stephan

  • owner set to stephan
  • status changed from new to assigned
  • version changed from 1.2.2 to pre_1.0
  • milestone set to OTDT_1.2.3

r18990 brings a new strategy to load classes (e.g. ReferencedTeams) from the JPLIS transformer -> JPLIS launching is much more complete now.

r18992 brings the mentioned adjustment for JPLIS launches (otre_min.jar).

Changed 3 years ago by stephan

  • keywords topprax-jira added

Changed 3 years ago by stephan

  • status changed from assigned to closed
  • resolution set to fixed

JPLIS mode required some improvements re concurrency/thread handling:

  • r18993 removes locking from Team.isActive(Thread), which caused a deadlock
  • r18994 avoids reentrance of ObjectTeamsTransformation#checkReadClassAttributes
  • r18996 makes the TeamThreadManager more accurately monitor thread start/end (filter out calls to Runnable#run not related to thread starting).

Further improvements of JPLIS mode:

  • r18995 fixes the loading of classes via ClassLoader#getResourceAsStream(..)
  • r18998 completes the reflection based invocation of team callin wrappers (replace, handle more types (basic, array)).

With these improvements JPLIS mode passes all jacks tests!

Jubilee commit r19000 acknowledges these advances: JPLIS launch is no longer marked as "experimental".

Note: See TracTickets for help on using tickets.