Skip to content

Latest commit

 

History

History
74 lines (55 loc) · 1.95 KB

internals.org

File metadata and controls

74 lines (55 loc) · 1.95 KB

Gargoyle Internals

A collection of descriptions of internals.

Java Class Hierarchy

A copy of the Java class hierarchy is (lazily) maintained in the Lisp address space.

A class struct is a plist (all supertypes, classes and interfaces, will be present if a class is preset):

(:name java.util.ArrayList
 :superclass java.util.AbstractList
 :interfaces (java.io.Serializable
              java.lang.Cloneable
              java.lang.Iterable
              java.util.Collection
              java.util.List
              java.util.RandomAccess)
 :methods methodList
 :fields fieldList
 :modifiers (public super))

A class struct is generated by the function gg--get-class-struct which takes a class symbol as an argument.

A method is a plist (TODO put modifiers here):

(:name currentThread
 :returns java.util.Thread
 :accepts nil
 :modifiers (static))

(:name contains
 :returns boolean
 :accepts (java.lang.Object)
 :modifiers nil)

A field is a plist:

(:name name
 :type java.lang.String)

Lisp Representation of Java Objects

In C code, a Java object is represented by a pointer. When objects are returned from C code, they are wrapped as Lisp structures by calling gg--new-object. When we say “Java object”, we are generally referring to a Lisp-wrapped version of the object. When we say raw object, we are referring to the List representation of the pointer.

Functions ending with -raw accept raw objects as arguments. All others accept Java objects.

c.f. gg-objectp

Debugging with gdb

  • Run Emacs under gdb (using the emacs_debug script)
  • Load/start Emacs Gargoyle (done automatically by gg_debug.el)
  • Load the ert tests (and call eval-buffer)
  • Run them (call ert)

Glossary

  • raw object - a List userptr of a C jobject.