Changeset 4530


Ignore:
Timestamp:
10/25/03 16:36:48 (18 years ago)
Author:
piso
Message:

DECLARE-OBJECT

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/jvm.lisp

    r4524 r4530  
    22;;;
    33;;; Copyright (C) 2003 Peter Graves
    4 ;;; $Id: jvm.lisp,v 1.2 2003-10-24 16:35:42 piso Exp $
     4;;; $Id: jvm.lisp,v 1.3 2003-10-25 16:36:48 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    459459(defconstant +lisp-object-class+ "org/armedbear/lisp/LispObject")
    460460(defconstant +lisp-object+ "Lorg/armedbear/lisp/LispObject;")
     461
     462(defconstant +lisp-string+ "Lorg/armedbear/lisp/LispString;")
    461463
    462464(defconstant +lisp-thread-class+ "org/armedbear/lisp/LispThread")
     
    775777
    776778(defun declare-field (name descriptor)
    777   (let ((field (make-field :name name
    778                            :descriptor descriptor)))
     779  (let ((field (make-field :name name :descriptor descriptor)))
    779780    (setf (field-access-flags field) (logior #x8 #x2)) ; private static
    780781    (setf (field-name-index field) (pool-name (field-name field)))
     
    879880        (s (format nil "~S" obj))
    880881        (*code* *static-code*))
    881     (declare-field g "Lorg/armedbear/lisp/LispObject;")
     882    (declare-field g +lisp-object+)
    882883    (emit 'ldc
    883884          (pool-string s))
     
    889890          *this-class*
    890891          g
    891           "Lorg/armedbear/lisp/LispObject;")
     892          +lisp-object+)
    892893    (setq *static-code* *code*)
    893894    g))
     895
     896(defun declare-object (obj)
     897  (let ((key (symbol-name (gensym))))
     898    (sys::remember key obj)
     899    (let* ((g1 (declare-string key))
     900           (g2 (symbol-name (gensym)))
     901           (*code* *static-code*))
     902      (declare-field g2 +lisp-object+)
     903      (emit 'getstatic
     904            *this-class*
     905            g1
     906            +lisp-string+)
     907      (emit 'dup)
     908      (emit 'invokestatic
     909            +lisp-class+
     910            "recall"
     911            "(Lorg/armedbear/lisp/LispString;)Lorg/armedbear/lisp/LispObject;")
     912      (emit 'putstatic
     913            *this-class*
     914            g2
     915            +lisp-object+)
     916      (emit 'invokestatic
     917            +lisp-class+
     918            "forget"
     919            "(Lorg/armedbear/lisp/LispString;)V")
     920      (setq *static-code* *code*)
     921      g2)))
    894922
    895923(defun declare-string (string)
     
    906934          *this-class*
    907935          g
    908           "Lorg/armedbear/lisp/LispString;")
     936          +lisp-string+)
    909937    (setq *static-code* *code*)
    910938    g))
     
    970998    (when (null (symbol-package form))
    971999      ;; An uninterned symbol.
    972       (let ((g (declare-object-as-string form)))
     1000      (let ((g (declare-object form)))
    9731001        (emit 'getstatic
    9741002              *this-class*
Note: See TracChangeset for help on using the changeset viewer.