ObjectClass.hpp
Go to the documentation of this file.
1 /*----------------------------------------------------------------------------*/
2 /* */
3 /* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */
4 /* Copyright (c) 2005-2009 Rexx Language Association. All rights reserved. */
5 /* */
6 /* This program and the accompanying materials are made available under */
7 /* the terms of the Common Public License v1.0 which accompanies this */
8 /* distribution. A copy is also available at the following address: */
9 /* http://www.oorexx.org/license.html */
10 /* */
11 /* Redistribution and use in source and binary forms, with or */
12 /* without modification, are permitted provided that the following */
13 /* conditions are met: */
14 /* */
15 /* Redistributions of source code must retain the above copyright */
16 /* notice, this list of conditions and the following disclaimer. */
17 /* Redistributions in binary form must reproduce the above copyright */
18 /* notice, this list of conditions and the following disclaimer in */
19 /* the documentation and/or other materials provided with the distribution. */
20 /* */
21 /* Neither the name of Rexx Language Association nor the names */
22 /* of its contributors may be used to endorse or promote products */
23 /* derived from this software without specific prior written permission. */
24 /* */
25 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
26 /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
27 /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
28 /* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
29 /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
30 /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
31 /* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
32 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
33 /* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
34 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
35 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
36 /* */
37 /*----------------------------------------------------------------------------*/
38 /******************************************************************************/
39 /* REXX Kernel ObjectClass.hpp */
40 /* */
41 /* Primitive Object Class Definitions */
42 /* */
43 /******************************************************************************/
44 /******************************************************************************/
45 #ifndef Included_RexxObject
46 #define Included_RexxObject
47 
48 #include "Numerics.hpp"
49 
50 #include <stddef.h>
51 
52  class RexxObject;
53  class RexxInteger;
54  class RexxBehaviour;
55  class RexxCompoundTail;
56  class RexxCompoundElement;
57  class RexxInternalStack;
58  class RexxSupplier;
59  class RexxEnvelope;
61  class RexxNumberString;
62  class RexxMethod;
63  class RexxMessage;
64  class ProtectedObject;
65  class SecurityManager;
66  class BaseExecutable;
67  class RexxActivity;
68  class RexxText;
69  class PackageClass;
70 
71 
72  enum
73  {
74  LiveMask = 0xFFFC, // mask for the checking the mark bits
75  MarkMask = 0x0003, // mask use for checking the mark bits
76  OldSpaceBit = 0x0010, // location of the OldSpace bit
77  };
78 
79 typedef size_t HashCode; // a hash code value
80 
81  /* used ofor special constructor */
83 
84 
86 {
87 public:
89  {
90  // copy the relevant state
92  flags = h.flags;
93  return *this;
94  }
95 
96  inline size_t getObjectSize() { return (size_t)objectSize; }
97  inline void setObjectSize(size_t l)
98  {
99  objectSize = l;
100  }
101 
102  inline void makeProxiedObject() { flags |= ProxiedObject; }
103  inline bool requiresProxyObject() { return (flags & ProxiedObject) != 0; }
104  inline void makeProxy() { flags |= ProxyObject; }
105  inline bool isProxyObject() { return (flags & ProxyObject) != 0; }
106  inline void clearObjectMark() { flags &= LiveMask; }
107  inline void setObjectMark(size_t mark) { clearObjectMark(); flags |= mark; }
108  inline bool isObjectMarked(size_t mark) { return (flags & mark) != 0; }
109  inline bool isObjectLive(size_t mark) { return ((size_t)(flags & MarkMask)) == mark; }
110  inline bool isObjectDead(size_t mark) { return ((size_t)(flags & MarkMask)) != mark; }
111  inline void clear() { objectSize = 0; flags = 0; }
112  inline void setOldSpace() { flags |= OldSpaceBit; }
113  inline void clearOldSpace() { flags &= ~OldSpaceBit; }
114  inline void setNewSpace() { clearOldSpace(); }
115  inline bool isOldSpace() { return (flags & OldSpaceBit) != 0; }
116  inline bool isNewSpace() { return (flags & OldSpaceBit) == 0; }
117  inline void setHasNoReferences() { flags |= NoRefBit; }
118  inline void setHasReferences() { flags &= ~NoRefBit; }
119  inline bool hasReferences() { return (flags & NoRefBit) == 0; }
120  inline bool hasNoReferences() { return (flags & NoRefBit) != 0; }
121  inline void setNonPrimitive() { flags |= IsNonPrimitive; }
122  inline void setPrimitive() { flags &= ~IsNonPrimitive; }
123  inline bool isNonPrimitive() { return (flags & IsNonPrimitive) != 0; }
124  inline bool isPrimitive() { return (flags & IsNonPrimitive) == 0; }
125  inline void setInRexxPackage() { flags |= IsInRexxPackage; }
126  inline bool isInRexxPackage() { return (flags & IsInRexxPackage) != 0; }
127  inline void initHeader(size_t l, size_t mark)
128  {
129  objectSize = l;
130  flags = (uint16_t)mark; // the flags are cleared except for the mark.
131  }
132  inline void initHeader(size_t mark)
133  {
134  flags = (uint16_t)mark; // the flags are cleared except for the mark.
135  }
136 
137 protected:
138  enum
139 
140  {
141  MarkBit1 = 0x0001, // location of the first mark bit. Note: shared with IsNonPrimitive
142  MarkBit2 = 0x0002, // Second of the mark bits
143  ProxiedObject = 0x0004, // This requires a proxy
144  ProxyObject = 0x0008, // This object is a PROXY(String) Obj
145  IsNonPrimitive = 0x0010, // use for flattened objects to indicated behaviour status
146  NoRefBit = 0x0020, // location of No References Bit.
147  IsInRexxPackage = 0x0040 // Object saved in rexx.img
148 
149  };
150 
151  size_t objectSize; // allocated size of the object
152  union
153  {
154  uint16_t flags; // the object flag/type information
155  size_t sizePadding; // padding to make sure this is a full pointer size
156  };
157 
158 };
159 
160 
161  class RexxVirtualBase { /* create first base level class */
162  /* dummy virtual function to force */
163  /* the virtual function table to a */
164  /* specific location. Different */
165  /* compilers place the virtual */
166  /* function table pointer at */
167  /* different locations. This forces */
168  /* to the front location */
169  protected:
170  virtual ~RexxVirtualBase() { ; }
171  virtual void baseVirtual() {;}
172 
173  public:
174  // the following need to be defined at the base virtual level. When
175  // an exception is thrown from within an object constructor, the destructors
176  // unwind and the constructed object just ends up with a virtual base
177  // vft. If the garbage collector sees this, it will crash unless these
178  // are defined at this level.
179  virtual void live(size_t) {;}
180  virtual void liveGeneral(int reason) {;}
181  virtual void flatten(RexxEnvelope *) {;}
182  virtual RexxObject *unflatten(RexxEnvelope *) { return (RexxObject *)this; };
183  };
184 
185 class RexxObject;
186 
187 /******************************************************************************/
188 /* Method pointer special types */
189 /******************************************************************************/
190 
191  // With positional arguments only
192  typedef RexxObject * (RexxObject::*PCPPM0)();
200 
201  // With positional and named arguments
202  typedef RexxObject * (RexxObject::*PCPPM0N)(RexxObject **, size_t);
203  typedef RexxObject * (RexxObject::*PCPPM1N)(RexxObject *, RexxObject **, size_t);
204  typedef RexxObject * (RexxObject::*PCPPM2N)(RexxObject *, RexxObject *, RexxObject **, size_t);
210 
211  typedef RexxObject * (RexxObject::*PCPPMA1)(RexxArray *); // Not used ?
212  typedef RexxObject * (RexxObject::*PCPPMC1)(RexxObject **, size_t, size_t); // Signature of methods A_COUNT
213 
214  /* pointer to method function */
215  typedef RexxObject * (RexxObject::*PCPPM)();
216  #define CPPM(n) ((PCPPM)&n)
217 
218 
219 #define OREFSHIFT 3
220  /* generate hash value from OREF */
221 inline uintptr_t HASHOREF(RexxVirtualBase *r) { return ((uintptr_t)r) >> OREFSHIFT; }
222  /* Base Object REXX class */
224  public:
225 
226  void * operator new(size_t, RexxClass *);
227  void * operator new(size_t, RexxClass *, RexxObject **, size_t, size_t);
228  inline void *operator new(size_t size, void *ptr) {return ptr;}
229  inline void operator delete(void *) { ; }
230  inline void operator delete(void *p, void *ptr) { }
231  inline RexxInternalObject() {;};
232  /* Following constructor used to */
233  /* reconstruct the Virtual */
234  /* Functiosn table. */
235  /* So it doesn't need to do anything */
236  inline RexxInternalObject(RESTORETYPE restoreType) { ; };
237  virtual ~RexxInternalObject() {;};
238 
239  inline operator RexxObject*() { return (RexxObject *)this; };
240 
241  inline size_t getObjectSize() { return header.getObjectSize(); }
242  inline void setObjectSize(size_t s) { header.setObjectSize(s); }
243  // NB: I hope this doesn't add any padding
244  static inline size_t getObjectHeaderSize() { return sizeof(RexxInternalObject); }
245  inline size_t getObjectDataSize() { return getObjectSize() - getObjectHeaderSize(); }
246  inline void *getObjectDataSpace() { return ((char *)this) + getObjectHeaderSize(); }
247  // these clear everything after the hash value.
248  inline void clearObject() { memset(getObjectDataSpace(), '\0', getObjectDataSize()); }
249  inline void clearObject(size_t l) { memset(getObjectDataSpace(), '\0', l - getObjectHeaderSize()); }
250  inline void setVirtualFunctions(void *t) { *((void **)this) = t; }
251 
252  inline void setInitHeader(size_t s, size_t markword) { header.initHeader(s, markword); }
253  inline void setInitHeader(size_t markword) { header.initHeader(markword); }
254 
255  inline void setObjectLive(size_t markword) { header.setObjectMark(markword); }
258  inline bool hasReferences() { return header.hasReferences(); }
259  inline bool hasNoReferences() { return header.hasNoReferences(); }
260  inline void setPrimitive() { header.setPrimitive(); }
262  inline bool isPrimitive() { return header.isPrimitive(); }
263  inline bool isNonPrimitive() { return header.isNonPrimitive(); }
265  inline bool isInRexxPackage() { return header.isInRexxPackage(); }
266  inline bool isObjectMarked(size_t markword) { return header.isObjectMarked(markword); }
267  inline void setObjectMark(size_t markword) { header.setObjectMark(markword); }
269  inline bool isObjectLive(size_t mark) { return header.isObjectLive(mark); }
270  inline bool isObjectDead(size_t mark) { return header.isObjectDead(mark); }
271  inline bool isOldSpace() { return header.isOldSpace(); }
272  inline bool isNewSpace() { return header.isNewSpace(); }
273  inline void setNewSpace() { header.setNewSpace(); }
274  inline void setOldSpace() { header.setOldSpace(); }
276  inline bool isProxyObject() { return header.isProxyObject(); }
277  bool isSubClassOrEnhanced();
278  bool isBaseClass();
279  size_t getObjectTypeNumber();
280  inline RexxBehaviour *getObjectType() { return behaviour; }
281  inline bool isObjectType(RexxBehaviour *b) { return b == behaviour; }
282  inline bool isObjectType(size_t t) { return getObjectTypeNumber() == t; }
283  inline bool isSameType(RexxInternalObject *o) { return behaviour == o->getObjectType(); }
284  inline void setBehaviour(RexxBehaviour *b) { behaviour = b; }
285 
286  virtual RexxObject *makeProxy(RexxEnvelope *);
287  virtual RexxObject *copy();
289  virtual RexxObject *getValue(RexxActivation *) { return OREF_NULL; }
293  virtual void uninit() {;}
294  virtual HashCode hash() { return getHashValue(); }
295  virtual HashCode getHashValue() { return identityHash(); }
296 
297  inline HashCode identityHash() { return HASHOREF(this); }
298 
299  virtual bool truthValue(int);
300  virtual bool logicalValue(logical_t &);
301  virtual RexxString *makeString();
302  virtual RexxText *makeText();
303  virtual void copyIntoTail(RexxCompoundTail *buffer);
304  virtual RexxString *primitiveMakeString();
305  virtual RexxText *primitiveMakeText();
306  virtual RexxArray *makeArray();
307  virtual RexxString *stringValue();
308  virtual RexxText *textValue();
309  virtual RexxInteger *integerValue(size_t);
310  virtual bool numberValue(wholenumber_t &result, size_t precision);
311  virtual bool numberValue(wholenumber_t &result);
312  virtual bool unsignedNumberValue(stringsize_t &result, size_t precision);
313  virtual bool unsignedNumberValue(stringsize_t &result);
314  virtual bool doubleValue(double &result);
315  virtual RexxNumberString *numberString();
316 
317  virtual bool isEqual(RexxObject *);
318  virtual bool isInstanceOf(RexxClass *);
321 
322  virtual RexxObject *dynamicTarget(RexxObject **arguments, size_t count, size_t named_count) { return (RexxObject *)this; }
323 
324  void hasUninit();
325  void removedUninit();
326  void printObject();
327  RexxObject *clone();
328 
329  ObjectHeader header; /* memory management header */
330  RexxBehaviour *behaviour; /* the object's behaviour */
331  };
332 
333 
334 
336  public:
337  void * operator new(size_t, RexxClass *);
338  void * operator new(size_t, RexxClass *, RexxObject **, size_t, size_t);
339  void * operator new(size_t size, void *objectPtr) { return objectPtr; };
340  inline void operator delete(void *, void *) {;}
341  inline void operator delete(void *) {;}
342  inline void operator delete(void *, RexxClass *) {;}
343  inline void operator delete(void *, RexxClass *, RexxObject **, size_t) {;}
344  // Followin are used to create new objects.
345  // Assumed that the message is sent to a class Object
346  // These may move to RexxClass in the future......
347  RexxObject *newRexx(RexxObject **arguments, size_t argCount, size_t named_argCount);
348  RexxObject *newObject() {return new ((RexxClass *)this) RexxObject; };
349 
350  operator RexxInternalObject*() { return (RexxInternalObject *)this; };
351  inline RexxObject(){;};
352  /* Following constructor used to */
353  /* reconstruct the Virtual */
354  /* Functiosn table. */
355  /* So it doesn't need to do anythin*/
356  inline RexxObject(RESTORETYPE restoreType) { ; };
357 
358 
359  // The following two methods probably should be on RexxInternalObject, but they
360  // need to reference the objectVariables field. That field could be moved to
361  // RexxInternalObject, but it would increase the size of all internal objects
362  // by 4 bytes. Since the minimum object size is large enough to always have
363  // that field, it's safe to clear this here.
364  inline void initializeNewObject(size_t size, size_t mark, void *vft, RexxBehaviour *b)
365  {
366  // we need to make this a function object of some type in case
367  // a GC cycle gets triggered before this is complete. By default,
368  // we make this a generic object
369  setVirtualFunctions(vft);
370  setBehaviour(b);
371  // this has a clean set of flags, except for the live mark
372  header.initHeader(size, mark);
373  // make sure the object is cleared in case this gets marked out of any of
374  // the constructors.
375  clearObject();
376  }
377 
378  inline void initializeNewObject(size_t mark, void *vft, RexxBehaviour *b)
379  {
380  // we need to make this a function object of some type in case
381  // a GC cycle gets triggered before this is complete. By default,
382  // we make this a generic object
383  setVirtualFunctions(vft);
384  setBehaviour(b);
385  // this has a clean set of flags, except for the live mark
386  header.initHeader(mark);
387  // make sure the object is cleared in case this gets marked out of any of
388  // the constructors.
389  clearObject();
390  }
391 
392  virtual ~RexxObject(){;};
393 
395  virtual RexxString *defaultName();
396 
397  virtual RexxObject *unknown(RexxString *msg, RexxArray *args, RexxDirectory *named_args){return OREF_NULL;};
398 
399  virtual RexxInteger *hasMethod(RexxString *msg);
400  bool hasUninitMethod();
401 
402  RexxObject *init();
403  void uninit();
404  void live(size_t);
405  void liveGeneral(int reason);
406  void flatten(RexxEnvelope *);
407  RexxObject *copy();
408  HashCode hash();
409  bool truthValue(int);
410  virtual bool logicalValue(logical_t &);
411  virtual bool numberValue(wholenumber_t &result, size_t precision);
412  virtual bool numberValue(wholenumber_t &result);
413  virtual bool unsignedNumberValue(stringsize_t &result, size_t precision);
414  virtual bool unsignedNumberValue(stringsize_t &result);
415  virtual bool doubleValue(double &result);
417  RexxInteger *integerValue(size_t);
419  RexxText *makeText();
420  void copyIntoTail(RexxCompoundTail *buffer);
421  RexxArray *makeArray();
423  RexxText *textValue();
427  RexxInteger *requestInteger(size_t);
428  bool requestNumber(wholenumber_t &, size_t);
429  bool requestUnsignedNumber(stringsize_t &, size_t);
432  RexxString *requiredString(RexxString *kind, size_t);
433  RexxString *requiredString(RexxString *kind, const char *);
435  RexxInteger *requiredInteger(RexxString *kind, size_t, size_t);
436  wholenumber_t requiredNumber(RexxString *kind, size_t position, size_t precision = Numerics::ARGUMENT_DIGITS);
437  stringsize_t requiredPositive(RexxString *kind, size_t position, size_t precision = Numerics::ARGUMENT_DIGITS);
438  stringsize_t requiredNonNegative(RexxString *kind, size_t position, size_t precision = Numerics::ARGUMENT_DIGITS);
439 
440  bool isEqual(RexxObject *);
441  bool isInstanceOf(RexxClass *);
448 
449  RexxObject *dynamicTargetRexx(RexxObject **arguments, size_t argCount, size_t named_argCount);
450 
457  RexxMessage *start(RexxObject **, size_t, size_t);
458  RexxMessage *startWith(RexxObject *, RexxArray *, /* named arguments*/ RexxObject **, size_t);
459  RexxObject *send(RexxObject **, size_t, size_t);
460  RexxObject *sendWith(RexxObject *, RexxArray *, /* named arguments*/ RexxObject **, size_t);
461  RexxMessage *startCommon(RexxObject *message, RexxObject **arguments, size_t argCount, size_t named_argCount);
462  static void decodeMessageName(RexxObject *target, RexxObject *message, RexxString *&messageName, RexxObject *&startScope);
463  RexxString *oref();
465  RexxObject *run(RexxObject **, size_t, size_t);
466 
467  bool messageSend(RexxString *, RexxObject **, size_t, size_t, ProtectedObject &, bool processUnknown=true, bool dynamicTarget=true);
468  bool messageSend(RexxString *, RexxObject **, size_t, size_t, RexxObject *, ProtectedObject &, bool processUnknown=true, bool dynamicTarget=true);
469 
472  void processUnknown(RexxErrorCodes, RexxString *, RexxObject **, size_t, size_t, ProtectedObject &);
473  void processProtectedMethod(RexxString *, RexxMethod *, RexxObject **, size_t, size_t, ProtectedObject &);
474 
475  // This method should be named "sendWith"
477 
478  inline void sendMessage(RexxString *message, RexxObject **args, size_t argCount, size_t named_argCount, ProtectedObject &result) { this->messageSend(message, args, argCount, named_argCount, result); };
479 
480  inline void sendMessage(RexxString *message, ProtectedObject &result) { this->messageSend(message, OREF_NULL, 0, 0, result); };
481  void sendMessage(RexxString *message, RexxObject *argument1, ProtectedObject &result);
486 
487  // This method should be named "sendWith"
489 
490  RexxObject *sendMessage(RexxString *message, RexxObject **args, size_t argCount, size_t named_argCount);
491 
492  RexxObject *sendMessage(RexxString *message);
493  RexxObject *sendMessage(RexxString *message, RexxObject *argument1);
498 
499  // Following are internal OREXX methods
510  inline RexxBehaviour *behaviourObject() { return this->behaviour; }
511 
512  const char *idString();
513  RexxString *id();
516  void guardOn(RexxActivity *activity, RexxObject *scope);
517  void guardOff(RexxActivity *activity, RexxObject *scope);
519  RexxObject *notEqual(RexxObject *other);
522 
524 
525  RexxObject *hashCode();
526 
533  RexxObject *copyRexx();
534 
535  // In setup.cpp, the methods "UNKOWN" are declared with 2 positional arguments and a list of named arguments.
536  // See CPPCode::run to see how the named arguments are passed to the native methods.
537  RexxObject *unknownRexx(RexxString *, RexxArray *, /* named arguments*/ RexxObject **, size_t);
538 
540  void *getCSelf();
541  void *getCSelf(RexxObject *scope);
542  // compare 2 values for equality, potentially falling back on the
543  // "==" method for the test.
544  bool inline equalValue(RexxObject *other)
545  {
546  // test first for direct equality, followed by value equality.
547  return (this == other) || this->isEqual(other);
548  }
550 
551  // Define operator methods here.
552 
553  koper (operator_plus)
554  koper (operator_minus)
555  koper (operator_multiply)
556  koper (operator_divide)
557  koper (operator_integerDivide)
558  koper (operator_remainder)
559  koper (operator_power)
560  koper (operator_abuttal)
561  koper (operator_concat)
562  koper (operator_concatBlank)
563  koper (operator_equal)
564  koper (operator_notEqual)
565  koper (operator_isGreaterThan)
566  koper (operator_isBackslashGreaterThan)
567  koper (operator_isLessThan)
568  koper (operator_isBackslashLessThan)
569  koper (operator_isGreaterOrEqual)
570  koper (operator_isLessOrEqual)
571  koper (operator_strictEqual)
572  koper (operator_strictNotEqual)
573  koper (operator_strictGreaterThan)
574  koper (operator_strictBackslashGreaterThan)
575  koper (operator_strictLessThan)
576  koper (operator_strictBackslashLessThan)
577  koper (operator_strictGreaterOrEqual)
578  koper (operator_strictLessOrEqual)
579  koper (operator_lessThanGreaterThan)
580  koper (operator_greaterThanLessThan)
581  koper (operator_and)
582  koper (operator_or)
583  koper (operator_xor)
584  koper (operator_not)
585 
586  RexxVariableDictionary *objectVariables; /* set of object variables */
588 
589  static void createInstance();
591 };
592 
593 
594 
595 
596 class RexxNilObject : public RexxObject {
597 public:
598  void * operator new(size_t);
599  void * operator new(size_t size, void *objectPtr) { return objectPtr; };
600  inline void operator delete(void *) { ; }
601  inline void operator delete(void *, void *) { ; }
602  RexxNilObject();
603  inline RexxNilObject(RESTORETYPE restoreType) { ; };
604  virtual ~RexxNilObject() {;};
605 
606  virtual HashCode getHashValue();
607 
609 
610 protected:
611  // we want .NIL to have a static hash value after the image restore, so
612  // this needs to be included in the object state
614 };
615 
616 class RexxList;
617 
618 
620 public:
621  inline RexxActivationBase() {;};
622  inline RexxActivationBase(RESTORETYPE restoreType) { ; };
623  virtual RexxObject *dispatch() {return NULL;};
624  virtual size_t digits() {return Numerics::DEFAULT_DIGITS;};
625  virtual size_t fuzz() {return Numerics::DEFAULT_FUZZ;};
626  virtual bool form() {return Numerics::DEFAULT_FORM;};
628  virtual RexxActivation *getRexxContext() { return OREF_NULL; }
629  virtual RexxActivation *findRexxContext() { return OREF_NULL; }
630  virtual void setDigits(size_t) {;};
631  virtual void setFuzz(size_t) {;};
632  virtual void setForm(bool) {;}
633  virtual bool trap(RexxString *, RexxDirectory *) {return false;};
634  virtual void setObjNotify(RexxMessage *) {;};
635  virtual void termination(){;};
637  virtual bool isForwarded() { return false; }
638  virtual bool isStackBase() { return false; }
639  virtual bool isRexxContext() { return false; }
640  virtual RexxObject *getReceiver() { return OREF_NULL; }
641  virtual PackageClass *getPackage() { return OREF_NULL; } // ooRexx5
642 
647 
648 protected:
651 
652 };
653 
654 
655 /**
656  * Block guard lock on an object instance.
657  */
659 {
660 public:
662  {
663  // just acquire the scope
665  }
666 
667  inline ~GuardLock()
668  {
670  }
671 
672 private:
673  RexxActivity *activity; // the activity we're running on
674  RexxObject *target; // the target object for the lock
675  RexxObject *scope; // the scope of the required guard lock
676 };
677 #endif
RexxObject *(RexxObject::* PCPPM7)(RexxObject *, RexxObject *, RexxObject *, RexxObject *, RexxObject *, RexxObject *, RexxObject *)
RexxObject *(RexxObject::* PCPPM5N)(RexxObject *, RexxObject *, RexxObject *, RexxObject *, RexxObject *, RexxObject **, size_t)
RexxObject *(RexxObject::* PCPPM7N)(RexxObject *, RexxObject *, RexxObject *, RexxObject *, RexxObject *, RexxObject *, RexxObject *, RexxObject **, size_t)
RexxObject *(RexxObject::* PCPPM2N)(RexxObject *, RexxObject *, RexxObject **, size_t)
RexxObject *(RexxObject::* PCPPM1N)(RexxObject *, RexxObject **, size_t)
RexxObject *(RexxObject::* PCPPMA1)(RexxArray *)
#define OREFSHIFT
RexxObject *(RexxObject::* PCPPM4N)(RexxObject *, RexxObject *, RexxObject *, RexxObject *, RexxObject **, size_t)
RESTORETYPE
Definition: ObjectClass.hpp:82
@ MOBILEUNFLATTEN
Definition: ObjectClass.hpp:82
@ METHODUNFLATTEN
Definition: ObjectClass.hpp:82
@ RESTOREIMAGE
Definition: ObjectClass.hpp:82
RexxObject *(RexxObject::* PCPPM1)(RexxObject *)
RexxObject *(RexxObject::* PCPPM3)(RexxObject *, RexxObject *, RexxObject *)
RexxObject *(RexxObject::* PCPPM5)(RexxObject *, RexxObject *, RexxObject *, RexxObject *, RexxObject *)
RexxObject *(RexxObject::* PCPPM2)(RexxObject *, RexxObject *)
uintptr_t HASHOREF(RexxVirtualBase *r)
RexxObject *(RexxObject::* PCPPMC1)(RexxObject **, size_t, size_t)
RexxObject *(RexxObject::* PCPPM)()
RexxObject *(RexxObject::* PCPPM6)(RexxObject *, RexxObject *, RexxObject *, RexxObject *, RexxObject *, RexxObject *)
RexxObject *(RexxObject::* PCPPM4)(RexxObject *, RexxObject *, RexxObject *, RexxObject *)
RexxObject *(RexxObject::* PCPPM6N)(RexxObject *, RexxObject *, RexxObject *, RexxObject *, RexxObject *, RexxObject *, RexxObject **, size_t)
size_t HashCode
Definition: ObjectClass.hpp:79
@ OldSpaceBit
Definition: ObjectClass.hpp:76
@ MarkMask
Definition: ObjectClass.hpp:75
@ LiveMask
Definition: ObjectClass.hpp:74
RexxObject *(RexxObject::* PCPPM3N)(RexxObject *, RexxObject *, RexxObject *, RexxObject **, size_t)
RexxObject *(RexxObject::* PCPPM0N)(RexxObject **, size_t)
RexxObject *(RexxObject::* PCPPM0)()
#define OREF_NULL
Definition: RexxCore.h:61
wholenumber_t RexxErrorCodes
Definition: RexxCore.h:65
GuardLock(RexxActivity *a, RexxObject *o, RexxObject *s)
RexxActivity * activity
RexxObject * target
RexxObject * scope
static NumericSettings * getDefaultSettings()
Definition: Numerics.hpp:114
static const bool DEFAULT_FORM
Definition: Numerics.hpp:81
static const size_t DEFAULT_FUZZ
Definition: Numerics.hpp:79
static const size_t ARGUMENT_DIGITS
Definition: Numerics.hpp:68
static const size_t DEFAULT_DIGITS
Definition: Numerics.hpp:66
bool isOldSpace()
uint16_t flags
void clearObjectMark()
void setObjectMark(size_t mark)
bool hasNoReferences()
bool isProxyObject()
size_t sizePadding
size_t getObjectSize()
Definition: ObjectClass.hpp:96
void makeProxy()
void initHeader(size_t mark)
size_t objectSize
bool hasReferences()
void setOldSpace()
void setHasNoReferences()
bool isNonPrimitive()
ObjectHeader & operator=(ObjectHeader &h)
Definition: ObjectClass.hpp:88
void setPrimitive()
bool isNewSpace()
bool isPrimitive()
void clearOldSpace()
void setHasReferences()
bool isObjectLive(size_t mark)
void setObjectSize(size_t l)
Definition: ObjectClass.hpp:97
void setNewSpace()
bool requiresProxyObject()
void makeProxiedObject()
void setNonPrimitive()
bool isObjectMarked(size_t mark)
bool isObjectDead(size_t mark)
void initHeader(size_t l, size_t mark)
void setInRexxPackage()
bool isInRexxPackage()
virtual void setFuzz(size_t)
virtual NumericSettings * getNumericSettings()
virtual bool form()
virtual RexxActivation * getRexxContext()
virtual size_t digits()
RexxActivationBase * previous
virtual bool trap(RexxString *, RexxDirectory *)
virtual size_t fuzz()
virtual bool isRexxContext()
virtual RexxObject * dispatch()
RexxObject * getExecutableObject()
virtual void termination()
BaseExecutable * executable
RexxActivationBase * getPreviousStackFrame()
virtual RexxObject * getReceiver()
BaseExecutable * getExecutable()
virtual bool isForwarded()
virtual bool isStackBase()
virtual void setForm(bool)
virtual SecurityManager * getSecurityManager()=0
RexxActivationBase(RESTORETYPE restoreType)
virtual PackageClass * getPackage()
virtual RexxActivation * findRexxContext()
virtual void setDigits(size_t)
virtual void setObjNotify(RexxMessage *)
void setPreviousStackFrame(RexxActivationBase *p)
void setObjectMark(size_t markword)
virtual RexxInteger * integerValue(size_t)
bool isObjectType(RexxBehaviour *b)
virtual bool isInstanceOf(RexxClass *)
void setBehaviour(RexxBehaviour *b)
virtual RexxString * primitiveMakeString()
virtual bool unsignedNumberValue(stringsize_t &result, size_t precision)
virtual RexxText * makeText()
virtual RexxObject * evaluate(RexxActivation *, RexxExpressionStack *)
virtual bool isEqual(RexxObject *)
void clearObject(size_t l)
void setInitHeader(size_t markword)
virtual void uninit()
virtual ~RexxInternalObject()
void setVirtualFunctions(void *t)
void setObjectSize(size_t s)
virtual RexxObject * getRealValue(RexxActivation *)
RexxInternalObject(RESTORETYPE restoreType)
virtual RexxObject * makeProxy(RexxEnvelope *)
size_t getObjectDataSize()
virtual bool doubleValue(double &result)
void setObjectLive(size_t markword)
bool isObjectLive(size_t mark)
virtual RexxString * stringValue()
ObjectHeader header
virtual RexxSupplier * instanceMethods(RexxClass *)
RexxObject * clone()
virtual RexxObject * getRealValue(RexxVariableDictionary *)
virtual RexxString * makeString()
static size_t getObjectHeaderSize()
virtual bool numberValue(wholenumber_t &result, size_t precision)
void setInitHeader(size_t s, size_t markword)
virtual RexxArray * makeArray()
virtual RexxObject * getValue(RexxVariableDictionary *)
virtual RexxText * primitiveMakeText()
virtual RexxObject * dynamicTarget(RexxObject **arguments, size_t count, size_t named_count)
virtual RexxMethod * instanceMethod(RexxString *)
bool isObjectMarked(size_t markword)
virtual void copyIntoTail(RexxCompoundTail *buffer)
bool isObjectDead(size_t mark)
virtual HashCode getHashValue()
virtual RexxObject * copy()
virtual RexxObject * getValue(RexxActivation *)
size_t getObjectTypeNumber()
RexxBehaviour * behaviour
virtual RexxText * textValue()
virtual HashCode hash()
virtual RexxNumberString * numberString()
virtual bool truthValue(int)
HashCode identityHash()
bool isObjectType(size_t t)
virtual bool logicalValue(logical_t &)
bool isSameType(RexxInternalObject *o)
void * getObjectDataSpace()
RexxBehaviour * getObjectType()
static RexxObject * nilObject
HashCode hashValue
virtual HashCode getHashValue()
virtual ~RexxNilObject()
RexxNilObject(RESTORETYPE restoreType)
RexxObject * isInstanceOfRexx(RexxClass *)
RexxInteger * requiredInteger(RexxString *kind, size_t, size_t)
bool hasUninitMethod()
RexxString * stringRexx()
RexxString * defaultNameRexx()
stringsize_t requiredPositive(RexxString *kind, size_t position, size_t precision=Numerics::ARGUMENT_DIGITS)
RexxMessage * start(RexxObject **, size_t, size_t)
virtual wholenumber_t compareTo(RexxObject *)
RexxString * objectName()
RexxNumberString * numberString()
RexxMessage * startCommon(RexxObject *message, RexxObject **arguments, size_t argCount, size_t named_argCount)
RexxInteger * integerValue(size_t)
void initializeNewObject(size_t size, size_t mark, void *vft, RexxBehaviour *b)
RexxVariableDictionary * getObjectVariables(RexxObject *)
RexxObject * requestRexx(RexxString *)
static void decodeMessageName(RexxObject *target, RexxObject *message, RexxString *&messageName, RexxObject *&startScope)
RexxObject * dynamicTargetRexx(RexxObject **arguments, size_t argCount, size_t named_argCount)
RexxObject * sendWith(RexxObject *, RexxArray *, RexxObject **, size_t)
RexxString * concatRexx(RexxObject *)
RexxObject * unknownRexx(RexxString *, RexxArray *, RexxObject **, size_t)
bool requestUnsignedNumber(stringsize_t &, size_t)
static RexxClass * classInstance
stringsize_t requiredNonNegative(RexxString *kind, size_t position, size_t precision=Numerics::ARGUMENT_DIGITS)
RexxObject * hasMethodRexx(RexxString *)
RexxMethod * instanceMethodRexx(RexxString *)
void live(size_t)
Definition: ObjectClass.cpp:79
RexxText * textValue()
RexxObject * unsetMethod(RexxString *)
RexxObject * setMdict(RexxObject *)
static void createInstance()
Definition: ObjectClass.cpp:73
RexxMethod * checkPrivate(RexxMethod *, RexxErrorCodes &)
RexxObject * superScope(RexxObject *)
virtual RexxInteger * hasMethod(RexxString *msg)
RexxObject * strictEqual(RexxObject *)
void guardOn(RexxActivity *activity, RexxObject *scope)
void initializeNewObject(size_t mark, void *vft, RexxBehaviour *b)
RexxMessage * startWith(RexxObject *, RexxArray *, RexxObject **, size_t)
virtual bool doubleValue(double &result)
RexxObject * pmdict()
RexxInteger * requestInteger(size_t)
RexxObject * setMethod(RexxString *, RexxMethod *, RexxString *a=OREF_NULL)
RexxMethod * methodLookup(RexxString *name)
virtual RexxObject * defMethod(RexxString *, RexxMethod *, RexxString *a=OREF_NULL)
RexxString * makeString()
RexxObject * send(RexxObject **, size_t, size_t)
RexxArray * makeArray()
void sendMessage(RexxString *message, ProtectedObject &result)
RexxObject * objectNameEquals(RexxObject *)
void guardOff(RexxActivity *activity, RexxObject *scope)
void processUnknown(RexxErrorCodes, RexxString *, RexxObject **, size_t, size_t, ProtectedObject &)
RexxText * requestText()
RexxString * oref()
virtual RexxObject * unknown(RexxString *msg, RexxArray *args, RexxDirectory *named_args)
RexxArray * requestArray()
RexxString * requiredString()
void * getCSelf()
void processProtectedMethod(RexxString *, RexxMethod *, RexxObject **, size_t, size_t, ProtectedObject &)
bool equalValue(RexxObject *other)
RexxObject * copy()
RexxString * stringValue()
RexxSupplier * instanceMethods(RexxClass *)
void flatten(RexxEnvelope *)
Definition: ObjectClass.cpp:95
RexxObject(RESTORETYPE restoreType)
RexxObject * equal(RexxObject *)
RexxObject * isNilRexx()
void sendMessage(RexxString *, RexxArray *, RexxDirectory *, ProtectedObject &)
koper(operator_plus) koper(operator_minus) koper(operator_multiply) koper(operator_divide) koper(operator_integerDivide) koper(operator_remainder) koper(operator_power) koper(operator_abuttal) koper(operator_concat) koper(operator_concatBlank) koper(operator_equal) koper(operator_notEqual) koper(operator_isGreaterThan) koper(operator_isBackslashGreaterThan) koper(operator_isLessThan) koper(operator_isBackslashLessThan) koper(operator_isGreaterOrEqual) koper(operator_isLessOrEqual) koper(operator_strictEqual) koper(operator_strictNotEqual) koper(operator_strictGreaterThan) koper(operator_strictBackslashGreaterThan) koper(operator_strictLessThan) koper(operator_strictBackslashLessThan) koper(operator_strictGreaterOrEqual) koper(operator_strictLessOrEqual) koper(operator_lessThanGreaterThan) koper(operator_greaterThanLessThan) koper(operator_and) koper(operator_or) koper(operator_xor) koper(operator_not) RexxVariableDictionary *objectVariables
RexxMethod * checkPackage(RexxMethod *, RexxErrorCodes &)
void liveGeneral(int reason)
Definition: ObjectClass.cpp:87
RexxObject * notEqual(RexxObject *other)
bool requestNumber(wholenumber_t &, size_t)
HashCode hash()
RexxInteger * identityHashRexx()
RexxObject * mdict()
RexxDirectory * requestDirectory()
RexxMethod * instanceMethod(RexxString *)
bool messageSend(RexxString *, RexxObject **, size_t, size_t, ProtectedObject &, bool processUnknown=true, bool dynamicTarget=true)
void addObjectVariables(RexxVariableDictionary *)
RexxString * requestString()
void copyIntoTail(RexxCompoundTail *buffer)
RexxObject * makeStringRexx()
virtual bool numberValue(wholenumber_t &result, size_t precision)
RexxObject * newRexx(RexxObject **arguments, size_t argCount, size_t named_argCount)
virtual ~RexxObject()
RexxObject * newObject()
RexxBehaviour * behaviourObject()
RexxObject * defMethods(RexxDirectory *)
RexxText * makeText()
bool isEqual(RexxObject *)
virtual RexxString * defaultName()
bool truthValue(int)
static PCPPM operatorMethods[]
RexxString * concatBlank(RexxObject *)
virtual bool unsignedNumberValue(stringsize_t &result, size_t precision)
RexxSupplier * instanceMethodsRexx(RexxClass *)
RexxString * requestStringNoNOSTRING()
RexxString * id()
RexxClass * classObject()
const char * idString()
RexxObject * copyRexx()
void setObjectVariable(RexxString *, RexxObject *, RexxObject *)
bool isInstanceOf(RexxClass *)
RexxObject * run(RexxObject **, size_t, size_t)
RexxObject * makeArrayRexx()
RexxMethod * superMethod(RexxString *, RexxObject *)
RexxObject * strictNotEqual(RexxObject *other)
RexxObject * getObjectVariable(RexxString *)
virtual bool logicalValue(logical_t &)
RexxObject * hashCode()
void copyObjectVariables(RexxObject *newObject)
void sendMessage(RexxString *message, RexxObject **args, size_t argCount, size_t named_argCount, ProtectedObject &result)
RexxObject * init()
wholenumber_t requiredNumber(RexxString *kind, size_t position, size_t precision=Numerics::ARGUMENT_DIGITS)
virtual void flatten(RexxEnvelope *)
virtual void liveGeneral(int reason)
virtual void live(size_t)
virtual RexxObject * unflatten(RexxEnvelope *)
virtual ~RexxVirtualBase()
virtual void baseVirtual()
size_t logical_t
Definition: rexx.h:231
ssize_t wholenumber_t
Definition: rexx.h:230
size_t stringsize_t
Definition: rexx.h:228
unsigned short uint16_t
UINT_PTR uintptr_t