Commit graph

120 commits

Author SHA1 Message Date
Bill Currie
9cf63dbbdf Clean up the create of the obj_module_s structure. 2011-02-26 22:06:22 +09:00
Bill Currie
cbfbc0b01a Ensure type_ClassPtr is chained before it is used. 2011-02-26 22:05:53 +09:00
Bill Currie
4336fc2c73 Move method function defs into the far data space.
As they are never referenced directly by instructions, there's no need for
them to be in the near data space, taking precious def locations.
2011-02-15 15:33:18 +09:00
Bill Currie
b2d4aee61e Reimplement selector expressions to work with far data.
They currently execute a lea instruction every method call, but the
optimizer should take care of that once its written.
2011-02-15 10:48:05 +09:00
Bill Currie
5707888fcf Fix some error-recovery segfaults. 2011-02-14 23:10:46 +09:00
Bill Currie
8a314e9e87 Class pointers need to be directly addressable. 2011-02-13 16:05:50 +09:00
Bill Currie
0b5565396b Add a class type to symbols and rework the CLASS_NAME handling.
This fixes the problem with [Array alloc] producing a warning about Class
not repsonding to -alloc.
2011-02-13 16:05:09 +09:00
Bill Currie
fa6b8d773c Correctly emit class and category symtab references. 2011-02-13 13:21:00 +09:00
Bill Currie
1bcf434b20 Move _OBJ_MODULE to the far data space. 2011-02-12 23:00:04 +09:00
Bill Currie
181596f5bf Make relocation records store the space of the relocation.
The space is meaningless for op_* relocations as they are always in the
code space, but def_* relocations need to know which space holds the
location to be adjusted.
2011-02-12 22:34:38 +09:00
Bill Currie
8c01497936 Give __obj_exec_class a sterner beating.
When linking a def into a defspace, ensure it can be removed. This fixes
the missing __obj_exec_class def in qwaq.
2011-02-11 22:29:57 +09:00
Bill Currie
5f3c1872b9 Put class and category reference/name symbols in the symbol table.
This fixes the undefined defs in qwaq.
2011-02-11 22:29:57 +09:00
Bill Currie
c185fbb782 Set the type of the super structure to the correct type. 2011-02-11 22:29:38 +09:00
Bill Currie
01a7af17e5 Beat __obj_exec_class into submission. 2011-02-10 00:15:19 +09:00
Bill Currie
1b8edc07c9 Adjust the offsets of ivars in derived classes.
As ivar structs are not independent, their starting offset is not
necessarily zero (almost never will be for derived classes).
2011-02-09 22:02:52 +09:00
Bill Currie
3e1b034aaf Use EMIT_DEF correctly. 2011-02-09 15:58:32 +09:00
Bill Currie
81125cff3a Creation of .ctor now mostly works.
There seems to be problems with the actual code generation using incorrect
addresses, but a very simple test file compiles successfully.
2011-02-08 22:38:34 +09:00
Bill Currie
1647b1e61d Check for the correct type in emit_symtab_cat_def_cnt(). 2011-02-08 22:31:09 +09:00
Bill Currie
9b52c590f8 Do not try to emit anything when there are no selector references. 2011-02-08 22:28:32 +09:00
Bill Currie
da14c95bb8 Initialize current_symtab in class_init() when necessary.
If an objective-qc symbol is the first token to be read, class_init() is
called before the parser gets a chance to perform the initialization
action. However, class_init() setting current_symtab if the first
objective-qc symbol is seen in a function body would be bad.
2011-02-08 22:26:35 +09:00
Bill Currie
c01f742b7b Fix some Class vs ClassPtr confusion. 2011-02-08 18:25:23 +09:00
Bill Currie
6643c5dd98 Fix messages to super. 2011-02-08 17:09:27 +09:00
Bill Currie
505e141633 Ensure the class symbol is in the symbol table. 2011-02-08 17:08:58 +09:00
Bill Currie
3c64ae7b66 Fix overzealous type merging.
Use the type name instead of the symbol table for comparing
struct/union/enum types.
2011-02-07 20:48:01 +09:00
Bill Currie
76034861c9 Implement direct ivar access in methods.
A warning needs to be generated for access to ivars in a class method, but
it seems to work (unable to check due to other errors).
2011-02-07 08:32:52 +09:00
Bill Currie
f2c272f0b8 Make adding a symbol to multiple tables an internal error. 2011-02-06 20:00:14 +09:00
Bill Currie
d7cdf8077b Rename id_ivars to object_ivars. 2011-02-06 15:41:15 +09:00
Bill Currie
c3c693e9c7 Correct construction of type_id. 2011-02-06 15:36:21 +09:00
Bill Currie
2f7b892452 Fix passing messages to classes.
Rename class_pointer_def() to class_pointer_symbol() and use it when a
class name is used as the receiver of a message.
2011-02-06 14:34:40 +09:00
Bill Currie
f721144ca5 Rewrite emit_ivars to use emit_structure.
The old code was broken anyway :) (it was segfaulting).
2011-02-04 15:11:47 +09:00
Bill Currie
acb3c0da11 Fix class initialization. 2011-02-04 14:29:47 +09:00
Bill Currie
04b86fcdb7 Move the Objective-QC structs from type.c to class.c 2011-02-04 12:07:32 +09:00
Bill Currie
12d8658ece Create a typedef for obj_module_t. 2011-02-03 18:05:46 +09:00
Bill Currie
79df3d2cca Put newly created classes into the symbol table. 2011-02-03 17:28:49 +09:00
Bill Currie
0624408317 Move the diagnostic functions into their own file. 2011-01-24 21:54:57 +09:00
Bill Currie
483cbeba03 Fix a few FIXMEs. 2011-01-24 21:13:37 +09:00
Bill Currie
afc5b2827d Simplify def handling, use far data.
Since there is now a proper symbol table, defs are now just references to
memory locations and the symbol table takes care of duplicates.

Also, start using far data for ObjQC structures.

The qfo functions have been stubbed out until I figure out what to do with
object files in the new scheme.
2011-01-24 15:41:43 +09:00
Bill Currie
5deda9c9b9 Clean out ex_def as ex_symbol replaces it. 2011-01-19 22:25:04 +09:00
Bill Currie
e08efe036b Move the constant expression values into their own struct. 2011-01-19 08:43:24 +09:00
Bill Currie
87ce9f5333 Get basic function creation working.
Even more FIXMEs, but the pascal parser can now create functions. The
function records even get emitted.
2011-01-18 12:47:13 +09:00
Bill Currie
ea3895805b Rewrite much to use symbols and symtabs. Gut emit.c. Massive breakage.
That which isn't rewritten is horribly broken. However, this does include a
nice mechanism for building QC structs for emitting data.

emit.c has been gutted in the spirit of "throw one away".

There is much work to be done to get even variables emitted, let alone
code. Things should be a little more fun from here on.
2011-01-17 22:34:41 +09:00
Bill Currie
d327c860cb Get messages working again. 2011-01-10 12:26:11 +09:00
Bill Currie
75ec6bf244 Clean out some unnecessary types from the progs engine and clean up the mess.
This is a nasty commit, sorry, but 99% of the commit is interdependent.
2011-01-10 12:25:31 +09:00
Bill Currie
5627e43465 Use the method's selector rather than its def name in error messages. 2011-01-03 16:25:29 +09:00
Bill Currie
a1f36a9944 Make new_function take a def rather than a name.
Moves into new_function some code that should have been there in the first
place.
2011-01-03 16:25:29 +09:00
Bill Currie
530e8fae34 Rework class_type_t to be more useful.
This allows current_class to refer to procols as well (for error
reporting).
2011-01-03 16:25:29 +09:00
Bill Currie
699799bfc8 Don't warn when adding a new method to an implementation.
Methods defined in the implementation but not declared in the interface are
just fine.
2010-12-16 20:04:08 +09:00
Bill Currie
eace5b3c81 Get message checking working properly. 2010-12-16 16:41:16 +09:00
Bill Currie
4481ba9b0d Allow explicit references to classes and categories.
Use "@reference ClassName;" or "@reference ClassName(CategoryName);" to
create a refence to the class or category, forcing the defining object file
to be linked into the program when the object file is part of a library.
2010-12-12 20:27:56 +09:00
Bill Currie
bfee029249 set current_func while building the init function to avoid issues with code expecting current_func to be set. 2008-08-01 22:55:10 +00:00